Search code examples
htmlmarkdowndocxpandoc

Pandoc export to Word: does it matter whether I use Markdown or HTML as input source format?


I'm in the process of creating a web app which appends a lot of textual boilerplates to a final report which then should be exported to Word (using Pandoc).

The textual boilerplates are written in Markdown. Now my question is: does it matter whether I use Markdown or HTML as input source format for Pandoc?

Or to be a bit more specific: are there features that can't be expressed in Markdown but can be expressed in HTML? For example, definition lists (<dl>)? I know there are a lot of additional Markdown features in Pandoc, but do they deliver every feature that Pandoc is able to export to Word? Or is Markdown as input format even more powerful than plain HTML?


Solution

  • Now my question is: does it matter whether I use Markdown or HTML as input source format for Pandoc?

    Pandoc has a internal abstract syntax tree (AST) so in principle doesn't matter if you use Markdown or HTML as input source format.

    I will recommend that you use Markdown as input source format because some HTML tags/attributes aren't supported so staying with Markdown will avoid that you lost something.

    are there features that can't be expressed in Markdown but can be expressed in HTML?

    Yes. Pandoc internal AST has something called raw HTML for HTML tags that hasn't one representation at the internal AST that mostly cover Markdown + extensions.

    For example, definition lists ()?

    Pandoc has one Markdown extension for definition lists.

    I know there are a lot of additional Markdown features in Pandoc, but do they deliver every feature that Pandoc is able to export to Word?

    AFAIK yes.