[NTG-context] markdown module vs pandoc

Aditya Mahajan adityam at umich.edu
Fri Feb 15 18:34:33 CET 2019


On Fri, 15 Feb 2019, Gour wrote:

> On Fri, 15 Feb 2019 06:11:32 -0500 (EST)
> Aditya Mahajan <adityam at umich.edu> wrote:
>
>> For obvious reasons, the built in markdown module is faster than
>> calling pandoc but I prefer using pandoc rather than the markdown
>> module for two reasons. First, pandoc provides many extensions to the
>> basic markdown syntax which I use frequently and second pandoc has
>> better documentation. 
>
> Thank you.
>
>> Markdown is a loosely specified standard and sometimes it can be tricky to
>> figure out how to get a particular behavior.
>
> That's correct - I was using reST in the past, but lack of support for e.g.
> nested inline markup leads to strange and ugly workarounds. Then I was
> considering AsciiDoc(tor), but consider that for simpler stuff (Pnadoc)
> markdown could be enough, but for larger bodies of text ConTeXt is without
> comparison.
>
>> So, if you are planning to use markdown for simple documents then go
>> with the markdown module but if you have more complicated document
>> structure, use pandoc. 
>
> Do I inderstand you correctly: for more complicated documents you use Pandoc'
> markdown and then do Pandoc --> ConTeXt conversion to typeset with the
> ConTeXt at the end?

For simple documents, I use something like this (untested):

\usemodule[filter]

\defineexternalfilter
    [markdown]
    [filter={pandoc -t context -o \externalfilteroutput},
     output=\externalfilterbasefile.tex,
     cache=yes,
     directory=output, %make sure a sub-dir output exists
     readcommand=\ReadFile]

\starttext

\startmarkdown
This is a *test* in **markdown**.
\stopmarkdown

\stoptext

For more complicated documents (where I need both TeX and HTML output), I 
pre-process the input: 
https://adityam.github.io/context-blog/post/markdown-with-gpp/

Aditya


More information about the ntg-context mailing list