Literate Haskell support
If you append +lhs
to an appropriate input or output format (markdown
, rst
, or latex
for input or output; beamer
, html
or html5
for output only), pandoc will treat the document as literate Haskell source. This means that
In markdown input, “bird track” sections will be parsed as Haskell code rather than block quotations. Text between \begin{code}
and \end{code}
will also be treated as Haskell code.
In markdown output, code blocks with classes haskell
and literate
will be rendered using bird tracks, and block quotations will be indented one space, so they will not be treated as Haskell code. In addition, headers will be rendered setext-style (with underlines) rather than atx-style (with ‘#’ characters). (This is because ghc treats ‘#’ characters in column 1 as introducing line numbers.)
In restructured text input, “bird track” sections will be parsed as Haskell code.
In restructured text output, code blocks with class haskell
will be rendered using bird tracks.
In LaTeX input, text in code
environments will be parsed as Haskell code.
In LaTeX output, code blocks with class haskell
will be rendered inside code
environments.
In HTML output, code blocks with class haskell
will be rendered with class literatehaskell
and bird tracks.
Examples:
pandoc -f markdown+lhs -t html
reads literate Haskell source formatted with markdown conventions and writes ordinary HTML (without bird tracks).
pandoc -f markdown+lhs -t html+lhs
writes HTML with the Haskell code in bird tracks, so it can be copied and pasted as literate Haskell source.