Search code examples
pdfintellij-ideamarkdownpandoc

Pandoc Matching Intellij Preview


When I'm building the markdown files, the preview looks really good.

enter image description here

But, when I run the following pandoc command, it doesn't look good at all!

pandoc --from markdown ./Example.md -o Example.pdf

enter image description here

I'm just wondering, what is the specific command that Intellij is using to generate the preview? I have other markdown files that I need to convert, but want them to look just like they do in the preview.


Solution

  • You can use pandoc -f commonmark to get you expected result.

    Each Markdown implementation used to differ on small details. E.g., pandoc's Markdown expects a blank line before the heading. CommonMark solves this by being well-defined for border cases. It seems that intellij uses CommonMark or something close.

    If you want to learn more about those subtle differences, check https://babelmark.github.io.