Skip to content
Aditya Mahajan edited this page Jan 19, 2015 · 5 revisions

Pandoc

Use pandoc to convert a variety of formats to ConTeXt.

\usemodule[filter]

\defineexternalfilter
  [pandoc]
  [
    filter={pandoc --no-wrap
                   -f \externalfilterparameter{format} -t context 
                   -o \externalfilteroutputfile},
    format=markdown,
    directory=output,
  ]

Key features

  • The temporary files are stored in output directory. Hence, that directory must exist.

  • The environment

       \startpandoc
        ...
       \stoppandoc
    

    parses its content as markdown.

  • The command

       \processpandocfile{...}
    

    parses the file specified by its arguments as a markdown file.

  • To change the input format from markdown to, say rst, use

      \setupexternalfilter[pandoc][format=rst]
    
  • To change the input format locally, use:

      \startpandoc[format=rst]
      ....
      \stoppandoc
    

    or

      \processpandocfile[format=rst]{...}
    
Clone this wiki locally