UPDATE: The issue with the original macro was solved by post #12.
Here is the final working macro:
Create PDF with Pandoc.kmmacros (4.6 KB)
- A Tex typesetting engine (Latex, ConText, etc) since the PDF creation chain is Md → Tex → Pdf
For the macro to work, the shell script shall be able to "find" both Pandoc and typesetting engine executables. You can set KM’s ENV_PATH variable so that it includes the right locations, e.g.
ORIGINAL POST: I built a really simple macro that run a
pandoc command to create a pdf file from a markdown text file.
/usr/local/bin/pandoc -r markdown+smart -w latex --top-level-division=chapter --pdf-engine=xelatex --number-sections --template=/Users/prem/Dropbox/Pandoc/templates/latex_PREM_1.template --filter /usr/local/bin/pandoc-crossref -M chapters --filter /usr/local/bin/pandoc-citeproc --csl=/Users/prem/Dropbox/Pandoc/csl/apsa.csl --bibliography=/Users/prem/Documents/bibs/PREM_Bibliography.bib -o "$KMVAR_TheOutPath" "$KMVAR_aPath"
It consists essentially in an Execute Shell Script action (the second one, disabled, is just a variation with different arguments).
The command works fine in the Terminal but gives an error when used in the macro; it seems it can't create the temporary folder needed for Tex files used in the conversion md→pdf:
That is probably due to the different environment in which the command is executed but I am at a loss how to solve the problem.
Any help will be much appreciated!