git.iko.soy/typeable/pandoc
on master help sign in
New README template, take in/out formats from manual.
commit72bdac3036cdab7c7fa3b02b5c7ac8ee93350cef authorJohn MacFarlane <jgm@berkeley.edu> dateSun 22 Apr 2018, 11:36 (9 years ago) parent873a4c4
4 files changed+195−125
MANUAL.txt+8−8 README.md+137−84 README.template+34−1 tools/update-readme.lua+16−32
MANUAL.txt+8−8
@@ -17,19 +17,15 @@ Pandoc can convert between numerous markup and word processing formats,
1717including, but not limited to, various flavors of [Markdown], [HTML],
1818[LaTeX] and [Word docx]. For the full lists of input and output formats,
1919see the `--from` and `--to` [options below][General options].
20−
21−Pandoc can also produce [PDF] output, see [creating a PDF] below.
20+Pandoc can also produce [PDF] output: see [creating a PDF], below.
2221
2322Pandoc's enhanced version of Markdown includes syntax for [tables],
24−[definition lists], [metadata blocks], [`Div` blocks][Extension:
25−`fenced_divs`], [footnotes] and [citations], embedded
26−[LaTeX][Extension: `raw_tex`] (including [math]), [Markdown inside HTML
27−block elements][Extension: `markdown_in_html_blocks`], and much more.
28−See below under [Pandoc's Markdown].
23+[definition lists], [metadata blocks], [footnotes], [citations], [math],
24+and much more. See below under [Pandoc's Markdown].
2925
3026Pandoc has a modular design: it consists of a set of readers, which parse
3127text in a given format and produce a native representation of the document
32−(like an _abstract syntax tree_ or AST), and a set of writers, which convert
28+(an _abstract syntax tree_ or AST), and a set of writers, which convert
3329this native representation into a target format. Thus, adding an input
3430or output format requires only adding a reader or writer. Users can also
3531run custom [pandoc filters] to modify the intermediate AST.
@@ -221,6 +217,7 @@ General options
221217
222218: Specify input format. *FORMAT* can be:
223219
220+ ::: {#input-formats}
224221 - `commonmark` ([CommonMark] Markdown)
225222 - `creole` ([Creole 1.0])
226223 - `docbook` ([DocBook])
@@ -251,6 +248,7 @@ General options
251248 - `tikiwiki` ([TikiWiki markup])
252249 - `twiki` ([TWiki markup])
253250 - `vimwiki` ([Vimwiki])
251+ :::
254252
255253 Extensions can be individually enabled or disabled by
256254 appending `+EXTENSION` or `-EXTENSION` to the format name.
@@ -262,6 +260,7 @@ General options
262260
263261: Specify output format. *FORMAT* can be:
264262
263+ ::: {#output-formats}
265264 - `asciidoc` ([AsciiDoc])
266265 - `beamer` ([LaTeX beamer][`beamer`] slide show)
267266 - `commonmark` ([CommonMark] Markdown)
@@ -311,6 +310,7 @@ General options
311310 - `tei` ([TEI Simple])
312311 - `zimwiki` ([ZimWiki markup])
313312 - the path of a custom lua writer, see [Custom writers] below
313+ :::
314314
315315 Note that `odt`, `docx`, and `epub` output will not be directed
316316 to *stdout* unless forced with `-o -`.
README.md+137−84
@@ -22,93 +22,148 @@ groups](https://img.shields.io/badge/pandoc-discuss-red.svg?style=social)](https
2222
2323## The universal markup converter
2424
25−<div id="description">
26−
27−Pandoc is a [Haskell](https://www.haskell.org) library for converting
28−from one markup format to another, and a command-line tool that uses
29−this library.
30−
31−Pandoc can read
32−[Markdown](http://daringfireball.net/projects/markdown/),
33−[CommonMark](http://commonmark.org), [PHP Markdown
34−Extra](https://michelf.ca/projects/php-markdown/extra/),
35−[GitHub-Flavored
36−Markdown](https://help.github.com/articles/github-flavored-markdown/),
37−[MultiMarkdown](http://fletcherpenney.net/multimarkdown/), and (subsets
38−of) [Textile](http://redcloth.org/textile),
39−[reStructuredText](http://docutils.sourceforge.net/docs/ref/rst/introduction.html),
40−[HTML](http://www.w3.org/html/), [LaTeX](http://latex-project.org),
41−[MediaWiki markup](https://www.mediawiki.org/wiki/Help:Formatting),
42−[TWiki markup](http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules),
43−[TikiWiki
44−markup](https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax),
45−[Creole 1.0](http://www.wikicreole.org/wiki/Creole1.0), [Haddock
46−markup](https://www.haskell.org/haddock/doc/html/ch03s08.html),
47−[OPML](http://dev.opml.org/spec2.html), [Emacs Org
48−mode](http://orgmode.org), [DocBook](http://docbook.org),
49−[JATS](https://jats.nlm.nih.gov),
50−[Muse](https://amusewiki.org/library/manual),
51−[txt2tags](http://txt2tags.org), [Vimwiki](https://vimwiki.github.io),
52−[EPUB](http://idpf.org/epub),
53−[ODT](http://en.wikipedia.org/wiki/OpenDocument), and [Word
54−docx](https://en.wikipedia.org/wiki/Office_Open_XML).
55−
56−Pandoc can write plain text,
57−[Markdown](http://daringfireball.net/projects/markdown/),
58−[CommonMark](http://commonmark.org), [PHP Markdown
59−Extra](https://michelf.ca/projects/php-markdown/extra/),
60−[GitHub-Flavored
61−Markdown](https://help.github.com/articles/github-flavored-markdown/),
62−[MultiMarkdown](http://fletcherpenney.net/multimarkdown/),
63−[reStructuredText](http://docutils.sourceforge.net/docs/ref/rst/introduction.html),
64−[XHTML](http://www.w3.org/TR/xhtml1/),
65−[HTML5](http://www.w3.org/TR/html5/), [LaTeX](http://latex-project.org)
66−(including [`beamer`](https://ctan.org/pkg/beamer) slide shows),
67−[ConTeXt](http://www.contextgarden.net/),
68−[RTF](http://en.wikipedia.org/wiki/Rich_Text_Format),
69−[OPML](http://dev.opml.org/spec2.html), [DocBook](http://docbook.org),
70−[JATS](https://jats.nlm.nih.gov),
71−[OpenDocument](http://opendocument.xml.org),
72−[ODT](http://en.wikipedia.org/wiki/OpenDocument), [Word
73−docx](https://en.wikipedia.org/wiki/Office_Open_XML), [GNU
74−Texinfo](http://www.gnu.org/software/texinfo/), [MediaWiki
75−markup](https://www.mediawiki.org/wiki/Help:Formatting), [DokuWiki
76−markup](https://www.dokuwiki.org/dokuwiki), [ZimWiki
77−markup](http://zim-wiki.org/manual/Help/Wiki_Syntax.html), [Haddock
78−markup](https://www.haskell.org/haddock/doc/html/ch03s08.html),
79−[EPUB](http://idpf.org/epub) (v2 or v3),
80−[FictionBook2](http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1),
81−[Textile](http://redcloth.org/textile), [groff
82−man](http://man7.org/linux/man-pages/man7/groff_man.7.html), [groff
83−ms](http://man7.org/linux/man-pages/man7/groff_ms.7.html), [Emacs Org
84−mode](http://orgmode.org),
85−[AsciiDoc](http://www.methods.co.nz/asciidoc/), [InDesign
86−ICML](http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf),
87−[TEI Simple](https://github.com/TEIC/TEI-Simple),
88−[Muse](https://amusewiki.org/library/manual),
89−[PowerPoint](https://en.wikipedia.org/wiki/Microsoft_PowerPoint) slide
90−shows and [Slidy](http://www.w3.org/Talks/Tools/Slidy/),
91−[Slideous](http://goessner.net/articles/slideous/),
92−[DZSlides](http://paulrouget.com/dzslides/),
93−[reveal.js](http://lab.hakim.se/reveal-js/) or
94−[S5](http://meyerweb.com/eric/tools/s5/) HTML slide shows. It can also
95−produce [PDF](https://www.adobe.com/pdf/) output on systems where LaTeX,
96−ConTeXt, `pdfroff`, `wkhtmltopdf`, `prince`, or `weasyprint` is
97−installed.
25+Pandoc is a \[Haskell\] library for converting from one markup format to
26+another, and a command-line tool that uses this library. It can convert
27+*from*
28+
29+<div id="input-formats">
30+
31+ - `commonmark` ([CommonMark](http://commonmark.org) Markdown)
32+ - `creole` ([Creole 1.0](http://www.wikicreole.org/wiki/Creole1.0))
33+ - `docbook` ([DocBook](http://docbook.org))
34+ - `docx` ([Word docx](https://en.wikipedia.org/wiki/Office_Open_XML))
35+ - `epub` ([EPUB](http://idpf.org/epub))
36+ - `gfm` ([GitHub-Flavored
37+ Markdown](https://help.github.com/articles/github-flavored-markdown/)),
38+ or `markdown_github`, which provides deprecated and less accurate
39+ support for Github-Flavored Markdown; please use `gfm` instead,
40+ unless you need to use extensions other than `smart`.
41+ - `haddock` ([Haddock
42+ markup](https://www.haskell.org/haddock/doc/html/ch03s08.html))
43+ - `html` ([HTML](http://www.w3.org/html/))
44+ - `jats` ([JATS](https://jats.nlm.nih.gov) XML)
45+ - `json` (JSON version of native AST)
46+ - `latex` ([LaTeX](http://latex-project.org))
47+ - `markdown` ([Pandoc’s Markdown](#pandocs-markdown))
48+ - `markdown_mmd`
49+ ([MultiMarkdown](http://fletcherpenney.net/multimarkdown/))
50+ - `markdown_phpextra` ([PHP Markdown
51+ Extra](https://michelf.ca/projects/php-markdown/extra/))
52+ - `markdown_strict` (original unextended
53+ [Markdown](http://daringfireball.net/projects/markdown/))
54+ - `mediawiki` ([MediaWiki
55+ markup](https://www.mediawiki.org/wiki/Help:Formatting))
56+ - `muse` ([Muse](https://amusewiki.org/library/manual))
57+ - `native` (native Haskell)
58+ - `odt` ([ODT](http://en.wikipedia.org/wiki/OpenDocument))
59+ - `opml` ([OPML](http://dev.opml.org/spec2.html))
60+ - `org` ([Emacs Org mode](http://orgmode.org))
61+ - `rst`
62+ ([reStructuredText](http://docutils.sourceforge.net/docs/ref/rst/introduction.html))
63+ - `t2t` ([txt2tags](http://txt2tags.org))
64+ - `textile` ([Textile](http://redcloth.org/textile))
65+ - `tikiwiki` ([TikiWiki
66+ markup](https://doc.tiki.org/Wiki-Syntax-Text#The_Markup_Language_Wiki-Syntax))
67+ - `twiki` ([TWiki
68+ markup](http://twiki.org/cgi-bin/view/TWiki/TextFormattingRules))
69+ - `vimwiki` ([Vimwiki](https://vimwiki.github.io))
70+
71+</div>
72+
73+It can convert *to*
74+
75+<div id="output-formats">
76+
77+ - `asciidoc` ([AsciiDoc](http://www.methods.co.nz/asciidoc/))
78+ - `beamer` ([LaTeX beamer](https://ctan.org/pkg/beamer) slide show)
79+ - `commonmark` ([CommonMark](http://commonmark.org) Markdown)
80+ - `context` ([ConTeXt](http://www.contextgarden.net/))
81+ - `docbook` or `docbook4` ([DocBook](http://docbook.org) 4)
82+ - `docbook5` (DocBook 5)
83+ - `docx` ([Word docx](https://en.wikipedia.org/wiki/Office_Open_XML))
84+ - `dokuwiki` ([DokuWiki markup](https://www.dokuwiki.org/dokuwiki))
85+ - `epub` or `epub3` ([EPUB](http://idpf.org/epub) v3 book)
86+ - `epub2` (EPUB v2)
87+ - `fb2`
88+ ([FictionBook2](http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1)
89+ e-book)
90+ - `gfm` ([GitHub-Flavored
91+ Markdown](https://help.github.com/articles/github-flavored-markdown/)),
92+ or `markdown_github`, which provides deprecated and less accurate
93+ support for Github-Flavored Markdown; please use `gfm` instead,
94+ unless you use extensions that do not work with `gfm`.
95+ - `haddock` ([Haddock
96+ markup](https://www.haskell.org/haddock/doc/html/ch03s08.html))
97+ - `html` or `html5` ([HTML](http://www.w3.org/html/), i.e.
98+ [HTML5](http://www.w3.org/TR/html5/)/XHTML [polyglot
99+ markup](https://www.w3.org/TR/html-polyglot/))
100+ - `html4` ([XHTML](http://www.w3.org/TR/xhtml1/) 1.0 Transitional)
101+ - `icml` ([InDesign
102+ ICML](http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf))
103+ - `jats` ([JATS](https://jats.nlm.nih.gov) XML)
104+ - `json` (JSON version of native AST)
105+ - `latex` ([LaTeX](http://latex-project.org))
106+ - `man` ([groff
107+ man](http://man7.org/linux/man-pages/man7/groff_man.7.html))
108+ - `markdown` ([Pandoc’s Markdown](#pandocs-markdown))
109+ - `markdown_mmd`
110+ ([MultiMarkdown](http://fletcherpenney.net/multimarkdown/))
111+ - `markdown_phpextra` ([PHP Markdown
112+ Extra](https://michelf.ca/projects/php-markdown/extra/))
113+ - `markdown_strict` (original unextended
114+ [Markdown](http://daringfireball.net/projects/markdown/))
115+ - `mediawiki` ([MediaWiki
116+ markup](https://www.mediawiki.org/wiki/Help:Formatting))
117+ - `ms` ([groff
118+ ms](http://man7.org/linux/man-pages/man7/groff_ms.7.html))
119+ - `muse` ([Muse](https://amusewiki.org/library/manual)),
120+ - `native` (native Haskell),
121+ - `odt` ([OpenOffice text
122+ document](http://en.wikipedia.org/wiki/OpenDocument))
123+ - `opml` ([OPML](http://dev.opml.org/spec2.html))
124+ - `opendocument` ([OpenDocument](http://opendocument.xml.org))
125+ - `org` ([Emacs Org mode](http://orgmode.org))
126+ - `plain` (plain text),
127+ - `pptx`
128+ ([PowerPoint](https://en.wikipedia.org/wiki/Microsoft_PowerPoint)
129+ slide show)
130+ - `rst`
131+ ([reStructuredText](http://docutils.sourceforge.net/docs/ref/rst/introduction.html))
132+ - `rtf` ([Rich Text
133+ Format](http://en.wikipedia.org/wiki/Rich_Text_Format))
134+ - `texinfo` ([GNU Texinfo](http://www.gnu.org/software/texinfo/))
135+ - `textile` ([Textile](http://redcloth.org/textile))
136+ - `slideous` ([Slideous](http://goessner.net/articles/slideous/) HTML
137+ and JavaScript slide show)
138+ - `slidy` ([Slidy](http://www.w3.org/Talks/Tools/Slidy/) HTML and
139+ JavaScript slide show)
140+ - `dzslides` ([DZSlides](http://paulrouget.com/dzslides/) HTML5 +
141+ JavaScript slide show),
142+ - `revealjs` ([reveal.js](http://lab.hakim.se/reveal-js/) HTML5 +
143+ JavaScript slide show)
144+ - `s5` ([S5](http://meyerweb.com/eric/tools/s5/) HTML and JavaScript
145+ slide show)
146+ - `tei` ([TEI Simple](https://github.com/TEIC/TEI-Simple))
147+ - `zimwiki` ([ZimWiki
148+ markup](http://zim-wiki.org/manual/Help/Wiki_Syntax.html))
149+ - the path of a custom lua writer, see [Custom
150+ writers](#custom-writers) below
151+
152+</div>
153+
154+Pandoc can also produce PDF output via LaTeX, Groff ms, or HTML.
98155
99156Pandoc’s enhanced version of Markdown includes syntax for tables,
100−definition lists, metadata blocks, `Div` blocks, footnotes and
101−citations, embedded LaTeX (including math), Markdown inside HTML block
102−elements, and much more. These enhancements, described further under
103−Pandoc’s Markdown, can be disabled using the `markdown_strict` format.
157+definition lists, metadata blocks, footnotes, citations, math, and much
158+more. See the User’s Manual below under [Pandoc’s
159+Markdown](https://pandoc.org/MANUAL.html#pandocs-markdown).
104160
105161Pandoc has a modular design: it consists of a set of readers, which
106162parse text in a given format and produce a native representation of the
107−document (like an *abstract syntax tree* or AST), and a set of writers,
108−which convert this native representation into a target format. Thus,
109−adding an input or output format requires only adding a reader or
110−writer. Users can also run custom [pandoc
111−filters](http://pandoc.org/filters.html) to modify the intermediate AST.
163+document (an *abstract syntax tree* or AST), and a set of writers, which
164+convert this native representation into a target format. Thus, adding an
165+input or output format requires only adding a reader or writer. Users
166+can also run custom \[pandoc filters\] to modify the intermediate AST.
112167
113168Because pandoc’s intermediate representation of a document is less
114169expressive than many of the formats it converts between, one should not
@@ -120,8 +175,6 @@ While conversions from pandoc’s Markdown to all formats aspire to be
120175perfect, conversions from formats more expressive than pandoc’s Markdown
121176can be expected to be lossy.
122177
123−</div>
124−
125178## Installing
126179
127180Here’s [how to install pandoc](INSTALL.md).
README.template+34−1
@@ -19,9 +19,42 @@ Pandoc
1919The universal markup converter
2020------------------------------
2121
22−::: description
22+Pandoc is a [Haskell] library for converting from one markup format to
23+another, and a command-line tool that uses this library. It can convert *from*
24+
25+::: {#input-formats}
2326:::
2427
28+It can convert *to*
29+
30+::: {#output-formats}
31+:::
32+
33+Pandoc can also produce PDF output via LaTeX, Groff ms, or HTML.
34+
35+Pandoc's enhanced version of Markdown includes syntax for tables,
36+definition lists, metadata blocks, footnotes, citations, math,
37+and much more. See the User's Manual below under
38+[Pandoc's Markdown](https://pandoc.org/MANUAL.html#pandocs-markdown).
39+
40+Pandoc has a modular design: it consists of a set of readers, which parse
41+text in a given format and produce a native representation of the document
42+(an _abstract syntax tree_ or AST), and a set of writers, which convert
43+this native representation into a target format. Thus, adding an input
44+or output format requires only adding a reader or writer. Users can also
45+run custom [pandoc filters] to modify the intermediate AST.
46+
47+Because pandoc's intermediate representation of a document is less
48+expressive than many of the formats it converts between, one should
49+not expect perfect conversions between every format and every other.
50+Pandoc attempts to preserve the structural elements of a document, but
51+not formatting details such as margin size. And some document elements,
52+such as complex tables, may not fit into pandoc's simple document
53+model. While conversions from pandoc's Markdown to all formats aspire
54+to be perfect, conversions from formats more expressive than pandoc's
55+Markdown can be expected to be lossy.
56+
57+
2558Installing
2659----------
2760
tools/update-readme.lua+16−32
@@ -1,38 +1,22 @@
11-- update README.md based on MANUAL.txt
2−-- assumes that the README.md has a div with id 'description'.
3−-- this gets replaced by the contents of the 'description' section
4−-- of the manual.
2+-- inserts contents of input-formats and output-formats
3+
4+local f = assert(io.open("MANUAL.txt", "r"))
5+local manual = f:read("*all")
6+mdoc = pandoc.read(manual, "markdown")
7+f:close()
8+result = {}
59
610function Div(elem)
7− if elem.classes[1] and elem.classes[1] == 'description' then
8− local f = assert(io.open("MANUAL.txt", "r"))
9− local manual = f:read("*all")
10− f:close()
11− local description = {}
12− local i = 1
13− local include = false
14− local mdoc = pandoc.read(manual, "markdown")
15− local blocks = mdoc.blocks
16− while blocks[i] do
17− if blocks[i].t == 'Header' then
18− include = false
19− end
20− if include then
21− table.insert(description, pandoc.walk_block(blocks[i],
22− -- remove internal links
23− { Link = function(el)
24− if el.target:match("^#") then
25− return el.content
26− end
27− end }))
28− end
29− if blocks[i].t == 'Header' and
30− blocks[i].identifier == 'description' then
31− include = true
32− end
33− i = i + 1
34− end
35− return pandoc.Div(description, pandoc.Attr("description",{},{}))
11+ local ident = elem.identifier or ""
12+ local get = function(el)
13+ if el.identifier == ident then
14+ result = el
15+ end
16+ end
17+ if ident == 'input-formats' or ident == 'output-formats' then
18+ pandoc.walk_block(pandoc.Div(mdoc.blocks), { Div = get })
19+ return result
3620 end
3721end
3822