Impossibile to compile with pandoc

I finished a manuscript and I followed the instructions for exporting in docx, latex and html using pandoc syntax and scrivomatic.
I created a directory pandoc with all necessary files (pandocomatic.yaml, templates etc). I tried with some simple files inserting equations and citations and everything worked right.
When I decided to compile my manuscript, I dragged and dropped my work in the simple project I created before but I got this error when I compiled:

[code]=== ------------------------------------------------------ ===
=== Scrivomatic V1.0.20 Report @ 2019-01-29 21:53:27 +0100 ===
=== ------------------------------------------------------ ===
Running under Ruby 2.3.7
Working directory: /Users/Gallomac/.pandoc/
===------ Input Options: ------===
#<struct Scrivomatic::OPT input=“”, output=nil, to=nil, yaml=nil, command=“pandocomatic”, envpath="/Users/Gallomac/bin:/usr/local/bin:/Library/TeX/texbin", build=false, cleanup=false, verbose=true, dry_run=false, open_log=true>
===------ Final ENV PATH: ------===
===------ TOOL PATHS: ------===
—pandoc: /usr/local/bin/pandoc | V: 2.4
—pandocomatic: /usr/local/bin/pandocomatic | V: Pandocomatic version
—ruby: /usr/bin/ruby | V: ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
—python: /usr/bin/python
—xelatex: /Library/TeX/texbin/xelatex
—latexmk: /Library/TeX/texbin/latexmk

… running pandocomatic, please wait …
===------ COMMAND OUTPUT: ------===
:: Running: /usr/local/bin/pandocomatic --debug
::: An unexpected error has occurred. You can report this bug via
::: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/psych.rb:379:in parse': (<unknown>): mapping values are not allowed in this context at line 34 column 8 (Psych::SyntaxError) ::: from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/psych.rb:379:in parse_stream’
::: from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/psych.rb:327:in parse' ::: from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/psych.rb:254:in load’
::: from /Library/Ruby/Gems/2.3.0/gems/pandocomatic- load_file' ::: from /Library/Ruby/Gems/2.3.0/gems/pandocomatic- initialize’
::: from /Library/Ruby/Gems/2.3.0/gems/pandocomatic- new' ::: from /Library/Ruby/Gems/2.3.0/gems/pandocomatic- run’
::: from /Library/Ruby/Gems/2.3.0/gems/pandocomatic- <top (required)>' ::: from /usr/local/bin/pandocomatic:22:in load’
::: from /usr/local/bin/pandocomatic:22:in `’
:: exit status: pid 7884 exit 1

!!!—scrivomatic::runCommand() RETURN non-zero value: /usr/local/bin/pandocomatic --debug !!!
A very similar problem was described in this post [url]] and nontroppo gave some useful advice. I controlled that Section Layout were “As-Is” and that I didn’t flag “Convert Rich Text to MultiMarkdown” in settings.
I put a front matter (I can’t choose this option with right click in binder, I can’t understand why) but I selected the pandoc metadata as front matter (see below).

front matter.jpg

The solution is simple: add a new Section Type to your project using Project :arrow_forward:︎Project Settings…:arrow_forward:︎Section Types then apply that Section Type to your front matter (for example I call it N/A in the screenshot below, but you can call it whatever you want). Now make sure you assign the N/A Section Layout to the As-Is Section Type:

Here is a screenshot showing my N/A section type is assigned to my meta-data, and N/A maps to the As-Is Section Layout:

Thank you. I set N/A as front matter. Metadata code was already as “As-Is”.
But nothing changed. I tried to compile section by section and all was right until the section named “pandocomatic”. Only after adding this section I get the error.
In this section (this document is a short memo for using pandoc in scrivener) I write some string to describe the workflow (I omitted italian text with bla bla)

from: markdown
to: html5
standalone: true
csl: ‘apa.csl’
toc: true
bibliography: /path/to/bibliography.bib
mathjax: true

bla bla bla

title: On teaching mathematics
author: Huub de Beer
use-template: education-research
output: on_teaching_mathematics.html

(Successivamente vi è il testo del documento).


pandocomatic -i

bla bla bla

sudo gem install paru pandocomatic -n /usr/local/bin

Now, I asked me if it was possible that this strings could interfere with the compile process.
I select this strings and I applied the styles “code block”. I restart the compiling process again and this time no problem occurred.
Then the problem is probably this. Using pandocomatic code in my document, compiling process treat them as commands and not text giving some conflicts. (this section and the other ones are set as section not “as-is”).
It’s very stange although

Please send me your metadata or a project and I can have a look. Remember YAML metadata requires spaces for indentation and must have — before and after; your text shows no — at the first line or any indentation…

Problem solved! Thanks! :mrgreen:

And for anyone else who may have a similar problem: the project contained a YAML metadata code sample (something wanted to be shown in the page, not parsed by Pandoc) which was not in a code block (and thus Pandoc tried to parse it) - the solution was to use the Scrivener style to make sure it was marked up as a Pandoc code block when compiled…