rst and pypandoc

Gregory Ewing greg.ewing at canterbury.ac.nz
Tue Mar 3 17:27:36 EST 2015


alb wrote:
> RuntimeError: Invalid input format! Expected one of these: native, json,
> markdown, markdown+lhs, rst, rst+lhs, docbook, textile, html, latex,
> latex+lhs

It looks like it's expecting the base format to be spelled
"markdown", not abbreviated to "md". (The python wrapper
expands "md" to "markdown", but not if it's followed by
any + or - options.) So try:

pypandoc.convert(s, 'latex', format="markdown+raw_tex")

BTW, I just installed pandoc on MacOSX to try this out,
and it seems that raw_tex is enabled by default for me --
I have to turn it *off* with format="markdown-raw_tex"
in order to get the behaviour you're seeing. Maybe a
different version? My pandoc says it's version 1.12.0.1.

-- 
Greg



More information about the Python-list mailing list