Markdown to PDF

Hi, I need some help. This is my current workflow. I do most of my work on the iOS app because I’m rarely on my desktop. My current project utilises tables so using markdown in the mobile app. I can compile to markdown when I do use desktop, but how do I turn this markdown file into a PDF using Scrivener because there’s no Markdown to PDF compile option?

Thanks for your help.

The Mac version can generate a PDF via Markdown. It’s down at the bottom of the list of output formats. I don’t have the Windows version handy, but you might want to double-check.

These are the compile options available to me. No Markdown to PDF option as far as I can see.

The Mac version makes use of an available LaTeX distribution, if one is installed on the system, otherwise that option disappears. It still does not appear to be an option on Windows, going by the lack of updates on the ticket for it.

But that’s not a huge blocker—honestly compile selection is rather limited and mostly only suitable for proofing convenience as you have no control over the command line. There is another approach that works just as well, that gives you 100% flexibility (in fact I just show Pandoc, but you could use MultiMarkdown, or any other tool in fact in the mix that could automate the production of PDFs, not necessarily just LaTeX-based typesetting).

Pandoc to PDF setup procedure...
  1. In File ▸ Compile... set the compile file type to plain “MultiMarkdown”.

  2. Double-click the “Basic Pandoc” compile Format to duplicate and edit it.

  3. In the Processing pane, enable Post-process on command-line and fill in the fields like so:

    • Path: C:\Program Files\Pandoc\pandoc.exe (or of course wherever it is installed).

    • Arguments: -t pdf --pdf-engine=xelatex -o <$outputname>.pdf <$inputfile>

      As you know, there are other flags that might be of use here (and maybe you want something other than xelatex at that). --top-level-division is one I use a lot, as well as --template to target my designs.

    The remaining options are up to you. With both checkboxes ticked you’ll get a clean output, just the PDF. With them left off it’ll be more useful for rebuilding while proofing typos or whatever.

Naturally that does still require a functional LaTeX system that Pandoc can find—but as noted you are writing the command-line, or even the .bat file for more involved setups, so there are no limits.

If you want, you can give this compile format a better name and save it globally for future use.

1 Like

That worked! Thank you!

1 Like