git.iko.soy/typeable/pandoc
on master help sign in
Modified README and man page to document lhs features.
4e12293fiddlosopher
README+51−16
@@ -222,13 +222,17 @@ For further documentation, see the `pandoc(1)` man page.
222`-f`, `--from`, `-r`, or `--read` *format*
222`-f`, `--from`, `-r`, or `--read` *format*
223: specifies the input format (the format Pandoc will be converting
223: specifies the input format (the format Pandoc will be converting
224 *from*). *format* can be `native`, `markdown`, `rst`, `html`, or
224 *from*). *format* can be `native`, `markdown`, `rst`, `html`, or
225− `latex`.
225+ `latex`. (`+lhs` can be appended to indicate that the input should
226+ be treated as literate Haskell source. See
227+ [Literate Haskell support](#literate-haskell-support), below.)
226
228
227`-t`, `--to`, `-w`, or `--write` *format*
229`-t`, `--to`, `-w`, or `--write` *format*
228: specifies the output format -- the format Pandoc will
230: specifies the output format -- the format Pandoc will
229 be converting *to*. *format* can be `native`, `html`, `s5`,
231 be converting *to*. *format* can be `native`, `html`, `s5`,
230 `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,
232 `docbook`, `opendocument`, `latex`, `context`, `markdown`, `man`,
231− `rst`, and `rtf`.
233+ `rst`, and `rtf`. (`+lhs` can be appended to indicate that the
234+ output should be treated as literate Haskell source. See
235+ [Literate Haskell support](#literate-haskell-support), below.)
232
236
233`-s` or `--standalone`
237`-s` or `--standalone`
234: indicates that a standalone document is to be produced (with
238: indicates that a standalone document is to be produced (with
@@ -371,20 +375,6 @@ For further documentation, see the `pandoc(1)` man page.
371 are omitted. URIs in links and images are also checked against a
375 are omitted. URIs in links and images are also checked against a
372 whitelist of URI schemes.
376 whitelist of URI schemes.
373
377
374−`--lhs-in`
375−: treat input as literate Haskell. In markdown input, "bird track"
376− sections will be treated as Haskell source code. In LaTeX input,
377− `code` environments will be treated as Haskell source code.
378−
379−`--lhs-out`
380−: write output as literate Haskell. In markdown output, Haskell
381− source code will be printed with "bird tracks." In LaTeX output,
382− it will be put in `code` environments. In HTML output, it will
383− be put inside `<pre>` tags, with "bird tracks."
384−
385−`--lhs`
386−: equivalent to `--lhs-in --lhs-out`.
387−
388`--dump-args`
378`--dump-args`
389: is intended to make it easier to create wrapper scripts that use
379: is intended to make it easier to create wrapper scripts that use
390 Pandoc. It causes Pandoc to dump information about the arguments
380 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.)
1073Alternatively, you may use `-s` together with the `-H/--custom-header`
1063Alternatively, you may use `-s` together with the `-H/--custom-header`
1074option.
1064option.
1075
1065
1066+Literate Haskell support
1067+========================
1068+
1069+If you append `+lhs` to an appropriate input or output format (`markdown`,
1070+`rst`, or `latex` for input or output; `html` for output only), pandoc
1071+will treat the document as literate Haskell source. This means that
1072+
1073+ - In markdown input, "bird track" sections will be parsed as Haskell
1074+ code rather than block quotations. Text between `\begin{code}`
1075+ and `\end{code}` will also be treated as Haskell code.
1076+
1077+ - In markdown output, code blocks with class `haskell` will be
1078+ rendered using bird tracks, and block quotations will be
1079+ indented one space, so they will not be treated as Haskell code.
1080+ In addition, headers will be rendered setext-style (with underlines)
1081+ rather than atx-style (with '#' characters). (This is because ghc
1082+ treats '#' characters in column 1 as introducing line numbers.)
1083+
1084+ - In restructured text input, "bird track" sections will be parsed
1085+ as Haskell code.
1086+
1087+ - In restructured text output, code blocks with class `haskell` will
1088+ be rendered using bird tracks.
1089+
1090+ - In LaTeX input, text in `code` environments will be parsed as
1091+ Haskell code.
1092+
1093+ - In LaTeX output, code blocks with class `haskell` will be rendered
1094+ inside `code` environments.
1095+
1096+ - In HTML output, code blocks with class `haskell` will be rendered
1097+ with class `literatehaskell` and bird tracks.
1098+
1099+Examples:
1100+
1101+ pandoc -f markdown+lhs -t html
1102+
1103+reads literate Haskell source formatted with markdown conventions and writes
1104+ordinary HTML (without bird tracks).
1105+
1106+ pandoc -f markdown+lhs -t html+lhs
1107+
1108+writes HTML with the Haskell code in bird tracks, so it can be copied
1109+and pasted as literate Haskell source.
1110+
man/man1/pandoc.1.md+5−15
@@ -64,6 +64,8 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
64: Specify input format. *FORMAT* can be
64: Specify input format. *FORMAT* can be
65 `native` (native Haskell), `markdown` (markdown or plain text),
65 `native` (native Haskell), `markdown` (markdown or plain text),
66 `rst` (reStructuredText), `html` (HTML), or `latex` (LaTeX).
66 `rst` (reStructuredText), `html` (HTML), or `latex` (LaTeX).
67+ If `+lhs` is appended to `markdown`, `rst`, or `latex`, the input
68+ will be treated as literate Haskell source.
67
69
68-t *FORMAT*, -w *FORMAT*, \--to=*FORMAT*, \--write=*FORMAT*
70-t *FORMAT*, -w *FORMAT*, \--to=*FORMAT*, \--write=*FORMAT*
69: Specify output format. *FORMAT* can be `native` (native Haskell),
71: Specify output format. *FORMAT* can be `native` (native Haskell),
@@ -74,7 +76,9 @@ to Pandoc. Or use `html2markdown`(1), a wrapper around `pandoc`.
74 `odt` (OpenOffice text document), `s5` (S5 HTML and javascript slide
76 `odt` (OpenOffice text document), `s5` (S5 HTML and javascript slide
75 show), or `rtf` (rich text format). Note that `odt` output will not
77 show), or `rtf` (rich text format). Note that `odt` output will not
76 be directed to *stdout*; an output filename must be specified using
78 be directed to *stdout*; an output filename must be specified using
77− the `-o/--output` option.
79+ the `-o/--output` option. If `+lhs` is appended to `markdown`,
80+ `rst`, `latex`, or `html`, the output will be rendered as literate
81+ Haskell source.
78
82
79-s, \--standalone
83-s, \--standalone
80: Produce output with an appropriate header and footer (e.g. a
84: 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`.
142 are omitted. URIs in links and images are also checked against a
146 are omitted. URIs in links and images are also checked against a
143 whitelist of URI schemes.
147 whitelist of URI schemes.
144
148
145−\--lhs-in
146−: Treat input as literate Haskell. In markdown input, "bird track"
147− sections will be treated as Haskell source code. In LaTeX input,
148− `code` environments will be treated as Haskell source code.
149−
150−\--lhs-out
151−: Write output as literate Haskell. In markdown output, Haskell
152− source code will be printed with "bird tracks." In LaTeX output,
153− it will be put in `code` environments. In HTML output, it will
154− be put inside `<pre>` tags, with "bird tracks."
155−
156−\--lhs
157−: Equivalent to `--lhs-in --lhs-out`.
158−
159\--toc, \--table-of-contents
149\--toc, \--table-of-contents
160: Include an automatically generated table of contents (HTML, markdown,
150: Include an automatically generated table of contents (HTML, markdown,
161 RTF) or an instruction to create one (LaTeX, reStructuredText).
151 RTF) or an instruction to create one (LaTeX, reStructuredText).