diff --git a/README b/README index f86c850ab..86c52ac2b 100644 --- a/README +++ b/README @@ -222,13 +222,17 @@ For further documentation, see the `pandoc(1)` man page. `-f`, `--from`, `-r`, or `--read` *format* : specifies the input format (the format Pandoc will be converting *from*). *format* can be `native`, `markdown`, `rst`, `html`, or - `latex`. + `latex`. (`+lhs` can be appended to indicate that the input should + be treated as literate Haskell source. See + [Literate Haskell support](#literate-haskell-support), below.) `-t`, `--to`, `-w`, or `--write` *format* : specifies the output format -- the format Pandoc will be converting *to*. *format* can be `native`, `html`, `s5`, `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`, - `rst`, and `rtf`. + `rst`, and `rtf`. (`+lhs` can be appended to indicate that the + output should be treated as literate Haskell source. See + [Literate Haskell support](#literate-haskell-support), below.) `-s` or `--standalone` : indicates that a standalone document is to be produced (with @@ -371,20 +375,6 @@ For further documentation, see the `pandoc(1)` man page. are omitted. URIs in links and images are also checked against a whitelist of URI schemes. -`--lhs-in` -: treat input as literate Haskell. In markdown input, "bird track" - sections will be treated as Haskell source code. In LaTeX input, - `code` environments will be treated as Haskell source code. - -`--lhs-out` -: write output as literate Haskell. In markdown output, Haskell - source code will be printed with "bird tracks." In LaTeX output, - it will be put in `code` environments. In HTML output, it will - be put inside `<pre>` tags, with "bird tracks." - -`--lhs` -: equivalent to `--lhs-in --lhs-out`. - `--dump-args` : is intended to make it easier to create wrapper scripts that use Pandoc. It causes Pandoc to dump information about the arguments @@ -1073,3 +1063,48 @@ and CSS files required by S5. (See the instructions on the S5 website.) Alternatively, you may use `-s` together with the `-H/--custom-header` option. +Literate Haskell support +======================== + +If you append `+lhs` to an appropriate input or output format (`markdown`, +`rst`, or `latex` for input or output; `html` 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 class `haskell` 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. + diff --git a/man/man1/pandoc.1.md b/man/man1/pandoc.1.md index bdd317c78..91c3a8537 100644 --- a/man/man1/pandoc.1.md +++ b/man/man1/pandoc.1.md @@ -64,6 +64,8 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`. : Specify input format. *FORMAT* can be `native` (native Haskell), `markdown` (markdown or plain text), `rst` (reStructuredText), `html` (HTML), or `latex` (LaTeX). + If `+lhs` is appended to `markdown`, `rst`, or `latex`, the input + will be treated as literate Haskell source. -t *FORMAT*, -w *FORMAT*, \--to=*FORMAT*, \--write=*FORMAT* : Specify output format. *FORMAT* can be `native` (native Haskell), @@ -74,7 +76,9 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`. `odt` (OpenOffice text document), `s5` (S5 HTML and javascript slide show), or `rtf` (rich text format). Note that `odt` output will not be directed to *stdout*; an output filename must be specified using - the `-o/--output` option. + the `-o/--output` option. If `+lhs` is appended to `markdown`, + `rst`, `latex`, or `html`, the output will be rendered as literate + Haskell source. -s, \--standalone : Produce output with an appropriate header and footer (e.g. a @@ -142,20 +146,6 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`. are omitted. URIs in links and images are also checked against a whitelist of URI schemes. -\--lhs-in -: Treat input as literate Haskell. In markdown input, "bird track" - sections will be treated as Haskell source code. In LaTeX input, - `code` environments will be treated as Haskell source code. - -\--lhs-out -: Write output as literate Haskell. In markdown output, Haskell - source code will be printed with "bird tracks." In LaTeX output, - it will be put in `code` environments. In HTML output, it will - be put inside `<pre>` tags, with "bird tracks." - -\--lhs -: Equivalent to `--lhs-in --lhs-out`. - \--toc, \--table-of-contents : Include an automatically generated table of contents (HTML, markdown, RTF) or an instruction to create one (LaTeX, reStructuredText).