pandoc 2.5 → 2.6
raw patch · 169 files changed
+10124/−6928 lines, 169 filesdep +ipynbdep ~http-clientdep ~skylightingsetup-changedbinary-added
Dependencies added: ipynb
Dependency ranges changed: http-client, skylighting
Files
- AUTHORS.md +1/−0
- INSTALL.md +63/−26
- MANUAL.txt +559/−269
- README.md +6/−2
- Setup.hs +1/−37
- changelog +352/−0
- data/epub.css +4/−3
- data/pandoc.lua +18/−6
- data/sample.lua +9/−1
- data/templates/default.dzslides +2/−2
- data/templates/default.epub3 +3/−3
- data/templates/default.html5 +2/−2
- data/templates/default.latex +104/−69
- data/templates/default.revealjs +6/−2
- man/pandoc.1 +6149/−5811
- pandoc.cabal +28/−21
- src/Text/Pandoc/App.hs +25/−13
- src/Text/Pandoc/App/CommandLineOptions.hs +37/−10
- src/Text/Pandoc/App/FormatHeuristics.hs +1/−0
- src/Text/Pandoc/App/OutputSettings.hs +5/−5
- src/Text/Pandoc/Error.hs +10/−0
- src/Text/Pandoc/Extensions.hs +5/−0
- src/Text/Pandoc/Parsing.hs +2/−17
- src/Text/Pandoc/Process.hs +63/−31
- src/Text/Pandoc/Readers.hs +13/−8
- src/Text/Pandoc/Readers/CommonMark.hs +5/−2
- src/Text/Pandoc/Readers/Docx.hs +1/−1
- src/Text/Pandoc/Readers/Docx/Lists.hs +4/−4
- src/Text/Pandoc/Readers/Docx/Parse.hs +38/−8
- src/Text/Pandoc/Readers/DokuWiki.hs +529/−0
- src/Text/Pandoc/Readers/HTML.hs +6/−11
- src/Text/Pandoc/Readers/Ipynb.hs +249/−0
- src/Text/Pandoc/Readers/LaTeX.hs +41/−15
- src/Text/Pandoc/Readers/LaTeX/Parsing.hs +0/−6
- src/Text/Pandoc/Readers/Man.hs +4/−9
- src/Text/Pandoc/Readers/Markdown.hs +11/−10
- src/Text/Pandoc/Readers/MediaWiki.hs +6/−8
- src/Text/Pandoc/Readers/Muse.hs +0/−6
- src/Text/Pandoc/Readers/Odt/StyleReader.hs +3/−6
- src/Text/Pandoc/Readers/Org/Blocks.hs +9/−9
- src/Text/Pandoc/Readers/Org/DocumentTree.hs +52/−6
- src/Text/Pandoc/Readers/Org/Inlines.hs +18/−13
- src/Text/Pandoc/Readers/Org/Meta.hs +17/−9
- src/Text/Pandoc/Readers/Org/ParserState.hs +10/−12
- src/Text/Pandoc/Readers/Org/Shared.hs +1/−2
- src/Text/Pandoc/Readers/RST.hs +20/−24
- src/Text/Pandoc/Readers/TWiki.hs +3/−1
- src/Text/Pandoc/Readers/TikiWiki.hs +6/−3
- src/Text/Pandoc/RoffChar.hs +0/−1
- src/Text/Pandoc/SelfContained.hs +1/−1
- src/Text/Pandoc/Shared.hs +32/−0
- src/Text/Pandoc/Templates.hs +1/−0
- src/Text/Pandoc/Writers.hs +6/−3
- src/Text/Pandoc/Writers/AsciiDoc.hs +2/−3
- src/Text/Pandoc/Writers/CommonMark.hs +29/−11
- src/Text/Pandoc/Writers/Docx.hs +22/−7
- src/Text/Pandoc/Writers/DokuWiki.hs +2/−6
- src/Text/Pandoc/Writers/EPUB.hs +7/−6
- src/Text/Pandoc/Writers/HTML.hs +33/−8
- src/Text/Pandoc/Writers/ICML.hs +15/−5
- src/Text/Pandoc/Writers/Ipynb.hs +237/−0
- src/Text/Pandoc/Writers/LaTeX.hs +43/−23
- src/Text/Pandoc/Writers/Markdown.hs +12/−24
- src/Text/Pandoc/Writers/MediaWiki.hs +33/−17
- src/Text/Pandoc/Writers/Ms.hs +1/−1
- src/Text/Pandoc/Writers/ODT.hs +29/−11
- src/Text/Pandoc/Writers/Org.hs +9/−3
- src/Text/Pandoc/Writers/Powerpoint/Output.hs +36/−5
- src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +21/−17
- src/Text/Pandoc/Writers/RST.hs +1/−1
- src/Text/Pandoc/Writers/RTF.hs +2/−17
- src/Text/Pandoc/Writers/Shared.hs +23/−1
- src/Text/Pandoc/Writers/Texinfo.hs +4/−2
- src/Text/Pandoc/Writers/ZimWiki.hs +2/−6
- src/Text/Pandoc/XML.hs +6/−1
- stack.yaml +4/−11
- test/Tests/Helpers.hs +24/−10
- test/Tests/Lua.hs +15/−4
- test/Tests/Old.hs +4/−0
- test/Tests/Readers/Docx.hs +4/−0
- test/Tests/Readers/DokuWiki.hs +315/−0
- test/Tests/Readers/Markdown.hs +2/−2
- test/Tests/Readers/Muse.hs +5/−0
- test/Tests/Readers/Org/Directive.hs +6/−1
- test/Tests/Readers/Org/Inline.hs +21/−13
- test/Tests/Readers/RST.hs +8/−8
- test/Tests/Writers/AsciiDoc.hs +4/−4
- test/Tests/Writers/Docx.hs +10/−0
- test/Tests/Writers/Powerpoint.hs +8/−0
- test/command/4811.md +1/−1
- test/command/5119.md +9/−0
- test/command/5121.md +13/−0
- test/command/5128.md +18/−0
- test/command/5177.md +12/−0
- test/command/5178.md +41/−0
- test/command/5182.md +6/−0
- test/command/5182.txt +5/−0
- test/command/5195.md +7/−0
- test/command/5233.md +9/−0
- test/command/5241.md +12/−0
- test/command/gfm.md +29/−0
- test/command/tasklist.md +113/−0
- test/docx/document-properties-short-desc.native +2/−0
- test/docx/document-properties.native +2/−0
- test/docx/golden/document-properties-short-desc.docx binary
- test/docx/golden/document-properties.docx binary
- test/docx/lists_level_override.docx binary
- test/docx/lists_level_override.native +37/−0
- test/dokuwiki_external_images.dokuwiki +1/−1
- test/lhs-test-markdown.native +1/−1
- test/lhs-test.html +3/−3
- test/lhs-test.html+lhs +3/−3
- test/lhs-test.latex +27/−21
- test/lhs-test.latex+lhs +29/−21
- test/lhs-test.markdown +1/−1
- test/lhs-test.native +1/−1
- test/lua/smart-constructors.lua +10/−0
- test/mediawiki-reader.native +16/−16
- test/org-select-tags.native +7/−0
- test/org-select-tags.org +17/−0
- test/pptx/document-properties-short-desc.native +2/−0
- test/pptx/document-properties-short-desc.pptx binary
- test/pptx/document-properties-short-desc_templated.pptx binary
- test/pptx/document-properties.native +2/−0
- test/pptx/document-properties.pptx binary
- test/pptx/document-properties_templated.pptx binary
- test/pptx/endnotes.pptx binary
- test/pptx/endnotes_templated.pptx binary
- test/pptx/endnotes_toc.pptx binary
- test/pptx/endnotes_toc_templated.pptx binary
- test/pptx/images.pptx binary
- test/pptx/images_templated.pptx binary
- test/pptx/inline_formatting.pptx binary
- test/pptx/inline_formatting_templated.pptx binary
- test/pptx/lists.pptx binary
- test/pptx/lists_templated.pptx binary
- test/pptx/raw_ooxml.pptx binary
- test/pptx/raw_ooxml_templated.pptx binary
- test/pptx/remove_empty_slides.pptx binary
- test/pptx/remove_empty_slides_templated.pptx binary
- test/pptx/slide_breaks.pptx binary
- test/pptx/slide_breaks_slide_level_1.pptx binary
- test/pptx/slide_breaks_slide_level_1_templated.pptx binary
- test/pptx/slide_breaks_templated.pptx binary
- test/pptx/slide_breaks_toc.pptx binary
- test/pptx/slide_breaks_toc_templated.pptx binary
- test/pptx/speaker_notes.pptx binary
- test/pptx/speaker_notes_afterseps.pptx binary
- test/pptx/speaker_notes_afterseps_templated.pptx binary
- test/pptx/speaker_notes_templated.pptx binary
- test/pptx/tables.pptx binary
- test/pptx/tables_templated.pptx binary
- test/pptx/two_column.pptx binary
- test/pptx/two_column_templated.pptx binary
- test/rst-reader.native +4/−4
- test/tables.asciidoc +14/−14
- test/tables.custom +7/−7
- test/test-pandoc.hs +7/−1
- test/writer.asciidoc +14/−14
- test/writer.custom +8/−8
- test/writer.dokuwiki +2/−2
- test/writer.html5 +1/−1
- test/writer.latex +29/−23
- test/writer.man +10/−10
- test/writer.mediawiki +1/−1
- test/writer.ms +9/−9
- test/writer.zimwiki +2/−2
- test/writers-lang-and-dir.latex +30/−23
- trypandoc/index.html +10/−4
@@ -41,6 +41,7 @@ - Clint Adams - Conal Elliott - Craig S. Bosma+- Damien Clochard - Daniel Bergey - Daniel T. Staal - Daniele D'Orazio
@@ -1,5 +1,15 @@ # Installing pandoc +The simplest way to get the latest pandoc release is to use the installer.++<a href="https://github.com/jgm/pandoc/releases/latest"+ class="btn btn-primary" id="downloadInstallerBtn">+ Download the latest installer+</a>++For alternative ways to install pandoc, see below+under the heading for your operating system.+ ## Windows - There is a package installer at pandoc's [download page].@@ -11,13 +21,22 @@ a zip file that contains pandoc's binaries and documentation. Simply unzip this file and move the binaries to a directory of your choice.- + - Alternatively, you can install pandoc using- [chocolatey](https://chocolatey.org): `choco install pandoc`.+ [Chocolatey](https://chocolatey.org): - - For PDF output, you'll also need to install LaTeX.- We recommend [MiKTeX](http://miktex.org/).+ choco install pandoc + Chocolatey can also install other software that integrates with Pandoc.+ For example, to install `rsvg-convert` (from [librsvg], covering formats+ without SVG support), [Python] (to use Pandoc filters), and+ [MiKTeX] (to typeset PDFs with [LaTeX]):++ choco install rsvg-convert python miktex++ - By default, Pandoc creates PDFs using LaTeX.+ We recommend installing it via [MiKTeX].+ ## macOS - There is a package installer at pandoc's [download page].@@ -25,37 +44,50 @@ by downloading [this script][uninstaller] and running it with `perl uninstall-pandoc.pl`. + - Alternatively, you can install pandoc using+ [Homebrew](http://brew.sh):++ brew install pandoc++ To include pandoc's citation parser:++ brew install pandoc-citeproc++ Homebrew can also install other software that integrates with Pandoc.+ For example, to install [librsvg] (its `rsvg-convert` covers formats+ without SVG support), [Python] (to use Pandoc filters), and+ [BasicTeX] (to typeset PDFs with [LaTeX]):++ brew install librsvg python homebrew/cask/basictex++ Note: On unsupported versions of macOS (more than three releases old),+ Homebrew installs from source, which takes additional time and disk space+ for the `ghc` compiler and dependent Haskell libraries.+ - We also provide a zip file containing the binaries and man pages, for those who prefer not to use the installer. Simply unzip the file and move the binaries and man pages to whatever directory you like. - - Alternatively, you can install pandoc using- [homebrew](http://brew.sh): `brew install pandoc`.- Note: If you are using macOS < 10.10, this method installs - pandoc from source, so it will take a long time and a lot of - disk space for the ghc compiler and dependent Haskell libraries.-- - For PDF output, you'll also need LaTeX. Because a full [MacTeX]- installation takes more than a gigabyte of disk space, we recommend- installing [BasicTeX](http://www.tug.org/mactex/morepackages.html)- (64M) or [TinyTeX](https://yihui.name/tinytex/)+ - By default, Pandoc creates PDFs using LaTeX. Because a full [MacTeX]+ installation uses four gigabytes of disk space, we recommend+ [BasicTeX] or [TinyTeX](https://yihui.name/tinytex/) and using the `tlmgr` tool to install additional packages- as needed. If you get errors warning of fonts not found, try+ as needed. If you receive errors warning of fonts not found: tlmgr install collection-fontsrecommended ## Linux - - First, try your package manager.- Pandoc is in the [Debian], [Ubuntu], [Slackware],+ - Check whether the pandoc version in your package manager is+ not outdated. Pandoc is in the [Debian], [Ubuntu], [Slackware], [Arch], [Fedora], [NiXOS], [openSUSE], and [gentoo] repositories.- Note, however, that versions in the repositories are often- old. - - We provide a binary package for amd64 architecture on- the [download page]. This provides both `pandoc` and- `pandoc-citeproc`. The executables are statically linked and+ - To get the latest release, we provide a binary package for amd64+ architecture on the **[download page]**.++ This provides both `pandoc` and `pandoc-citeproc`.+ The executables are statically linked and have no dynamic dependencies or dependencies on external data files. Note: because of the static linking, the pandoc binary from this package cannot use lua@@ -138,9 +170,9 @@ ### Quick stack method -The easiest way to build pandoc from source is to use [stack]:+The easiest way to build pandoc from source is to use [stack][stack]: -1. Install [stack]. Note that Pandoc requires stack >= 1.6.0.+1. Install [stack][stack]. Note that Pandoc requires stack >= 1.7.0. 2. Change to the pandoc source directory and issue the following commands: @@ -206,7 +238,7 @@ Note that this requires the `text-icu` library, which in turn depends on the C library `icu4c`. Installation directions- vary by platform. Here is how it might work on macOS with homebrew:+ vary by platform. Here is how it might work on macOS with Homebrew: brew install icu4c cabal install --extra-lib-dirs=/usr/local/Cellar/icu4c/51.1/lib \@@ -350,6 +382,11 @@ [Haskell platform]: http://hackage.haskell.org/platform/ [MacPorts]: http://trac.macports.org/browser/trunk/dports/textproc/pandoc/Portfile [MacTeX]: https://tug.org/mactex/+[BasicTeX]: http://www.tug.org/mactex/morepackages.html+[LaTeX]: https://www.latex-project.org+[MiKTeX]: http://miktex.org/+[librsvg]: https://wiki.gnome.org/Projects/LibRsvg+[Python]: https://www.python.org [NetBSD]: http://pkgsrc.se/wip/pandoc [NixOS]: https://nixos.org/nixos/packages.html [Slackware]: https://www.slackbuilds.org/result/?search=pandoc&sv=@@ -359,6 +396,6 @@ [haskell repository]: https://wiki.archlinux.org/index.php/Haskell_Package_Guidelines#.5Bhaskell.5D [openSUSE]: https://software.opensuse.org/package/pandoc [source tarball]: http://hackage.haskell.org/package/pandoc-[stack]: http://docs.haskellstack.org/en/stable/install_and_upgrade.html+[stack]: https://docs.haskellstack.org/en/stable/install_and_upgrade.html [cabal-install]: http://hackage.haskell.org/package/cabal-install [uninstaller]: https://raw.githubusercontent.com/jgm/pandoc/master/macos/uninstall-pandoc.pl
@@ -1,6 +1,6 @@ % Pandoc User's Guide % John MacFarlane-% November 25, 2018+% January 30, 2019 Synopsis ========@@ -128,12 +128,9 @@ but add the `--pdf-engine` option or `-t context`, `-t html`, or `-t ms` to the command line (`-t html` defaults to `--pdf-engine=wkhtmltopdf`). -PDF output can be controlled using [variables for LaTeX] (if-LaTeX is used) and [variables for ConTeXt] (if ConTeXt is used).-When using an HTML/CSS-to-PDF-engine, `--css` affects the output.-If `wkhtmltopdf` is used, then the variables `margin-left`,-`margin-right`, `margin-top`, `margin-bottom`, `footer-html`,-`header-html` and `papersize` will affect the output.+PDF output uses [variables for LaTeX] (with a LaTeX engine);+[variables for ConTeXt] (with ConTeXt); or [variables for `wkhtmltopdf`]+(an HTML/CSS-to-PDF engine; `--css` also affects the output). To debug the PDF creation, it can be useful to look at the intermediate representation: instead of `-o test.pdf`, use for example `-s -o test.tex`@@ -145,11 +142,11 @@ [`ifxetex`], [`ifluatex`], [`listings`] (if the `--listings` option is used), [`fancyvrb`], [`longtable`], [`booktabs`], [`graphicx`] and [`grffile`] (if the document-contains images), [`hyperref`], [`xcolor`] (with `colorlinks`),+contains images), [`hyperref`], [`xcolor`], [`ulem`], [`geometry`] (with the `geometry` variable set), [`setspace`] (with `linestretch`), and [`babel`] (with `lang`). The use of `xelatex` or `lualatex` as-the LaTeX engine requires [`fontspec`]. `xelatex` uses+the PDF engine requires [`fontspec`]. `xelatex` uses [`polyglossia`] (with `lang`), [`xecjk`], and [`bidi`] (with the `dir` variable set). If the `mathspec` variable is set, `xelatex` will use [`mathspec`] instead of [`unicode-math`].@@ -158,42 +155,58 @@ if `\usepackage{csquotes}` is present in the template or included via `/H/--include-in-header`. The [`natbib`], [`biblatex`], [`bibtex`], and [`biber`] packages can optionally-be used for [citation rendering].+be used for [citation rendering]. The following packages+will be used to improve output quality if present, but+pandoc does not require them to be present:+[`upquote`] (for straight quotes in verbatim environments),+[`microtype`] (for better spacing adjustments),+[`parskip`] (for better inter-paragraph spaces),+[`xurl`] (for better line breaks in URLs),+[`bookmark`] (for better PDF bookmarks),+and [`footnotehyper`] or [`footnote`] (to allow footnotes in tables). +[TeX Live]: http://www.tug.org/texlive/ [`amsfonts`]: https://ctan.org/pkg/amsfonts [`amsmath`]: https://ctan.org/pkg/amsmath-[`lm`]: https://ctan.org/pkg/lm-[`ifxetex`]: https://ctan.org/pkg/ifxetex-[`ifluatex`]: https://ctan.org/pkg/ifluatex-[`listings`]: https://ctan.org/pkg/listings-[`fancyvrb`]: https://ctan.org/pkg/fancyvrb-[`longtable`]: https://ctan.org/pkg/longtable+[`babel`]: https://ctan.org/pkg/babel+[`biber`]: https://ctan.org/pkg/biber+[`biblatex`]: https://ctan.org/pkg/biblatex+[`bibtex`]: https://ctan.org/pkg/bibtex+[`bidi`]: https://ctan.org/pkg/bidi+[`bookmark`]: https://ctan.org/pkg/bookmark [`booktabs`]: https://ctan.org/pkg/booktabs+[`csquotes`]: https://ctan.org/pkg/csquotes+[`fancyvrb`]: https://ctan.org/pkg/fancyvrb+[`fontspec`]: https://ctan.org/pkg/fontspec+[`footnote`]: https://ctan.org/pkg/footnote+[`footnotehyper`]: https://ctan.org/pkg/footnotehyper+[`geometry`]: https://ctan.org/pkg/geometry [`graphicx`]: https://ctan.org/pkg/graphicx [`grffile`]: https://ctan.org/pkg/grffile-[`geometry`]: https://ctan.org/pkg/geometry-[`setspace`]: https://ctan.org/pkg/setspace-[`xecjk`]: https://ctan.org/pkg/xecjk [`hyperref`]: https://ctan.org/pkg/hyperref-[`ulem`]: https://ctan.org/pkg/ulem-[`babel`]: https://ctan.org/pkg/babel-[`bidi`]: https://ctan.org/pkg/bidi+[`ifluatex`]: https://ctan.org/pkg/ifluatex+[`ifxetex`]: https://ctan.org/pkg/ifxetex+[`listings`]: https://ctan.org/pkg/listings+[`lm`]: https://ctan.org/pkg/lm+[`longtable`]: https://ctan.org/pkg/longtable [`mathspec`]: https://ctan.org/pkg/mathspec-[`unicode-math`]: https://ctan.org/pkg/unicode-math-[`polyglossia`]: https://ctan.org/pkg/polyglossia-[`fontspec`]: https://ctan.org/pkg/fontspec-[`upquote`]: https://ctan.org/pkg/upquote [`microtype`]: https://ctan.org/pkg/microtype-[`csquotes`]: https://ctan.org/pkg/csquotes [`natbib`]: https://ctan.org/pkg/natbib-[`biblatex`]: https://ctan.org/pkg/biblatex-[`bibtex`]: https://ctan.org/pkg/bibtex-[`biber`]: https://ctan.org/pkg/biber-[TeX Live]: http://www.tug.org/texlive/-[`wkhtmltopdf`]: https://wkhtmltopdf.org-[`weasyprint`]: http://weasyprint.org+[`parskip`]: https://ctan.org/pkg/parskip+[`polyglossia`]: https://ctan.org/pkg/polyglossia [`prince`]: https://www.princexml.com/+[`setspace`]: https://ctan.org/pkg/setspace+[`ulem`]: https://ctan.org/pkg/ulem+[`unicode-math`]: https://ctan.org/pkg/unicode-math+[`upquote`]: https://ctan.org/pkg/upquote+[`weasyprint`]: http://weasyprint.org+[`wkhtmltopdf`]: https://wkhtmltopdf.org+[`xcolor`]: https://ctan.org/pkg/xcolor+[`xecjk`]: https://ctan.org/pkg/xecjk+[`xurl`]: https://ctan.org/pkg/xurl ++ Reading from the Web -------------------- @@ -223,6 +236,7 @@ - `creole` ([Creole 1.0]) - `docbook` ([DocBook]) - `docx` ([Word docx])+ - `dokuwiki` ([DokuWiki markup]) - `epub` ([EPUB]) - `fb2` ([FictionBook2] e-book) - `gfm` ([GitHub-Flavored Markdown]),@@ -231,6 +245,7 @@ if you need extensions not supported in [`gfm`](#markdown-variants). - `haddock` ([Haddock markup]) - `html` ([HTML])+ - `ipynb` ([Jupyter notebook]) - `jats` ([JATS] XML) - `json` (JSON version of native AST) - `latex` ([LaTeX])@@ -283,6 +298,7 @@ - `html` or `html5` ([HTML], i.e. [HTML5]/XHTML [polyglot markup]) - `html4` ([XHTML] 1.0 Transitional) - `icml` ([InDesign ICML])+ - `ipynb` ([Jupyter notebook]) - `jats` ([JATS] XML) - `json` (JSON version of native AST) - `latex` ([LaTeX])@@ -454,6 +470,7 @@ [PDF]: https://www.adobe.com/pdf/ [reveal.js]: http://lab.hakim.se/reveal-js/ [FictionBook2]: http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1+[Jupyter notebook]: https://nbformat.readthedocs.io/en/latest/ [InDesign ICML]: http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf [TEI Simple]: https://github.com/TEIC/TEI-Simple [Muse]: https://amusewiki.org/library/manual@@ -713,6 +730,8 @@ where there are nonsemantic newlines in the source, there will be nonsemantic newlines in the output as well). Automatic wrapping does not currently work in HTML output.+ In `ipynb` output, this option affects wrapping of the+ contents of markdown cells. `--columns=`*NUMBER* @@ -779,7 +798,7 @@ new languages or to use altered syntax definitions for existing languages. -`-H` *FILE*, `--include-in-header=`*FILE*+`-H` *FILE*, `--include-in-header=`*FILE*|*URL* : Include contents of *FILE*, verbatim, at the end of the header. This can be used, for example, to include special@@ -787,7 +806,7 @@ repeatedly to include multiple files in the header. They will be included in the order specified. Implies `--standalone`. -`-B` *FILE*, `--include-before-body=`*FILE*+`-B` *FILE*, `--include-before-body=`*FILE*|*URL* : Include contents of *FILE*, verbatim, at the beginning of the document body (e.g. after the `<body>` tag in HTML, or the@@ -796,7 +815,7 @@ used repeatedly to include multiple files. They will be included in the order specified. Implies `--standalone`. -`-A` *FILE*, `--include-after-body=`*FILE*+`-A` *FILE*, `--include-after-body=`*FILE*|*URL* : Include contents of *FILE*, verbatim, at the end of the document body (before the `</body>` tag in HTML, or the@@ -885,6 +904,7 @@ : Use ATX-style headers in Markdown output. The default is to use setext-style headers for levels 1-2, and then ATX headers. (Note: for `gfm` output, ATX headers are always used.)+ This option also affects markdown cells in `ipynb` output. `--top-level-division=[default|section|chapter|part]` @@ -1004,16 +1024,51 @@ custom-reference.docx`. Then open `custom-reference.docx` in Word, modify the styles as you wish, and save the file. For best results, do not make changes to this file other- than modifying the styles used by pandoc: [paragraph]- Normal, Body Text, First Paragraph, Compact, Title,- Subtitle, Author, Date, Abstract, Bibliography, Heading 1,- Heading 2, Heading 3, Heading 4, Heading 5, Heading 6,- Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,- Definition Term, Definition, Caption, Table Caption,- Image Caption, Figure, Captioned Figure, TOC Heading;- [character] Default Paragraph Font, Body Text Char,- Verbatim Char, Footnote Reference, Hyperlink; [table]- Table.+ than modifying the styles used by pandoc:+ + Paragraph styles:+ + - Normal+ - Body Text+ - First Paragraph+ - Compact+ - Title+ - Subtitle+ - Author+ - Date+ - Abstract+ - Bibliography+ - Heading 1+ - Heading 2+ - Heading 3+ - Heading 4+ - Heading 5+ - Heading 6+ - Heading 7+ - Heading 8+ - Heading 9+ - Block Text+ - Footnote Text+ - Definition Term+ - Definition+ - Caption+ - Table Caption+ - Image Caption+ - Figure+ - Captioned Figure+ - TOC Heading+ + Character styles:+ + - Default Paragraph Font+ - Body Text Char+ - Verbatim Char+ - Footnote Reference+ - Hyperlink+ + Table style:+ + - Table ODT @@ -1300,7 +1355,7 @@ (or the `default.context` template, if you use `-t context`, or the `default.ms` template, if you use `-t ms`, or the `default.html` template, if you use `-t html`).-- `docx` has no template (however, you can use+- `docx` and `pptx` have no template (however, you can use `--reference-doc` to customize the output). Templates contain *variables*, which allow for the inclusion of@@ -1308,29 +1363,10 @@ command line using the `-V/--variable` option. If a variable is not set, pandoc will look for the key in the document's metadata – which can be set using either [YAML metadata blocks][Extension: `yaml_metadata_block`]-or with the `--metadata` option.--Variables set by pandoc--------------------------Some variables are set automatically by pandoc. These vary somewhat-depending on the output format, but include the following:--`sourcefile`, `outputfile`-: source and destination filenames, as given on the command line.- `sourcefile` can also be a list if input comes from multiple files, or empty- if input is from stdin. You can use the following snippet in your template- to distinguish them:-- $if(sourcefile)$- $for(sourcefile)$- $sourcefile$- $endfor$- $else$- (stdin)- $endif$+or with the `-M/--metadata` option. - Similarly, `outputfile` can be `-` if output goes to the terminal.+Metadata variables+------------------ `title`, `author`, `date` : allow identification of basic aspects of the document. Included@@ -1345,76 +1381,76 @@ ... `subtitle`-: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word docx;- renders in LaTeX only when using a document class that supports- `\subtitle`, such as `beamer` or the [KOMA-Script] series (`scrartcl`,- `scrreprt`, `scrbook`).[^subtitle]--`institute`-: author affiliations (in LaTeX and Beamer only). Can be a- list, when there are multiple authors.+: document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and docx+ documents `abstract`-: document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx+: document summary, included in LaTeX, ConTeXt, AsciiDoc, and docx+ documents `keywords`-: list of keywords to be included in HTML, PDF, and AsciiDoc metadata;- may be repeated as for `author`, above--`header-includes`-: contents specified by `-H/--include-in-header` (may have multiple- values)--`toc`-: non-null value if `--toc/--table-of-contents` was specified+: list of keywords to be included in HTML, PDF, ODT, pptx, docx+ and AsciiDoc metadata; repeat as for `author`, above -`toc-title`-: title of table of contents (works only with EPUB,- opendocument, odt, docx, pptx, beamer, LaTeX)+`subject`+: document subject, included in ODT, docx and pptx metadata -`include-before`-: contents specified by `-B/--include-before-body` (may have- multiple values)+`description`+: document description, included in ODT, docx and pptx metadata. Some+ applications show this as `Comments` metadata. -`include-after`-: contents specified by `-A/--include-after-body` (may have- multiple values)+`category`+: document category, included in docx and pptx metadata -`body`-: body of document+Additionally,+any root-level string metadata, not included in ODT, docx+or pptx metadata is added as a *custom property*.+The following YAML metadata block for instance: -`meta-json`-: JSON representation of all of the document's metadata. Field- values are transformed to the selected output format.+ ---+ title: 'This is the title'+ subtitle: "This is the subtitle"+ author:+ - Author One+ - Author Two+ description: |+ This is a long+ description. -[^subtitle]: To make `subtitle` work with other LaTeX- document classes, you can add the following to `header-includes`:+ It consists of two paragraphs+ ... - \providecommand{\subtitle}[1]{%- \usepackage{titling}- \posttitle{%- \par\large#1\end{center}}- }+will include `title`, `author` and `description` as standard document+properties and `subtitle` as a custom property when converting to docx,+ODT or pptx. Language variables ------------------ `lang`-: identifies the main language of the document,- using a code according to [BCP 47] (e.g. `en` or `en-GB`).- For some output formats, pandoc will convert it to an appropriate- format stored in the additional variables `babel-lang`,- `polyglossia-lang` (LaTeX) and `context-lang` (ConTeXt).+: identifies the main language of the document using IETF language+ tags (following the [BCP 47] standard), such as `en` or `en-GB`.+ The [Language subtag lookup] tool can look up or verify these tags.+ This affects most formats, and controls hyphenation in PDF output+ when using LaTeX (through [`babel`] and [`polyglossia`]) or ConTeXt.+ + Use native pandoc [Divs and Spans] with the `lang` attribute to+ switch the language:+ + ---+ lang: en-GB+ ... - Native pandoc Spans and Divs with the lang attribute- (value in BCP 47) can be used to switch the language in- that range. In LaTeX output, `babel-otherlangs` and- `polyglossia-otherlangs` variables will be generated- automatically based on the `lang` attributes of Spans- and Divs in the document.+ Text in the main document language (British English). + ::: {lang=fr-CA}+ > Cette citation est écrite en français canadien.+ :::++ More text in English. ['Zitat auf Deutsch.']{lang=de}+ `dir`-: the base direction of the document, either `rtl` (right-to-left)+: the base script direction, either `rtl` (right-to-left) or `ltr` (left-to-right). For bidirectional documents, native pandoc `span`s and `div`s@@ -1429,18 +1465,19 @@ [BCP 47]: https://tools.ietf.org/html/bcp47 [Unicode Bidirectional Algorithm]: http://www.w3.org/International/articles/inline-bidi-markup/uba-basics+[Language subtag lookup]: https://r12a.github.io/app-subtags/ -Variables for slides---------------------+Variables for HTML slides+------------------------- -Variables are available for [producing slide shows with pandoc],-including all [reveal.js configuration options].+These affect HTML output when [producing slide shows with pandoc].+All [reveal.js configuration options] are available as variables. -`titlegraphic`-: title graphic for Beamer documents+`revealjs-url`+: base URL for reveal.js documents (defaults to `reveal.js`) -`logo`-: logo for Beamer documents+`s5-url`+: base URL for S5 documents (defaults to `s5/default`) `slidy-url` : base URL for Slidy documents (defaults to@@ -1449,100 +1486,144 @@ `slideous-url` : base URL for Slideous documents (defaults to `slideous`) -`s5-url`-: base URL for S5 documents (defaults to `s5/default`)+[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration -`revealjs-url`-: base URL for reveal.js documents (defaults to `reveal.js`)+Variables for Beamer slides+--------------------------- -`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`-: themes for LaTeX [`beamer`] documents+These variables change the appearance of PDF slides using [`beamer`]. -`themeoptions`-: options for LaTeX beamer themes (a list).+`aspectratio`+: slide aspect ratio (`43` for 4:3 [default], `169` for 16:9,+ `1610` for 16:10, `149` for 14:9, `141` for 1.41:1, `54` for 5:4,+ `32` for 3:2) +`beamerarticle`+: produce an article from Beamer slides++`beameroption`+: add extra beamer option with `\setbeameroption{}`++`institute`+: author affiliations: can be a list when there are multiple authors++`logo`+: logo image for slides+ `navigation`-: controls navigation symbols in `beamer` documents- (default is `empty` for no navigation symbols; other valid values- are `frame`, `vertical`, and `horizontal`).+: controls navigation symbols (default is `empty` for no navigation+ symbols; other valid values are `frame`, `vertical`, and `horizontal`) `section-titles`-: enables on "title pages" for new sections in `beamer`- documents (default = true).+: enables "title pages" for new sections (default is true) -`beamerarticle`-: when true, the `beamerarticle` package is loaded (for- producing an article from beamer slides).+`theme`, `colortheme`, `fonttheme`, `innertheme`, `outertheme`+: beamer themes: -`aspectratio`-: aspect ratio of slides (for beamer only, `1610` for 16:10, `169` for 16:9,- `149` for 14:9, `141` for 1.41:1, `54` for 5:4, `43` for 4:3 which is the- default, and `32` for 3:2).+`themeoptions`+: options for LaTeX beamer themes (a list). -[reveal.js configuration options]: https://github.com/hakimel/reveal.js#configuration+`titlegraphic`+: image for title slide Variables for LaTeX ------------------- -LaTeX variables are used when [creating a PDF].--`papersize`-: paper size, e.g. `letter`, `a4`--`fontsize`-: font size for body text (e.g. `10pt`, `12pt`)+Pandoc uses these variables when [creating a PDF] with a LaTeX engine. -`documentclass`-: document class, e.g. [`article`], [`report`], [`book`], [`memoir`]+### Layout `classoption`-: option for document class, e.g. `oneside`; may be repeated- for multiple options+: option for document class, e.g. `oneside`; repeat for multiple options -`beameroption`-: In beamer, add extra beamer option with `\setbeameroption{}`+`documentclass`+: document class: usually one of the standard classes, [`article`], [`report`],+ and [`book`]; the [KOMA-Script] equivalents, `scrartcl`, `scrreprt`,+ and `scrbook`, which default to smaller margins; or [`memoir`] `geometry` : option for [`geometry`] package, e.g. `margin=1in`;- may be repeated for multiple options+ repeat for multiple options -`margin-left`, `margin-right`, `margin-top`, `margin-bottom`-: sets margins, if `geometry` is not used (otherwise `geometry`- overrides these)+`indent`+: uses document class settings for indentation (the default LaTeX template+ otherwise removes indentation and adds space between paragraphs) `linestretch` : adjusts line spacing using the [`setspace`] package, e.g. `1.25`, `1.5` +`margin-left`, `margin-right`, `margin-top`, `margin-bottom`+: sets margins if `geometry` is not used (otherwise `geometry`+ overrides these)++`pagestyle`+: control `\pagestyle{}`: the default article class+ supports `plain` (default), `empty` (no running heads or page numbers),+ and `headings` (section titles in running heads)++`papersize`+: paper size, e.g. `letter`, `a4`++`secnumdepth`+: numbering depth for sections (with `--number-sections` option+ or `numbersections` variable)++`subparagraph`+: disables default behavior of LaTeX template that redefines (sub)paragraphs+ as sections, changing the appearance of nested headings in some classes++### Fonts++`fontenc`+: allows font encoding to be specified through `fontenc` package (with `pdflatex`);+ default is `T1` (see [LaTeX font encodings guide])+ `fontfamily` : font package for use with `pdflatex`: [TeX Live] includes many options, documented in the [LaTeX Font Catalogue]. The default is [Latin Modern][`lm`]. `fontfamilyoptions`-: options for package used as `fontfamily`: e.g. `osf,sc` with- `fontfamily` set to [`mathpazo`] provides Palatino with old-style- figures and true small caps; may be repeated for multiple options+: options for package used as `fontfamily`; repeat for multiple options.+ For example, to use the Libertine font with proportional lowercase+ (old-style) figures through the [`libertinus`] package:+ + ---+ fontfamily: libertinus+ fontfamilyoptions:+ - osf+ - p+ ... -`mainfont`, `romanfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont`+`fontsize`+: font size for body text. The standard classes allow 10pt, 11pt, and 12pt.+ To use another size, set `documentclass` to one of the [KOMA-Script] classes,+ such as `scrartcl` or `scrbook`.++`mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont` : font families for use with `xelatex` or `lualatex`: take the name of any system font, using the- [`fontspec`] package. Note that if `CJKmainfont` is used,- the [`xecjk`] package must be available.+ [`fontspec`] package. `CJKmainfont` uses the [`xecjk`] package. -`mainfontoptions`, `romanfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions`+`mainfontoptions`, `sansfontoptions`, `monofontoptions`, `mathfontoptions`, `CJKoptions` : options to use with `mainfont`, `sansfont`, `monofont`, `mathfont`, `CJKmainfont` in `xelatex` and `lualatex`. Allow for any choices- available through [`fontspec`], such as the OpenType features- `Numbers=OldStyle,Numbers=Proportional`. May be repeated for multiple options.+ available through [`fontspec`]; repeat for multiple options. For example,+ to use the [TeX Gyre] version of Palatino with lowercase figures: -`fontenc`-: allows font encoding to be specified through `fontenc` package (with `pdflatex`);- default is `T1` (see guide to [LaTeX font encodings])+ ---+ mainfont: TeX Gyre Pagella+ mainfontoptions:+ - Numbers=Lowercase+ - Numbers=Proportional+ ... `microtypeoptions` : options to pass to the microtype package +### Links+ `colorlinks` : add color to link text; automatically enabled if any of `linkcolor`, `filecolor`, `citecolor`, `urlcolor`, or `toccolor` are set@@ -1556,16 +1637,13 @@ `links-as-notes` : causes links to be printed as footnotes -`indent`-: uses document class settings for indentation (the default LaTeX template- otherwise removes indentation and adds space between paragraphs)+### Front matter -`subparagraph`-: disables default behavior of LaTeX template that redefines (sub)paragraphs- as sections, changing the appearance of nested headings in some classes+`lof`, `lot`+: include list of figures, list of tables `thanks`-: specifies contents of acknowledgments footnote after document title.+: contents of acknowledgments footnote after document title `toc` : include table of contents (can also be set using `--toc/--table-of-contents`)@@ -1573,14 +1651,12 @@ `toc-depth` : level of section to include in table of contents -`secnumdepth`-: numbering depth for sections, if sections are numbered+### BibLaTeX Bibliographies -`lof`, `lot`-: include list of figures, list of tables+These variables function when using BibLaTeX for [citation rendering]. -`bibliography`-: bibliography to use for resolving references+`biblatexoptions`+: list of options for biblatex `biblio-style` : bibliography style, when used with `--natbib` and `--biblatex`.@@ -1588,78 +1664,69 @@ `biblio-title` : bibliography title, when used with `--natbib` and `--biblatex`. -`biblatexoptions`-: list of options for biblatex.+`bibliography`+: bibliography to use for resolving references `natbiboptions`-: list of options for natbib.--`pagestyle`-: An option for LaTeX's `\pagestyle{}`. The default article class- supports 'plain' (default), 'empty', and 'headings'; headings puts- section titles in the header.+: list of options for natbib +[KOMA-Script]: https://ctan.org/pkg/koma-script+[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/+[LaTeX font encodings guide]: https://ctan.org/pkg/encguide+[TeX Gyre]: http://www.gust.org.pl/projects/e-foundry/tex-gyre [`article`]: https://ctan.org/pkg/article-[`report`]: https://ctan.org/pkg/report [`book`]: https://ctan.org/pkg/book-[KOMA-Script]: https://ctan.org/pkg/koma-script+[`libertinus`]: https://ctan.org/pkg/libertinus [`memoir`]: https://ctan.org/pkg/memoir-[`xcolor`]: https://ctan.org/pkg/xcolor-[LaTeX Font Catalogue]: http://www.tug.dk/FontCatalogue/-[`mathpazo`]: https://ctan.org/pkg/mathpazo-[LaTeX font encodings]: https://ctan.org/pkg/encguide+[`report`]: https://ctan.org/pkg/report Variables for ConTeXt --------------------- -`papersize`-: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);- may be repeated for multiple options--`layout`-: options for page margins and text arrangement (see [ConTeXt Layout]);- may be repeated for multiple options--`margin-left`, `margin-right`, `margin-top`, `margin-bottom`-: sets margins, if `layout` is not used (otherwise `layout`- overrides these)+Pandoc uses these variables when [creating a PDF] with ConTeXt. `fontsize` : font size for body text (e.g. `10pt`, `12pt`) -`mainfont`, `sansfont`, `monofont`, `mathfont`-: font families: take the name of any system font (see [ConTeXt Font Switching])+`headertext`, `footertext`+: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);+ repeat up to four times for different placement +`indenting`+: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);+ repeat for multiple options++`interlinespace`+: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);+ repeat for multiple options++`layout`+: options for page margins and text arrangement (see [ConTeXt Layout]);+ repeat for multiple options+ `linkcolor`, `contrastcolor` : color for links outside and inside a page, e.g. `red`, `blue` (see [ConTeXt Color]) `linkstyle` : typeface style for links, e.g. `normal`, `bold`, `slanted`, `boldslanted`, `type`, `cap`, `small` -`indenting`-: controls indentation of paragraphs, e.g. `yes,small,next` (see [ConTeXt Indentation]);- may be repeated for multiple options--`whitespace`-: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])+`lof`, `lot`+: include list of figures, list of tables -`interlinespace`-: adjusts line spacing, e.g. `4ex` (using [`setupinterlinespace`]);- may be repeated for multiple options+`mainfont`, `sansfont`, `monofont`, `mathfont`+: font families: take the name of any system font (see [ConTeXt Font Switching]) -`headertext`, `footertext`-: text to be placed in running header or footer (see [ConTeXt Headers and Footers]);- may be repeated up to four times for different placement+`margin-left`, `margin-right`, `margin-top`, `margin-bottom`+: sets margins, if `layout` is not used (otherwise `layout`+ overrides these) `pagenumbering` : page number style and location (using [`setuppagenumbering`]);- may be repeated for multiple options--`toc`-: include table of contents (can also be set using `--toc/--table-of-contents`)+ repeat for multiple options -`lof`, `lot`-: include list of figures, list of tables+`papersize`+: paper size, e.g. `letter`, `A4`, `landscape` (see [ConTeXt Paper Setup]);+ repeat for multiple options `pdfa` : adds to the preamble the setup necessary to generate PDF/A-1b:2005.@@ -1669,6 +1736,12 @@ from [ConTeXt ICC Profiles]. See also [ConTeXt PDFA] for more details. +`toc`+: include table of contents (can also be set using `--toc/--table-of-contents`)++`whitespace`+: spacing between paragraphs, e.g. `none`, `small` (using [`setupwhitespace`])+ [ConTeXt Paper Setup]: https://wiki.contextgarden.net/PaperSetup [ConTeXt Layout]: https://wiki.contextgarden.net/Layout [ConTeXt Font Switching]: https://wiki.contextgarden.net/Font_Switching@@ -1681,40 +1754,117 @@ [`setupinterlinespace`]: https://wiki.contextgarden.net/Command/setupinterlinespace [`setuppagenumbering`]: https://wiki.contextgarden.net/Command/setuppagenumbering -Variables for man pages------------------------+Variables for `wkhtmltopdf`+--------------------------- -`section`-: section number in man pages+Pandoc uses these variables when [creating a PDF] with [`wkhtmltopdf`].+The `--css` option also affects the output. -`header`-: header in man pages+`footer-html`, `header-html`+: add information to the header and footer -`footer`-: footer in man pages+`margin-left`, `margin-right`, `margin-top`, `margin-bottom`+: set the page margins +`papersize`+: sets the PDF paper size++Variables for man pages+-----------------------+ `adjusting` : adjusts text to left (`l`), right (`r`), center (`c`), or both (`b`) margins +`footer`+: footer in man pages++`header`+: header in man pages+ `hyphenate` : if `true` (the default), hyphenation will be used +`section`+: section number in man pages+ Variables for ms ---------------- -`pointsize`-: point size (e.g. `10p`)--`lineheight`-: line height (e.g. `12p`)- `fontfamily` : font family (e.g. `T` or `P`) `indent` : paragraph indent (e.g. `2m`) +`lineheight`+: line height (e.g. `12p`)++`pointsize`+: point size (e.g. `10p`)++Structural variables+--------------------++Pandoc sets these variables automatically in response to [options] or+document contents; users can also modify them. These vary depending+on the output format, and include the following:++`body`+: body of document++`date-meta`+: the `date` variable converted to ISO 8601 YYYY-MM-DD,+ included in all HTML based formats (dzslides, epub,+ html, html4, html5, revealjs, s5, slideous, slidy).+ The recognized formats for `date` are: `mm/dd/yyyy`,+ `mm/dd/yy`, `yyyy-mm-dd` (ISO 8601), `dd MM yyyy`+ (e.g. either `02 Apr 2018` or `02 April 2018`),+ `MM dd, yyyy` (e.g. `Apr. 02, 2018` or `April 02, 2018),+ `yyyy[mm[dd]]]` (e.g. `20180402, `201804` or `2018`).++`header-includes`+: contents specified by `-H/--include-in-header` (may have multiple+ values)++`include-before`+: contents specified by `-B/--include-before-body` (may have+ multiple values)++`include-after`+: contents specified by `-A/--include-after-body` (may have+ multiple values)++`meta-json`+: JSON representation of all of the document's metadata. Field+ values are transformed to the selected output format.++`numbersections`+: non-null value if `-N/--number-sections` was specified++`sourcefile`, `outputfile`+: source and destination filenames, as given on the command line.+ `sourcefile` can also be a list if input comes from multiple files, or empty+ if input is from stdin. You can use the following snippet in your template+ to distinguish them:++ $if(sourcefile)$+ $for(sourcefile)$+ $sourcefile$+ $endfor$+ $else$+ (stdin)+ $endif$++ Similarly, `outputfile` can be `-` if output goes to the terminal.++`toc`+: non-null value if `--toc/--table-of-contents` was specified++`toc-title`+: title of table of contents (works only with EPUB,+ opendocument, odt, docx, pptx, beamer, LaTeX)+ Using variables in templates ---------------------------- @@ -1766,6 +1916,9 @@ $for(author)$$author$$sep$, $endfor$ +Note that the separator needs to be specified immediately before the `$endfor` +keyword.+ A dot can be used to select a field of a variable that takes an object as its value. So, for example: @@ -1800,6 +1953,10 @@ `commonmark` and `gfm`.) In the following, extensions that also work for other formats are covered. +Note that markdown extensions added to the `ipynb` format+affect Markdown cells in Jupyter notebooks (as do command-line+options like `--atx-headers`).+ Typography ---------- @@ -1857,7 +2014,8 @@ - Remove all formatting, links, etc. - Remove all footnotes.- - Remove all punctuation, except underscores, hyphens, and periods.+ - Remove all non-alphanumeric characters,+ except underscores, hyphens, and periods. - Replace all spaces and newlines with hyphens. - Convert all alphabetic characters to lowercase. - Remove everything up to the first letter (identifiers may@@ -1869,6 +2027,7 @@ Header Identifier ------------------------------- ---------------------------- `Header identifiers in HTML` `header-identifiers-in-html`+ `Maître d'hôtel` `maître-dhôtel` `*Dogs*?--in *my* house?` `dogs--in-my-house` `[HTML], [S5], or [RTF]?` `html-s5-or-rtf` `3. Applications` `applications`@@ -1947,11 +2106,19 @@ input formats : `latex`, `org`, `textile`, `html` (environments, `\ref`, and- `\eqref` only)+ `\eqref` only), `ipynb` output formats : `textile`, `commonmark` +Note: as applied to `ipynb`, `raw_html` and `raw_tex` affect not+only raw TeX in markdown cells, but data with mime type+`text/html` in output cells. Since the `ipynb` reader attempts+to preserve the richest possible outputs when several options+are given, you will get best results if you disable `raw_html`+and `raw_tex` when converting to formats like `docx` which don't+allow raw `html` or `tex`.+ #### Extension: `native_divs` {#native_divs} This extension is enabled by default for HTML input. This means that@@ -2051,7 +2218,7 @@ Read all docx styles as divs (for paragraph styles) and spans (for character styles) regardless of whether pandoc understands the meaning of these styles. This can be used with [docx custom-styles](#custom-styles-in-docx). Disabled by default.+styles](#custom-styles). Disabled by default. input formats : `docx`@@ -2612,7 +2779,13 @@ #. two #. three +#### Extension: `task_lists` #### +Pandoc supports task lists, using the syntax of GitHub-Flavored Markdown.++ - [ ] an unchecked task list item+ - [x] checked item+ ### Definition lists ### #### Extension: `definition_lists` ####@@ -3396,6 +3569,9 @@ DZSlides, EPUB, Markdown, CommonMark, Emacs Org mode, and Textile output, and suppressed in other formats. +For a more explicit way of including raw HTML in a Markdown+document, see the [`raw_attribute` extension][Extension: `raw_attribute`].+ In the CommonMark format, if `raw_html` is enabled, superscripts, subscripts, strikeouts and small capitals will be represented as HTML. Otherwise, plain-text fallbacks will be used. Note that even if@@ -3475,6 +3651,10 @@ the material between the begin and end tags will be interpreted as raw LaTeX, not as Markdown. +For a more explicit and flexible way of including raw TeX in a+Markdown document, see the [`raw_attribute`+extension][Extension: `raw_attribute`].+ Inline LaTeX is ignored in output formats other than Markdown, LaTeX, Emacs Org mode, and ConTeXt. @@ -3992,7 +4172,7 @@ If the style calls for a list of works cited, it will be placed in a div with id `refs`, if one exists: - ::: #refs+ ::: {#refs} ::: Otherwise, it will be placed at the end of the document.@@ -4223,7 +4403,7 @@ : `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`, `gfm_auto_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`, `space_in_atx_header`,- `intraword_underscores`, `strikeout`, `emoji`,+ `intraword_underscores`, `strikeout`, `task_lists`, `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`, `lists_without_preceding_blankline`. @@ -4245,16 +4425,16 @@ which is implemented as a set of extensions on `commonmark`). Note, however, that `commonmark` and `gfm` have limited support-for extensions. Only those listed below (and `smart` and-`raw_tex`) will work. The extensions can, however, all be-individually disabled.-Also, `raw_tex` only affects `gfm` output, not input.+for extensions. Only those listed below (and `smart`,+`raw_tex`, and `hard_line_breaks`) will work. The extensions+can, however, all be individually disabled. Also, `raw_tex`+only affects `gfm` output, not input. `gfm` (GitHub-Flavored Markdown) : `pipe_tables`, `raw_html`, `fenced_code_blocks`, `auto_identifiers`, `gfm_auto_identifiers`, `backtick_code_blocks`, `autolink_bare_uris`, `space_in_atx_header`,- `intraword_underscores`, `strikeout`, `emoji`,+ `intraword_underscores`, `strikeout`, `task_lists`, `emoji`, `shortcut_reference_links`, `angle_brackets_escapable`, `lists_without_preceding_blankline`. @@ -4313,7 +4493,7 @@ assumed to be available at the relative path `s5/default` (for S5), `slideous` (for Slideous), `reveal.js` (for reveal.js), or at the Slidy website at `w3.org` (for Slidy). (These paths can be changed by setting the `slidy-url`,-`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for slides],+`slideous-url`, `revealjs-url`, or `s5-url` variables; see [Variables for HTML slides], above.) For DZSlides, the (relatively short) JavaScript and CSS are included in the file by default. @@ -4726,6 +4906,114 @@ </source> </audio> +Creating Jupyter notebooks with pandoc+======================================++When creating a [Jupyter notebook], pandoc will try to infer the+notebook structure. Code blocks with the class `code` will be+taken as code cells, and intervening content will be taken as+Markdown cells. Attachments will automatically be created for+images in Markdown cells. Metadata will be taken from the+`jupyter` metadata field. For example:++````+---+title: My notebook+jupyter:+ nbformat: 4+ nbformat_minor: 5+ kernelspec:+ display_name: Python 2+ language: python+ name: python2+ language_info:+ codemirror_mode:+ name: ipython+ version: 2+ file_extension: ".py"+ mimetype: "text/x-python"+ name: "python"+ nbconvert_exporter: "python"+ pygments_lexer: "ipython2"+ version: "2.7.15"+---++# Lorem ipsum++**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus+bibendum felis dictum sodales.++``` code+print("hello")+```++## Pyout++``` code+from IPython.display import HTML+HTML("""+<script>+console.log("hello");+</script>+<b>HTML</b>+""")+```++## Image++This image  will be+included as a cell attachment.+````++If you want to add cell attributes, group cells differently, or+add output to code cells, then you need to include divs to+indicate the structure. You can use either [fenced+divs][Extension: `fenced_divs`] or [native divs][Extension:+`native_divs`] for this. Here is an example:++````+:::::: {.cell .markdown}+# Lorem++**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus+bibendum felis dictum sodales.+::::::++:::::: {.cell .code execution_count=1}+``` {.python}+print("hello")+```++::: {.output .stream .stdout}+```+hello+```+:::+::::::++:::::: {.cell .code execution_count=2}+``` {.python}+from IPython.display import HTML+HTML("""+<script>+console.log("hello");+</script>+<b>HTML</b>+""")+```++::: {.output .execute_result execution_count=2}+```{=html}+<script>+console.log("hello");+</script>+<b>HTML</b>+hello+```+:::+::::::+````+ Syntax highlighting =================== @@ -4763,9 +5051,11 @@ [skylighting]: https://github.com/jgm/skylighting -Custom Styles in Docx-=====================+Custom Styles+============= +Custom styles can be used in the docx and ICML formats.+ Input ----- @@ -4817,8 +5107,8 @@ Output ------ -By default, pandoc's docx output applies a predefined set of styles for-blocks such as paragraphs and block quotes, and uses largely default+By default, pandoc's docx and ICML output applies a predefined set of styles+for blocks such as paragraphs and block quotes, and uses largely default formatting (italics, bold) for inlines. This will work for most purposes, especially alongside a `reference.docx` file. However, if you need to apply your own styles to blocks, or match a preexisting set of@@ -4843,9 +5133,9 @@ would style the two contained lines with the `Poetry` paragraph style. -If the styles are not yet in your reference.docx, they will be defined-in the output file as inheriting from normal text. If they are already-defined, pandoc will not alter the definition.+For docx output, styles will be defined in the output file as inheriting+from normal text, if the styles are not yet in your reference.docx.+If they are already defined, pandoc will not alter the definition. This feature allows for greatest customization in conjunction with [pandoc filters]. If you want all paragraphs after block quotes to be@@ -4912,7 +5202,7 @@ Authors ======= -Copyright 2006-2017 John MacFarlane (jgm@berkeley.edu). Released+Copyright 2006--2019 John MacFarlane (jgm@berkeley.edu). Released under the [GPL], version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.) For a full list of contributors, see the file
@@ -12,8 +12,7 @@ [](http://brewformulas.org/Pandoc) [](http://stackage.org/lts/package/pandoc)-[](https://travis-ci.org/jgm/pandoc)+[](https://circleci.com/gh/jgm/pandoc) [](https://ci.appveyor.com/project/jgm/pandoc) [](https://www.gnu.org/licenses/gpl.html)@@ -32,6 +31,7 @@ - `creole` ([Creole 1.0](http://www.wikicreole.org/wiki/Creole1.0)) - `docbook` ([DocBook](http://docbook.org)) - `docx` ([Word docx](https://en.wikipedia.org/wiki/Office_Open_XML))+ - `dokuwiki` ([DokuWiki markup](https://www.dokuwiki.org/dokuwiki)) - `epub` ([EPUB](http://idpf.org/epub)) - `fb2` ([FictionBook2](http://www.fictionbook.org/index.php/Eng:XML_Schema_Fictionbook_2.1)@@ -44,6 +44,8 @@ - `haddock` ([Haddock markup](https://www.haskell.org/haddock/doc/html/ch03s08.html)) - `html` ([HTML](http://www.w3.org/html/))+ - `ipynb` ([Jupyter+ notebook](https://nbformat.readthedocs.io/en/latest/)) - `jats` ([JATS](https://jats.nlm.nih.gov) XML) - `json` (JSON version of native AST) - `latex` ([LaTeX](http://latex-project.org))@@ -105,6 +107,8 @@ - `html4` ([XHTML](http://www.w3.org/TR/xhtml1/) 1.0 Transitional) - `icml` ([InDesign ICML](http://wwwimages.adobe.com/www.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/idml/idml-cookbook.pdf))+ - `ipynb` ([Jupyter+ notebook](https://nbformat.readthedocs.io/en/latest/)) - `jats` ([JATS](https://jats.nlm.nih.gov) XML) - `json` (JSON version of native AST) - `latex` ([LaTeX](http://latex-project.org))
@@ -1,38 +1,2 @@-{--Copyright (C) 2006-2018 John MacFarlane <jgm@berkeley.edu>--This program is free software; you can redistribute it and/or modify-it under the terms of the GNU General Public License as published by-the Free Software Foundation; either version 2 of the License, or-(at your option) any later version.--This program is distributed in the hope that it will be useful,-but WITHOUT ANY WARRANTY; without even the implied warranty of-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-GNU General Public License for more details.--You should have received a copy of the GNU General Public License-along with this program; if not, write to the Free Software-Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--}- import Distribution.Simple-import Distribution.Simple.Setup (CopyFlags(..), fromFlag)-import Distribution.PackageDescription (PackageDescription(..))-import Distribution.Simple.Utils (notice, installOrdinaryFiles)-import Distribution.Simple.LocalBuildInfo--main :: IO ()-main = defaultMainWithHooks $ simpleUserHooks {- postCopy = installManPage- }--installManPage :: Args -> CopyFlags- -> PackageDescription -> LocalBuildInfo -> IO ()-installManPage _ flags pkg lbi = do- let verbosity = fromFlag (copyVerbosity flags)- let copydest = fromFlag (copyDest flags)- let mandest = mandir (absoluteInstallDirs pkg lbi copydest)- ++ "/man1"- notice verbosity $ "Copying man page to " ++ mandest- installOrdinaryFiles verbosity mandest [("man", "pandoc.1")]+main = defaultMain
@@ -1,3 +1,355 @@+pandoc (2.6) PROVISIONAL++ * Support ipynb (Jupyter notebook) as input and output format.++ + Add `ipynb` as input and output format (extension `.ipynb`).+ + Added Text.Pandoc.Readers.Ipynb [API change].+ + Added Text.Pandoc.Writers.Ipynb [API change].+ + Add `PandocIpynbDecodingError` constructor to Text.Pandoc.Error.Error+ [API change].+ + Depend on ipynb library.+ + Note: there is no template for ipynb.++ * Add DokuWiki reader (#1792, Alexander Krotov). This adds+ Text.Pandoc.Readers.DokuWiki [API change], and adds `dokuwiki`+ as an input format.++ * Implement task lists (#3051, Mauro Bieg). Added `task_lists`+ extension. Task lists are supported from markdown and gfm input.+ They should work, to some degree, in all output formats, though in+ most formats you'll get a bullet list with a unicode character for+ the box. In HTML, you get checkboxes and in LaTeX/PDF output, a+ box is used as the list marker. API changes:++ + Added constructor `Ext_task_lists` to `Extension`.+ + Added `taskListItemFromAscii` and `taskListItemToAscii` to+ Text.Pandoc.Shared.++ * Allow some command line options to take URL in addition to FILE.+ `--include-in-header`, `--include-before-body`, `--include-after-body`.++ * HTML reader:++ + Handle empty `start` attribute (see #5162).+ + Treat `textarea` as a verbatim environment (#5241) and preserve+ spacing.++ * RST reader:++ + Change treatment of `number-lines` directive (Brian Leung,+ #5207). Directives of this type without numeric inputs should+ not have a `startFrom` attribute; with a blank value, the+ writers can produce extra whitespace.+ + Removed superfluous `sourceCode` class on code blocks (#5047).+ + Handle `sourcecode` directive as synonynm for `code` (#5204).++ * Markdown reader:++ + Remove `sourceCode` class for literate Haskell code blocks+ (#5047). Reverse order of `literate` and `haskell` classes on+ code blocks when parsing literate Haskell, so `haskell` is+ first.+ + Treat `<textarea>` as a verbatim environment (#5241).++ * Org reader:++ + Handle `minlevel` option differently (#5190, Brian Leung).+ When `minlevel` exceeds the original minimum level observed in+ the file to be included, every heading should be shifted+ rightward.+ + Allow for case of `:minlevel == 0` (#5190).+ + Fix treatment of links to images (#5191, Albert Krewinkel).+ Links with descriptions which are pointing to images are no+ longer parsed as inline images, but as links.+ + Add support for #+SELECT_TAGS (Brian Leung).+ + Separate filtering logic from conversion function (Brian Leung).++ * TWiki reader: Fix performance issue with underscores (#3921).++ * MediaWiki reader: use `_` instead of `-` in auto-identifiers (#4731).+ We may not still be exactly matching mediawiki's algorithm.++ * LaTeX reader:++ + Remove `sourceCode` class for literate Haskell code blocks+ (#5047). Reverse order of `literate` and `haskell` classes on+ code blocks when parsing literate Haskell, so `haskell` is+ first.+ + Support `\DeclareMathOperator` (#5149).+ + Support `\inputminted` (#5103).+ + Support `\endinput` (#5233).+ + Allow includes with dots like `cc_by_4.0`. Previously the `.0`+ was interpreted as a file extension, leading pandoc not to add+ `.tex` (and thus not to find the file). The new behavior matches+ tex more closely.++ * Man reader:++ + Use `mapLeft` from Shared instead of defining own.++ * Docx reader (Jesse Rosenthal):++ + Handle level overrides (#5134).++ * Docx writer:++ + Support custom properties (#3024, #5252, Agustín Martín Barbero).+ Also supports additional core properties: `subject`, `lang`,+ `category`, `description`.+ + Make Level into a real type, instead of an alias for a tuple+ (Jesse Rosenthal).++ * ICML writer (Mauro Bieg):++ + Support custom-styles (#5137, see #2106).+ + Support unnumbered headers (#5140).++ * Texinfo writer: Use header identifier for anchor if present (#4731).+ Previously we were overwriting an existing identifier with a new one.++ * Org writer: Preserve line-numbering for example and code blocks+ (Brian Leung).++ * Man/Ms writers: Don't escape `-` as `\-`. The `\-` gets rendered+ in HTML and PDF as a unicode minus sign.++ * Ms writer: Ensure we have a newline after .EN in disply math (#5251).++ * RST writer: Don't wrap simple table header lines (#5128).++ * Asciidoc writer: Shorter delimiters for tables, blockquotes+ (#4364). This matches asciidoctor reference docs.++ * Dokuwiki writer: Remove automatic `:` prefix before internal image+ links (#5183, Damien Clochard). This prevented users from making+ relative image links.++ * Zimwiki writer: remove automatic colon prefix before internal+ images (#5183, Damien Clochard).++ * MediaWiki writer: fix caption, use 'thumb' instead of 'frame'+ (#5105). Captions used to have the word 'caption' prepended; this+ has been removed. Also, 'thumb' is used instead of 'frame' to+ allow images to be resized.++ * reveal.js writer:++ + Ensure that we don't get > 2 levels of section nesting,+ even with slide level > 2 (#5168).+ + If slide level == N but there is no N-level header, make+ sure the next header with level > N gets treated as a slide+ and put in a section, rather than remaining loose (#5168).++ * Markdown writer:++ + Make `plain` RawBlocks pass through in `plain` output.+ + Include needed whitespace after HTML figure (#5121).+ We use HTML for a figure in markdown dialects that can't+ represent it natively.++ * Commonmark writer:++ + Fix handling of SoftBreak with `hard_line_breaks` (#5195).+ + Implement `--toc` (`writerTableOfContents`)+ in commonmark/gfm writers (#5172).++ * EPUB writer:++ + Ensure that picture transforms are done on metadata too.+ + Small fixes to `nav.xhtml`:+ Add 'landmarks' id attribute to the landmarks nav.+ Replace old default CSS removing numbers from ol.toc li+ with new rules that match `nav#toc ol, nav#landmarks ol`.+ We keep the `toc` class on `ol` for backwards compatibility.++ * LaTeX writer:++ + Make raw content marked `beamer` pass through in `beamer`+ output (pandoc/lua-filters#40).+ + Beamer: avoid duplicated `fragile` property in some cases+ (#5208).+ + Add `#` special characters for listings (#4939).+ This character needs special handling in `\lstinline`.++ * RTF writer: use `toTableOfContents` from Shared to replace+ old duplicated code.++ * Pptx writer:++ + Support custom properties. Also supports additional core+ properties: `subject`, `category`, `description` (#5252,+ Agustín Martín Barbero).+ + Use `toTableOfContents` from Shared to replace old duplicated code.++ * ODT writer (Augustín Martín Barbero):++ + Fix typo in custom properties (#2839).+ + Improve standard properties, including the following core+ properties: `generator` (Pandoc/VERSION), `description`, `subject`,+ `keywords`, `initial-creator` (from authors), `creation-date`+ (actual creation date) (#5252).++ * Custom writers:++ + Allow '-' in filenames for custom lua writers (#5187).+ + sample.lua: add `SingleQuoted`, `DoubleQuoted` (#5104).+ + sample.lua: Add a missing `>` (MichaWiedenmann).++ * reveal.js template: Add `zoomKey` config (#4249).++ * HTML5 template: Remove unnecessary type="text/css" on style and+ link for HTML5 (#5146).++ * LaTeX template (Andrew Dunning, except where noted):++ + Prevent fontspec from scaling `mainfont` to match the default+ font, Latin Modern. A main font set to 12pt could+ previously appear between 11pt to 13pt depending on its design.+ To return to the earlier rendering, use `-V+ mainfontoptions="Scale=MatchLowercase"` (#5212, #5218).+ + Display monospaced fonts without TeX ligatures when using+ `--pdf-engine=lualatex`. It now matches the behaviour of other+ engines (#5212, #5218).+ + Remove the deprecated `romanfont` variable. The functionality of+ `mainfont` is identical (#5218).+ + Render `\subtitle` with the standard document classes.+ Previously, `subtitle` only appeared when using the KOMA-Script+ classes or Beamer (#5213, #5244).+ + Use Babel instead of Polyglossia for LuaLaTeX. This avoids+ several language selection problems, notably with retaining+ French spacing conventions when switching to a verbatim+ environment or another language; and in printing Greek text+ without hyphenation (#5193).+ + Use the [`xurl`](https://ctan.org/pkg/xurl) package if+ available, improving the appearance of URLs by allowing them to+ break at additional points (#5193).+ + Use [`bookmark`](https://ctan.org/pkg/bookmark) if available+ to correct heading levels in PDF bookmarks: see the [KOMA-Script+ 3.26 release notes](https://komascript.de/release3.26) (#5193).+ + Require the [`xcolor`](https://ctan.org/pkg/xcolor) package to+ avoid a possible error when using additional packages alongside+ footnotes in tables (#5193, closes #4861).+ + Remove obsolete `fixltx2e` package, which has no functionality+ with TeX Live 2015 or later (#5193).+ + Allow multiple `fontfamilies.options` (#5193, closes #5194).+ + Restrict `institute` variable to Beamer (#5219).+ + Use [`footnotehyper`](https://ctan.org/pkg/footnotehyper)+ package if available to make footnotes in tables compatible+ with `hyperref` (#5234).+ + Number parts and chapters in book classes only if the+ `numbersections` variable is set, for consistency with other+ output formats. To return to the previous behaviour, use+ `-V numbersections -V secnumdepth=0` (#5235).+ + Reindent file (#5193).+ + Use built-in parskip handling with KOMA-Script classes (#5143, Enno).+ + Set default listings language for lua, assembler (#5227, John+ MacFarlane). Otherwise we get an error when trying to compile code+ with lua or assembler code. To change the default dialect+ (currenty 5.3 for lua and x86masm for assembler), you can use+ `--include-in-header` to inject something like+ `\lstset{defaultdialect=[5.2]Lua}`.++ * Text.Pandoc.Readers: Changed types of `readJSON`; it now runs+ in an instance of PandocMonad, like the other readers and+ writers. [API change]++ * Text.Pandoc.Writers: Changed types of `writeJSON`; it now runs+ in an instance of PandocMonad, like the other readers and+ writers. [API change] ++ * Text.Pandoc.Error: Added `PandocUTF8DecodingError` constructor+ for `PandocError`. [API change]++ * Text.Pandoc.Writers.Shared - add `toTableOfContents`. [API change]+ This is refactored out from the Markdown writer.+ It can be used in other writers to create a table of contents.++ * Improve error messages for UTF-8 decoding errors. Now we give+ the filename and byte offset (#4765).++ * Text.Pandoc.XML: Strip out illegal XML characters in+ `escapeXMLString` (#5119).++ * Text.Pandoc.Process: update `pipeProcess` (Albert Krewinkel).+ The implementation of `pipeProcess` was rewritten to fix sporadic+ failures caused by prematurely closed pipes.++ * Use `safeRead` instead of `read` everywhere in the code+ (John MacFarlane, Mauro Bieg, #5162, #5180).++ * Text.Pandoc.SelfContained: Decompress `.svgz` when+ converting to `data:` URI (#5163, Alexander Krotov).++ * Text.Pandoc.Parsing: Remove unused `HasHeaderMap`+ (#5175, Alexander Krotov). [API change]++ * Normalize Windows paths to account for change in ghc 8.6 (#5127).+ When pandoc is compiled with ghc 8.6, Windows paths are treated+ differently, and paths beginning `\\server` no longer work.+ This commit rewrites such patsh to `\\?\UNC\server` which works.+ The change operates at the level of argument parsing, so it+ only affects the command line program.++ * Simplify/fix reading of `--metadata` values on command line+ to avoid problems relating to hvr/HsYAML#7 (#5177).++ * data/pandoc.lua: auto-fix nested constructor arguments (Albert+ Krewinkel). Incorrect types to pandoc element constructors are+ automatically converted to the correct types when possible. This was+ already done for most constructors, but conversions are now also done+ for nested types (like lists of lists).++ * Removed custom Setup.hs, use build-type: simple. The only thing we+ gained from the custom build was automatic installation of the man+ page when using 'cabal install'. But custom builds cause problems,+ e.g., with cross-compilation. Installation of the man page is+ better handled by packagers. Note to packagers (e.g. Debian): it+ may be necessary to add a step installing the man page with the+ next release.++ * Allow latest http-client, tasty, zip-archive, Glob.++ * Require skylighting >= 0.7.5, adding support for sml, J,+ typescript.++ * Tests: Cleaned up `findPandoc` in `Tests.Helpers`, so it+ works well with cabal v2.++ * INSTALL.md:++ + Use button for installer links (John MacFarlane, Mauro Bieg,+ #5167).+ + Fix links and bump required stack version (max).+ + Improve installation notes on associated software (Andrew+ Dunning). Includes explanation of how to install related tools+ with package managers (since the method of installing+ `rsvg-convert` is not obvious).++ * doc/org.md: improve documentation of org features (Albert+ Krewinkel).++ * doc/lua-filters.md: use 3rd level headers for module fields.++ * MANUAL:++ + Clarify automatic identifiers (#5201). We remove+ non-alphanumerics. This includes, e.g., emojis.+ + Fix example for Div with id (Geoffrey Ely).+ + Update list of LaTeX packages used.+ + Make it clear that `hard_line_breaks` works in `gfm` (see #5195).+ + Mention `raw_attribute` in documentation for `raw_html` and+ `raw_tex` (#5240, thanks to @eiro).+ + Clarify that `$sep$` must come right before `$endfor$` in templates+ (#5243, Lev Givon).+ + Document metadata support for docx, odt, pptx writers (Agustín+ Martín Barbero).+ + Reorganize template variables (#5249, Andrew Dunning).+ Add additional headings to categorize variables, and+ alphabetize when there is large number; add more examples.+ + Document `date-meta` template variable (#5260, Tristan Stenner).++ * trypandoc: Fix CSS and viewport.+ pandoc (2.5) * Text.Pandoc.App: split into several unexported submodules (Albert
@@ -10,9 +10,10 @@ h1.title { } h2.author { } h3.date { }-ol.toc { padding: 0; margin-left: 1em; }-ol.toc li { list-style-type: none; margin: 0; padding: 0; }+nav#toc ol,+nav#landmarks ol { padding: 0; margin-left: 1em; }+nav#toc ol li,+nav#landmarks ol li { list-style-type: none; margin: 0; padding: 0; } a.footnote-ref { vertical-align: super; } em, em em em, em em em em em { font-style: italic;} em em, em em em em { font-style: normal; }-
@@ -254,6 +254,14 @@ end end +--- Ensure that the given object is a definition pair, convert if necessary.+-- @local+local function ensureDefinitionPairs (pair)+ local inlines = ensureInlineList(pair[1] or {})+ local blocks = ensureList(pair[2] or {}):map(ensureList)+ return {inlines, blocks}+end+ ------------------------------------------------------------------------ --- Pandoc Document -- @section document@@ -369,7 +377,7 @@ -- @treturn Block bullet list element M.BulletList = M.Block:create_constructor( "BulletList",- function(content) return {c = ensureList(content)} end,+ function(content) return {c = ensureList(content):map(ensureList)} end, "content" ) @@ -386,11 +394,13 @@ --- Creates a definition list, containing terms and their explanation. -- @function DefinitionList--- @tparam {{{Inline,...},{Block,...}},...} content list of items+-- @tparam {{{Inline,...},{{Block,...}}},...} content list of items -- @treturn Block definition list element M.DefinitionList = M.Block:create_constructor( "DefinitionList",- function(content) return {c = ensureList(content)} end,+ function(content)+ return {c = ensureList(content):map(ensureDefinitionPairs)}+ end, "content" ) @@ -435,7 +445,7 @@ -- @treturn Block line block element M.LineBlock = M.Block:create_constructor( "LineBlock",- function(content) return {c = ensureList(content)} end,+ function(content) return {c = ensureList(content):map(ensureInlineList)} end, "content" ) @@ -456,7 +466,7 @@ "OrderedList", function(items, listAttributes) listAttributes = listAttributes or M.ListAttributes()- return {c = {listAttributes, ensureList(items)}}+ return {c = {listAttributes, ensureList(items):map(ensureList)}} end, {{listAttributes = {"start", "style", "delimiter"}}, "content"} )@@ -647,7 +657,9 @@ -- @treturn Inline quoted element M.Quoted = M.Inline:create_constructor( "Quoted",- function(quotetype, content) return {c = {quotetype, ensureInlineList(content)}} end,+ function(quotetype, content)+ return {c = {quotetype, ensureInlineList(content)}}+ end, {"quotetype", "content"} ) --- Creates a single-quoted inline element (DEPRECATED).
@@ -164,6 +164,14 @@ return "\\[" .. escape(s) .. "\\]" end +function SingleQuoted(s)+ return "‘" .. s .. "’"+end++function DoubleQuoted(s)+ return "“" .. s .. "”"+end+ function Note(s) local num = #notes + 1 -- insert the back reference right before the final closing tag.@@ -324,7 +332,7 @@ end add('</tr>') end- add('</table')+ add('</table>') return table.concat(buffer,'\n') end
@@ -12,7 +12,7 @@ <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$"> $endif$ <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;}@@ -22,7 +22,7 @@ $endif$ </style> $if(highlighting-css)$- <style type="text/css">+ <style> $highlighting-css$ </style> $endif$
@@ -5,7 +5,7 @@ <meta charset="utf-8" /> <meta name="generator" content="pandoc" /> <title>$pagetitle$</title>- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;}@@ -15,12 +15,12 @@ $endif$ </style> $if(highlighting-css)$- <style type="text/css">+ <style> $highlighting-css$ </style> $endif$ $for(css)$- <link rel="stylesheet" type="text/css" href="$css$" />+ <link rel="stylesheet" href="$css$" /> $endfor$ $for(header-includes)$ $header-includes$
@@ -14,7 +14,7 @@ <meta name="keywords" content="$for(keywords)$$keywords$$sep$, $endfor$" /> $endif$ <title>$if(title-prefix)$$title-prefix$ – $endif$$pagetitle$</title>- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;}@@ -24,7 +24,7 @@ $endif$ </style> $if(highlighting-css)$- <style type="text/css">+ <style> $highlighting-css$ </style> $endif$
@@ -2,14 +2,40 @@ \PassOptionsToPackage{hyphens}{url} $if(colorlinks)$ \PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}-$endif$$if(dir)$$if(latex-dir-rtl)$+$endif$+$if(dir)$+$if(latex-dir-rtl)$ \PassOptionsToPackage{RTLdocument}{bidi}-$endif$$endif$%-\documentclass[$if(fontsize)$$fontsize$,$endif$$if(lang)$$babel-lang$,$endif$$if(papersize)$$papersize$paper,$endif$$if(beamer)$ignorenonframetext,$if(handout)$handout,$endif$$if(aspectratio)$aspectratio=$aspectratio$,$endif$$endif$$for(classoption)$$classoption$$sep$,$endfor$]{$documentclass$}+$endif$+$endif$+%+\documentclass[+$if(fontsize)$+ $fontsize$,+$endif$+$if(lang)$+ $babel-lang$,+$endif$+$if(papersize)$+ $papersize$paper,+$endif$ $if(beamer)$+ ignorenonframetext,+$if(handout)$+ handout,+$endif$+$if(aspectratio)$+ aspectratio=$aspectratio$,+$endif$+$endif$+$for(classoption)$+ $classoption$$sep$,+$endfor$+]{$documentclass$}+$if(beamer)$ $if(background-image)$ \usebackgroundtemplate{%-\includegraphics[width=\paperwidth]{$background-image$}%+ \includegraphics[width=\paperwidth]{$background-image$}% } $endif$ \usepackage{pgfpages}@@ -25,22 +51,22 @@ \raggedbottom $if(section-titles)$ \setbeamertemplate{part page}{-\centering-\begin{beamercolorbox}[sep=16pt,center]{part title}- \usebeamerfont{part title}\insertpart\par-\end{beamercolorbox}+ \centering+ \begin{beamercolorbox}[sep=16pt,center]{part title}+ \usebeamerfont{part title}\insertpart\par+ \end{beamercolorbox} } \setbeamertemplate{section page}{-\centering-\begin{beamercolorbox}[sep=12pt,center]{part title}- \usebeamerfont{section title}\insertsection\par-\end{beamercolorbox}+ \centering+ \begin{beamercolorbox}[sep=12pt,center]{part title}+ \usebeamerfont{section title}\insertsection\par+ \end{beamercolorbox} } \setbeamertemplate{subsection page}{-\centering-\begin{beamercolorbox}[sep=8pt,center]{part title}- \usebeamerfont{subsection title}\insertsubsection\par-\end{beamercolorbox}+ \centering+ \begin{beamercolorbox}[sep=8pt,center]{part title}+ \usebeamerfont{subsection title}\insertsubsection\par+ \end{beamercolorbox} } \AtBeginPart{ \frame{\partpage}@@ -70,7 +96,6 @@ $endif$ \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex}-\usepackage{fixltx2e} % provides \textsubscript \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[$if(fontenc)$$fontenc$$else$T1$endif$]{fontenc} \usepackage[utf8]{inputenc}@@ -85,22 +110,20 @@ $else$ \usepackage{unicode-math} $endif$- \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}-$for(fontfamilies)$- \newfontfamily{$fontfamilies.name$}[$fontfamilies.options$]{$fontfamilies.font$}-$endfor$+ \defaultfontfeatures{Scale=MatchLowercase}+ \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} $if(mainfont)$- \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$}-$endif$-$if(romanfont)$- \setromanfont[$for(romanfontoptions)$$romanfontoptions$$sep$,$endfor$]{$romanfont$}+ \setmainfont[$for(mainfontoptions)$$mainfontoptions$$sep$,$endfor$]{$mainfont$} $endif$ $if(sansfont)$- \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$}+ \setsansfont[$for(sansfontoptions)$$sansfontoptions$$sep$,$endfor$]{$sansfont$} $endif$ $if(monofont)$- \setmonofont[Mapping=tex-ansi$if(monofontoptions)$,$for(monofontoptions)$$monofontoptions$$sep$,$endfor$$endif$]{$monofont$}+ \setmonofont[$for(monofontoptions)$$monofontoptions$$sep$,$endfor$]{$monofont$} $endif$+$for(fontfamilies)$+ \newfontfamily{$fontfamilies.name$}[$for(fontfamilies.options)$$fontfamilies.options$$sep$,$endfor$]{$fontfamilies.font$}+$endfor$ $if(mathfont)$ $if(mathspec)$ \ifxetex@@ -152,47 +175,49 @@ $endif$ % use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{}-% use microtype if available-\IfFileExists{microtype.sty}{%-\usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}-\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts+\IfFileExists{microtype.sty}{% use microtype if available+ \usepackage[$for(microtypeoptions)$$microtypeoptions$$sep$,$endfor$]{microtype}+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{} $if(indent)$ $else$-\IfFileExists{parskip.sty}{%-\usepackage{parskip}-}{% else-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt}-}+\makeatletter+\@ifundefined{KOMAClassName}{% if non-KOMA class+ \IfFileExists{parskip.sty}{%+ \usepackage{parskip}+ }{% else+ \setlength{\parindent}{0pt}+ \setlength{\parskip}{6pt plus 2pt minus 1pt}}+}{% if KOMA class+ \KOMAoptions{parskip=half}}+\makeatother $endif$ $if(verbatim-in-note)$ \usepackage{fancyvrb} $endif$-$if(colorlinks)$ \usepackage{xcolor}-$endif$-\usepackage{hyperref}+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \hypersetup{ $if(title-meta)$- pdftitle={$title-meta$},+ pdftitle={$title-meta$}, $endif$ $if(author-meta)$- pdfauthor={$author-meta$},+ pdfauthor={$author-meta$}, $endif$ $if(keywords)$- pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$},+ pdfkeywords={$for(keywords)$$keywords$$sep$, $endfor$}, $endif$ $if(colorlinks)$- colorlinks=true,- linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,- filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,- citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,- urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$,+ colorlinks=true,+ linkcolor=$if(linkcolor)$$linkcolor$$else$Maroon$endif$,+ filecolor=$if(filecolor)$$filecolor$$else$Maroon$endif$,+ citecolor=$if(citecolor)$$citecolor$$else$Blue$endif$,+ urlcolor=$if(urlcolor)$$urlcolor$$else$Blue$endif$, $else$- pdfborder={0 0 0},+ pdfborder={0 0 0}, $endif$- breaklinks=true}+ breaklinks=true} \urlstyle{same} % don't use monospace font for urls $if(verbatim-in-note)$ \VerbatimFootnotes % allows verbatim text in footnotes@@ -206,6 +231,8 @@ $if(listings)$ \usepackage{listings} \newcommand{\passthrough}[1]{#1}+\lstset{defaultdialect=[5.3]Lua}+\lstset{defaultdialect=[x86masm]Assembler} $endif$ $if(lhs)$ \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{}@@ -222,8 +249,9 @@ \def\fnum@table{\tablename~\thetable} \makeatother $else$-% Fix footnotes in tables (requires footnote package)-\IfFileExists{footnote.sty}{\usepackage{footnote}\makesavenoteenv{longtable}}{}+% Allow footnotes in longtable head/foot+\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}+\makesavenoteenv{longtable} $endif$ $endif$ $if(graphics)$@@ -252,7 +280,7 @@ $if(numbersections)$ \setcounter{secnumdepth}{$if(secnumdepth)$$secnumdepth$$else$5$endif$} $else$-\setcounter{secnumdepth}{0}+\setcounter{secnumdepth}{-2} $endif$ $if(beamer)$ $else$@@ -260,12 +288,12 @@ $else$ % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else-\let\oldparagraph\paragraph-\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}+ \let\oldparagraph\paragraph+ \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else-\let\oldsubparagraph\subparagraph-\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}+ \let\oldsubparagraph\subparagraph+ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi $endif$ $endif$@@ -282,12 +310,12 @@ $header-includes$ $endfor$ $if(lang)$-\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex+\ifnum 0\ifxetex 1\fi=0 % if pdftex or luatex \usepackage[shorthands=off,$for(babel-otherlangs)$$babel-otherlangs$,$endfor$main=$babel-lang$]{babel} $if(babel-newcommands)$ $babel-newcommands$ $endif$-\else+\else % if xetex % load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic) \usepackage{polyglossia} \setmainlanguage[$polyglossia-lang.options$]{$polyglossia-lang.name$}@@ -324,18 +352,25 @@ \title{$title$$if(thanks)$\thanks{$thanks$}$endif$} $endif$ $if(subtitle)$-\providecommand{\subtitle}[1]{}+$if(beamer)$+$else$+\usepackage{etoolbox}+\makeatletter+\providecommand{\subtitle}[1]{% add subtitle to \maketitle+ \apptocmd{\@title}{\par {\large #1 \par}}{}{}+}+\makeatother+$endif$ \subtitle{$subtitle$} $endif$ $if(author)$ \author{$for(author)$$author$$sep$ \and $endfor$} $endif$+\date{$date$}+$if(beamer)$ $if(institute)$-\providecommand{\institute}[1]{} \institute{$for(institute)$$institute$$sep$ \and $endfor$} $endif$-\date{$date$}-$if(beamer)$ $if(titlegraphic)$ \titlegraphic{\includegraphics{$titlegraphic$}} $endif$@@ -369,9 +404,9 @@ $if(beamer)$ \begin{frame} $if(toc-title)$-\frametitle{$toc-title$}+ \frametitle{$toc-title$} $endif$-\tableofcontents[hideallsubsections]+ \tableofcontents[hideallsubsections] \end{frame} $else$ {@@ -402,9 +437,9 @@ $endif$ $if(beamer)$ \begin{frame}[allowframebreaks]{$biblio-title$}-\bibliographytrue+ \bibliographytrue $endif$-\bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$}+ \bibliography{$for(bibliography)$$bibliography$$sep$,$endfor$} $if(beamer)$ \end{frame} $endif$@@ -414,8 +449,8 @@ $if(biblatex)$ $if(beamer)$ \begin{frame}[allowframebreaks]{$biblio-title$}-\bibliographytrue-\printbibliography[heading=none]+ \bibliographytrue+ \printbibliography[heading=none] \end{frame} $else$ \printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
@@ -17,7 +17,7 @@ <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui"> <link rel="stylesheet" href="$revealjs-url$/css/reveal.css">- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;}@@ -27,7 +27,7 @@ $endif$ </style> $if(highlighting-css)$- <style type="text/css">+ <style> $highlighting-css$ </style> $endif$@@ -238,6 +238,10 @@ $endif$ $if(maxScale)$ maxScale: $maxScale$,+$endif$+$if(zoomKey)$+ // Modifier key used to click-zoom to part of the slide+ zoomKey: '$zoomKey$', $endif$ $if(mathjax)$ math: {
@@ -1,5815 +1,6153 @@ .\"t-.TH PANDOC 1 "November 25, 2018" "pandoc 2.5"-.SH NAME-pandoc - general markup converter-.SH SYNOPSIS-.PP-\f[C]pandoc\f[R] [\f[I]options\f[R]] [\f[I]input\-file\f[R]]...-.SH DESCRIPTION-.PP-Pandoc is a Haskell library for converting from one markup format to-another, and a command\-line tool that uses this library.-.PP-Pandoc can convert between numerous markup and word processing formats,-including, but not limited to, various flavors of Markdown, HTML, LaTeX-and Word docx.-For the full lists of input and output formats, see the-\f[C]\-\-from\f[R] and \f[C]\-\-to\f[R] options below.-Pandoc can also produce PDF output: see creating a PDF, below.-.PP-Pandoc\[aq]s enhanced version of Markdown includes syntax for tables,-definition lists, metadata blocks, footnotes, citations, math, and much-more.-See below under Pandoc\[aq]s Markdown.-.PP-Pandoc has a modular design: it consists of a set of readers, which-parse text in a given format and produce a native representation of the-document (an \f[I]abstract syntax tree\f[R] or AST), and a set of-writers, which convert this native representation into a target format.-Thus, adding an input or output format requires only adding a reader or-writer.-Users can also run custom pandoc filters to modify the intermediate AST.-.PP-Because pandoc\[aq]s intermediate representation of a document is less-expressive than many of the formats it converts between, one should not-expect perfect conversions between every format and every other.-Pandoc attempts to preserve the structural elements of a document, but-not formatting details such as margin size.-And some document elements, such as complex tables, may not fit into-pandoc\[aq]s simple document model.-While conversions from pandoc\[aq]s Markdown to all formats aspire to be-perfect, conversions from formats more expressive than pandoc\[aq]s-Markdown can be expected to be lossy.-.SS Using pandoc-.PP-If no \f[I]input\-files\f[R] are specified, input is read from-\f[I]stdin\f[R].-Output goes to \f[I]stdout\f[R] by default.-For output to a file, use the \f[C]\-o\f[R] option:-.IP-.nf-\f[C]-pandoc \-o output.html input.txt-\f[R]-.fi-.PP-By default, pandoc produces a document fragment.-To produce a standalone document (e.g.-a valid HTML file including \f[C]<head>\f[R] and \f[C]<body>\f[R]), use-the \f[C]\-s\f[R] or \f[C]\-\-standalone\f[R] flag:-.IP-.nf-\f[C]-pandoc \-s \-o output.html input.txt-\f[R]-.fi-.PP-For more information on how standalone documents are produced, see-Templates below.-.PP-If multiple input files are given, \f[C]pandoc\f[R] will concatenate-them all (with blank lines between them) before parsing.-(Use \f[C]\-\-file\-scope\f[R] to parse files individually.)-.SS Specifying formats-.PP-The format of the input and output can be specified explicitly using-command\-line options.-The input format can be specified using the \f[C]\-f/\-\-from\f[R]-option, the output format using the \f[C]\-t/\-\-to\f[R] option.-Thus, to convert \f[C]hello.txt\f[R] from Markdown to LaTeX, you could-type:-.IP-.nf-\f[C]-pandoc \-f markdown \-t latex hello.txt-\f[R]-.fi-.PP-To convert \f[C]hello.html\f[R] from HTML to Markdown:-.IP-.nf-\f[C]-pandoc \-f html \-t markdown hello.html-\f[R]-.fi-.PP-Supported input and output formats are listed below under Options (see-\f[C]\-f\f[R] for input formats and \f[C]\-t\f[R] for output formats).-You can also use \f[C]pandoc \-\-list\-input\-formats\f[R] and-\f[C]pandoc \-\-list\-output\-formats\f[R] to print lists of supported-formats.-.PP-If the input or output format is not specified explicitly,-\f[C]pandoc\f[R] will attempt to guess it from the extensions of the-filenames.-Thus, for example,-.IP-.nf-\f[C]-pandoc \-o hello.tex hello.txt-\f[R]-.fi-.PP-will convert \f[C]hello.txt\f[R] from Markdown to LaTeX.-If no output file is specified (so that output goes to-\f[I]stdout\f[R]), or if the output file\[aq]s extension is unknown, the-output format will default to HTML.-If no input file is specified (so that input comes from-\f[I]stdin\f[R]), or if the input files\[aq] extensions are unknown, the-input format will be assumed to be Markdown.-.SS Character encoding-.PP-Pandoc uses the UTF\-8 character encoding for both input and output.-If your local character encoding is not UTF\-8, you should pipe input-and output through \f[C]iconv\f[R]:-.IP-.nf-\f[C]-iconv \-t utf\-8 input.txt | pandoc | iconv \-f utf\-8-\f[R]-.fi-.PP-Note that in some output formats (such as HTML, LaTeX, ConTeXt, RTF,-OPML, DocBook, and Texinfo), information about the character encoding is-included in the document header, which will only be included if you use-the \f[C]\-s/\-\-standalone\f[R] option.-.SS Creating a PDF-.PP-To produce a PDF, specify an output file with a \f[C].pdf\f[R]-extension:-.IP-.nf-\f[C]-pandoc test.txt \-o test.pdf-\f[R]-.fi-.PP-By default, pandoc will use LaTeX to create the PDF, which requires that-a LaTeX engine be installed (see \f[C]\-\-pdf\-engine\f[R] below).-.PP-Alternatively, pandoc can use ConTeXt, \f[C]pdfroff\f[R], or any of the-following HTML/CSS\-to\-PDF\-engines, to create a PDF:-\f[C]wkhtmltopdf\f[R], \f[C]weasyprint\f[R] or \f[C]prince\f[R].-To do this, specify an output file with a \f[C].pdf\f[R] extension, as-before, but add the \f[C]\-\-pdf\-engine\f[R] option or-\f[C]\-t context\f[R], \f[C]\-t html\f[R], or \f[C]\-t ms\f[R] to the-command line (\f[C]\-t html\f[R] defaults to-\f[C]\-\-pdf\-engine=wkhtmltopdf\f[R]).-.PP-PDF output can be controlled using variables for LaTeX (if LaTeX is-used) and variables for ConTeXt (if ConTeXt is used).-When using an HTML/CSS\-to\-PDF\-engine, \f[C]\-\-css\f[R] affects the-output.-If \f[C]wkhtmltopdf\f[R] is used, then the variables-\f[C]margin\-left\f[R], \f[C]margin\-right\f[R], \f[C]margin\-top\f[R],-\f[C]margin\-bottom\f[R], \f[C]footer\-html\f[R], \f[C]header\-html\f[R]-and \f[C]papersize\f[R] will affect the output.-.PP-To debug the PDF creation, it can be useful to look at the intermediate-representation: instead of \f[C]\-o test.pdf\f[R], use for example-\f[C]\-s \-o test.tex\f[R] to output the generated LaTeX.-You can then test it with \f[C]pdflatex test.tex\f[R].-.PP-When using LaTeX, the following packages need to be available (they are-included with all recent versions of TeX Live): \f[C]amsfonts\f[R],-\f[C]amsmath\f[R], \f[C]lm\f[R], \f[C]unicode\-math\f[R],-\f[C]ifxetex\f[R], \f[C]ifluatex\f[R], \f[C]listings\f[R] (if the-\f[C]\-\-listings\f[R] option is used), \f[C]fancyvrb\f[R],-\f[C]longtable\f[R], \f[C]booktabs\f[R], \f[C]graphicx\f[R] and-\f[C]grffile\f[R] (if the document contains images), \f[C]hyperref\f[R],-\f[C]xcolor\f[R] (with \f[C]colorlinks\f[R]), \f[C]ulem\f[R],-\f[C]geometry\f[R] (with the \f[C]geometry\f[R] variable set),-\f[C]setspace\f[R] (with \f[C]linestretch\f[R]), and \f[C]babel\f[R]-(with \f[C]lang\f[R]).-The use of \f[C]xelatex\f[R] or \f[C]lualatex\f[R] as the LaTeX engine-requires \f[C]fontspec\f[R].-\f[C]xelatex\f[R] uses \f[C]polyglossia\f[R] (with \f[C]lang\f[R]),-\f[C]xecjk\f[R], and \f[C]bidi\f[R] (with the \f[C]dir\f[R] variable-set).-If the \f[C]mathspec\f[R] variable is set, \f[C]xelatex\f[R] will use-\f[C]mathspec\f[R] instead of \f[C]unicode\-math\f[R].-The \f[C]upquote\f[R] and \f[C]microtype\f[R] packages are used if-available, and \f[C]csquotes\f[R] will be used for typography if-\f[C]\[rs]usepackage{csquotes}\f[R] is present in the template or-included via \f[C]/H/\-\-include\-in\-header\f[R].-The \f[C]natbib\f[R], \f[C]biblatex\f[R], \f[C]bibtex\f[R], and-\f[C]biber\f[R] packages can optionally be used for citation rendering.-.SS Reading from the Web-.PP-Instead of an input file, an absolute URI may be given.-In this case pandoc will fetch the content using HTTP:-.IP-.nf-\f[C]-pandoc \-f html \-t markdown http://www.fsf.org-\f[R]-.fi-.PP-It is possible to supply a custom User\-Agent string or other header-when requesting a document from a URL:-.IP-.nf-\f[C]-pandoc \-f html \-t markdown \-\-request\-header User\-Agent:\[dq]Mozilla/5.0\[dq] \[rs]- http://www.fsf.org-\f[R]-.fi-.SH OPTIONS-.SS General options-.TP-.B \f[C]\-f\f[R] \f[I]FORMAT\f[R], \f[C]\-r\f[R] \f[I]FORMAT\f[R], \f[C]\-\-from=\f[R]\f[I]FORMAT\f[R], \f[C]\-\-read=\f[R]\f[I]FORMAT\f[R]-Specify input format.-\f[I]FORMAT\f[R] can be:-.RS-.IP \[bu] 2-\f[C]commonmark\f[R] (CommonMark Markdown)-.IP \[bu] 2-\f[C]creole\f[R] (Creole 1.0)-.IP \[bu] 2-\f[C]docbook\f[R] (DocBook)-.IP \[bu] 2-\f[C]docx\f[R] (Word docx)-.IP \[bu] 2-\f[C]epub\f[R] (EPUB)-.IP \[bu] 2-\f[C]fb2\f[R] (FictionBook2 e\-book)-.IP \[bu] 2-\f[C]gfm\f[R] (GitHub\-Flavored Markdown), or the deprecated and less-accurate \f[C]markdown_github\f[R]; use \f[C]markdown_github\f[R] only-if you need extensions not supported in \f[C]gfm\f[R].-.IP \[bu] 2-\f[C]haddock\f[R] (Haddock markup)-.IP \[bu] 2-\f[C]html\f[R] (HTML)-.IP \[bu] 2-\f[C]jats\f[R] (JATS XML)-.IP \[bu] 2-\f[C]json\f[R] (JSON version of native AST)-.IP \[bu] 2-\f[C]latex\f[R] (LaTeX)-.IP \[bu] 2-\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)-.IP \[bu] 2-\f[C]markdown_mmd\f[R] (MultiMarkdown)-.IP \[bu] 2-\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)-.IP \[bu] 2-\f[C]markdown_strict\f[R] (original unextended Markdown)-.IP \[bu] 2-\f[C]mediawiki\f[R] (MediaWiki markup)-.IP \[bu] 2-\f[C]man\f[R] (roff man)-.IP \[bu] 2-\f[C]muse\f[R] (Muse)-.IP \[bu] 2-\f[C]native\f[R] (native Haskell)-.IP \[bu] 2-\f[C]odt\f[R] (ODT)-.IP \[bu] 2-\f[C]opml\f[R] (OPML)-.IP \[bu] 2-\f[C]org\f[R] (Emacs Org mode)-.IP \[bu] 2-\f[C]rst\f[R] (reStructuredText)-.IP \[bu] 2-\f[C]t2t\f[R] (txt2tags)-.IP \[bu] 2-\f[C]textile\f[R] (Textile)-.IP \[bu] 2-\f[C]tikiwiki\f[R] (TikiWiki markup)-.IP \[bu] 2-\f[C]twiki\f[R] (TWiki markup)-.IP \[bu] 2-\f[C]vimwiki\f[R] (Vimwiki)-.PP-Extensions can be individually enabled or disabled by appending-\f[C]+EXTENSION\f[R] or \f[C]\-EXTENSION\f[R] to the format name.-See Extensions below, for a list of extensions and their names.-See \f[C]\-\-list\-input\-formats\f[R] and-\f[C]\-\-list\-extensions\f[R], below.-.RE-.TP-.B \f[C]\-t\f[R] \f[I]FORMAT\f[R], \f[C]\-w\f[R] \f[I]FORMAT\f[R], \f[C]\-\-to=\f[R]\f[I]FORMAT\f[R], \f[C]\-\-write=\f[R]\f[I]FORMAT\f[R]-Specify output format.-\f[I]FORMAT\f[R] can be:-.RS-.IP \[bu] 2-\f[C]asciidoc\f[R] (AsciiDoc)-.IP \[bu] 2-\f[C]beamer\f[R] (LaTeX beamer slide show)-.IP \[bu] 2-\f[C]commonmark\f[R] (CommonMark Markdown)-.IP \[bu] 2-\f[C]context\f[R] (ConTeXt)-.IP \[bu] 2-\f[C]docbook\f[R] or \f[C]docbook4\f[R] (DocBook 4)-.IP \[bu] 2-\f[C]docbook5\f[R] (DocBook 5)-.IP \[bu] 2-\f[C]docx\f[R] (Word docx)-.IP \[bu] 2-\f[C]dokuwiki\f[R] (DokuWiki markup)-.IP \[bu] 2-\f[C]epub\f[R] or \f[C]epub3\f[R] (EPUB v3 book)-.IP \[bu] 2-\f[C]epub2\f[R] (EPUB v2)-.IP \[bu] 2-\f[C]fb2\f[R] (FictionBook2 e\-book)-.IP \[bu] 2-\f[C]gfm\f[R] (GitHub\-Flavored Markdown), or the deprecated and less-accurate \f[C]markdown_github\f[R]; use \f[C]markdown_github\f[R] only-if you need extensions not supported in \f[C]gfm\f[R].-.IP \[bu] 2-\f[C]haddock\f[R] (Haddock markup)-.IP \[bu] 2-\f[C]html\f[R] or \f[C]html5\f[R] (HTML, i.e.-HTML5/XHTML polyglot markup)-.IP \[bu] 2-\f[C]html4\f[R] (XHTML 1.0 Transitional)-.IP \[bu] 2-\f[C]icml\f[R] (InDesign ICML)-.IP \[bu] 2-\f[C]jats\f[R] (JATS XML)-.IP \[bu] 2-\f[C]json\f[R] (JSON version of native AST)-.IP \[bu] 2-\f[C]latex\f[R] (LaTeX)-.IP \[bu] 2-\f[C]man\f[R] (roff man)-.IP \[bu] 2-\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)-.IP \[bu] 2-\f[C]markdown_mmd\f[R] (MultiMarkdown)-.IP \[bu] 2-\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)-.IP \[bu] 2-\f[C]markdown_strict\f[R] (original unextended Markdown)-.IP \[bu] 2-\f[C]mediawiki\f[R] (MediaWiki markup)-.IP \[bu] 2-\f[C]ms\f[R] (roff ms)-.IP \[bu] 2-\f[C]muse\f[R] (Muse),-.IP \[bu] 2-\f[C]native\f[R] (native Haskell),-.IP \[bu] 2-\f[C]odt\f[R] (OpenOffice text document)-.IP \[bu] 2-\f[C]opml\f[R] (OPML)-.IP \[bu] 2-\f[C]opendocument\f[R] (OpenDocument)-.IP \[bu] 2-\f[C]org\f[R] (Emacs Org mode)-.IP \[bu] 2-\f[C]plain\f[R] (plain text),-.IP \[bu] 2-\f[C]pptx\f[R] (PowerPoint slide show)-.IP \[bu] 2-\f[C]rst\f[R] (reStructuredText)-.IP \[bu] 2-\f[C]rtf\f[R] (Rich Text Format)-.IP \[bu] 2-\f[C]texinfo\f[R] (GNU Texinfo)-.IP \[bu] 2-\f[C]textile\f[R] (Textile)-.IP \[bu] 2-\f[C]slideous\f[R] (Slideous HTML and JavaScript slide show)-.IP \[bu] 2-\f[C]slidy\f[R] (Slidy HTML and JavaScript slide show)-.IP \[bu] 2-\f[C]dzslides\f[R] (DZSlides HTML5 + JavaScript slide show),-.IP \[bu] 2-\f[C]revealjs\f[R] (reveal.js HTML5 + JavaScript slide show)-.IP \[bu] 2-\f[C]s5\f[R] (S5 HTML and JavaScript slide show)-.IP \[bu] 2-\f[C]tei\f[R] (TEI Simple)-.IP \[bu] 2-\f[C]zimwiki\f[R] (ZimWiki markup)-.IP \[bu] 2-the path of a custom lua writer, see Custom writers below-.PP-Note that \f[C]odt\f[R], \f[C]docx\f[R], and \f[C]epub\f[R] output will-not be directed to \f[I]stdout\f[R] unless forced with \f[C]\-o \-\f[R].-.PP-Extensions can be individually enabled or disabled by appending-\f[C]+EXTENSION\f[R] or \f[C]\-EXTENSION\f[R] to the format name.-See Extensions below, for a list of extensions and their names.-See \f[C]\-\-list\-output\-formats\f[R] and-\f[C]\-\-list\-extensions\f[R], below.-.RE-.TP-.B \f[C]\-o\f[R] \f[I]FILE\f[R], \f[C]\-\-output=\f[R]\f[I]FILE\f[R]-Write output to \f[I]FILE\f[R] instead of \f[I]stdout\f[R].-If \f[I]FILE\f[R] is \f[C]\-\f[R], output will go to \f[I]stdout\f[R],-even if a non\-textual format (\f[C]docx\f[R], \f[C]odt\f[R],-\f[C]epub2\f[R], \f[C]epub3\f[R]) is specified.-.TP-.B \f[C]\-\-data\-dir=\f[R]\f[I]DIRECTORY\f[R]-Specify the user data directory to search for pandoc data files.-If this option is not specified, the default user data directory will be-used.-This is, in UNIX:-.RS-.IP-.nf-\f[C]-$HOME/.pandoc-\f[R]-.fi-.PP-in Windows XP:-.IP-.nf-\f[C]-C:\[rs]Documents And Settings\[rs]USERNAME\[rs]Application Data\[rs]pandoc-\f[R]-.fi-.PP-and in Windows Vista or later:-.IP-.nf-\f[C]-C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]pandoc-\f[R]-.fi-.PP-You can find the default user data directory on your system by looking-at the output of \f[C]pandoc \-\-version\f[R].-A \f[C]reference.odt\f[R], \f[C]reference.docx\f[R], \f[C]epub.css\f[R],-\f[C]templates\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R], or-\f[C]s5\f[R] directory placed in this directory will override-pandoc\[aq]s normal defaults.-.RE-.TP-.B \f[C]\-\-bash\-completion\f[R]-Generate a bash completion script.-To enable bash completion with pandoc, add this to your-\f[C].bashrc\f[R]:-.RS-.IP-.nf-\f[C]-eval \[dq]$(pandoc \-\-bash\-completion)\[dq]-\f[R]-.fi-.RE-.TP-.B \f[C]\-\-verbose\f[R]-Give verbose debugging output.-Currently this only has an effect with PDF output.-.TP-.B \f[C]\-\-quiet\f[R]-Suppress warning messages.-.TP-.B \f[C]\-\-fail\-if\-warnings\f[R]-Exit with error status if there are any warnings.-.TP-.B \f[C]\-\-log=\f[R]\f[I]FILE\f[R]-Write log messages in machine\-readable JSON format to \f[I]FILE\f[R].-All messages above DEBUG level will be written, regardless of verbosity-settings (\f[C]\-\-verbose\f[R], \f[C]\-\-quiet\f[R]).-.TP-.B \f[C]\-\-list\-input\-formats\f[R]-List supported input formats, one per line.-.TP-.B \f[C]\-\-list\-output\-formats\f[R]-List supported output formats, one per line.-.TP-.B \f[C]\-\-list\-extensions\f[R][\f[C]=\f[R]\f[I]FORMAT\f[R]]-List supported extensions, one per line, preceded by a \f[C]+\f[R] or-\f[C]\-\f[R] indicating whether it is enabled by default in-\f[I]FORMAT\f[R].-If \f[I]FORMAT\f[R] is not specified, defaults for pandoc\[aq]s Markdown-are given.-.TP-.B \f[C]\-\-list\-highlight\-languages\f[R]-List supported languages for syntax highlighting, one per line.-.TP-.B \f[C]\-\-list\-highlight\-styles\f[R]-List supported styles for syntax highlighting, one per line.-See \f[C]\-\-highlight\-style\f[R].-.TP-.B \f[C]\-v\f[R], \f[C]\-\-version\f[R]-Print version.-.TP-.B \f[C]\-h\f[R], \f[C]\-\-help\f[R]-Show usage message.-.SS Reader options-.TP-.B \f[C]\-\-base\-header\-level=\f[R]\f[I]NUMBER\f[R]-Specify the base level for headers (defaults to 1).-.TP-.B \f[C]\-\-strip\-empty\-paragraphs\f[R]-\f[I]Deprecated. Use the \f[CI]+empty_paragraphs\f[I] extension-instead.\f[R] Ignore paragraphs with no content.-This option is useful for converting word processing documents where-users have used empty paragraphs to create inter\-paragraph space.-.TP-.B \f[C]\-\-indented\-code\-classes=\f[R]\f[I]CLASSES\f[R]-Specify classes to use for indented code blocks\-\-for example,-\f[C]perl,numberLines\f[R] or \f[C]haskell\f[R].-Multiple classes may be separated by spaces or commas.-.TP-.B \f[C]\-\-default\-image\-extension=\f[R]\f[I]EXTENSION\f[R]-Specify a default extension to use when image paths/URLs have no-extension.-This allows you to use the same source for formats that require-different kinds of images.-Currently this option only affects the Markdown and LaTeX readers.-.TP-.B \f[C]\-\-file\-scope\f[R]-Parse each file individually before combining for multifile documents.-This will allow footnotes in different files with the same identifiers-to work as expected.-If this option is set, footnotes and links will not work across files.-Reading binary files (docx, odt, epub) implies-\f[C]\-\-file\-scope\f[R].-.TP-.B \f[C]\-F\f[R] \f[I]PROGRAM\f[R], \f[C]\-\-filter=\f[R]\f[I]PROGRAM\f[R]-Specify an executable to be used as a filter transforming the pandoc AST-after the input is parsed and before the output is written.-The executable should read JSON from stdin and write JSON to stdout.-The JSON must be formatted like pandoc\[aq]s own JSON input and output.-The name of the output format will be passed to the filter as the first-argument.-Hence,-.RS-.IP-.nf-\f[C]-pandoc \-\-filter ./caps.py \-t latex-\f[R]-.fi-.PP-is equivalent to-.IP-.nf-\f[C]-pandoc \-t json | ./caps.py latex | pandoc \-f json \-t latex-\f[R]-.fi-.PP-The latter form may be useful for debugging filters.-.PP-Filters may be written in any language.-\f[C]Text.Pandoc.JSON\f[R] exports \f[C]toJSONFilter\f[R] to facilitate-writing filters in Haskell.-Those who would prefer to write filters in python can use the module-\f[C]pandocfilters\f[R], installable from PyPI.-There are also pandoc filter libraries in PHP, perl, and-JavaScript/node.js.-.PP-In order of preference, pandoc will look for filters in-.IP "1." 3-a specified full or relative path (executable or non\-executable)-.IP "2." 3-\f[C]$DATADIR/filters\f[R] (executable or non\-executable) where-\f[C]$DATADIR\f[R] is the user data directory (see-\f[C]\-\-data\-dir\f[R], above).-.IP "3." 3-\f[C]$PATH\f[R] (executable only)-.PP-Filters and lua\-filters are applied in the order specified on the-command line.-.RE-.TP-.B \f[C]\-\-lua\-filter=\f[R]\f[I]SCRIPT\f[R]-Transform the document in a similar fashion as JSON filters (see-\f[C]\-\-filter\f[R]), but use pandoc\[aq]s build\-in lua filtering-system.-The given lua script is expected to return a list of lua filters which-will be applied in order.-Each lua filter must contain element\-transforming functions indexed by-the name of the AST element on which the filter function should be-applied.-.RS-.PP-The \f[C]pandoc\f[R] lua module provides helper functions for element-creation.-It is always loaded into the script\[aq]s lua environment.-.PP-The following is an example lua script for macro\-expansion:-.IP-.nf-\f[C]-function expand_hello_world(inline)- if inline.c == \[aq]{{helloworld}}\[aq] then- return pandoc.Emph{ pandoc.Str \[dq]Hello, World\[dq] }- else- return inline- end-end--return {{Str = expand_hello_world}}-\f[R]-.fi-.PP-In order of preference, pandoc will look for lua filters in-.IP "1." 3-a specified full or relative path (executable or non\-executable)-.IP "2." 3-\f[C]$DATADIR/filters\f[R] (executable or non\-executable) where-\f[C]$DATADIR\f[R] is the user data directory (see-\f[C]\-\-data\-dir\f[R], above).-.RE-.TP-.B \f[C]\-M\f[R] \f[I]KEY\f[R][\f[C]=\f[R]\f[I]VAL\f[R]], \f[C]\-\-metadata=\f[R]\f[I]KEY\f[R][\f[C]:\f[R]\f[I]VAL\f[R]]-Set the metadata field \f[I]KEY\f[R] to the value \f[I]VAL\f[R].-A value specified on the command line overrides a value specified in the-document using YAML metadata blocks.-Values will be parsed as YAML boolean or string values.-If no value is specified, the value will be treated as Boolean true.-Like \f[C]\-\-variable\f[R], \f[C]\-\-metadata\f[R] causes template-variables to be set.-But unlike \f[C]\-\-variable\f[R], \f[C]\-\-metadata\f[R] affects the-metadata of the underlying document (which is accessible from filters-and may be printed in some output formats) and metadata values will be-escaped when inserted into the template.-.TP-.B \f[C]\-\-metadata\-file=\f[R]\f[I]FILE\f[R]-Read metadata from the supplied YAML (or JSON) file.-This option can be used with every input format, but string scalars in-the YAML file will always be parsed as Markdown.-Generally, the input will be handled the same as in YAML metadata-blocks.-Metadata values specified inside the document, or by using-\f[C]\-M\f[R], overwrite values specified with this option.-.TP-.B \f[C]\-p\f[R], \f[C]\-\-preserve\-tabs\f[R]-Preserve tabs instead of converting them to spaces (the default).-Note that this will only affect tabs in literal code spans and code-blocks; tabs in regular text will be treated as spaces.-.TP-.B \f[C]\-\-tab\-stop=\f[R]\f[I]NUMBER\f[R]-Specify the number of spaces per tab (default is 4).-.TP-.B \f[C]\-\-track\-changes=accept\f[R]|\f[C]reject\f[R]|\f[C]all\f[R]-Specifies what to do with insertions, deletions, and comments produced-by the MS Word \[dq]Track Changes\[dq] feature.-\f[C]accept\f[R] (the default), inserts all insertions, and ignores all-deletions.-\f[C]reject\f[R] inserts all deletions and ignores insertions.-Both \f[C]accept\f[R] and \f[C]reject\f[R] ignore comments.-\f[C]all\f[R] puts in insertions, deletions, and comments, wrapped in-spans with \f[C]insertion\f[R], \f[C]deletion\f[R],-\f[C]comment\-start\f[R], and \f[C]comment\-end\f[R] classes,-respectively.-The author and time of change is included.-\f[C]all\f[R] is useful for scripting: only accepting changes from a-certain reviewer, say, or before a certain date.-If a paragraph is inserted or deleted, \f[C]track\-changes=all\f[R]-produces a span with the class-\f[C]paragraph\-insertion\f[R]/\f[C]paragraph\-deletion\f[R] before the-affected paragraph break.-This option only affects the docx reader.-.TP-.B \f[C]\-\-extract\-media=\f[R]\f[I]DIR\f[R]-Extract images and other media contained in or linked from the source-document to the path \f[I]DIR\f[R], creating it if necessary, and adjust-the images references in the document so they point to the extracted-files.-If the source format is a binary container (docx, epub, or odt), the-media is extracted from the container and the original filenames are-used.-Otherwise the media is read from the file system or downloaded, and new-filenames are constructed based on SHA1 hashes of the contents.-.TP-.B \f[C]\-\-abbreviations=\f[R]\f[I]FILE\f[R]-Specifies a custom abbreviations file, with abbreviations one to a line.-If this option is not specified, pandoc will read the data file-\f[C]abbreviations\f[R] from the user data directory or fall back on a-system default.-To see the system default, use-\f[C]pandoc \-\-print\-default\-data\-file=abbreviations\f[R].-The only use pandoc makes of this list is in the Markdown reader.-Strings ending in a period that are found in this list will be followed-by a nonbreaking space, so that the period will not produce-sentence\-ending space in formats like LaTeX.-.SS General writer options-.TP-.B \f[C]\-s\f[R], \f[C]\-\-standalone\f[R]-Produce output with an appropriate header and footer (e.g.-a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).-This option is set automatically for \f[C]pdf\f[R], \f[C]epub\f[R],-\f[C]epub3\f[R], \f[C]fb2\f[R], \f[C]docx\f[R], and \f[C]odt\f[R]-output.-For \f[C]native\f[R] output, this option causes metadata to be included;-otherwise, metadata is suppressed.-.TP-.B \f[C]\-\-template=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]-Use the specified file as a custom template for the generated document.-Implies \f[C]\-\-standalone\f[R].-See Templates, below, for a description of template syntax.-If no extension is specified, an extension corresponding to the writer-will be added, so that \f[C]\-\-template=special\f[R] looks for-\f[C]special.html\f[R] for HTML output.-If the template is not found, pandoc will search for it in the-\f[C]templates\f[R] subdirectory of the user data directory (see-\f[C]\-\-data\-dir\f[R]).-If this option is not used, a default template appropriate for the-output format will be used (see-\f[C]\-D/\-\-print\-default\-template\f[R]).-.TP-.B \f[C]\-V\f[R] \f[I]KEY\f[R][\f[C]=\f[R]\f[I]VAL\f[R]], \f[C]\-\-variable=\f[R]\f[I]KEY\f[R][\f[C]:\f[R]\f[I]VAL\f[R]]-Set the template variable \f[I]KEY\f[R] to the value \f[I]VAL\f[R] when-rendering the document in standalone mode.-This is generally only useful when the \f[C]\-\-template\f[R] option is-used to specify a custom template, since pandoc automatically sets the-variables used in the default templates.-If no \f[I]VAL\f[R] is specified, the key will be given the value-\f[C]true\f[R].-.TP-.B \f[C]\-D\f[R] \f[I]FORMAT\f[R], \f[C]\-\-print\-default\-template=\f[R]\f[I]FORMAT\f[R]-Print the system default template for an output \f[I]FORMAT\f[R].-(See \f[C]\-t\f[R] for a list of possible \f[I]FORMAT\f[R]s.) Templates-in the user data directory are ignored.-.TP-.B \f[C]\-\-print\-default\-data\-file=\f[R]\f[I]FILE\f[R]-Print a system default data file.-Files in the user data directory are ignored.-.TP-.B \f[C]\-\-eol=crlf\f[R]|\f[C]lf\f[R]|\f[C]native\f[R]-Manually specify line endings: \f[C]crlf\f[R] (Windows), \f[C]lf\f[R]-(macOS/Linux/UNIX), or \f[C]native\f[R] (line endings appropriate to the-OS on which pandoc is being run).-The default is \f[C]native\f[R].-.TP-.B \f[C]\-\-dpi\f[R]=\f[I]NUMBER\f[R]-Specify the dpi (dots per inch) value for conversion from pixels to-inch/centimeters and vice versa.-The default is 96dpi.-Technically, the correct term would be ppi (pixels per inch).-.TP-.B \f[C]\-\-wrap=auto\f[R]|\f[C]none\f[R]|\f[C]preserve\f[R]-Determine how text is wrapped in the output (the source code, not the-rendered version).-With \f[C]auto\f[R] (the default), pandoc will attempt to wrap lines to-the column width specified by \f[C]\-\-columns\f[R] (default 72).-With \f[C]none\f[R], pandoc will not wrap lines at all.-With \f[C]preserve\f[R], pandoc will attempt to preserve the wrapping-from the source document (that is, where there are nonsemantic newlines-in the source, there will be nonsemantic newlines in the output as-well).-Automatic wrapping does not currently work in HTML output.-.TP-.B \f[C]\-\-columns=\f[R]\f[I]NUMBER\f[R]-Specify length of lines in characters.-This affects text wrapping in the generated source code (see-\f[C]\-\-wrap\f[R]).-It also affects calculation of column widths for plain text tables (see-Tables below).-.TP-.B \f[C]\-\-toc\f[R], \f[C]\-\-table\-of\-contents\f[R]-Include an automatically generated table of contents (or, in the case of-\f[C]latex\f[R], \f[C]context\f[R], \f[C]docx\f[R], \f[C]odt\f[R],-\f[C]opendocument\f[R], \f[C]rst\f[R], or \f[C]ms\f[R], an instruction-to create one) in the output document.-This option has no effect unless \f[C]\-s/\-\-standalone\f[R] is used,-and it has no effect on \f[C]man\f[R], \f[C]docbook4\f[R],-\f[C]docbook5\f[R], or \f[C]jats\f[R] output.-.TP-.B \f[C]\-\-toc\-depth=\f[R]\f[I]NUMBER\f[R]-Specify the number of section levels to include in the table of-contents.-The default is 3 (which means that level 1, 2, and 3 headers will be-listed in the contents).-.TP-.B \f[C]\-\-strip\-comments\f[R]-Strip out HTML comments in the Markdown or Textile source, rather than-passing them on to Markdown, Textile or HTML output as raw HTML.-This does not apply to HTML comments inside raw HTML blocks when the-\f[C]markdown_in_html_blocks\f[R] extension is not set.-.TP-.B \f[C]\-\-no\-highlight\f[R]-Disables syntax highlighting for code blocks and inlines, even when a-language attribute is given.-.TP-.B \f[C]\-\-highlight\-style=\f[R]\f[I]STYLE\f[R]|\f[I]FILE\f[R]-Specifies the coloring style to be used in highlighted source code.-Options are \f[C]pygments\f[R] (the default), \f[C]kate\f[R],-\f[C]monochrome\f[R], \f[C]breezeDark\f[R], \f[C]espresso\f[R],-\f[C]zenburn\f[R], \f[C]haddock\f[R], and \f[C]tango\f[R].-For more information on syntax highlighting in pandoc, see Syntax-highlighting, below.-See also \f[C]\-\-list\-highlight\-styles\f[R].-.RS-.PP-Instead of a \f[I]STYLE\f[R] name, a JSON file with extension-\f[C].theme\f[R] may be supplied.-This will be parsed as a KDE syntax highlighting theme and (if valid)-used as the highlighting style.-.PP-To generate the JSON version of an existing style, use-\f[C]\-\-print\-highlight\-style\f[R].-.RE-.TP-.B \f[C]\-\-print\-highlight\-style=\f[R]\f[I]STYLE\f[R]|\f[I]FILE\f[R]-Prints a JSON version of a highlighting style, which can be modified,-saved with a \f[C].theme\f[R] extension, and used with-\f[C]\-\-highlight\-style\f[R].-.TP-.B \f[C]\-\-syntax\-definition=\f[R]\f[I]FILE\f[R]-Instructs pandoc to load a KDE XML syntax definition file, which will be-used for syntax highlighting of appropriately marked code blocks.-This can be used to add support for new languages or to use altered-syntax definitions for existing languages.-.TP-.B \f[C]\-H\f[R] \f[I]FILE\f[R], \f[C]\-\-include\-in\-header=\f[R]\f[I]FILE\f[R]-Include contents of \f[I]FILE\f[R], verbatim, at the end of the header.-This can be used, for example, to include special CSS or JavaScript in-HTML documents.-This option can be used repeatedly to include multiple files in the-header.-They will be included in the order specified.-Implies \f[C]\-\-standalone\f[R].-.TP-.B \f[C]\-B\f[R] \f[I]FILE\f[R], \f[C]\-\-include\-before\-body=\f[R]\f[I]FILE\f[R]-Include contents of \f[I]FILE\f[R], verbatim, at the beginning of the-document body (e.g.-after the \f[C]<body>\f[R] tag in HTML, or the-\f[C]\[rs]begin{document}\f[R] command in LaTeX).-This can be used to include navigation bars or banners in HTML-documents.-This option can be used repeatedly to include multiple files.-They will be included in the order specified.-Implies \f[C]\-\-standalone\f[R].-.TP-.B \f[C]\-A\f[R] \f[I]FILE\f[R], \f[C]\-\-include\-after\-body=\f[R]\f[I]FILE\f[R]-Include contents of \f[I]FILE\f[R], verbatim, at the end of the document-body (before the \f[C]</body>\f[R] tag in HTML, or the-\f[C]\[rs]end{document}\f[R] command in LaTeX).-This option can be used repeatedly to include multiple files.-They will be included in the order specified.-Implies \f[C]\-\-standalone\f[R].-.TP-.B \f[C]\-\-resource\-path=\f[R]\f[I]SEARCHPATH\f[R]-List of paths to search for images and other resources.-The paths should be separated by \f[C]:\f[R] on Linux, UNIX, and macOS-systems, and by \f[C];\f[R] on Windows.-If \f[C]\-\-resource\-path\f[R] is not specified, the default resource-path is the working directory.-Note that, if \f[C]\-\-resource\-path\f[R] is specified, the working-directory must be explicitly listed or it will not be searched.-For example: \f[C]\-\-resource\-path=.:test\f[R] will search the working-directory and the \f[C]test\f[R] subdirectory, in that order.-.RS-.PP-\f[C]\-\-resource\-path\f[R] only has an effect if (a) the output format-embeds images (for example, \f[C]docx\f[R], \f[C]pdf\f[R], or-\f[C]html\f[R] with \f[C]\-\-self\-contained\f[R]) or (b) it is used-together with \f[C]\-\-extract\-media\f[R].-.RE-.TP-.B \f[C]\-\-request\-header=\f[R]\f[I]NAME\f[R]\f[C]:\f[R]\f[I]VAL\f[R]-Set the request header \f[I]NAME\f[R] to the value \f[I]VAL\f[R] when-making HTTP requests (for example, when a URL is given on the command-line, or when resources used in a document must be downloaded).-If you\[aq]re behind a proxy, you also need to set the environment-variable \f[C]http_proxy\f[R] to \f[C]http://...\f[R].-.SS Options affecting specific writers-.TP-.B \f[C]\-\-self\-contained\f[R]-Produce a standalone HTML file with no external dependencies, using-\f[C]data:\f[R] URIs to incorporate the contents of linked scripts,-stylesheets, images, and videos.-Implies \f[C]\-\-standalone\f[R].-The resulting file should be \[dq]self\-contained,\[dq] in the sense-that it needs no external files and no net access to be displayed-properly by a browser.-This option works only with HTML output formats, including-\f[C]html4\f[R], \f[C]html5\f[R], \f[C]html+lhs\f[R],-\f[C]html5+lhs\f[R], \f[C]s5\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R],-\f[C]dzslides\f[R], and \f[C]revealjs\f[R].-Scripts, images, and stylesheets at absolute URLs will be downloaded;-those at relative URLs will be sought relative to the working directory-(if the first source file is local) or relative to the base URL (if the-first source file is remote).-Elements with the attribute \f[C]data\-external=\[dq]1\[dq]\f[R] will be-left alone; the documents they link to will not be incorporated in the-document.-Limitation: resources that are loaded dynamically through JavaScript-cannot be incorporated; as a result, \f[C]\-\-self\-contained\f[R] does-not work with \f[C]\-\-mathjax\f[R], and some advanced features (e.g.-zoom or speaker notes) may not work in an offline-\[dq]self\-contained\[dq] \f[C]reveal.js\f[R] slide show.-.TP-.B \f[C]\-\-html\-q\-tags\f[R]-Use \f[C]<q>\f[R] tags for quotes in HTML.-.TP-.B \f[C]\-\-ascii\f[R]-Use only ASCII characters in output.-Currently supported for XML and HTML formats (which use entities instead-of UTF\-8 when this option is selected), CommonMark, gfm, and Markdown-(which use entities), roff ms (which use hexadecimal escapes), and to a-limited degree LaTeX (which uses standard commands for accented-characters when possible).-roff man output uses ASCII by default.-.TP-.B \f[C]\-\-reference\-links\f[R]-Use reference\-style links, rather than inline links, in writing-Markdown or reStructuredText.-By default inline links are used.-The placement of link references is affected by the-\f[C]\-\-reference\-location\f[R] option.-.TP-.B \f[C]\-\-reference\-location = block\f[R]|\f[C]section\f[R]|\f[C]document\f[R]-Specify whether footnotes (and references, if \f[C]reference\-links\f[R]-is set) are placed at the end of the current (top\-level) block, the-current section, or the document.-The default is \f[C]document\f[R].-Currently only affects the markdown writer.-.TP-.B \f[C]\-\-atx\-headers\f[R]-Use ATX\-style headers in Markdown output.-The default is to use setext\-style headers for levels 1\-2, and then-ATX headers.-(Note: for \f[C]gfm\f[R] output, ATX headers are always used.)-.TP-.B \f[C]\-\-top\-level\-division=[default|section|chapter|part]\f[R]-Treat top\-level headers as the given division type in LaTeX, ConTeXt,-DocBook, and TEI output.-The hierarchy order is part, chapter, then section; all headers are-shifted such that the top\-level header becomes the specified type.-The default behavior is to determine the best division type via-heuristics: unless other conditions apply, \f[C]section\f[R] is chosen.-When the LaTeX document class is set to \f[C]report\f[R],-\f[C]book\f[R], or \f[C]memoir\f[R] (unless the \f[C]article\f[R] option-is specified), \f[C]chapter\f[R] is implied as the setting for this-option.-If \f[C]beamer\f[R] is the output format, specifying either-\f[C]chapter\f[R] or \f[C]part\f[R] will cause top\-level headers to-become \f[C]\[rs]part{..}\f[R], while second\-level headers remain as-their default type.-.TP-.B \f[C]\-N\f[R], \f[C]\-\-number\-sections\f[R]-Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.-By default, sections are not numbered.-Sections with class \f[C]unnumbered\f[R] will never be numbered, even if-\f[C]\-\-number\-sections\f[R] is specified.-.TP-.B \f[C]\-\-number\-offset=\f[R]\f[I]NUMBER\f[R][\f[C],\f[R]\f[I]NUMBER\f[R]\f[C],\f[R]\f[I]...\f[R]]-Offset for section headings in HTML output (ignored in other output-formats).-The first number is added to the section number for top\-level headers,-the second for second\-level headers, and so on.-So, for example, if you want the first top\-level header in your-document to be numbered \[dq]6\[dq], specify-\f[C]\-\-number\-offset=5\f[R].-If your document starts with a level\-2 header which you want to be-numbered \[dq]1.5\[dq], specify \f[C]\-\-number\-offset=1,4\f[R].-Offsets are 0 by default.-Implies \f[C]\-\-number\-sections\f[R].-.TP-.B \f[C]\-\-listings\f[R]-Use the \f[C]listings\f[R] package for LaTeX code blocks.-The package does not support multi\-byte encoding for source code.-To handle UTF\-8 you would need to use a custom template.-This issue is fully documented here: Encoding issue with the listings-package.-.TP-.B \f[C]\-i\f[R], \f[C]\-\-incremental\f[R]-Make list items in slide shows display incrementally (one by one).-The default is for lists to be displayed all at once.-.TP-.B \f[C]\-\-slide\-level=\f[R]\f[I]NUMBER\f[R]-Specifies that headers with the specified level create slides (for-\f[C]beamer\f[R], \f[C]s5\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R],-\f[C]dzslides\f[R]).-Headers above this level in the hierarchy are used to divide the slide-show into sections; headers below this level create subheads within a-slide.-Note that content that is not contained under slide\-level headers will-not appear in the slide show.-The default is to set the slide level based on the contents of the-document; see Structuring the slide show.-.TP-.B \f[C]\-\-section\-divs\f[R]-Wrap sections in \f[C]<section>\f[R] tags (or \f[C]<div>\f[R] tags for-\f[C]html4\f[R]), and attach identifiers to the enclosing-\f[C]<section>\f[R] (or \f[C]<div>\f[R]) rather than the header itself.-See Header identifiers, below.-.TP-.B \f[C]\-\-email\-obfuscation=none\f[R]|\f[C]javascript\f[R]|\f[C]references\f[R]-Specify a method for obfuscating \f[C]mailto:\f[R] links in HTML-documents.-\f[C]none\f[R] leaves \f[C]mailto:\f[R] links as they are.-\f[C]javascript\f[R] obfuscates them using JavaScript.-\f[C]references\f[R] obfuscates them by printing their letters as-decimal or hexadecimal character references.-The default is \f[C]none\f[R].-.TP-.B \f[C]\-\-id\-prefix=\f[R]\f[I]STRING\f[R]-Specify a prefix to be added to all identifiers and internal links in-HTML and DocBook output, and to footnote numbers in Markdown and Haddock-output.-This is useful for preventing duplicate identifiers when generating-fragments to be included in other pages.-.TP-.B \f[C]\-T\f[R] \f[I]STRING\f[R], \f[C]\-\-title\-prefix=\f[R]\f[I]STRING\f[R]-Specify \f[I]STRING\f[R] as a prefix at the beginning of the title that-appears in the HTML header (but not in the title as it appears at the-beginning of the HTML body).-Implies \f[C]\-\-standalone\f[R].-.TP-.B \f[C]\-c\f[R] \f[I]URL\f[R], \f[C]\-\-css=\f[R]\f[I]URL\f[R]-Link to a CSS style sheet.-This option can be used repeatedly to include multiple files.-They will be included in the order specified.-.RS-.PP-A stylesheet is required for generating EPUB.-If none is provided using this option (or the \f[C]css\f[R] or-\f[C]stylesheet\f[R] metadata fields), pandoc will look for a file-\f[C]epub.css\f[R] in the user data directory (see-\f[C]\-\-data\-dir\f[R]).-If it is not found there, sensible defaults will be used.-.RE-.TP-.B \f[C]\-\-reference\-doc=\f[R]\f[I]FILE\f[R]-Use the specified file as a style reference in producing a docx or ODT-file.-.RS-.TP-.B Docx-For best results, the reference docx should be a modified version of a-docx file produced using pandoc.-The contents of the reference docx are ignored, but its stylesheets and-document properties (including margins, page size, header, and footer)-are used in the new docx.-If no reference docx is specified on the command line, pandoc will look-for a file \f[C]reference.docx\f[R] in the user data directory (see-\f[C]\-\-data\-dir\f[R]).-If this is not found either, sensible defaults will be used.-.RS-.PP-To produce a custom \f[C]reference.docx\f[R], first get a copy of the-default \f[C]reference.docx\f[R]:-\f[C]pandoc \-\-print\-default\-data\-file reference.docx > custom\-reference.docx\f[R].-Then open \f[C]custom\-reference.docx\f[R] in Word, modify the styles as-you wish, and save the file.-For best results, do not make changes to this file other than modifying-the styles used by pandoc: [paragraph] Normal, Body Text, First-Paragraph, Compact, Title, Subtitle, Author, Date, Abstract,-Bibliography, Heading 1, Heading 2, Heading 3, Heading 4, Heading 5,-Heading 6, Heading 7, Heading 8, Heading 9, Block Text, Footnote Text,-Definition Term, Definition, Caption, Table Caption, Image Caption,-Figure, Captioned Figure, TOC Heading; [character] Default Paragraph-Font, Body Text Char, Verbatim Char, Footnote Reference, Hyperlink;-[table] Table.-.RE-.TP-.B ODT-For best results, the reference ODT should be a modified version of an-ODT produced using pandoc.-The contents of the reference ODT are ignored, but its stylesheets are-used in the new ODT.-If no reference ODT is specified on the command line, pandoc will look-for a file \f[C]reference.odt\f[R] in the user data directory (see-\f[C]\-\-data\-dir\f[R]).-If this is not found either, sensible defaults will be used.-.RS-.PP-To produce a custom \f[C]reference.odt\f[R], first get a copy of the-default \f[C]reference.odt\f[R]:-\f[C]pandoc \-\-print\-default\-data\-file reference.odt > custom\-reference.odt\f[R].-Then open \f[C]custom\-reference.odt\f[R] in LibreOffice, modify the-styles as you wish, and save the file.-.RE-.TP-.B PowerPoint-Any template included with a recent install of Microsoft PowerPoint-(either with \f[C].pptx\f[R] or \f[C].potx\f[R] extension) should work,-as will most templates derived from these.-.RS-.PP-The specific requirement is that the template should contain the-following four layouts as its first four layouts:-.IP "1." 3-Title Slide-.IP "2." 3-Title and Content-.IP "3." 3-Section Header-.IP "4." 3-Two Content-.PP-All templates included with a recent version of MS PowerPoint will fit-these criteria.-(You can click on \f[C]Layout\f[R] under the \f[C]Home\f[R] menu to-check.)-.PP-You can also modify the default \f[C]reference.pptx\f[R]: first run-\f[C]pandoc \-\-print\-default\-data\-file reference.pptx > custom\-reference.pptx\f[R],-and then modify \f[C]custom\-reference.pptx\f[R] in MS PowerPoint-(pandoc will use the first four layout slides, as mentioned above).-.RE-.RE-.TP-.B \f[C]\-\-epub\-cover\-image=\f[R]\f[I]FILE\f[R]-Use the specified image as the EPUB cover.-It is recommended that the image be less than 1000px in width and-height.-Note that in a Markdown source document you can also specify-\f[C]cover\-image\f[R] in a YAML metadata block (see EPUB Metadata,-below).-.TP-.B \f[C]\-\-epub\-metadata=\f[R]\f[I]FILE\f[R]-Look in the specified XML file for metadata for the EPUB.-The file should contain a series of Dublin Core elements.-For example:-.RS-.IP-.nf-\f[C]- <dc:rights>Creative Commons</dc:rights>- <dc:language>es\-AR</dc:language>-\f[R]-.fi-.PP-By default, pandoc will include the following metadata elements:-\f[C]<dc:title>\f[R] (from the document title), \f[C]<dc:creator>\f[R]-(from the document authors), \f[C]<dc:date>\f[R] (from the document-date, which should be in ISO 8601 format), \f[C]<dc:language>\f[R] (from-the \f[C]lang\f[R] variable, or, if is not set, the locale), and-\f[C]<dc:identifier id=\[dq]BookId\[dq]>\f[R] (a randomly generated-UUID).-Any of these may be overridden by elements in the metadata file.-.PP-Note: if the source document is Markdown, a YAML metadata block in the-document can be used instead.-See below under EPUB Metadata.-.RE-.TP-.B \f[C]\-\-epub\-embed\-font=\f[R]\f[I]FILE\f[R]-Embed the specified font in the EPUB.-This option can be repeated to embed multiple fonts.-Wildcards can also be used: for example, \f[C]DejaVuSans\-*.ttf\f[R].-However, if you use wildcards on the command line, be sure to escape-them or put the whole filename in single quotes, to prevent them from-being interpreted by the shell.-To use the embedded fonts, you will need to add declarations like the-following to your CSS (see \f[C]\-\-css\f[R]):-.RS-.IP-.nf-\f[C]-\[at]font\-face {-font\-family: DejaVuSans;-font\-style: normal;-font\-weight: normal;-src:url(\[dq]DejaVuSans\-Regular.ttf\[dq]);-}-\[at]font\-face {-font\-family: DejaVuSans;-font\-style: normal;-font\-weight: bold;-src:url(\[dq]DejaVuSans\-Bold.ttf\[dq]);-}-\[at]font\-face {-font\-family: DejaVuSans;-font\-style: italic;-font\-weight: normal;-src:url(\[dq]DejaVuSans\-Oblique.ttf\[dq]);-}-\[at]font\-face {-font\-family: DejaVuSans;-font\-style: italic;-font\-weight: bold;-src:url(\[dq]DejaVuSans\-BoldOblique.ttf\[dq]);-}-body { font\-family: \[dq]DejaVuSans\[dq]; }-\f[R]-.fi-.RE-.TP-.B \f[C]\-\-epub\-chapter\-level=\f[R]\f[I]NUMBER\f[R]-Specify the header level at which to split the EPUB into separate-\[dq]chapter\[dq] files.-The default is to split into chapters at level 1 headers.-This option only affects the internal composition of the EPUB, not the-way chapters and sections are displayed to users.-Some readers may be slow if the chapter files are too large, so for-large documents with few level 1 headers, one might want to use a-chapter level of 2 or 3.-.TP-.B \f[C]\-\-epub\-subdirectory=\f[R]\f[I]DIRNAME\f[R]-Specify the subdirectory in the OCF container that is to hold the-EPUB\-specific contents.-The default is \f[C]EPUB\f[R].-To put the EPUB contents in the top level, use an empty string.-.TP-.B \f[C]\-\-pdf\-engine=pdflatex\f[R]|\f[C]lualatex\f[R]|\f[C]xelatex\f[R]|\f[C]wkhtmltopdf\f[R]|\f[C]weasyprint\f[R]|\f[C]prince\f[R]|\f[C]context\f[R]|\f[C]pdfroff\f[R]-Use the specified engine when producing PDF output.-The default is \f[C]pdflatex\f[R].-If the engine is not in your PATH, the full path of the engine may be-specified here.-.TP-.B \f[C]\-\-pdf\-engine\-opt=\f[R]\f[I]STRING\f[R]-Use the given string as a command\-line argument to the-\f[C]pdf\-engine\f[R].-If used multiple times, the arguments are provided with spaces between-them.-Note that no check for duplicate options is done.-.SS Citation rendering-.TP-.B \f[C]\-\-bibliography=\f[R]\f[I]FILE\f[R]-Set the \f[C]bibliography\f[R] field in the document\[aq]s metadata to-\f[I]FILE\f[R], overriding any value set in the metadata, and process-citations using \f[C]pandoc\-citeproc\f[R].-(This is equivalent to-\f[C]\-\-metadata bibliography=FILE \-\-filter pandoc\-citeproc\f[R].)-If \f[C]\-\-natbib\f[R] or \f[C]\-\-biblatex\f[R] is also supplied,-\f[C]pandoc\-citeproc\f[R] is not used, making this equivalent to-\f[C]\-\-metadata bibliography=FILE\f[R].-If you supply this argument multiple times, each \f[I]FILE\f[R] will be-added to bibliography.-.TP-.B \f[C]\-\-csl=\f[R]\f[I]FILE\f[R]-Set the \f[C]csl\f[R] field in the document\[aq]s metadata to-\f[I]FILE\f[R], overriding any value set in the metadata.-(This is equivalent to \f[C]\-\-metadata csl=FILE\f[R].) This option is-only relevant with \f[C]pandoc\-citeproc\f[R].-.TP-.B \f[C]\-\-citation\-abbreviations=\f[R]\f[I]FILE\f[R]-Set the \f[C]citation\-abbreviations\f[R] field in the document\[aq]s-metadata to \f[I]FILE\f[R], overriding any value set in the metadata.-(This is equivalent to-\f[C]\-\-metadata citation\-abbreviations=FILE\f[R].) This option is-only relevant with \f[C]pandoc\-citeproc\f[R].-.TP-.B \f[C]\-\-natbib\f[R]-Use \f[C]natbib\f[R] for citations in LaTeX output.-This option is not for use with the \f[C]pandoc\-citeproc\f[R] filter or-with PDF output.-It is intended for use in producing a LaTeX file that can be processed-with \f[C]bibtex\f[R].-.TP-.B \f[C]\-\-biblatex\f[R]-Use \f[C]biblatex\f[R] for citations in LaTeX output.-This option is not for use with the \f[C]pandoc\-citeproc\f[R] filter or-with PDF output.-It is intended for use in producing a LaTeX file that can be processed-with \f[C]bibtex\f[R] or \f[C]biber\f[R].-.SS Math rendering in HTML-.PP-The default is to render TeX math as far as possible using Unicode-characters.-Formulas are put inside a \f[C]span\f[R] with-\f[C]class=\[dq]math\[dq]\f[R], so that they may be styled differently-from the surrounding text if needed.-However, this gives acceptable results only for basic math, usually you-will want to use \f[C]\-\-mathjax\f[R] or another of the following-options.-.TP-.B \f[C]\-\-mathjax\f[R][\f[C]=\f[R]\f[I]URL\f[R]]-Use MathJax to display embedded TeX math in HTML output.-TeX math will be put between \f[C]\[rs](...\[rs])\f[R] (for inline math)-or \f[C]\[rs][...\[rs]]\f[R] (for display math) and wrapped in-\f[C]<span>\f[R] tags with class \f[C]math\f[R].-Then the MathJax JavaScript will render it.-The \f[I]URL\f[R] should point to the \f[C]MathJax.js\f[R] load script.-If a \f[I]URL\f[R] is not provided, a link to the Cloudflare CDN will be-inserted.-.TP-.B \f[C]\-\-mathml\f[R]-Convert TeX math to MathML (in \f[C]epub3\f[R], \f[C]docbook4\f[R],-\f[C]docbook5\f[R], \f[C]jats\f[R], \f[C]html4\f[R] and-\f[C]html5\f[R]).-This is the default in \f[C]odt\f[R] output.-Note that currently only Firefox and Safari (and select e\-book readers)-natively support MathML.-.TP-.B \f[C]\-\-webtex\f[R][\f[C]=\f[R]\f[I]URL\f[R]]-Convert TeX formulas to \f[C]<img>\f[R] tags that link to an external-script that converts formulas to images.-The formula will be URL\-encoded and concatenated with the URL provided.-For SVG images you can for example use-\f[C]\-\-webtex https://latex.codecogs.com/svg.latex?\f[R].-If no URL is specified, the CodeCogs URL generating PNGs will be used-(\f[C]https://latex.codecogs.com/png.latex?\f[R]).-Note: the \f[C]\-\-webtex\f[R] option will affect Markdown output as-well as HTML, which is useful if you\[aq]re targeting a version of-Markdown without native math support.-.TP-.B \f[C]\-\-katex\f[R][\f[C]=\f[R]\f[I]URL\f[R]]-Use KaTeX to display embedded TeX math in HTML output.-The \f[I]URL\f[R] is the base URL for the KaTeX library.-That directory should contain a \f[C]katex.min.js\f[R] and a-\f[C]katex.min.css\f[R] file.-If a \f[I]URL\f[R] is not provided, a link to the KaTeX CDN will be-inserted.-.TP-.B \f[C]\-\-gladtex\f[R]-Enclose TeX math in \f[C]<eq>\f[R] tags in HTML output.-The resulting HTML can then be processed by GladTeX to produce images of-the typeset formulas and an HTML file with links to these images.-So, the procedure is:-.RS-.IP-.nf-\f[C]-pandoc \-s \-\-gladtex input.md \-o myfile.htex-gladtex \-d myfile\-images myfile.htex-# produces myfile.html and images in myfile\-images-\f[R]-.fi-.RE-.SS Options for wrapper scripts-.TP-.B \f[C]\-\-dump\-args\f[R]-Print information about command\-line arguments to \f[I]stdout\f[R],-then exit.-This option is intended primarily for use in wrapper scripts.-The first line of output contains the name of the output file specified-with the \f[C]\-o\f[R] option, or \f[C]\-\f[R] (for \f[I]stdout\f[R]) if-no output file was specified.-The remaining lines contain the command\-line arguments, one per line,-in the order they appear.-These do not include regular pandoc options and their arguments, but do-include any options appearing after a \f[C]\-\-\f[R] separator at the-end of the line.-.TP-.B \f[C]\-\-ignore\-args\f[R]-Ignore command\-line arguments (for use in wrapper scripts).-Regular pandoc options are not ignored.-Thus, for example,-.RS-.IP-.nf-\f[C]-pandoc \-\-ignore\-args \-o foo.html \-s foo.txt \-\- \-e latin1-\f[R]-.fi-.PP-is equivalent to-.IP-.nf-\f[C]-pandoc \-o foo.html \-s-\f[R]-.fi-.RE-.SH TEMPLATES-.PP-When the \f[C]\-s/\-\-standalone\f[R] option is used, pandoc uses a-template to add header and footer material that is needed for a-self\-standing document.-To see the default template that is used, just type-.IP-.nf-\f[C]-pandoc \-D *FORMAT*-\f[R]-.fi-.PP-where \f[I]FORMAT\f[R] is the name of the output format.-A custom template can be specified using the \f[C]\-\-template\f[R]-option.-You can also override the system default templates for a given output-format \f[I]FORMAT\f[R] by putting a file-\f[C]templates/default.*FORMAT*\f[R] in the user data directory (see-\f[C]\-\-data\-dir\f[R], above).-\f[I]Exceptions:\f[R]-.IP \[bu] 2-For \f[C]odt\f[R] output, customize the \f[C]default.opendocument\f[R]-template.-.IP \[bu] 2-For \f[C]pdf\f[R] output, customize the \f[C]default.latex\f[R] template-(or the \f[C]default.context\f[R] template, if you use-\f[C]\-t context\f[R], or the \f[C]default.ms\f[R] template, if you use-\f[C]\-t ms\f[R], or the \f[C]default.html\f[R] template, if you use-\f[C]\-t html\f[R]).-.IP \[bu] 2-\f[C]docx\f[R] has no template (however, you can use-\f[C]\-\-reference\-doc\f[R] to customize the output).-.PP-Templates contain \f[I]variables\f[R], which allow for the inclusion of-arbitrary information at any point in the file.-They may be set at the command line using the \f[C]\-V/\-\-variable\f[R]-option.-If a variable is not set, pandoc will look for the key in the-document\[aq]s metadata \[en] which can be set using either YAML-metadata blocks or with the \f[C]\-\-metadata\f[R] option.-.SS Variables set by pandoc-.PP-Some variables are set automatically by pandoc.-These vary somewhat depending on the output format, but include the-following:-.TP-.B \f[C]sourcefile\f[R], \f[C]outputfile\f[R]-source and destination filenames, as given on the command line.-\f[C]sourcefile\f[R] can also be a list if input comes from multiple-files, or empty if input is from stdin.-You can use the following snippet in your template to distinguish them:-.RS-.IP-.nf-\f[C]-$if(sourcefile)$-$for(sourcefile)$-$sourcefile$-$endfor$-$else$-(stdin)-$endif$-\f[R]-.fi-.PP-Similarly, \f[C]outputfile\f[R] can be \f[C]\-\f[R] if output goes to-the terminal.-.RE-.TP-.B \f[C]title\f[R], \f[C]author\f[R], \f[C]date\f[R]-allow identification of basic aspects of the document.-Included in PDF metadata through LaTeX and ConTeXt.-These can be set through a pandoc title block, which allows for multiple-authors, or through a YAML metadata block:-.RS-.IP-.nf-\f[C]-\-\-\--author:-\- Aristotle-\- Peter Abelard-\&...-\f[R]-.fi-.RE-.TP-.B \f[C]subtitle\f[R]-document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and Word-docx; renders in LaTeX only when using a document class that supports-\f[C]\[rs]subtitle\f[R], such as \f[C]beamer\f[R] or the KOMA\-Script-series (\f[C]scrartcl\f[R], \f[C]scrreprt\f[R], \f[C]scrbook\f[R]).-.TP-.B \f[C]institute\f[R]-author affiliations (in LaTeX and Beamer only).-Can be a list, when there are multiple authors.-.TP-.B \f[C]abstract\f[R]-document summary, included in LaTeX, ConTeXt, AsciiDoc, and Word docx-.TP-.B \f[C]keywords\f[R]-list of keywords to be included in HTML, PDF, and AsciiDoc metadata; may-be repeated as for \f[C]author\f[R], above-.TP-.B \f[C]header\-includes\f[R]-contents specified by \f[C]\-H/\-\-include\-in\-header\f[R] (may have-multiple values)-.TP-.B \f[C]toc\f[R]-non\-null value if \f[C]\-\-toc/\-\-table\-of\-contents\f[R] was-specified-.TP-.B \f[C]toc\-title\f[R]-title of table of contents (works only with EPUB, opendocument, odt,-docx, pptx, beamer, LaTeX)-.TP-.B \f[C]include\-before\f[R]-contents specified by \f[C]\-B/\-\-include\-before\-body\f[R] (may have-multiple values)-.TP-.B \f[C]include\-after\f[R]-contents specified by \f[C]\-A/\-\-include\-after\-body\f[R] (may have-multiple values)-.TP-.B \f[C]body\f[R]-body of document-.TP-.B \f[C]meta\-json\f[R]-JSON representation of all of the document\[aq]s metadata.-Field values are transformed to the selected output format.-.SS Language variables-.TP-.B \f[C]lang\f[R]-identifies the main language of the document, using a code according to-BCP 47 (e.g.-\f[C]en\f[R] or \f[C]en\-GB\f[R]).-For some output formats, pandoc will convert it to an appropriate format-stored in the additional variables \f[C]babel\-lang\f[R],-\f[C]polyglossia\-lang\f[R] (LaTeX) and \f[C]context\-lang\f[R]-(ConTeXt).-.RS-.PP-Native pandoc Spans and Divs with the lang attribute (value in BCP 47)-can be used to switch the language in that range.-In LaTeX output, \f[C]babel\-otherlangs\f[R] and-\f[C]polyglossia\-otherlangs\f[R] variables will be generated-automatically based on the \f[C]lang\f[R] attributes of Spans and Divs-in the document.-.RE-.TP-.B \f[C]dir\f[R]-the base direction of the document, either \f[C]rtl\f[R]-(right\-to\-left) or \f[C]ltr\f[R] (left\-to\-right).-.RS-.PP-For bidirectional documents, native pandoc \f[C]span\f[R]s and-\f[C]div\f[R]s with the \f[C]dir\f[R] attribute (value \f[C]rtl\f[R] or-\f[C]ltr\f[R]) can be used to override the base direction in some output-formats.-This may not always be necessary if the final renderer (e.g.-the browser, when generating HTML) supports the Unicode Bidirectional-Algorithm.-.PP-When using LaTeX for bidirectional documents, only the \f[C]xelatex\f[R]-engine is fully supported (use \f[C]\-\-pdf\-engine=xelatex\f[R]).-.RE-.SS Variables for slides-.PP-Variables are available for producing slide shows with pandoc, including-all reveal.js configuration options.-.TP-.B \f[C]titlegraphic\f[R]-title graphic for Beamer documents-.TP-.B \f[C]logo\f[R]-logo for Beamer documents-.TP-.B \f[C]slidy\-url\f[R]-base URL for Slidy documents (defaults to-\f[C]https://www.w3.org/Talks/Tools/Slidy2\f[R])-.TP-.B \f[C]slideous\-url\f[R]-base URL for Slideous documents (defaults to \f[C]slideous\f[R])-.TP-.B \f[C]s5\-url\f[R]-base URL for S5 documents (defaults to \f[C]s5/default\f[R])-.TP-.B \f[C]revealjs\-url\f[R]-base URL for reveal.js documents (defaults to \f[C]reveal.js\f[R])-.TP-.B \f[C]theme\f[R], \f[C]colortheme\f[R], \f[C]fonttheme\f[R], \f[C]innertheme\f[R], \f[C]outertheme\f[R]-themes for LaTeX \f[C]beamer\f[R] documents-.TP-.B \f[C]themeoptions\f[R]-options for LaTeX beamer themes (a list).-.TP-.B \f[C]navigation\f[R]-controls navigation symbols in \f[C]beamer\f[R] documents (default is-\f[C]empty\f[R] for no navigation symbols; other valid values are-\f[C]frame\f[R], \f[C]vertical\f[R], and \f[C]horizontal\f[R]).-.TP-.B \f[C]section\-titles\f[R]-enables on \[dq]title pages\[dq] for new sections in \f[C]beamer\f[R]-documents (default = true).-.TP-.B \f[C]beamerarticle\f[R]-when true, the \f[C]beamerarticle\f[R] package is loaded (for producing-an article from beamer slides).-.TP-.B \f[C]aspectratio\f[R]-aspect ratio of slides (for beamer only, \f[C]1610\f[R] for 16:10,-\f[C]169\f[R] for 16:9, \f[C]149\f[R] for 14:9, \f[C]141\f[R] for-1.41:1, \f[C]54\f[R] for 5:4, \f[C]43\f[R] for 4:3 which is the default,-and \f[C]32\f[R] for 3:2).-.SS Variables for LaTeX-.PP-LaTeX variables are used when creating a PDF.-.TP-.B \f[C]papersize\f[R]-paper size, e.g.-\f[C]letter\f[R], \f[C]a4\f[R]-.TP-.B \f[C]fontsize\f[R]-font size for body text (e.g.-\f[C]10pt\f[R], \f[C]12pt\f[R])-.TP-.B \f[C]documentclass\f[R]-document class, e.g.-\f[C]article\f[R], \f[C]report\f[R], \f[C]book\f[R], \f[C]memoir\f[R]-.TP-.B \f[C]classoption\f[R]-option for document class, e.g.-\f[C]oneside\f[R]; may be repeated for multiple options-.TP-.B \f[C]beameroption\f[R]-In beamer, add extra beamer option with \f[C]\[rs]setbeameroption{}\f[R]-.TP-.B \f[C]geometry\f[R]-option for \f[C]geometry\f[R] package, e.g.-\f[C]margin=1in\f[R]; may be repeated for multiple options-.TP-.B \f[C]margin\-left\f[R], \f[C]margin\-right\f[R], \f[C]margin\-top\f[R], \f[C]margin\-bottom\f[R]-sets margins, if \f[C]geometry\f[R] is not used (otherwise-\f[C]geometry\f[R] overrides these)-.TP-.B \f[C]linestretch\f[R]-adjusts line spacing using the \f[C]setspace\f[R] package, e.g.-\f[C]1.25\f[R], \f[C]1.5\f[R]-.TP-.B \f[C]fontfamily\f[R]-font package for use with \f[C]pdflatex\f[R]: TeX Live includes many-options, documented in the LaTeX Font Catalogue.-The default is Latin Modern.-.TP-.B \f[C]fontfamilyoptions\f[R]-options for package used as \f[C]fontfamily\f[R]: e.g.-\f[C]osf,sc\f[R] with \f[C]fontfamily\f[R] set to \f[C]mathpazo\f[R]-provides Palatino with old\-style figures and true small caps; may be-repeated for multiple options-.TP-.B \f[C]mainfont\f[R], \f[C]romanfont\f[R], \f[C]sansfont\f[R], \f[C]monofont\f[R], \f[C]mathfont\f[R], \f[C]CJKmainfont\f[R]-font families for use with \f[C]xelatex\f[R] or \f[C]lualatex\f[R]: take-the name of any system font, using the \f[C]fontspec\f[R] package.-Note that if \f[C]CJKmainfont\f[R] is used, the \f[C]xecjk\f[R] package-must be available.-.TP-.B \f[C]mainfontoptions\f[R], \f[C]romanfontoptions\f[R], \f[C]sansfontoptions\f[R], \f[C]monofontoptions\f[R], \f[C]mathfontoptions\f[R], \f[C]CJKoptions\f[R]-options to use with \f[C]mainfont\f[R], \f[C]sansfont\f[R],-\f[C]monofont\f[R], \f[C]mathfont\f[R], \f[C]CJKmainfont\f[R] in-\f[C]xelatex\f[R] and \f[C]lualatex\f[R].-Allow for any choices available through \f[C]fontspec\f[R], such as the-OpenType features \f[C]Numbers=OldStyle,Numbers=Proportional\f[R].-May be repeated for multiple options.-.TP-.B \f[C]fontenc\f[R]-allows font encoding to be specified through \f[C]fontenc\f[R] package-(with \f[C]pdflatex\f[R]); default is \f[C]T1\f[R] (see guide to LaTeX-font encodings)-.TP-.B \f[C]microtypeoptions\f[R]-options to pass to the microtype package-.TP-.B \f[C]colorlinks\f[R]-add color to link text; automatically enabled if any of-\f[C]linkcolor\f[R], \f[C]filecolor\f[R], \f[C]citecolor\f[R],-\f[C]urlcolor\f[R], or \f[C]toccolor\f[R] are set-.TP-.B \f[C]linkcolor\f[R], \f[C]filecolor\f[R], \f[C]citecolor\f[R], \f[C]urlcolor\f[R], \f[C]toccolor\f[R]-color for internal links, external links, citation links, linked URLs,-and links in table of contents, respectively: uses options allowed by-\f[C]xcolor\f[R], including the \f[C]dvipsnames\f[R],-\f[C]svgnames\f[R], and \f[C]x11names\f[R] lists-.TP-.B \f[C]links\-as\-notes\f[R]-causes links to be printed as footnotes-.TP-.B \f[C]indent\f[R]-uses document class settings for indentation (the default LaTeX template-otherwise removes indentation and adds space between paragraphs)-.TP-.B \f[C]subparagraph\f[R]-disables default behavior of LaTeX template that redefines-(sub)paragraphs as sections, changing the appearance of nested headings-in some classes-.TP-.B \f[C]thanks\f[R]-specifies contents of acknowledgments footnote after document title.-.TP-.B \f[C]toc\f[R]-include table of contents (can also be set using-\f[C]\-\-toc/\-\-table\-of\-contents\f[R])-.TP-.B \f[C]toc\-depth\f[R]-level of section to include in table of contents-.TP-.B \f[C]secnumdepth\f[R]-numbering depth for sections, if sections are numbered-.TP-.B \f[C]lof\f[R], \f[C]lot\f[R]-include list of figures, list of tables-.TP-.B \f[C]bibliography\f[R]-bibliography to use for resolving references-.TP-.B \f[C]biblio\-style\f[R]-bibliography style, when used with \f[C]\-\-natbib\f[R] and-\f[C]\-\-biblatex\f[R].-.TP-.B \f[C]biblio\-title\f[R]-bibliography title, when used with \f[C]\-\-natbib\f[R] and-\f[C]\-\-biblatex\f[R].-.TP-.B \f[C]biblatexoptions\f[R]-list of options for biblatex.-.TP-.B \f[C]natbiboptions\f[R]-list of options for natbib.-.TP-.B \f[C]pagestyle\f[R]-An option for LaTeX\[aq]s \f[C]\[rs]pagestyle{}\f[R].-The default article class supports \[aq]plain\[aq] (default),-\[aq]empty\[aq], and \[aq]headings\[aq]; headings puts section titles in-the header.-.SS Variables for ConTeXt-.TP-.B \f[C]papersize\f[R]-paper size, e.g.-\f[C]letter\f[R], \f[C]A4\f[R], \f[C]landscape\f[R] (see ConTeXt Paper-Setup); may be repeated for multiple options-.TP-.B \f[C]layout\f[R]-options for page margins and text arrangement (see ConTeXt Layout); may-be repeated for multiple options-.TP-.B \f[C]margin\-left\f[R], \f[C]margin\-right\f[R], \f[C]margin\-top\f[R], \f[C]margin\-bottom\f[R]-sets margins, if \f[C]layout\f[R] is not used (otherwise-\f[C]layout\f[R] overrides these)-.TP-.B \f[C]fontsize\f[R]-font size for body text (e.g.-\f[C]10pt\f[R], \f[C]12pt\f[R])-.TP-.B \f[C]mainfont\f[R], \f[C]sansfont\f[R], \f[C]monofont\f[R], \f[C]mathfont\f[R]-font families: take the name of any system font (see ConTeXt Font-Switching)-.TP-.B \f[C]linkcolor\f[R], \f[C]contrastcolor\f[R]-color for links outside and inside a page, e.g.-\f[C]red\f[R], \f[C]blue\f[R] (see ConTeXt Color)-.TP-.B \f[C]linkstyle\f[R]-typeface style for links, e.g.-\f[C]normal\f[R], \f[C]bold\f[R], \f[C]slanted\f[R],-\f[C]boldslanted\f[R], \f[C]type\f[R], \f[C]cap\f[R], \f[C]small\f[R]-.TP-.B \f[C]indenting\f[R]-controls indentation of paragraphs, e.g.-\f[C]yes,small,next\f[R] (see ConTeXt Indentation); may be repeated for-multiple options-.TP-.B \f[C]whitespace\f[R]-spacing between paragraphs, e.g.-\f[C]none\f[R], \f[C]small\f[R] (using \f[C]setupwhitespace\f[R])-.TP-.B \f[C]interlinespace\f[R]-adjusts line spacing, e.g.-\f[C]4ex\f[R] (using \f[C]setupinterlinespace\f[R]); may be repeated for-multiple options-.TP-.B \f[C]headertext\f[R], \f[C]footertext\f[R]-text to be placed in running header or footer (see ConTeXt Headers and-Footers); may be repeated up to four times for different placement-.TP-.B \f[C]pagenumbering\f[R]-page number style and location (using \f[C]setuppagenumbering\f[R]); may-be repeated for multiple options-.TP-.B \f[C]toc\f[R]-include table of contents (can also be set using-\f[C]\-\-toc/\-\-table\-of\-contents\f[R])-.TP-.B \f[C]lof\f[R], \f[C]lot\f[R]-include list of figures, list of tables-.TP-.B \f[C]pdfa\f[R]-adds to the preamble the setup necessary to generate PDF/A\-1b:2005.-To successfully generate PDF/A the required ICC color profiles have to-be available and the content and all included files (such as images)-have to be standard conforming.-The ICC profiles can be obtained from ConTeXt ICC Profiles.-See also ConTeXt PDFA for more details.-.SS Variables for man pages-.TP-.B \f[C]section\f[R]-section number in man pages-.TP-.B \f[C]header\f[R]-header in man pages-.TP-.B \f[C]footer\f[R]-footer in man pages-.TP-.B \f[C]adjusting\f[R]-adjusts text to left (\f[C]l\f[R]), right (\f[C]r\f[R]), center-(\f[C]c\f[R]), or both (\f[C]b\f[R]) margins-.TP-.B \f[C]hyphenate\f[R]-if \f[C]true\f[R] (the default), hyphenation will be used-.SS Variables for ms-.TP-.B \f[C]pointsize\f[R]-point size (e.g.-\f[C]10p\f[R])-.TP-.B \f[C]lineheight\f[R]-line height (e.g.-\f[C]12p\f[R])-.TP-.B \f[C]fontfamily\f[R]-font family (e.g.-\f[C]T\f[R] or \f[C]P\f[R])-.TP-.B \f[C]indent\f[R]-paragraph indent (e.g.-\f[C]2m\f[R])-.SS Using variables in templates-.PP-Variable names are sequences of alphanumerics, \f[C]\-\f[R], and-\f[C]_\f[R], starting with a letter.-A variable name surrounded by \f[C]$\f[R] signs will be replaced by its-value.-For example, the string \f[C]$title$\f[R] in-.IP-.nf-\f[C]-<title>$title$</title>-\f[R]-.fi-.PP-will be replaced by the document title.-.PP-To write a literal \f[C]$\f[R] in a template, use \f[C]$$\f[R].-.PP-Templates may contain conditionals.-The syntax is as follows:-.IP-.nf-\f[C]-$if(variable)$-X-$else$-Y-$endif$-\f[R]-.fi-.PP-This will include \f[C]X\f[R] in the template if \f[C]variable\f[R] has-a truthy value; otherwise it will include \f[C]Y\f[R].-Here a truthy value is any of the following:-.IP \[bu] 2-a string that is not entirely white space,-.IP \[bu] 2-a non\-empty array where the first value is truthy,-.IP \[bu] 2-any number (including zero),-.IP \[bu] 2-any object,-.IP \[bu] 2-the boolean \f[C]true\f[R] (to specify the boolean \f[C]true\f[R] value-using YAML metadata or the \f[C]\-\-metadata\f[R] flag, use-\f[C]true\f[R], \f[C]True\f[R], or \f[C]TRUE\f[R]; with the-\f[C]\-\-variable\f[R] flag, simply omit a value for the variable, e.g.-\f[C]\-\-variable draft\f[R]).-.PP-\f[C]X\f[R] and \f[C]Y\f[R] are placeholders for any valid template-text, and may include interpolated variables or other conditionals.-The \f[C]$else$\f[R] section may be omitted.-.PP-When variables can have multiple values (for example, \f[C]author\f[R]-in a multi\-author document), you can use the \f[C]$for$\f[R] keyword:-.IP-.nf-\f[C]-$for(author)$-<meta name=\[dq]author\[dq] content=\[dq]$author$\[dq] />-$endfor$-\f[R]-.fi-.PP-You can optionally specify a separator to be used between consecutive-items:-.IP-.nf-\f[C]-$for(author)$$author$$sep$, $endfor$-\f[R]-.fi-.PP-A dot can be used to select a field of a variable that takes an object-as its value.-So, for example:-.IP-.nf-\f[C]-$author.name$ ($author.affiliation$)-\f[R]-.fi-.PP-If you use custom templates, you may need to revise them as pandoc-changes.-We recommend tracking the changes in the default templates, and-modifying your custom templates accordingly.-An easy way to do this is to fork the pandoc\-templates repository and-merge in changes after each pandoc release.-.PP-Templates may contain comments: anything on a line after \f[C]$\-\-\f[R]-will be treated as a comment and ignored.-.SH EXTENSIONS-.PP-The behavior of some of the readers and writers can be adjusted by-enabling or disabling various extensions.-.PP-An extension can be enabled by adding \f[C]+EXTENSION\f[R] to the format-name and disabled by adding \f[C]\-EXTENSION\f[R].-For example, \f[C]\-\-from markdown_strict+footnotes\f[R] is strict-Markdown with footnotes enabled, while-\f[C]\-\-from markdown\-footnotes\-pipe_tables\f[R] is pandoc\[aq]s-Markdown without footnotes or pipe tables.-.PP-The markdown reader and writer make by far the most use of extensions.-Extensions only used by them are therefore covered in the section-Pandoc\[aq]s Markdown below (See Markdown variants for-\f[C]commonmark\f[R] and \f[C]gfm\f[R].) In the following, extensions-that also work for other formats are covered.-.SS Typography-.SS Extension: \f[C]smart\f[R]-.PP-Interpret straight quotes as curly quotes, \f[C]\-\-\-\f[R] as-em\-dashes, \f[C]\-\-\f[R] as en\-dashes, and \f[C]...\f[R] as ellipses.-Nonbreaking spaces are inserted after certain abbreviations, such as-\[dq]Mr.\[dq]-.PP-This extension can be enabled/disabled for the following formats:-.TP-.B input formats-\f[C]markdown\f[R], \f[C]commonmark\f[R], \f[C]latex\f[R],-\f[C]mediawiki\f[R], \f[C]org\f[R], \f[C]rst\f[R], \f[C]twiki\f[R]-.TP-.B output formats-\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]context\f[R], \f[C]rst\f[R]-.TP-.B enabled by default in-\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]context\f[R] (both input and-output)-.PP-Note: If you are \f[I]writing\f[R] Markdown, then the \f[C]smart\f[R]-extension has the reverse effect: what would have been curly quotes-comes out straight.-.PP-In LaTeX, \f[C]smart\f[R] means to use the standard TeX ligatures for-quotation marks (\f[C]\[ga]\[ga]\f[R] and \f[C]\[aq]\[aq]\f[R] for-double quotes, \f[C]\[ga]\f[R] and \f[C]\[aq]\f[R] for single quotes)-and dashes (\f[C]\-\-\f[R] for en\-dash and \f[C]\-\-\-\f[R] for-em\-dash).-If \f[C]smart\f[R] is disabled, then in reading LaTeX pandoc will parse-these characters literally.-In writing LaTeX, enabling \f[C]smart\f[R] tells pandoc to use the-ligatures when possible; if \f[C]smart\f[R] is disabled pandoc will use-unicode quotation mark and dash characters.-.SS Headers and sections-.SS Extension: \f[C]auto_identifiers\f[R]-.PP-A header without an explicitly specified identifier will be-automatically assigned a unique identifier based on the header text.-.PP-This extension can be enabled/disabled for the following formats:-.TP-.B input formats-\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]rst\f[R], \f[C]mediawiki\f[R],-\f[C]textile\f[R]-.TP-.B output formats-\f[C]markdown\f[R], \f[C]muse\f[R]-.TP-.B enabled by default in-\f[C]markdown\f[R], \f[C]muse\f[R]-.PP-The default algorithm used to derive the identifier from the header text-is:-.IP \[bu] 2-Remove all formatting, links, etc.-.IP \[bu] 2-Remove all footnotes.-.IP \[bu] 2-Remove all punctuation, except underscores, hyphens, and periods.-.IP \[bu] 2-Replace all spaces and newlines with hyphens.-.IP \[bu] 2-Convert all alphabetic characters to lowercase.-.IP \[bu] 2-Remove everything up to the first letter (identifiers may not begin with-a number or punctuation mark).-.IP \[bu] 2-If nothing is left after this, use the identifier \f[C]section\f[R].-.PP-Thus, for example,-.PP-.TS-tab(@);-l l.-T{-Header-T}@T{-Identifier-T}-_-T{-\f[C]Header identifiers in HTML\f[R]-T}@T{-\f[C]header\-identifiers\-in\-html\f[R]-T}-T{-\f[C]*Dogs*?\-\-in *my* house?\f[R]-T}@T{-\f[C]dogs\-\-in\-my\-house\f[R]-T}-T{-\f[C][HTML], [S5], or [RTF]?\f[R]-T}@T{-\f[C]html\-s5\-or\-rtf\f[R]-T}-T{-\f[C]3. Applications\f[R]-T}@T{-\f[C]applications\f[R]-T}-T{-\f[C]33\f[R]-T}@T{-\f[C]section\f[R]-T}-.TE-.PP-These rules should, in most cases, allow one to determine the identifier-from the header text.-The exception is when several headers have the same text; in this case,-the first will get an identifier as described above; the second will get-the same identifier with \f[C]\-1\f[R] appended; the third with-\f[C]\-2\f[R]; and so on.-.PP-(However, a different algorithm is used if-\f[C]gfm_auto_identifiers\f[R] is enabled; see below.)-.PP-These identifiers are used to provide link targets in the table of-contents generated by the \f[C]\-\-toc|\-\-table\-of\-contents\f[R]-option.-They also make it easy to provide links from one section of a document-to another.-A link to this section, for example, might look like this:-.IP-.nf-\f[C]-See the section on-[header identifiers](#header\-identifiers\-in\-html\-latex\-and\-context).-\f[R]-.fi-.PP-Note, however, that this method of providing links to sections works-only in HTML, LaTeX, and ConTeXt formats.-.PP-If the \f[C]\-\-section\-divs\f[R] option is specified, then each-section will be wrapped in a \f[C]section\f[R] (or a \f[C]div\f[R], if-\f[C]html4\f[R] was specified), and the identifier will be attached to-the enclosing \f[C]<section>\f[R] (or \f[C]<div>\f[R]) tag rather than-the header itself.-This allows entire sections to be manipulated using JavaScript or-treated differently in CSS.-.SS Extension: \f[C]ascii_identifiers\f[R]-.PP-Causes the identifiers produced by \f[C]auto_identifiers\f[R] to be pure-ASCII.-Accents are stripped off of accented Latin letters, and non\-Latin-letters are omitted.-.SS Extension: \f[C]gfm_auto_identifiers\f[R]-.PP-Changes the algorithm used by \f[C]auto_identifiers\f[R] to conform to-GitHub\[aq]s method.-Spaces are converted to dashes (\f[C]\-\f[R]), uppercase characters to-lowercase characters, and punctuation characters other than \f[C]\-\f[R]-and \f[C]_\f[R] are removed.-.SS Math Input-.PP-The extensions \f[C]tex_math_dollars\f[R],-\f[C]tex_math_single_backslash\f[R], and-\f[C]tex_math_double_backslash\f[R] are described in the section about-Pandoc\[aq]s Markdown.-.PP-However, they can also be used with HTML input.-This is handy for reading web pages formatted using MathJax, for-example.-.SS Raw HTML/TeX-.PP-The following extensions (especially how they affect Markdown-input/output) are also described in more detail in their respective-sections of Pandoc\[aq]s Markdown.-.SS Extension: \f[C]raw_html\f[R]-.PP-When converting from HTML, parse elements to raw HTML which are not-representable in pandoc\[aq]s AST.-By default, this is disabled for HTML input.-.SS Extension: \f[C]raw_tex\f[R]-.PP-Allows raw LaTeX, TeX, and ConTeXt to be included in a document.-.PP-This extension can be enabled/disabled for the following formats (in-addition to \f[C]markdown\f[R]):-.TP-.B input formats-\f[C]latex\f[R], \f[C]org\f[R], \f[C]textile\f[R], \f[C]html\f[R]-(environments, \f[C]\[rs]ref\f[R], and \f[C]\[rs]eqref\f[R] only)-.TP-.B output formats-\f[C]textile\f[R], \f[C]commonmark\f[R]-.SS Extension: \f[C]native_divs\f[R]-.PP-This extension is enabled by default for HTML input.-This means that \f[C]div\f[R]s are parsed to pandoc native elements.-(Alternatively, you can parse them to raw HTML using-\f[C]\-f html\-native_divs+raw_html\f[R].)-.PP-When converting HTML to Markdown, for example, you may want to drop all-\f[C]div\f[R]s and \f[C]span\f[R]s:-.IP-.nf-\f[C]-pandoc \-f html\-native_divs\-native_spans \-t markdown-\f[R]-.fi-.SS Extension: \f[C]native_spans\f[R]-.PP-Analogous to \f[C]native_divs\f[R] above.-.SS Literate Haskell support-.SS Extension: \f[C]literate_haskell\f[R]-.PP-Treat the document as literate Haskell source.-.PP-This extension can be enabled/disabled for the following formats:-.TP-.B input formats-\f[C]markdown\f[R], \f[C]rst\f[R], \f[C]latex\f[R]-.TP-.B output formats-\f[C]markdown\f[R], \f[C]rst\f[R], \f[C]latex\f[R], \f[C]html\f[R]-.PP-If you append \f[C]+lhs\f[R] (or \f[C]+literate_haskell\f[R]) to one of-the formats above, pandoc will treat the document as literate Haskell-source.-This means that-.IP \[bu] 2-In Markdown input, \[dq]bird track\[dq] sections will be parsed as-Haskell code rather than block quotations.-Text between \f[C]\[rs]begin{code}\f[R] and \f[C]\[rs]end{code}\f[R]-will also be treated as Haskell code.-For ATX\-style headers the character \[aq]=\[aq] will be used instead of-\[aq]#\[aq].-.IP \[bu] 2-In Markdown output, code blocks with classes \f[C]haskell\f[R] and-\f[C]literate\f[R] 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 \[aq]#\[aq] characters).-(This is because ghc treats \[aq]#\[aq] characters in column 1 as-introducing line numbers.)-.IP \[bu] 2-In restructured text input, \[dq]bird track\[dq] sections will be parsed-as Haskell code.-.IP \[bu] 2-In restructured text output, code blocks with class \f[C]haskell\f[R]-will be rendered using bird tracks.-.IP \[bu] 2-In LaTeX input, text in \f[C]code\f[R] environments will be parsed as-Haskell code.-.IP \[bu] 2-In LaTeX output, code blocks with class \f[C]haskell\f[R] will be-rendered inside \f[C]code\f[R] environments.-.IP \[bu] 2-In HTML output, code blocks with class \f[C]haskell\f[R] will be-rendered with class \f[C]literatehaskell\f[R] and bird tracks.-.PP-Examples:-.IP-.nf-\f[C]-pandoc \-f markdown+lhs \-t html-\f[R]-.fi-.PP-reads literate Haskell source formatted with Markdown conventions and-writes ordinary HTML (without bird tracks).-.IP-.nf-\f[C]-pandoc \-f markdown+lhs \-t html+lhs-\f[R]-.fi-.PP-writes HTML with the Haskell code in bird tracks, so it can be copied-and pasted as literate Haskell source.-.PP-Note that GHC expects the bird tracks in the first column, so indented-literate code blocks (e.g.-inside an itemized environment) will not be picked up by the Haskell-compiler.-.SS Other extensions-.SS Extension: \f[C]empty_paragraphs\f[R]-.PP-Allows empty paragraphs.-By default empty paragraphs are omitted.-.PP-This extension can be enabled/disabled for the following formats:-.TP-.B input formats-\f[C]docx\f[R], \f[C]html\f[R]-.TP-.B output formats-\f[C]docx\f[R], \f[C]odt\f[R], \f[C]opendocument\f[R], \f[C]html\f[R]-.SS Extension: \f[C]styles\f[R]-.PP-Read all docx styles as divs (for paragraph styles) and spans (for-character styles) regardless of whether pandoc understands the meaning-of these styles.-This can be used with docx custom styles.-Disabled by default.-.TP-.B input formats-\f[C]docx\f[R]-.SS Extension: \f[C]amuse\f[R]-.PP-In the \f[C]muse\f[R] input format, this enables Text::Amuse extensions-to Emacs Muse markup.-.SS Extension: \f[C]citations\f[R]-.PP-Some aspects of Pandoc\[aq]s Markdown citation syntax are also accepted-in \f[C]org\f[R] input.-.SS Extension: \f[C]ntb\f[R]-.PP-In the \f[C]context\f[R] output format this enables the use of Natural-Tables (TABLE) instead of the default Extreme Tables (xtables).-Natural tables allow more fine\-grained global customization but come at-a performance penalty compared to extreme tables.-.SH PANDOC\[aq]S MARKDOWN-.PP-Pandoc understands an extended and slightly revised version of John-Gruber\[aq]s Markdown syntax.-This document explains the syntax, noting differences from standard-Markdown.-Except where noted, these differences can be suppressed by using the-\f[C]markdown_strict\f[R] format instead of \f[C]markdown\f[R].-Extensions can be enabled or disabled to specify the behavior more-granularly.-They are described in the following.-See also Extensions above, for extensions that work also on other-formats.-.SS Philosophy-.PP-Markdown is designed to be easy to write, and, even more importantly,-easy to read:-.RS-.PP-A Markdown\-formatted document should be publishable as\-is, as plain-text, without looking like it\[aq]s been marked up with tags or-formatting instructions.-\-\- John Gruber-.RE-.PP-This principle has guided pandoc\[aq]s decisions in finding syntax for-tables, footnotes, and other extensions.-.PP-There is, however, one respect in which pandoc\[aq]s aims are different-from the original aims of Markdown.-Whereas Markdown was originally designed with HTML generation in mind,-pandoc is designed for multiple output formats.-Thus, while pandoc allows the embedding of raw HTML, it discourages it,-and provides other, non\-HTMLish ways of representing important document-elements like definition lists, tables, mathematics, and footnotes.-.SS Paragraphs-.PP-A paragraph is one or more lines of text followed by one or more blank-lines.-Newlines are treated as spaces, so you can reflow your paragraphs as you-like.-If you need a hard line break, put two or more spaces at the end of a-line.-.SS Extension: \f[C]escaped_line_breaks\f[R]-.PP-A backslash followed by a newline is also a hard line break.-Note: in multiline and grid table cells, this is the only way to create-a hard line break, since trailing spaces in the cells are ignored.-.SS Headers-.PP-There are two kinds of headers: Setext and ATX.-.SS Setext\-style headers-.PP-A setext\-style header is a line of text \[dq]underlined\[dq] with a row-of \f[C]=\f[R] signs (for a level one header) or \f[C]\-\f[R] signs (for-a level two header):-.IP-.nf-\f[C]-A level\-one header-==================--A level\-two header-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\f[R]-.fi-.PP-The header text can contain inline formatting, such as emphasis (see-Inline formatting, below).-.SS ATX\-style headers-.PP-An ATX\-style header consists of one to six \f[C]#\f[R] signs and a line-of text, optionally followed by any number of \f[C]#\f[R] signs.-The number of \f[C]#\f[R] signs at the beginning of the line is the-header level:-.IP-.nf-\f[C]-## A level\-two header--### A level\-three header ###-\f[R]-.fi-.PP-As with setext\-style headers, the header text can contain formatting:-.IP-.nf-\f[C]-# A level\-one header with a [link](/url) and *emphasis*-\f[R]-.fi-.SS Extension: \f[C]blank_before_header\f[R]-.PP-Standard Markdown syntax does not require a blank line before a header.-Pandoc does require this (except, of course, at the beginning of the-document).-The reason for the requirement is that it is all too easy for a-\f[C]#\f[R] to end up at the beginning of a line by accident (perhaps-through line wrapping).-Consider, for example:-.IP-.nf-\f[C]-I like several of their flavors of ice cream:-#22, for example, and #5.-\f[R]-.fi-.SS Extension: \f[C]space_in_atx_header\f[R]-.PP-Many Markdown implementations do not require a space between the opening-\f[C]#\f[R]s of an ATX header and the header text, so that-\f[C]#5 bolt\f[R] and \f[C]#hashtag\f[R] count as headers.-With this extension, pandoc does require the space.-.SS Header identifiers-.PP-See also the \f[C]auto_identifiers\f[R] extension above.-.SS Extension: \f[C]header_attributes\f[R]-.PP-Headers can be assigned attributes using this syntax at the end of the-line containing the header text:-.IP-.nf-\f[C]-{#identifier .class .class key=value key=value}-\f[R]-.fi-.PP-Thus, for example, the following headers will all be assigned the-identifier \f[C]foo\f[R]:-.IP-.nf-\f[C]-# My header {#foo}--## My header ## {#foo}--My other header {#foo}-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\f[R]-.fi-.PP-(This syntax is compatible with PHP Markdown Extra.)-.PP-Note that although this syntax allows assignment of classes and-key/value attributes, writers generally don\[aq]t use all of this-information.-Identifiers, classes, and key/value attributes are used in HTML and-HTML\-based formats such as EPUB and slidy.-Identifiers are used for labels and link anchors in the LaTeX, ConTeXt,-Textile, and AsciiDoc writers.-.PP-Headers with the class \f[C]unnumbered\f[R] will not be numbered, even-if \f[C]\-\-number\-sections\f[R] is specified.-A single hyphen (\f[C]\-\f[R]) in an attribute context is equivalent to-\f[C].unnumbered\f[R], and preferable in non\-English documents.-So,-.IP-.nf-\f[C]-# My header {\-}-\f[R]-.fi-.PP-is just the same as-.IP-.nf-\f[C]-# My header {.unnumbered}-\f[R]-.fi-.SS Extension: \f[C]implicit_header_references\f[R]-.PP-Pandoc behaves as if reference links have been defined for each header.-So, to link to a header-.IP-.nf-\f[C]-# Header identifiers in HTML-\f[R]-.fi-.PP-you can simply write-.IP-.nf-\f[C]-[Header identifiers in HTML]-\f[R]-.fi-.PP-or-.IP-.nf-\f[C]-[Header identifiers in HTML][]-\f[R]-.fi-.PP-or-.IP-.nf-\f[C]-[the section on header identifiers][header identifiers in-HTML]-\f[R]-.fi-.PP-instead of giving the identifier explicitly:-.IP-.nf-\f[C]-[Header identifiers in HTML](#header\-identifiers\-in\-html)-\f[R]-.fi-.PP-If there are multiple headers with identical text, the corresponding-reference will link to the first one only, and you will need to use-explicit links to link to the others, as described above.-.PP-Like regular reference links, these references are case\-insensitive.-.PP-Explicit link reference definitions always take priority over implicit-header references.-So, in the following example, the link will point to \f[C]bar\f[R], not-to \f[C]#foo\f[R]:-.IP-.nf-\f[C]-# Foo--[foo]: bar--See [foo]-\f[R]-.fi-.SS Block quotations-.PP-Markdown uses email conventions for quoting blocks of text.-A block quotation is one or more paragraphs or other block elements-(such as lists or headers), with each line preceded by a \f[C]>\f[R]-character and an optional space.-(The \f[C]>\f[R] need not start at the left margin, but it should not be-indented more than three spaces.)-.IP-.nf-\f[C]-> This is a block quote. This-> paragraph has two lines.->-> 1. This is a list inside a block quote.-> 2. Second item.-\f[R]-.fi-.PP-A \[dq]lazy\[dq] form, which requires the \f[C]>\f[R] character only on-the first line of each block, is also allowed:-.IP-.nf-\f[C]-> This is a block quote. This-paragraph has two lines.--> 1. This is a list inside a block quote.-2. Second item.-\f[R]-.fi-.PP-Among the block elements that can be contained in a block quote are-other block quotes.-That is, block quotes can be nested:-.IP-.nf-\f[C]-> This is a block quote.->-> > A block quote within a block quote.-\f[R]-.fi-.PP-If the \f[C]>\f[R] character is followed by an optional space, that-space will be considered part of the block quote marker and not part of-the indentation of the contents.-Thus, to put an indented code block in a block quote, you need five-spaces after the \f[C]>\f[R]:-.IP-.nf-\f[C]-> code-\f[R]-.fi-.SS Extension: \f[C]blank_before_blockquote\f[R]-.PP-Standard Markdown syntax does not require a blank line before a block-quote.-Pandoc does require this (except, of course, at the beginning of the-document).-The reason for the requirement is that it is all too easy for a-\f[C]>\f[R] to end up at the beginning of a line by accident (perhaps-through line wrapping).-So, unless the \f[C]markdown_strict\f[R] format is used, the following-does not produce a nested block quote in pandoc:-.IP-.nf-\f[C]-> This is a block quote.->> Nested.-\f[R]-.fi-.SS Verbatim (code) blocks-.SS Indented code blocks-.PP-A block of text indented four spaces (or one tab) is treated as verbatim-text: that is, special characters do not trigger special formatting, and-all spaces and line breaks are preserved.-For example,-.IP-.nf-\f[C]- if (a > 3) {- moveShip(5 * gravity, DOWN);- }-\f[R]-.fi-.PP-The initial (four space or one tab) indentation is not considered part-of the verbatim text, and is removed in the output.-.PP-Note: blank lines in the verbatim text need not begin with four spaces.-.SS Fenced code blocks-.SS Extension: \f[C]fenced_code_blocks\f[R]-.PP-In addition to standard indented code blocks, pandoc supports-\f[I]fenced\f[R] code blocks.-These begin with a row of three or more tildes (\f[C]\[ti]\f[R]) and end-with a row of tildes that must be at least as long as the starting row.-Everything between these lines is treated as code.-No indentation is necessary:-.IP-.nf-\f[C]-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-if (a > 3) {- moveShip(5 * gravity, DOWN);-}-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-\f[R]-.fi-.PP-Like regular code blocks, fenced code blocks must be separated from-surrounding text by blank lines.-.PP-If the code itself contains a row of tildes or backticks, just use a-longer row of tildes or backticks at the start and end:-.IP-.nf-\f[C]-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-code including tildes-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-\f[R]-.fi-.SS Extension: \f[C]backtick_code_blocks\f[R]-.PP-Same as \f[C]fenced_code_blocks\f[R], but uses backticks-(\f[C]\[ga]\f[R]) instead of tildes (\f[C]\[ti]\f[R]).-.SS Extension: \f[C]fenced_code_attributes\f[R]-.PP-Optionally, you may attach attributes to fenced or backtick code block-using this syntax:-.IP-.nf-\f[C]-\[ti]\[ti]\[ti]\[ti] {#mycode .haskell .numberLines startFrom=\[dq]100\[dq]}-qsort [] = []-qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++- qsort (filter (>= x) xs)-\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]-\f[R]-.fi-.PP-Here \f[C]mycode\f[R] is an identifier, \f[C]haskell\f[R] and-\f[C]numberLines\f[R] are classes, and \f[C]startFrom\f[R] is an-attribute with value \f[C]100\f[R].-Some output formats can use this information to do syntax highlighting.-Currently, the only output formats that uses this information are HTML,-LaTeX, Docx, Ms, and PowerPoint.-If highlighting is supported for your output format and language, then-the code block above will appear highlighted, with numbered lines.-(To see which languages are supported, type-\f[C]pandoc \-\-list\-highlight\-languages\f[R].) Otherwise, the code-block above will appear as follows:-.IP-.nf-\f[C]-<pre id=\[dq]mycode\[dq] class=\[dq]haskell numberLines\[dq] startFrom=\[dq]100\[dq]>- <code>- ...- </code>-</pre>-\f[R]-.fi-.PP-The \f[C]numberLines\f[R] (or \f[C]number\-lines\f[R]) class will cause-the lines of the code block to be numbered, starting with \f[C]1\f[R] or-the value of the \f[C]startFrom\f[R] attribute.-The \f[C]lineAnchors\f[R] (or \f[C]line\-anchors\f[R]) class will cause-the lines to be clickable anchors in HTML output.-.PP-A shortcut form can also be used for specifying the language of the code-block:-.IP-.nf-\f[C]-\[ga]\[ga]\[ga]haskell-qsort [] = []-\[ga]\[ga]\[ga]-\f[R]-.fi-.PP-This is equivalent to:-.IP-.nf-\f[C]-\[ga]\[ga]\[ga] {.haskell}-qsort [] = []-\[ga]\[ga]\[ga]-\f[R]-.fi-.PP-If the \f[C]fenced_code_attributes\f[R] extension is disabled, but input-contains class attribute(s) for the code block, the first class-attribute will be printed after the opening fence as a bare word.-.PP-To prevent all highlighting, use the \f[C]\-\-no\-highlight\f[R] flag.-To set the highlighting style, use \f[C]\-\-highlight\-style\f[R].-For more information on highlighting, see Syntax highlighting, below.-.SS Line blocks-.SS Extension: \f[C]line_blocks\f[R]-.PP-A line block is a sequence of lines beginning with a vertical bar-(\f[C]|\f[R]) followed by a space.-The division into lines will be preserved in the output, as will any-leading spaces; otherwise, the lines will be formatted as Markdown.-This is useful for verse and addresses:-.IP-.nf-\f[C]-| The limerick packs laughs anatomical-| In space that is quite economical.-| But the good ones I\[aq]ve seen-| So seldom are clean-| And the clean ones so seldom are comical--| 200 Main St.-| Berkeley, CA 94718-\f[R]-.fi-.PP-The lines can be hard\-wrapped if needed, but the continuation line must-begin with a space.-.IP-.nf-\f[C]-| The Right Honorable Most Venerable and Righteous Samuel L.- Constable, Jr.-| 200 Main St.-| Berkeley, CA 94718-\f[R]-.fi-.PP-This syntax is borrowed from reStructuredText.-.SS Lists-.SS Bullet lists-.PP-A bullet list is a list of bulleted list items.-A bulleted list item begins with a bullet (\f[C]*\f[R], \f[C]+\f[R], or-\f[C]\-\f[R]).-Here is a simple example:-.IP-.nf-\f[C]-* one-* two-* three-\f[R]-.fi-.PP-This will produce a \[dq]compact\[dq] list.-If you want a \[dq]loose\[dq] list, in which each item is formatted as a-paragraph, put spaces between the items:-.IP-.nf-\f[C]-* one--* two--* three-\f[R]-.fi-.PP-The bullets need not be flush with the left margin; they may be indented-one, two, or three spaces.-The bullet must be followed by whitespace.-.PP-List items look best if subsequent lines are flush with the first line-(after the bullet):-.IP-.nf-\f[C]-* here is my first- list item.-* and my second.-\f[R]-.fi-.PP-But Markdown also allows a \[dq]lazy\[dq] format:-.IP-.nf-\f[C]-* here is my first-list item.-* and my second.-\f[R]-.fi-.SS Block content in list items-.PP-A list item may contain multiple paragraphs and other block\-level-content.-However, subsequent paragraphs must be preceded by a blank line and-indented to line up with the first non\-space content after the list-marker.-.IP-.nf-\f[C]- * First paragraph.-- Continued.-- * Second paragraph. With a code block, which must be indented- eight spaces:-- { code }-\f[R]-.fi-.PP-Exception: if the list marker is followed by an indented code block,-which must begin 5 spaces after the list marker, then subsequent-paragraphs must begin two columns after the last character of the list-marker:-.IP-.nf-\f[C]-* code-- continuation paragraph-\f[R]-.fi-.PP-List items may include other lists.-In this case the preceding blank line is optional.-The nested list must be indented to line up with the first non\-space-character after the list marker of the containing list item.-.IP-.nf-\f[C]-* fruits- + apples- \- macintosh- \- red delicious- + pears- + peaches-* vegetables- + broccoli- + chard-\f[R]-.fi-.PP-As noted above, Markdown allows you to write list items-\[dq]lazily,\[dq] instead of indenting continuation lines.-However, if there are multiple paragraphs or other blocks in a list-item, the first line of each must be indented.-.IP-.nf-\f[C]-+ A lazy, lazy, list-item.--+ Another one; this looks-bad but is legal.-- Second paragraph of second-list item.-\f[R]-.fi-.SS Ordered lists-.PP-Ordered lists work just like bulleted lists, except that the items begin-with enumerators rather than bullets.-.PP-In standard Markdown, enumerators are decimal numbers followed by a-period and a space.-The numbers themselves are ignored, so there is no difference between-this list:-.IP-.nf-\f[C]-1. one-2. two-3. three-\f[R]-.fi-.PP-and this one:-.IP-.nf-\f[C]-5. one-7. two-1. three-\f[R]-.fi-.SS Extension: \f[C]fancy_lists\f[R]-.PP-Unlike standard Markdown, pandoc allows ordered list items to be marked-with uppercase and lowercase letters and roman numerals, in addition to-Arabic numerals.-List markers may be enclosed in parentheses or followed by a single-right\-parentheses or period.-They must be separated from the text that follows by at least one space,-and, if the list marker is a capital letter with a period, by at least-two spaces.-.PP-The \f[C]fancy_lists\f[R] extension also allows \[aq]\f[C]#\f[R]\[aq] to-be used as an ordered list marker in place of a numeral:-.IP-.nf-\f[C]-#. one-#. two-\f[R]-.fi-.SS Extension: \f[C]startnum\f[R]-.PP-Pandoc also pays attention to the type of list marker used, and to the-starting number, and both of these are preserved where possible in the-output format.-Thus, the following yields a list with numbers followed by a single-parenthesis, starting with 9, and a sublist with lowercase roman-numerals:-.IP-.nf-\f[C]- 9) Ninth-10) Tenth-11) Eleventh- i. subone- ii. subtwo- iii. subthree-\f[R]-.fi-.PP-Pandoc will start a new list each time a different type of list marker-is used.-So, the following will create three lists:-.IP-.nf-\f[C]-(2) Two-(5) Three-1. Four-* Five-\f[R]-.fi-.PP-If default list markers are desired, use \f[C]#.\f[R]:-.IP-.nf-\f[C]-#. one-#. two-#. three-\f[R]-.fi-.SS Definition lists-.SS Extension: \f[C]definition_lists\f[R]-.PP-Pandoc supports definition lists, using the syntax of PHP Markdown Extra-with some extensions.-.IP-.nf-\f[C]-Term 1--: Definition 1--Term 2 with *inline markup*--: Definition 2-- { some code, part of Definition 2 }-- Third paragraph of definition 2.-\f[R]-.fi-.PP-Each term must fit on one line, which may optionally be followed by a-blank line, and must be followed by one or more definitions.-A definition begins with a colon or tilde, which may be indented one or-two spaces.-.PP-A term may have multiple definitions, and each definition may consist of-one or more block elements (paragraph, code block, list, etc.), each-indented four spaces or one tab stop.-The body of the definition (including the first line, aside from the-colon or tilde) should be indented four spaces.-However, as with other Markdown lists, you can \[dq]lazily\[dq] omit-indentation except at the beginning of a paragraph or other block-element:-.IP-.nf-\f[C]-Term 1--: Definition-with lazy continuation.-- Second paragraph of the definition.-\f[R]-.fi-.PP-If you leave space before the definition (as in the example above), the-text of the definition will be treated as a paragraph.-In some output formats, this will mean greater spacing between-term/definition pairs.-For a more compact definition list, omit the space before the-definition:-.IP-.nf-\f[C]-Term 1- \[ti] Definition 1--Term 2- \[ti] Definition 2a- \[ti] Definition 2b-\f[R]-.fi-.PP-Note that space between items in a definition list is required.-(A variant that loosens this requirement, but disallows \[dq]lazy\[dq]-hard wrapping, can be activated with \f[C]compact_definition_lists\f[R]:-see Non\-pandoc extensions, below.)-.SS Numbered example lists-.SS Extension: \f[C]example_lists\f[R]-.PP-The special list marker \f[C]\[at]\f[R] can be used for sequentially-numbered examples.-The first list item with a \f[C]\[at]\f[R] marker will be numbered-\[aq]1\[aq], the next \[aq]2\[aq], and so on, throughout the document.-The numbered examples need not occur in a single list; each new list-using \f[C]\[at]\f[R] will take up where the last stopped.-So, for example:-.IP-.nf-\f[C]-(\[at]) My first example will be numbered (1).-(\[at]) My second example will be numbered (2).--Explanation of examples.--(\[at]) My third example will be numbered (3).-\f[R]-.fi-.PP-Numbered examples can be labeled and referred to elsewhere in the-document:-.IP-.nf-\f[C]-(\[at]good) This is a good example.--As (\[at]good) illustrates, ...-\f[R]-.fi-.PP-The label can be any string of alphanumeric characters, underscores, or-hyphens.-.PP-Note: continuation paragraphs in example lists must always be indented-four spaces, regardless of the length of the list marker.-That is, example lists always behave as if the \f[C]four_space_rule\f[R]-extension is set.-This is because example labels tend to be long, and indenting content to-the first non\-space character after the label would be awkward.-.SS Compact and loose lists-.PP-Pandoc behaves differently from \f[C]Markdown.pl\f[R] on some \[dq]edge-cases\[dq] involving lists.-Consider this source:-.IP-.nf-\f[C]-+ First-+ Second:- \- Fee- \- Fie- \- Foe--+ Third-\f[R]-.fi-.PP-Pandoc transforms this into a \[dq]compact list\[dq] (with no-\f[C]<p>\f[R] tags around \[dq]First\[dq], \[dq]Second\[dq], or-\[dq]Third\[dq]), while Markdown puts \f[C]<p>\f[R] tags around-\[dq]Second\[dq] and \[dq]Third\[dq] (but not \[dq]First\[dq]), because-of the blank space around \[dq]Third\[dq].-Pandoc follows a simple rule: if the text is followed by a blank line,-it is treated as a paragraph.-Since \[dq]Second\[dq] is followed by a list, and not a blank line, it-isn\[aq]t treated as a paragraph.-The fact that the list is followed by a blank line is irrelevant.-(Note: Pandoc works this way even when the \f[C]markdown_strict\f[R]-format is specified.-This behavior is consistent with the official Markdown syntax-description, even though it is different from that of-\f[C]Markdown.pl\f[R].)-.SS Ending a list-.PP-What if you want to put an indented code block after a list?-.IP-.nf-\f[C]-\- item one-\- item two-- { my code block }-\f[R]-.fi-.PP-Trouble! Here pandoc (like other Markdown implementations) will treat-\f[C]{ my code block }\f[R] as the second paragraph of item two, and not-as a code block.-.PP-To \[dq]cut off\[dq] the list after item two, you can insert some-non\-indented content, like an HTML comment, which won\[aq]t produce-visible output in any format:-.IP-.nf-\f[C]-\- item one-\- item two--<!\-\- end of list \-\->-- { my code block }-\f[R]-.fi-.PP-You can use the same trick if you want two consecutive lists instead of-one big list:-.IP-.nf-\f[C]-1. one-2. two-3. three--<!\-\- \-\->--1. uno-2. dos-3. tres-\f[R]-.fi-.SS Horizontal rules-.PP-A line containing a row of three or more \f[C]*\f[R], \f[C]\-\f[R], or-\f[C]_\f[R] characters (optionally separated by spaces) produces a-horizontal rule:-.IP-.nf-\f[C]-* * * *--\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\f[R]-.fi-.SS Tables-.PP-Four kinds of tables may be used.-The first three kinds presuppose the use of a fixed\-width font, such as-Courier.-The fourth kind can be used with proportionally spaced fonts, as it does-not require lining up columns.-.SS Extension: \f[C]table_captions\f[R]-.PP-A caption may optionally be provided with all 4 kinds of tables (as-illustrated in the examples below).-A caption is a paragraph beginning with the string \f[C]Table:\f[R] (or-just \f[C]:\f[R]), which will be stripped off.-It may appear either before or after the table.-.SS Extension: \f[C]simple_tables\f[R]-.PP-Simple tables look like this:-.IP-.nf-\f[C]- Right Left Center Default-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-- 12 12 12 12- 123 123 123 123- 1 1 1 1--Table: Demonstration of simple table syntax.-\f[R]-.fi-.PP-The headers and table rows must each fit on one line.-Column alignments are determined by the position of the header text-relative to the dashed line below it:-.IP \[bu] 2-If the dashed line is flush with the header text on the right side but-extends beyond it on the left, the column is right\-aligned.-.IP \[bu] 2-If the dashed line is flush with the header text on the left side but-extends beyond it on the right, the column is left\-aligned.-.IP \[bu] 2-If the dashed line extends beyond the header text on both sides, the-column is centered.-.IP \[bu] 2-If the dashed line is flush with the header text on both sides, the-default alignment is used (in most cases, this will be left).-.PP-The table must end with a blank line, or a line of dashes followed by a-blank line.-.PP-The column headers may be omitted, provided a dashed line is used to end-the table.-For example:-.IP-.nf-\f[C]-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-- 12 12 12 12- 123 123 123 123- 1 1 1 1-\-\-\-\-\-\-\- \-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\--\f[R]-.fi-.PP-When headers are omitted, column alignments are determined on the basis-of the first line of the table body.-So, in the tables above, the columns would be right, left, center, and-right aligned, respectively.-.SS Extension: \f[C]multiline_tables\f[R]-.PP-Multiline tables allow headers and table rows to span multiple lines of-text (but cells that span multiple columns or rows of the table are not-supported).-Here is an example:-.IP-.nf-\f[C]-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-- Centered Default Right Left- Header Aligned Aligned Aligned-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-- First row 12.0 Example of a row that- spans multiple lines.-- Second row 5.0 Here\[aq]s another one. Note- the blank line between- rows.-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\---Table: Here\[aq]s the caption. It, too, may span-multiple lines.-\f[R]-.fi-.PP-These work like simple tables, but with the following differences:-.IP \[bu] 2-They must begin with a row of dashes, before the header text (unless the-headers are omitted).-.IP \[bu] 2-They must end with a row of dashes, then a blank line.-.IP \[bu] 2-The rows must be separated by blank lines.-.PP-In multiline tables, the table parser pays attention to the widths of-the columns, and the writers try to reproduce these relative widths in-the output.-So, if you find that one of the columns is too narrow in the output, try-widening it in the Markdown source.-.PP-Headers may be omitted in multiline tables as well as simple tables:-.IP-.nf-\f[C]-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-- First row 12.0 Example of a row that- spans multiple lines.-- Second row 5.0 Here\[aq]s another one. Note- the blank line between- rows.-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\---: Here\[aq]s a multiline table without headers.-\f[R]-.fi-.PP-It is possible for a multiline table to have just one row, but the row-should be followed by a blank line (and then the row of dashes that ends-the table), or the table may be interpreted as a simple table.-.SS Extension: \f[C]grid_tables\f[R]-.PP-Grid tables look like this:-.IP-.nf-\f[C]-: Sample grid table.--+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+-| Fruit | Price | Advantages |-+===============+===============+====================+-| Bananas | $1.34 | \- built\-in wrapper |-| | | \- bright color |-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+-| Oranges | $2.10 | \- cures scurvy |-| | | \- tasty |-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+-\f[R]-.fi-.PP-The row of \f[C]=\f[R]s separates the header from the table body, and-can be omitted for a headerless table.-The cells of grid tables may contain arbitrary block elements (multiple-paragraphs, code blocks, lists, etc.).-Cells that span multiple columns or rows are not supported.-Grid tables can be created easily using Emacs table mode.-.PP-Alignments can be specified as with pipe tables, by putting colons at-the boundaries of the separator line after the header:-.IP-.nf-\f[C]-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+-| Right | Left | Centered |-+==============:+:==============+:==================:+-| Bananas | $1.34 | built\-in wrapper |-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+-\f[R]-.fi-.PP-For headerless tables, the colons go on the top line instead:-.IP-.nf-\f[C]-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-:+:\-\-\-\-\-\-\-\-\-\-\-\-\-\-+:\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-:+-| Right | Left | Centered |-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+-\f[R]-.fi-.SS Grid Table Limitations-.PP-Pandoc does not support grid tables with row spans or column spans.-This means that neither variable numbers of columns across rows nor-variable numbers of rows across columns are supported by Pandoc.-All grid tables must have the same number of columns in each row, and-the same number of rows in each column.-For example, the Docutils sample grid tables will not render as expected-with Pandoc.-.SS Extension: \f[C]pipe_tables\f[R]-.PP-Pipe tables look like this:-.IP-.nf-\f[C]-| Right | Left | Default | Center |-|\-\-\-\-\-\-:|:\-\-\-\-\-|\-\-\-\-\-\-\-\-\-|:\-\-\-\-\-\-:|-| 12 | 12 | 12 | 12 |-| 123 | 123 | 123 | 123 |-| 1 | 1 | 1 | 1 |-- : Demonstration of pipe table syntax.-\f[R]-.fi-.PP-The syntax is identical to PHP Markdown Extra tables.-The beginning and ending pipe characters are optional, but pipes are-required between all columns.-The colons indicate column alignment as shown.-The header cannot be omitted.-To simulate a headerless table, include a header with blank cells.-.PP-Since the pipes indicate column boundaries, columns need not be-vertically aligned, as they are in the above example.-So, this is a perfectly legal (though ugly) pipe table:-.IP-.nf-\f[C]-fruit| price-\-\-\-\-\-|\-\-\-\-\-:-apple|2.05-pear|1.37-orange|3.09-\f[R]-.fi-.PP-The cells of pipe tables cannot contain block elements like paragraphs-and lists, and cannot span multiple lines.-If a pipe table contains a row whose printable content is wider than the-column width (see \f[C]\-\-columns\f[R]), then the table will take up-the full text width and the cell contents will wrap, with the relative-cell widths determined by the number of dashes in the line separating-the table header from the table body.-(For example \f[C]\-\-\-|\-\f[R] would make the first column 3/4 and the-second column 1/4 of the full text width.) On the other hand, if no-lines are wider than column width, then cell contents will not be-wrapped, and the cells will be sized to their contents.-.PP-Note: pandoc also recognizes pipe tables of the following form, as can-be produced by Emacs\[aq] orgtbl\-mode:-.IP-.nf-\f[C]-| One | Two |-|\-\-\-\-\-+\-\-\-\-\-\-\-|-| my | table |-| is | nice |-\f[R]-.fi-.PP-The difference is that \f[C]+\f[R] is used instead of \f[C]|\f[R].-Other orgtbl features are not supported.-In particular, to get non\-default column alignment, you\[aq]ll need to-add colons as above.-.SS Metadata blocks-.SS Extension: \f[C]pandoc_title_block\f[R]-.PP-If the file begins with a title block-.IP-.nf-\f[C]-% title-% author(s) (separated by semicolons)-% date-\f[R]-.fi-.PP-it will be parsed as bibliographic information, not regular text.-(It will be used, for example, in the title of standalone LaTeX or HTML-output.) The block may contain just a title, a title and an author, or-all three elements.-If you want to include an author but no title, or a title and a date but-no author, you need a blank line:-.IP-.nf-\f[C]-%-% Author--% My title-%-% June 15, 2006-\f[R]-.fi-.PP-The title may occupy multiple lines, but continuation lines must begin-with leading space, thus:-.IP-.nf-\f[C]-% My title- on multiple lines-\f[R]-.fi-.PP-If a document has multiple authors, the authors may be put on separate-lines with leading space, or separated by semicolons, or both.-So, all of the following are equivalent:-.IP-.nf-\f[C]-% Author One- Author Two--% Author One; Author Two--% Author One;- Author Two-\f[R]-.fi-.PP-The date must fit on one line.-.PP-All three metadata fields may contain standard inline formatting-(italics, links, footnotes, etc.).-.PP-Title blocks will always be parsed, but they will affect the output only-when the \f[C]\-\-standalone\f[R] (\f[C]\-s\f[R]) option is chosen.-In HTML output, titles will appear twice: once in the document head \-\--this is the title that will appear at the top of the window in a browser-\-\- and once at the beginning of the document body.-The title in the document head can have an optional prefix attached-(\f[C]\-\-title\-prefix\f[R] or \f[C]\-T\f[R] option).-The title in the body appears as an H1 element with class-\[dq]title\[dq], so it can be suppressed or reformatted with CSS.-If a title prefix is specified with \f[C]\-T\f[R] and no title block-appears in the document, the title prefix will be used by itself as the-HTML title.-.PP-The man page writer extracts a title, man page section number, and other-header and footer information from the title line.-The title is assumed to be the first word on the title line, which may-optionally end with a (single\-digit) section number in parentheses.-(There should be no space between the title and the parentheses.)-Anything after this is assumed to be additional footer and header text.-A single pipe character (\f[C]|\f[R]) should be used to separate the-footer text from the header text.-Thus,-.IP-.nf-\f[C]-% PANDOC(1)-\f[R]-.fi-.PP-will yield a man page with the title \f[C]PANDOC\f[R] and section 1.-.IP-.nf-\f[C]-% PANDOC(1) Pandoc User Manuals-\f[R]-.fi-.PP-will also have \[dq]Pandoc User Manuals\[dq] in the footer.-.IP-.nf-\f[C]-% PANDOC(1) Pandoc User Manuals | Version 4.0-\f[R]-.fi-.PP-will also have \[dq]Version 4.0\[dq] in the header.-.SS Extension: \f[C]yaml_metadata_block\f[R]-.PP-A YAML metadata block is a valid YAML object, delimited by a line of-three hyphens (\f[C]\-\-\-\f[R]) at the top and a line of three hyphens-(\f[C]\-\-\-\f[R]) or three dots (\f[C]...\f[R]) at the bottom.-A YAML metadata block may occur anywhere in the document, but if it is-not at the beginning, it must be preceded by a blank line.-(Note that, because of the way pandoc concatenates input files when-several are provided, you may also keep the metadata in a separate YAML-file and pass it to pandoc as an argument, along with your Markdown-files:-.IP-.nf-\f[C]-pandoc chap1.md chap2.md chap3.md metadata.yaml \-s \-o book.html-\f[R]-.fi-.PP-Just be sure that the YAML file begins with \f[C]\-\-\-\f[R] and ends-with \f[C]\-\-\-\f[R] or \f[C]...\f[R].) Alternatively, you can use the-\f[C]\-\-metadata\-file\f[R] option.-Using that approach however, you cannot reference content (like-footnotes) from the main markdown input document.-.PP-Metadata will be taken from the fields of the YAML object and added to-any existing document metadata.-Metadata can contain lists and objects (nested arbitrarily), but all-string scalars will be interpreted as Markdown.-Fields with names ending in an underscore will be ignored by pandoc.-(They may be given a role by external processors.) Field names must not-be interpretable as YAML numbers or boolean values (so, for example,-\f[C]yes\f[R], \f[C]True\f[R], and \f[C]15\f[R] cannot be used as field-names).-.PP-A document may contain multiple metadata blocks.-The metadata fields will be combined through a \f[I]left\-biased-union\f[R]: if two metadata blocks attempt to set the same field, the-value from the first block will be taken.-.PP-When pandoc is used with \f[C]\-t markdown\f[R] to create a Markdown-document, a YAML metadata block will be produced only if the-\f[C]\-s/\-\-standalone\f[R] option is used.-All of the metadata will appear in a single block at the beginning of-the document.-.PP-Note that YAML escaping rules must be followed.-Thus, for example, if a title contains a colon, it must be quoted.-The pipe character (\f[C]|\f[R]) can be used to begin an indented block-that will be interpreted literally, without need for escaping.-This form is necessary when the field contains blank lines or-block\-level formatting:-.IP-.nf-\f[C]-\-\-\--title: \[aq]This is the title: it contains a colon\[aq]-author:-\- Author One-\- Author Two-keywords: [nothing, nothingness]-abstract: |- This is the abstract.-- It consists of two paragraphs.-\&...-\f[R]-.fi-.PP-Template variables will be set automatically from the metadata.-Thus, for example, in writing HTML, the variable \f[C]abstract\f[R] will-be set to the HTML equivalent of the Markdown in the \f[C]abstract\f[R]-field:-.IP-.nf-\f[C]-<p>This is the abstract.</p>-<p>It consists of two paragraphs.</p>-\f[R]-.fi-.PP-Variables can contain arbitrary YAML structures, but the template must-match this structure.-The \f[C]author\f[R] variable in the default templates expects a simple-list or string, but can be changed to support more complicated-structures.-The following combination, for example, would add an affiliation to the-author if one is given:-.IP-.nf-\f[C]-\-\-\--title: The document title-author:-\- name: Author One- affiliation: University of Somewhere-\- name: Author Two- affiliation: University of Nowhere-\&...-\f[R]-.fi-.PP-To use the structured authors in the example above, you would need a-custom template:-.IP-.nf-\f[C]-$for(author)$-$if(author.name)$-$author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$-$else$-$author$-$endif$-$endfor$-\f[R]-.fi-.PP-Raw content to include in the document\[aq]s header may be specified-using \f[C]header\-includes\f[R]; however, it is important to mark up-this content as raw code for a particular output format, using the-\f[C]raw_attribute\f[R] extension), or it will be interpreted as-markdown.-For example:-.IP-.nf-\f[C]-header\-includes:-\- |- \[ga]\[ga]\[ga]{=latex}- \[rs]let\[rs]oldsection\[rs]section- \[rs]renewcommand{\[rs]section}[1]{\[rs]clearpage\[rs]oldsection{#1}}- \[ga]\[ga]\[ga]-\f[R]-.fi-.SS Backslash escapes-.SS Extension: \f[C]all_symbols_escapable\f[R]-.PP-Except inside a code block or inline code, any punctuation or space-character preceded by a backslash will be treated literally, even if it-would normally indicate formatting.-Thus, for example, if one writes-.IP-.nf-\f[C]-*\[rs]*hello\[rs]**-\f[R]-.fi-.PP-one will get-.IP-.nf-\f[C]-<em>*hello*</em>-\f[R]-.fi-.PP-instead of-.IP-.nf-\f[C]-<strong>hello</strong>-\f[R]-.fi-.PP-This rule is easier to remember than standard Markdown\[aq]s rule, which-allows only the following characters to be backslash\-escaped:-.IP-.nf-\f[C]-\[rs]\[ga]*_{}[]()>#+\-.!-\f[R]-.fi-.PP-(However, if the \f[C]markdown_strict\f[R] format is used, the standard-Markdown rule will be used.)-.PP-A backslash\-escaped space is parsed as a nonbreaking space.-It will appear in TeX output as \f[C]\[ti]\f[R] and in HTML and XML as-\f[C]\[rs] \f[R] or \f[C]\[rs] \f[R].-.PP-A backslash\-escaped newline (i.e.-a backslash occurring at the end of a line) is parsed as a hard line-break.-It will appear in TeX output as \f[C]\[rs]\[rs]\f[R] and in HTML as-\f[C]<br />\f[R].-This is a nice alternative to Markdown\[aq]s \[dq]invisible\[dq] way of-indicating hard line breaks using two trailing spaces on a line.-.PP-Backslash escapes do not work in verbatim contexts.-.SS Inline formatting-.SS Emphasis-.PP-To \f[I]emphasize\f[R] some text, surround it with \f[C]*\f[R]s or-\f[C]_\f[R], like this:-.IP-.nf-\f[C]-This text is _emphasized with underscores_, and this-is *emphasized with asterisks*.-\f[R]-.fi-.PP-Double \f[C]*\f[R] or \f[C]_\f[R] produces \f[B]strong emphasis\f[R]:-.IP-.nf-\f[C]-This is **strong emphasis** and __with underscores__.-\f[R]-.fi-.PP-A \f[C]*\f[R] or \f[C]_\f[R] character surrounded by spaces, or-backslash\-escaped, will not trigger emphasis:-.IP-.nf-\f[C]-This is * not emphasized *, and \[rs]*neither is this\[rs]*.-\f[R]-.fi-.SS Extension: \f[C]intraword_underscores\f[R]-.PP-Because \f[C]_\f[R] is sometimes used inside words and identifiers,-pandoc does not interpret a \f[C]_\f[R] surrounded by alphanumeric-characters as an emphasis marker.-If you want to emphasize just part of a word, use \f[C]*\f[R]:-.IP-.nf-\f[C]-feas*ible*, not feas*able*.-\f[R]-.fi-.SS Strikeout-.SS Extension: \f[C]strikeout\f[R]-.PP-To strikeout a section of text with a horizontal line, begin and end it-with \f[C]\[ti]\[ti]\f[R].-Thus, for example,-.IP-.nf-\f[C]-This \[ti]\[ti]is deleted text.\[ti]\[ti]-\f[R]-.fi-.SS Superscripts and subscripts-.SS Extension: \f[C]superscript\f[R], \f[C]subscript\f[R]-.PP-Superscripts may be written by surrounding the superscripted text by-\f[C]\[ha]\f[R] characters; subscripts may be written by surrounding the-subscripted text by \f[C]\[ti]\f[R] characters.-Thus, for example,-.IP-.nf-\f[C]-H\[ti]2\[ti]O is a liquid. 2\[ha]10\[ha] is 1024.-\f[R]-.fi-.PP-If the superscripted or subscripted text contains spaces, these spaces-must be escaped with backslashes.-(This is to prevent accidental superscripting and subscripting through-the ordinary use of \f[C]\[ti]\f[R] and \f[C]\[ha]\f[R].) Thus, if you-want the letter P with \[aq]a cat\[aq] in subscripts, use-\f[C]P\[ti]a\[rs] cat\[ti]\f[R], not \f[C]P\[ti]a cat\[ti]\f[R].-.SS Verbatim-.PP-To make a short span of text verbatim, put it inside backticks:-.IP-.nf-\f[C]-What is the difference between \[ga]>>=\[ga] and \[ga]>>\[ga]?-\f[R]-.fi-.PP-If the verbatim text includes a backtick, use double backticks:-.IP-.nf-\f[C]-Here is a literal backtick \[ga]\[ga] \[ga] \[ga]\[ga].-\f[R]-.fi-.PP-(The spaces after the opening backticks and before the closing backticks-will be ignored.)-.PP-The general rule is that a verbatim span starts with a string of-consecutive backticks (optionally followed by a space) and ends with a-string of the same number of backticks (optionally preceded by a space).-.PP-Note that backslash\-escapes (and other Markdown constructs) do not work-in verbatim contexts:-.IP-.nf-\f[C]-This is a backslash followed by an asterisk: \[ga]\[rs]*\[ga].-\f[R]-.fi-.SS Extension: \f[C]inline_code_attributes\f[R]-.PP-Attributes can be attached to verbatim text, just as with fenced code-blocks:-.IP-.nf-\f[C]-\[ga]<$>\[ga]{.haskell}-\f[R]-.fi-.SS Small caps-.PP-To write small caps, use the \f[C]smallcaps\f[R] class:-.IP-.nf-\f[C]-[Small caps]{.smallcaps}-\f[R]-.fi-.PP-Or, without the \f[C]bracketed_spans\f[R] extension:-.IP-.nf-\f[C]-<span class=\[dq]smallcaps\[dq]>Small caps</span>-\f[R]-.fi-.PP-For compatibility with other Markdown flavors, CSS is also supported:-.IP-.nf-\f[C]-<span style=\[dq]font\-variant:small\-caps;\[dq]>Small caps</span>-\f[R]-.fi-.PP-This will work in all output formats that support small caps.-.SS Math-.SS Extension: \f[C]tex_math_dollars\f[R]-.PP-Anything between two \f[C]$\f[R] characters will be treated as TeX math.-The opening \f[C]$\f[R] must have a non\-space character immediately to-its right, while the closing \f[C]$\f[R] must have a non\-space-character immediately to its left, and must not be followed immediately-by a digit.-Thus, \f[C]$20,000 and $30,000\f[R] won\[aq]t parse as math.-If for some reason you need to enclose text in literal \f[C]$\f[R]-characters, backslash\-escape them and they won\[aq]t be treated as math-delimiters.-.PP-TeX math will be printed in all output formats.-How it is rendered depends on the output format:-.TP-.B LaTeX-It will appear verbatim surrounded by \f[C]\[rs](...\[rs])\f[R] (for-inline math) or \f[C]\[rs][...\[rs]]\f[R] (for display math).-.TP-.B Markdown, Emacs Org mode, ConTeXt, ZimWiki-It will appear verbatim surrounded by \f[C]$...$\f[R] (for inline math)-or \f[C]$$...$$\f[R] (for display math).-.TP-.B reStructuredText-It will be rendered using an interpreted text role \f[C]:math:\f[R].-.TP-.B AsciiDoc-It will be rendered as \f[C]latexmath:[...]\f[R].-.TP-.B Texinfo-It will be rendered inside a \f[C]\[at]math\f[R] command.-.TP-.B roff man-It will be rendered verbatim without \f[C]$\f[R]\[aq]s.-.TP-.B MediaWiki, DokuWiki-It will be rendered inside \f[C]<math>\f[R] tags.-.TP-.B Textile-It will be rendered inside \f[C]<span class=\[dq]math\[dq]>\f[R] tags.-.TP-.B RTF, OpenDocument-It will be rendered, if possible, using Unicode characters, and will-otherwise appear verbatim.-.TP-.B ODT-It will be rendered, if possible, using MathML.-.TP-.B DocBook-If the \f[C]\-\-mathml\f[R] flag is used, it will be rendered using-MathML in an \f[C]inlineequation\f[R] or \f[C]informalequation\f[R] tag.-Otherwise it will be rendered, if possible, using Unicode characters.-.TP-.B Docx-It will be rendered using OMML math markup.-.TP-.B FictionBook2-If the \f[C]\-\-webtex\f[R] option is used, formulas are rendered as-images using CodeCogs or other compatible web service, downloaded and-embedded in the e\-book.-Otherwise, they will appear verbatim.-.TP-.B HTML, Slidy, DZSlides, S5, EPUB-The way math is rendered in HTML will depend on the command\-line-options selected.-Therefore see Math rendering in HTML above.-.SS Raw HTML-.SS Extension: \f[C]raw_html\f[R]-.PP-Markdown allows you to insert raw HTML (or DocBook) anywhere in a-document (except verbatim contexts, where \f[C]<\f[R], \f[C]>\f[R], and-\f[C]&\f[R] are interpreted literally).-(Technically this is not an extension, since standard Markdown allows-it, but it has been made an extension so that it can be disabled if-desired.)-.PP-The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,-DZSlides, EPUB, Markdown, CommonMark, Emacs Org mode, and Textile-output, and suppressed in other formats.-.PP-In the CommonMark format, if \f[C]raw_html\f[R] is enabled,-superscripts, subscripts, strikeouts and small capitals will be-represented as HTML.-Otherwise, plain\-text fallbacks will be used.-Note that even if \f[C]raw_html\f[R] is disabled, tables will be-rendered with HTML syntax if they cannot use pipe syntax.-.SS Extension: \f[C]markdown_in_html_blocks\f[R]-.PP-Standard Markdown allows you to include HTML \[dq]blocks\[dq]: blocks of-HTML between balanced tags that are separated from the surrounding text-with blank lines, and start and end at the left margin.-Within these blocks, everything is interpreted as HTML, not Markdown; so-(for example), \f[C]*\f[R] does not signify emphasis.-.PP-Pandoc behaves this way when the \f[C]markdown_strict\f[R] format is-used; but by default, pandoc interprets material between HTML block tags-as Markdown.-Thus, for example, pandoc will turn-.IP-.nf-\f[C]-<table>-<tr>-<td>*one*</td>-<td>[a link](http://google.com)</td>-</tr>-</table>-\f[R]-.fi-.PP-into-.IP-.nf-\f[C]-<table>-<tr>-<td><em>one</em></td>-<td><a href=\[dq]http://google.com\[dq]>a link</a></td>-</tr>-</table>-\f[R]-.fi-.PP-whereas \f[C]Markdown.pl\f[R] will preserve it as is.-.PP-There is one exception to this rule: text between \f[C]<script>\f[R] and-\f[C]<style>\f[R] tags is not interpreted as Markdown.-.PP-This departure from standard Markdown should make it easier to mix-Markdown with HTML block elements.-For example, one can surround a block of Markdown text with-\f[C]<div>\f[R] tags without preventing it from being interpreted as-Markdown.-.SS Extension: \f[C]native_divs\f[R]-.PP-Use native pandoc \f[C]Div\f[R] blocks for content inside-\f[C]<div>\f[R] tags.-For the most part this should give the same output as-\f[C]markdown_in_html_blocks\f[R], but it makes it easier to write-pandoc filters to manipulate groups of blocks.-.SS Extension: \f[C]native_spans\f[R]-.PP-Use native pandoc \f[C]Span\f[R] blocks for content inside-\f[C]<span>\f[R] tags.-For the most part this should give the same output as-\f[C]raw_html\f[R], but it makes it easier to write pandoc filters to-manipulate groups of inlines.-.SS Extension: \f[C]raw_tex\f[R]-.PP-In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be-included in a document.-Inline TeX commands will be preserved and passed unchanged to the LaTeX-and ConTeXt writers.-Thus, for example, you can use LaTeX to include BibTeX citations:-.IP-.nf-\f[C]-This result was proved in \[rs]cite{jones.1967}.-\f[R]-.fi-.PP-Note that in LaTeX environments, like-.IP-.nf-\f[C]-\[rs]begin{tabular}{|l|l|}\[rs]hline-Age & Frequency \[rs]\[rs] \[rs]hline-18\-\-25 & 15 \[rs]\[rs]-26\-\-35 & 33 \[rs]\[rs]-36\-\-45 & 22 \[rs]\[rs] \[rs]hline-\[rs]end{tabular}-\f[R]-.fi-.PP-the material between the begin and end tags will be interpreted as raw-LaTeX, not as Markdown.-.PP-Inline LaTeX is ignored in output formats other than Markdown, LaTeX,-Emacs Org mode, and ConTeXt.-.SS Generic raw attribute-.SS Extension: \f[C]raw_attribute\f[R]-.PP-Inline spans and fenced code blocks with a special kind of attribute-will be parsed as raw content with the designated format.-For example, the following produces a raw roff \f[C]ms\f[R] block:-.IP-.nf-\f[C]-\[ga]\[ga]\[ga]{=ms}-\&.MYMACRO-blah blah-\[ga]\[ga]\[ga]-\f[R]-.fi-.PP-And the following produces a raw \f[C]html\f[R] inline element:-.IP-.nf-\f[C]-This is \[ga]<a>html</a>\[ga]{=html}-\f[R]-.fi-.PP-This can be useful to insert raw xml into \f[C]docx\f[R] documents, e.g.-a pagebreak:-.IP-.nf-\f[C]-\[ga]\[ga]\[ga]{=openxml}-<w:p>- <w:r>- <w:br w:type=\[dq]page\[dq]/>- </w:r>-</w:p>-\[ga]\[ga]\[ga]-\f[R]-.fi-.PP-The format name should match the target format name (see-\f[C]\-t/\-\-to\f[R], above, for a list, or use-\f[C]pandoc \-\-list\-output\-formats\f[R]).-Use \f[C]openxml\f[R] for \f[C]docx\f[R] output, \f[C]opendocument\f[R]-for \f[C]odt\f[R] output, \f[C]html5\f[R] for \f[C]epub3\f[R] output,-\f[C]html4\f[R] for \f[C]epub2\f[R] output, and \f[C]latex\f[R],-\f[C]beamer\f[R], \f[C]ms\f[R], or \f[C]html5\f[R] for \f[C]pdf\f[R]-output (depending on what you use for \f[C]\-\-pdf\-engine\f[R]).-.PP-This extension presupposes that the relevant kind of inline code or-fenced code block is enabled.-Thus, for example, to use a raw attribute with a backtick code block,-\f[C]backtick_code_blocks\f[R] must be enabled.-.PP-The raw attribute cannot be combined with regular attributes.-.SS LaTeX macros-.SS Extension: \f[C]latex_macros\f[R]-.PP-When this extension is enabled, pandoc will parse LaTeX macro-definitions and apply the resulting macros to all LaTeX math and raw-LaTeX.-So, for example, the following will work in all output formats, not just-LaTeX:-.IP-.nf-\f[C]-\[rs]newcommand{\[rs]tuple}[1]{\[rs]langle #1 \[rs]rangle}--$\[rs]tuple{a, b, c}$-\f[R]-.fi-.PP-Note that LaTeX macros will not be applied if they occur inside inside a-raw span or block marked with the \f[C]raw_attribute\f[R] extension.-.PP-When \f[C]latex_macros\f[R] is disabled, the raw LaTeX and math will not-have macros applied.-This is usually a better approach when you are targeting LaTeX or PDF.-.PP-Whether or not \f[C]latex_macros\f[R] is enabled, the macro definitions-will still be passed through as raw LaTeX.-.SS Links-.PP-Markdown allows links to be specified in several ways.-.SS Automatic links-.PP-If you enclose a URL or email address in pointy brackets, it will become-a link:-.IP-.nf-\f[C]-<http://google.com>-<sam\[at]green.eggs.ham>-\f[R]-.fi-.SS Inline links-.PP-An inline link consists of the link text in square brackets, followed by-the URL in parentheses.-(Optionally, the URL can be followed by a link title, in quotes.)-.IP-.nf-\f[C]-This is an [inline link](/url), and here\[aq]s [one with-a title](http://fsf.org \[dq]click here for a good time!\[dq]).-\f[R]-.fi-.PP-There can be no space between the bracketed part and the parenthesized-part.-The link text can contain formatting (such as emphasis), but the title-cannot.-.PP-Email addresses in inline links are not autodetected, so they have to be-prefixed with \f[C]mailto\f[R]:-.IP-.nf-\f[C]-[Write me!](mailto:sam\[at]green.eggs.ham)-\f[R]-.fi-.SS Reference links-.PP-An \f[I]explicit\f[R] reference link has two parts, the link itself and-the link definition, which may occur elsewhere in the document (either-before or after the link).-.PP-The link consists of link text in square brackets, followed by a label-in square brackets.-(There cannot be space between the two unless the-\f[C]spaced_reference_links\f[R] extension is enabled.) The link-definition consists of the bracketed label, followed by a colon and a-space, followed by the URL, and optionally (after a space) a link title-either in quotes or in parentheses.-The label must not be parseable as a citation (assuming the-\f[C]citations\f[R] extension is enabled): citations take precedence-over link labels.-.PP-Here are some examples:-.IP-.nf-\f[C]-[my label 1]: /foo/bar.html \[dq]My title, optional\[dq]-[my label 2]: /foo-[my label 3]: http://fsf.org (The free software foundation)-[my label 4]: /bar#special \[aq]A title in single quotes\[aq]-\f[R]-.fi-.PP-The URL may optionally be surrounded by angle brackets:-.IP-.nf-\f[C]-[my label 5]: <http://foo.bar.baz>-\f[R]-.fi-.PP-The title may go on the next line:-.IP-.nf-\f[C]-[my label 3]: http://fsf.org- \[dq]The free software foundation\[dq]-\f[R]-.fi-.PP-Note that link labels are not case sensitive.-So, this will work:-.IP-.nf-\f[C]-Here is [my link][FOO]--[Foo]: /bar/baz-\f[R]-.fi-.PP-In an \f[I]implicit\f[R] reference link, the second pair of brackets is-empty:-.IP-.nf-\f[C]-See [my website][].--[my website]: http://foo.bar.baz-\f[R]-.fi-.PP-Note: In \f[C]Markdown.pl\f[R] and most other Markdown implementations,-reference link definitions cannot occur in nested constructions such as-list items or block quotes.-Pandoc lifts this arbitrary seeming restriction.-So the following is fine in pandoc, though not in most other-implementations:-.IP-.nf-\f[C]-> My block [quote].->-> [quote]: /foo-\f[R]-.fi-.SS Extension: \f[C]shortcut_reference_links\f[R]-.PP-In a \f[I]shortcut\f[R] reference link, the second pair of brackets may-be omitted entirely:-.IP-.nf-\f[C]-See [my website].--[my website]: http://foo.bar.baz-\f[R]-.fi-.SS Internal links-.PP-To link to another section of the same document, use the automatically-generated identifier (see Header identifiers).-For example:-.IP-.nf-\f[C]-See the [Introduction](#introduction).-\f[R]-.fi-.PP-or-.IP-.nf-\f[C]-See the [Introduction].--[Introduction]: #introduction-\f[R]-.fi-.PP-Internal links are currently supported for HTML formats (including HTML-slide shows and EPUB), LaTeX, and ConTeXt.-.SS Images-.PP-A link immediately preceded by a \f[C]!\f[R] will be treated as an-image.-The link text will be used as the image\[aq]s alt text:-.IP-.nf-\f[C]---![movie reel]--[movie reel]: movie.gif-\f[R]-.fi-.SS Extension: \f[C]implicit_figures\f[R]-.PP-An image with nonempty alt text, occurring by itself in a paragraph,-will be rendered as a figure with a caption.-The image\[aq]s alt text will be used as the caption.-.IP-.nf-\f[C]--\f[R]-.fi-.PP-How this is rendered depends on the output format.-Some output formats (e.g.-RTF) do not yet support figures.-In those formats, you\[aq]ll just get an image in a paragraph by itself,-with no caption.-.PP-If you just want a regular inline image, just make sure it is not the-only thing in the paragraph.-One way to do this is to insert a nonbreaking space after the image:-.IP-.nf-\f[C]-![This image won\[aq]t be a figure](/url/of/image.png)\[rs]-\f[R]-.fi-.PP-Note that in reveal.js slide shows, an image in a paragraph by itself-that has the \f[C]stretch\f[R] class will fill the screen, and the-caption and figure tags will be omitted.-.SS Extension: \f[C]link_attributes\f[R]-.PP-Attributes can be set on links and images:-.IP-.nf-\f[C]-An inline {#id .class width=30 height=20px}-and a reference ![image][ref] with attributes.--[ref]: foo.jpg \[dq]optional title\[dq] {#id .class key=val key2=\[dq]val 2\[dq]}-\f[R]-.fi-.PP-(This syntax is compatible with PHP Markdown Extra when only-\f[C]#id\f[R] and \f[C].class\f[R] are used.)-.PP-For HTML and EPUB, all attributes except \f[C]width\f[R] and-\f[C]height\f[R] (but including \f[C]srcset\f[R] and \f[C]sizes\f[R])-are passed through as is.-The other writers ignore attributes that are not supported by their-output format.-.PP-The \f[C]width\f[R] and \f[C]height\f[R] attributes on images are-treated specially.-When used without a unit, the unit is assumed to be pixels.-However, any of the following unit identifiers can be used:-\f[C]px\f[R], \f[C]cm\f[R], \f[C]mm\f[R], \f[C]in\f[R], \f[C]inch\f[R]-and \f[C]%\f[R].-There must not be any spaces between the number and the unit.-For example:-.IP-.nf-\f[C]-{ width=50% }-\f[R]-.fi-.IP \[bu] 2-Dimensions are converted to inches for output in page\-based formats-like LaTeX.-Dimensions are converted to pixels for output in HTML\-like formats.-Use the \f[C]\-\-dpi\f[R] option to specify the number of pixels per-inch.-The default is 96dpi.-.IP \[bu] 2-The \f[C]%\f[R] unit is generally relative to some available space.-For example the above example will render to the following.-.RS 2-.IP \[bu] 2-HTML:-\f[C]<img href=\[dq]file.jpg\[dq] style=\[dq]width: 50%;\[dq] />\f[R]-.IP \[bu] 2-LaTeX:-\f[C]\[rs]includegraphics[width=0.5\[rs]textwidth,height=\[rs]textheight]{file.jpg}\f[R]-(If you\[aq]re using a custom template, you need to configure-\f[C]graphicx\f[R] as in the default template.)-.IP \[bu] 2-ConTeXt:-\f[C]\[rs]externalfigure[file.jpg][width=0.5\[rs]textwidth]\f[R]-.RE-.IP \[bu] 2-Some output formats have a notion of a class (ConTeXt) or a unique-identifier (LaTeX \f[C]\[rs]caption\f[R]), or both (HTML).-.IP \[bu] 2-When no \f[C]width\f[R] or \f[C]height\f[R] attributes are specified,-the fallback is to look at the image resolution and the dpi metadata-embedded in the image file.-.SS Divs and Spans-.PP-Using the \f[C]native_divs\f[R] and \f[C]native_spans\f[R] extensions-(see above), HTML syntax can be used as part of markdown to create-native \f[C]Div\f[R] and \f[C]Span\f[R] elements in the pandoc AST (as-opposed to raw HTML).-However, there is also nicer syntax available:-.SS Extension: \f[C]fenced_divs\f[R]-.PP-Allow special fenced syntax for native \f[C]Div\f[R] blocks.-A Div starts with a fence containing at least three consecutive colons-plus some attributes.-The attributes may optionally be followed by another string of-consecutive colons.-The attribute syntax is exactly as in fenced code blocks (see Extension:-\f[C]fenced_code_attributes\f[R]).-As with fenced code blocks, one can use either attributes in curly-braces or a single unbraced word, which will be treated as a class name.-The Div ends with another line containing a string of at least three-consecutive colons.-The fenced Div should be separated by blank lines from preceding and-following blocks.-.PP-Example:-.IP-.nf-\f[C]-::::: {#special .sidebar}-Here is a paragraph.--And another.-:::::-\f[R]-.fi-.PP-Fenced divs can be nested.-Opening fences are distinguished because they \f[I]must\f[R] have-attributes:-.IP-.nf-\f[C]-::: Warning ::::::-This is a warning.--::: Danger-This is a warning within a warning.-:::-::::::::::::::::::-\f[R]-.fi-.PP-Fences without attributes are always closing fences.-Unlike with fenced code blocks, the number of colons in the closing-fence need not match the number in the opening fence.-However, it can be helpful for visual clarity to use fences of different-lengths to distinguish nested divs from their parents.-.SS Extension: \f[C]bracketed_spans\f[R]-.PP-A bracketed sequence of inlines, as one would use to begin a link, will-be treated as a \f[C]Span\f[R] with attributes if it is followed-immediately by attributes:-.IP-.nf-\f[C]-[This is *some text*]{.class key=\[dq]val\[dq]}-\f[R]-.fi-.SS Footnotes-.SS Extension: \f[C]footnotes\f[R]-.PP-Pandoc\[aq]s Markdown allows footnotes, using the following syntax:-.IP-.nf-\f[C]-Here is a footnote reference,[\[ha]1] and another.[\[ha]longnote]--[\[ha]1]: Here is the footnote.--[\[ha]longnote]: Here\[aq]s one with multiple blocks.-- Subsequent paragraphs are indented to show that they-belong to the previous footnote.-- { some.code }-- The whole paragraph can be indented, or just the first- line. In this way, multi\-paragraph footnotes work like- multi\-paragraph list items.--This paragraph won\[aq]t be part of the note, because it-isn\[aq]t indented.-\f[R]-.fi-.PP-The identifiers in footnote references may not contain spaces, tabs, or-newlines.-These identifiers are used only to correlate the footnote reference with-the note itself; in the output, footnotes will be numbered sequentially.-.PP-The footnotes themselves need not be placed at the end of the document.-They may appear anywhere except inside other block elements (lists,-block quotes, tables, etc.).-Each footnote should be separated from surrounding content (including-other footnotes) by blank lines.-.SS Extension: \f[C]inline_notes\f[R]-.PP-Inline footnotes are also allowed (though, unlike regular notes, they-cannot contain multiple paragraphs).-The syntax is as follows:-.IP-.nf-\f[C]-Here is an inline note.\[ha][Inlines notes are easier to write, since-you don\[aq]t have to pick an identifier and move down to type the-note.]-\f[R]-.fi-.PP-Inline and regular footnotes may be mixed freely.-.SS Citations-.SS Extension: \f[C]citations\f[R]-.PP-Using an external filter, \f[C]pandoc\-citeproc\f[R], pandoc can-automatically generate citations and a bibliography in a number of-styles.-Basic usage is-.IP-.nf-\f[C]-pandoc \-\-filter pandoc\-citeproc myinput.txt-\f[R]-.fi-.PP-In order to use this feature, you will need to specify a bibliography-file using the \f[C]bibliography\f[R] metadata field in a YAML metadata-section, or \f[C]\-\-bibliography\f[R] command line argument.-You can supply multiple \f[C]\-\-bibliography\f[R] arguments or set-\f[C]bibliography\f[R] metadata field to YAML array, if you want to use-multiple bibliography files.-The bibliography may have any of these formats:-.PP-.TS-tab(@);-l l.-T{-Format-T}@T{-File extension-T}-_-T{-BibLaTeX-T}@T{-\&.bib-T}-T{-BibTeX-T}@T{-\&.bibtex-T}-T{-Copac-T}@T{-\&.copac-T}-T{-CSL JSON-T}@T{-\&.json-T}-T{-CSL YAML-T}@T{-\&.yaml-T}-T{-EndNote-T}@T{-\&.enl-T}-T{-EndNote XML-T}@T{-\&.xml-T}-T{-ISI-T}@T{-\&.wos-T}-T{-MEDLINE-T}@T{-\&.medline-T}-T{-MODS-T}@T{-\&.mods-T}-T{-RIS-T}@T{-\&.ris-T}-.TE-.PP-Note that \f[C].bib\f[R] can be used with both BibTeX and BibLaTeX-files; use \f[C].bibtex\f[R] to force BibTeX.-.PP-Note that \f[C]pandoc\-citeproc \-\-bib2json\f[R] and-\f[C]pandoc\-citeproc \-\-bib2yaml\f[R] can produce \f[C].json\f[R] and-\f[C].yaml\f[R] files from any of the supported formats.-.PP-In\-field markup: In BibTeX and BibLaTeX databases, pandoc\-citeproc-parses a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown;-and in CSL JSON databases, an HTML\-like markup:-.TP-.B \f[C]<i>...</i>\f[R]-italics-.TP-.B \f[C]<b>...</b>\f[R]-bold-.TP-.B \f[C]<span style=\[dq]font\-variant:small\-caps;\[dq]>...</span>\f[R] or \f[C]<sc>...</sc>\f[R]-small capitals-.TP-.B \f[C]<sub>...</sub>\f[R]-subscript-.TP-.B \f[C]<sup>...</sup>\f[R]-superscript-.TP-.B \f[C]<span class=\[dq]nocase\[dq]>...</span>\f[R]-prevent a phrase from being capitalized as title case-.PP-\f[C]pandoc\-citeproc \-j\f[R] and \f[C]\-y\f[R] interconvert the CSL-JSON and CSL YAML formats as far as possible.-.PP-As an alternative to specifying a bibliography file using-\f[C]\-\-bibliography\f[R] or the YAML metadata field-\f[C]bibliography\f[R], you can include the citation data directly in-the \f[C]references\f[R] field of the document\[aq]s YAML metadata.-The field should contain an array of YAML\-encoded references, for-example:-.IP-.nf-\f[C]-\-\-\--references:-\- type: article\-journal- id: WatsonCrick1953- author:- \- family: Watson- given: J. D.- \- family: Crick- given: F. H. C.- issued:- date\-parts:- \- \- 1953- \- 4- \- 25- title: \[aq]Molecular structure of nucleic acids: a structure for deoxyribose- nucleic acid\[aq]- title\-short: Molecular structure of nucleic acids- container\-title: Nature- volume: 171- issue: 4356- page: 737\-738- DOI: 10.1038/171737a0- URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html- language: en\-GB-\&...-\f[R]-.fi-.PP-(\f[C]pandoc\-citeproc \-\-bib2yaml\f[R] can produce these from a-bibliography file in one of the supported formats.)-.PP-Citations and references can be formatted using any style supported by-the Citation Style Language, listed in the Zotero Style Repository.-These files are specified using the \f[C]\-\-csl\f[R] option or the-\f[C]csl\f[R] metadata field.-By default, \f[C]pandoc\-citeproc\f[R] will use the Chicago Manual of-Style author\-date format.-The CSL project provides further information on finding and editing-styles.-.PP-To make your citations hyperlinks to the corresponding bibliography-entries, add \f[C]link\-citations: true\f[R] to your YAML metadata.-.PP-Citations go inside square brackets and are separated by semicolons.-Each citation must have a key, composed of \[aq]\[at]\[aq] + the-citation identifier from the database, and may optionally have a prefix,-a locator, and a suffix.-The citation key must begin with a letter, digit, or \f[C]_\f[R], and-may contain alphanumerics, \f[C]_\f[R], and internal punctuation-characters (\f[C]:.#$%&\-+?<>\[ti]/\f[R]).-Here are some examples:-.IP-.nf-\f[C]-Blah blah [see \[at]doe99, pp. 33\-35; also \[at]smith04, chap. 1].--Blah blah [\[at]doe99, pp. 33\-35, 38\-39 and *passim*].--Blah blah [\[at]smith04; \[at]doe99].-\f[R]-.fi-.PP-\f[C]pandoc\-citeproc\f[R] detects locator terms in the CSL locale-files.-Either abbreviated or unabbreviated forms are accepted.-In the \f[C]en\-US\f[R] locale, locator terms can be written in either-singular or plural forms, as \f[C]book\f[R],-\f[C]bk.\f[R]/\f[C]bks.\f[R]; \f[C]chapter\f[R],-\f[C]chap.\f[R]/\f[C]chaps.\f[R]; \f[C]column\f[R],-\f[C]col.\f[R]/\f[C]cols.\f[R]; \f[C]figure\f[R],-\f[C]fig.\f[R]/\f[C]figs.\f[R]; \f[C]folio\f[R],-\f[C]fol.\f[R]/\f[C]fols.\f[R]; \f[C]number\f[R],-\f[C]no.\f[R]/\f[C]nos.\f[R]; \f[C]line\f[R],-\f[C]l.\f[R]/\f[C]ll.\f[R]; \f[C]note\f[R], \f[C]n.\f[R]/\f[C]nn.\f[R];-\f[C]opus\f[R], \f[C]op.\f[R]/\f[C]opp.\f[R]; \f[C]page\f[R],-\f[C]p.\f[R]/\f[C]pp.\f[R]; \f[C]paragraph\f[R],-\f[C]para.\f[R]/\f[C]paras.\f[R]; \f[C]part\f[R],-\f[C]pt.\f[R]/\f[C]pts.\f[R]; \f[C]section\f[R],-\f[C]sec.\f[R]/\f[C]secs.\f[R]; \f[C]sub verbo\f[R],-\f[C]s.v.\f[R]/\f[C]s.vv.\f[R]; \f[C]verse\f[R],-\f[C]v.\f[R]/\f[C]vv.\f[R]; \f[C]volume\f[R],-\f[C]vol.\f[R]/\f[C]vols.\f[R]; \f[C]\[ps]\f[R]/\f[C]\[ps]\[ps]\f[R];-\f[C]\[sc]\f[R]/\f[C]\[sc]\[sc]\f[R].-If no locator term is used, \[dq]page\[dq] is assumed.-.PP-\f[C]pandoc\-citeproc\f[R] will use heuristics to distinguish the-locator from the suffix.-In complex cases, the locator can be enclosed in curly braces (using-\f[C]pandoc\-citeproc\f[R] 0.15 and higher only):-.IP-.nf-\f[C]-[\[at]smith{ii, A, D\-Z}, with a suffix]-[\[at]smith, {pp. iv, vi\-xi, (xv)\-(xvii)} with suffix here]-\f[R]-.fi-.PP-A minus sign (\f[C]\-\f[R]) before the \f[C]\[at]\f[R] will suppress-mention of the author in the citation.-This can be useful when the author is already mentioned in the text:-.IP-.nf-\f[C]-Smith says blah [\-\[at]smith04].-\f[R]-.fi-.PP-You can also write an in\-text citation, as follows:-.IP-.nf-\f[C]-\[at]smith04 says blah.--\[at]smith04 [p. 33] says blah.-\f[R]-.fi-.PP-If the style calls for a list of works cited, it will be placed in a div-with id \f[C]refs\f[R], if one exists:-.IP-.nf-\f[C]-::: #refs-:::-\f[R]-.fi-.PP-Otherwise, it will be placed at the end of the document.-Generation of the bibliography can be suppressed by setting-\f[C]suppress\-bibliography: true\f[R] in the YAML metadata.-.PP-If you wish the bibliography to have a section header, you can set-\f[C]reference\-section\-title\f[R] in the metadata, or put the header-at the beginning of the div with id \f[C]refs\f[R] (if you are using it)-or at the end of your document:-.IP-.nf-\f[C]-last paragraph...--# References-\f[R]-.fi-.PP-The bibliography will be inserted after this header.-Note that the \f[C]unnumbered\f[R] class will be added to this header,-so that the section will not be numbered.-.PP-If you want to include items in the bibliography without actually citing-them in the body text, you can define a dummy \f[C]nocite\f[R] metadata-field and put the citations there:-.IP-.nf-\f[C]-\-\-\--nocite: |- \[at]item1, \[at]item2-\&...--\[at]item3-\f[R]-.fi-.PP-In this example, the document will contain a citation for-\f[C]item3\f[R] only, but the bibliography will contain entries for-\f[C]item1\f[R], \f[C]item2\f[R], and \f[C]item3\f[R].-.PP-It is possible to create a bibliography with all the citations, whether-or not they appear in the document, by using a wildcard:-.IP-.nf-\f[C]-\-\-\--nocite: |- \[at]*-\&...-\f[R]-.fi-.PP-For LaTeX output, you can also use \f[C]natbib\f[R] or-\f[C]biblatex\f[R] to render the bibliography.-In order to do so, specify bibliography files as outlined above, and add-\f[C]\-\-natbib\f[R] or \f[C]\-\-biblatex\f[R] argument to-\f[C]pandoc\f[R] invocation.-Bear in mind that bibliography files have to be in respective format-(either BibTeX or BibLaTeX).-.PP-For more information, see the pandoc\-citeproc man page.-.SS Non\-pandoc extensions-.PP-The following Markdown syntax extensions are not enabled by default in-pandoc, but may be enabled by adding \f[C]+EXTENSION\f[R] to the format-name, where \f[C]EXTENSION\f[R] is the name of the extension.-Thus, for example, \f[C]markdown+hard_line_breaks\f[R] is Markdown with-hard line breaks.-.SS Extension: \f[C]old_dashes\f[R]-.PP-Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:-\f[C]\-\f[R] before a numeral is an en\-dash, and \f[C]\-\-\f[R] is an-em\-dash.-This option only has an effect if \f[C]smart\f[R] is enabled.-It is selected automatically for \f[C]textile\f[R] input.-.SS Extension: \f[C]angle_brackets_escapable\f[R]-.PP-Allow \f[C]<\f[R] and \f[C]>\f[R] to be backslash\-escaped, as they can-be in GitHub flavored Markdown but not original Markdown.-This is implied by pandoc\[aq]s default \f[C]all_symbols_escapable\f[R].-.SS Extension: \f[C]lists_without_preceding_blankline\f[R]-.PP-Allow a list to occur right after a paragraph, with no intervening blank-space.-.SS Extension: \f[C]four_space_rule\f[R]-.PP-Selects the pandoc <= 2.0 behavior for parsing lists, so that four-spaces indent are needed for list item continuation paragraphs.-.SS Extension: \f[C]spaced_reference_links\f[R]-.PP-Allow whitespace between the two components of a reference link, for-example,-.IP-.nf-\f[C]-[foo] [bar].-\f[R]-.fi-.SS Extension: \f[C]hard_line_breaks\f[R]-.PP-Causes all newlines within a paragraph to be interpreted as hard line-breaks instead of spaces.-.SS Extension: \f[C]ignore_line_breaks\f[R]-.PP-Causes newlines within a paragraph to be ignored, rather than being-treated as spaces or as hard line breaks.-This option is intended for use with East Asian languages where spaces-are not used between words, but text is divided into lines for-readability.-.SS Extension: \f[C]east_asian_line_breaks\f[R]-.PP-Causes newlines within a paragraph to be ignored, rather than being-treated as spaces or as hard line breaks, when they occur between two-East Asian wide characters.-This is a better choice than \f[C]ignore_line_breaks\f[R] for texts that-include a mix of East Asian wide characters and other characters.-.SS Extension: \f[C]emoji\f[R]-.PP-Parses textual emojis like \f[C]:smile:\f[R] as Unicode emoticons.-.SS Extension: \f[C]tex_math_single_backslash\f[R]-.PP-Causes anything between \f[C]\[rs](\f[R] and \f[C]\[rs])\f[R] to be-interpreted as inline TeX math, and anything between \f[C]\[rs][\f[R]-and \f[C]\[rs]]\f[R] to be interpreted as display TeX math.-Note: a drawback of this extension is that it precludes escaping-\f[C](\f[R] and \f[C][\f[R].-.SS Extension: \f[C]tex_math_double_backslash\f[R]-.PP-Causes anything between \f[C]\[rs]\[rs](\f[R] and \f[C]\[rs]\[rs])\f[R]-to be interpreted as inline TeX math, and anything between-\f[C]\[rs]\[rs][\f[R] and \f[C]\[rs]\[rs]]\f[R] to be interpreted as-display TeX math.-.SS Extension: \f[C]markdown_attribute\f[R]-.PP-By default, pandoc interprets material inside block\-level tags as-Markdown.-This extension changes the behavior so that Markdown is only parsed-inside block\-level tags if the tags have the attribute-\f[C]markdown=1\f[R].-.SS Extension: \f[C]mmd_title_block\f[R]-.PP-Enables a MultiMarkdown style title block at the top of the document,-for example:-.IP-.nf-\f[C]-Title: My title-Author: John Doe-Date: September 1, 2008-Comment: This is a sample mmd title block, with- a field spanning multiple lines.-\f[R]-.fi-.PP-See the MultiMarkdown documentation for details.-If \f[C]pandoc_title_block\f[R] or \f[C]yaml_metadata_block\f[R] is-enabled, it will take precedence over \f[C]mmd_title_block\f[R].-.SS Extension: \f[C]abbreviations\f[R]-.PP-Parses PHP Markdown Extra abbreviation keys, like-.IP-.nf-\f[C]-*[HTML]: Hypertext Markup Language-\f[R]-.fi-.PP-Note that the pandoc document model does not support abbreviations, so-if this extension is enabled, abbreviation keys are simply skipped (as-opposed to being parsed as paragraphs).-.SS Extension: \f[C]autolink_bare_uris\f[R]-.PP-Makes all absolute URIs into links, even when not surrounded by pointy-braces \f[C]<...>\f[R].-.SS Extension: \f[C]mmd_link_attributes\f[R]-.PP-Parses multimarkdown style key\-value attributes on link and image-references.-This extension should not be confused with the \f[C]link_attributes\f[R]-extension.-.IP-.nf-\f[C]-This is a reference ![image][ref] with multimarkdown attributes.--[ref]: http://path.to/image \[dq]Image title\[dq] width=20px height=30px- id=myId class=\[dq]myClass1 myClass2\[dq]-\f[R]-.fi-.SS Extension: \f[C]mmd_header_identifiers\f[R]-.PP-Parses multimarkdown style header identifiers (in square brackets, after-the header but before any trailing \f[C]#\f[R]s in an ATX header).-.SS Extension: \f[C]compact_definition_lists\f[R]-.PP-Activates the definition list syntax of pandoc 1.12.x and earlier.-This syntax differs from the one described above under Definition lists-in several respects:-.IP \[bu] 2-No blank line is required between consecutive items of the definition-list.-.IP \[bu] 2-To get a \[dq]tight\[dq] or \[dq]compact\[dq] list, omit space between-consecutive items; the space between a term and its definition does not-affect anything.-.IP \[bu] 2-Lazy wrapping of paragraphs is not allowed: the entire definition must-be indented four spaces.-.SS Markdown variants-.PP-In addition to pandoc\[aq]s extended Markdown, the following Markdown-variants are supported:-.TP-.B \f[C]markdown_phpextra\f[R] (PHP Markdown Extra)-\f[C]footnotes\f[R], \f[C]pipe_tables\f[R], \f[C]raw_html\f[R],-\f[C]markdown_attribute\f[R], \f[C]fenced_code_blocks\f[R],-\f[C]definition_lists\f[R], \f[C]intraword_underscores\f[R],-\f[C]header_attributes\f[R], \f[C]link_attributes\f[R],-\f[C]abbreviations\f[R], \f[C]shortcut_reference_links\f[R],-\f[C]spaced_reference_links\f[R].-.TP-.B \f[C]markdown_github\f[R] (deprecated GitHub\-Flavored Markdown)-\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],-\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],-\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],-\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],-\f[C]strikeout\f[R], \f[C]emoji\f[R],-\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],-\f[C]lists_without_preceding_blankline\f[R].-.TP-.B \f[C]markdown_mmd\f[R] (MultiMarkdown)-\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]markdown_attribute\f[R],-\f[C]mmd_link_attributes\f[R], \f[C]tex_math_double_backslash\f[R],-\f[C]intraword_underscores\f[R], \f[C]mmd_title_block\f[R],-\f[C]footnotes\f[R], \f[C]definition_lists\f[R],-\f[C]all_symbols_escapable\f[R], \f[C]implicit_header_references\f[R],-\f[C]auto_identifiers\f[R], \f[C]mmd_header_identifiers\f[R],-\f[C]shortcut_reference_links\f[R], \f[C]implicit_figures\f[R],-\f[C]superscript\f[R], \f[C]subscript\f[R],-\f[C]backtick_code_blocks\f[R], \f[C]spaced_reference_links\f[R],-\f[C]raw_attribute\f[R].-.TP-.B \f[C]markdown_strict\f[R] (Markdown.pl)-\f[C]raw_html\f[R], \f[C]shortcut_reference_links\f[R],-\f[C]spaced_reference_links\f[R].-.PP-We also support \f[C]commonmark\f[R] and \f[C]gfm\f[R] (GitHub\-Flavored-Markdown, which is implemented as a set of extensions on-\f[C]commonmark\f[R]).-.PP-Note, however, that \f[C]commonmark\f[R] and \f[C]gfm\f[R] have limited-support for extensions.-Only those listed below (and \f[C]smart\f[R] and \f[C]raw_tex\f[R]) will-work.-The extensions can, however, all be individually disabled.-Also, \f[C]raw_tex\f[R] only affects \f[C]gfm\f[R] output, not input.-.TP-.B \f[C]gfm\f[R] (GitHub\-Flavored Markdown)-\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],-\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],-\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],-\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],-\f[C]strikeout\f[R], \f[C]emoji\f[R],-\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],-\f[C]lists_without_preceding_blankline\f[R].-.SH PRODUCING SLIDE SHOWS WITH PANDOC-.PP-You can use pandoc to produce an HTML + JavaScript slide presentation-that can be viewed via a web browser.-There are five ways to do this, using S5, DZSlides, Slidy, Slideous, or-reveal.js.-You can also produce a PDF slide show using LaTeX \f[C]beamer\f[R], or-slides shows in Microsoft PowerPoint format.-.PP-Here\[aq]s the Markdown source for a simple slide show,-\f[C]habits.txt\f[R]:-.IP-.nf-\f[C]-% Habits-% John Doe-% March 22, 2005--# In the morning--## Getting up--\- Turn off alarm-\- Get out of bed--## Breakfast--\- Eat eggs-\- Drink coffee--# In the evening--## Dinner--\- Eat spaghetti-\- Drink wine--\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-----## Going to sleep--\- Get in bed-\- Count sheep-\f[R]-.fi-.PP-To produce an HTML/JavaScript slide show, simply type-.IP-.nf-\f[C]-pandoc \-t FORMAT \-s habits.txt \-o habits.html-\f[R]-.fi-.PP-where \f[C]FORMAT\f[R] is either \f[C]s5\f[R], \f[C]slidy\f[R],-\f[C]slideous\f[R], \f[C]dzslides\f[R], or \f[C]revealjs\f[R].-.PP-For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with-the \f[C]\-s/\-\-standalone\f[R] option embeds a link to JavaScript and-CSS files, which are assumed to be available at the relative path-\f[C]s5/default\f[R] (for S5), \f[C]slideous\f[R] (for Slideous),-\f[C]reveal.js\f[R] (for reveal.js), or at the Slidy website at-\f[C]w3.org\f[R] (for Slidy).-(These paths can be changed by setting the \f[C]slidy\-url\f[R],-\f[C]slideous\-url\f[R], \f[C]revealjs\-url\f[R], or \f[C]s5\-url\f[R]-variables; see Variables for slides, above.) For DZSlides, the-(relatively short) JavaScript and CSS are included in the file by-default.-.PP-With all HTML slide formats, the \f[C]\-\-self\-contained\f[R] option-can be used to produce a single file that contains all of the data-necessary to display the slide show, including linked scripts,-stylesheets, images, and videos.-.PP-To produce a PDF slide show using beamer, type-.IP-.nf-\f[C]-pandoc \-t beamer habits.txt \-o habits.pdf-\f[R]-.fi-.PP-Note that a reveal.js slide show can also be converted to a PDF by-printing it to a file from the browser.-.PP-To produce a Powerpoint slide show, type-.IP-.nf-\f[C]-pandoc habits.txt \-o habits.pptx-\f[R]-.fi-.SS Structuring the slide show-.PP-By default, the \f[I]slide level\f[R] is the highest header level in the-hierarchy that is followed immediately by content, and not another-header, somewhere in the document.-In the example above, level 1 headers are always followed by level 2-headers, which are followed by content, so 2 is the slide level.-This default can be overridden using the \f[C]\-\-slide\-level\f[R]-option.-.PP-The document is carved up into slides according to the following rules:-.IP \[bu] 2-A horizontal rule always starts a new slide.-.IP \[bu] 2-A header at the slide level always starts a new slide.-.IP \[bu] 2-Headers \f[I]below\f[R] the slide level in the hierarchy create headers-\f[I]within\f[R] a slide.-.IP \[bu] 2-Headers \f[I]above\f[R] the slide level in the hierarchy create-\[dq]title slides,\[dq] which just contain the section title and help to-break the slide show into sections.-.IP \[bu] 2-Content \f[I]above\f[R] the slide level will not appear in the slide-show.-.IP \[bu] 2-A title page is constructed automatically from the document\[aq]s title-block, if present.-(In the case of beamer, this can be disabled by commenting out some-lines in the default template.)-.PP-These rules are designed to support many different styles of slide show.-If you don\[aq]t care about structuring your slides into sections and-subsections, you can just use level 1 headers for all each slide.-(In that case, level 1 will be the slide level.) But you can also-structure the slide show into sections, as in the example above.-.PP-Note: in reveal.js slide shows, if slide level is 2, a two\-dimensional-layout will be produced, with level 1 headers building horizontally and-level 2 headers building vertically.-It is not recommended that you use deeper nesting of section levels with-reveal.js.-.SS Incremental lists-.PP-By default, these writers produce lists that display \[dq]all at-once.\[dq] If you want your lists to display incrementally (one item at-a time), use the \f[C]\-i\f[R] option.-If you want a particular list to depart from the default, put it in a-\f[C]div\f[R] block with class \f[C]incremental\f[R] or-\f[C]nonincremental\f[R].-So, for example, using the \f[C]fenced div\f[R] syntax, the following-would be incremental regardless of the document default:-.IP-.nf-\f[C]-::: incremental--\- Eat spaghetti-\- Drink wine--:::-\f[R]-.fi-.PP-or-.IP-.nf-\f[C]-::: nonincremental--\- Eat spaghetti-\- Drink wine--:::-\f[R]-.fi-.PP-While using \f[C]incremental\f[R] and \f[C]nonincremental\f[R] divs are-the recommended method of setting incremental lists on a per\-case-basis, an older method is also supported: putting lists inside a-blockquote will depart from the document default (that is, it will-display incrementally without the \f[C]\-i\f[R] option and all at once-with the \f[C]\-i\f[R] option):-.IP-.nf-\f[C]-> \- Eat spaghetti-> \- Drink wine-\f[R]-.fi-.PP-Both methods allow incremental and nonincremental lists to be mixed in a-single document.-.SS Inserting pauses-.PP-You can add \[dq]pauses\[dq] within a slide by including a paragraph-containing three dots, separated by spaces:-.IP-.nf-\f[C]-# Slide with a pause--content before the pause--\&. . .--content after the pause-\f[R]-.fi-.SS Styling the slides-.PP-You can change the style of HTML slides by putting customized CSS files-in \f[C]$DATADIR/s5/default\f[R] (for S5), \f[C]$DATADIR/slidy\f[R] (for-Slidy), or \f[C]$DATADIR/slideous\f[R] (for Slideous), where-\f[C]$DATADIR\f[R] is the user data directory (see-\f[C]\-\-data\-dir\f[R], above).-The originals may be found in pandoc\[aq]s system data directory-(generally \f[C]$CABALDIR/pandoc\-VERSION/s5/default\f[R]).-Pandoc will look there for any files it does not find in the user data-directory.-.PP-For dzslides, the CSS is included in the HTML file itself, and may be-modified there.-.PP-All reveal.js configuration options can be set through variables.-For example, themes can be used by setting the \f[C]theme\f[R] variable:-.IP-.nf-\f[C]-\-V theme=moon-\f[R]-.fi-.PP-Or you can specify a custom stylesheet using the \f[C]\-\-css\f[R]-option.-.PP-To style beamer slides, you can specify a \f[C]theme\f[R],-\f[C]colortheme\f[R], \f[C]fonttheme\f[R], \f[C]innertheme\f[R], and-\f[C]outertheme\f[R], using the \f[C]\-V\f[R] option:-.IP-.nf-\f[C]-pandoc \-t beamer habits.txt \-V theme:Warsaw \-o habits.pdf-\f[R]-.fi-.PP-Note that header attributes will turn into slide attributes (on a-\f[C]<div>\f[R] or \f[C]<section>\f[R]) in HTML slide formats, allowing-you to style individual slides.-In beamer, the only header attribute that affects slides is the-\f[C]allowframebreaks\f[R] class, which sets the-\f[C]allowframebreaks\f[R] option, causing multiple slides to be created-if the content overfills the frame.-This is recommended especially for bibliographies:-.IP-.nf-\f[C]-# References {.allowframebreaks}-\f[R]-.fi-.SS Speaker notes-.PP-Speaker notes are supported in reveal.js and PowerPoint (pptx) output.-You can add notes to your Markdown document thus:-.IP-.nf-\f[C]-::: notes--This is my note.--\- It can contain Markdown-\- like this list--:::-\f[R]-.fi-.PP-To show the notes window in reveal.js, press \f[C]s\f[R] while viewing-the presentation.-Speaker notes in PowerPoint will be available, as usual, in handouts and-presenter view.-.PP-Notes are not yet supported for other slide formats, but the notes will-not appear on the slides themselves.-.SS Columns-.PP-To put material in side by side columns, you can use a native div-container with class \f[C]columns\f[R], containing two or more div-containers with class \f[C]column\f[R] and a \f[C]width\f[R] attribute:-.IP-.nf-\f[C]-:::::::::::::: {.columns}-::: {.column width=\[dq]40%\[dq]}-contents...-:::-::: {.column width=\[dq]60%\[dq]}-contents...-:::-::::::::::::::-\f[R]-.fi-.SS Frame attributes in beamer-.PP-Sometimes it is necessary to add the LaTeX \f[C][fragile]\f[R] option to-a frame in beamer (for example, when using the \f[C]minted\f[R]-environment).-This can be forced by adding the \f[C]fragile\f[R] class to the header-introducing the slide:-.IP-.nf-\f[C]-# Fragile slide {.fragile}-\f[R]-.fi-.PP-All of the other frame attributes described in Section 8.1 of the Beamer-User\[aq]s Guide may also be used: \f[C]allowdisplaybreaks\f[R],-\f[C]allowframebreaks\f[R], \f[C]b\f[R], \f[C]c\f[R], \f[C]t\f[R],-\f[C]environment\f[R], \f[C]label\f[R], \f[C]plain\f[R],-\f[C]shrink\f[R], \f[C]standout\f[R], \f[C]noframenumbering\f[R].-.SS Background in reveal.js and beamer-.PP-Background images can be added to self\-contained reveal.js slideshows-and to beamer slideshows.-.PP-For the same image on every slide, use the configuration option-\f[C]background\-image\f[R] either in the YAML metadata block or as a-command\-line variable.-(There are no other options in beamer and the rest of this section-concerns reveal.js slideshows.)-.PP-For reveal.js, you can instead use the reveal.js\-native option-\f[C]parallaxBackgroundImage\f[R].-You can also set \f[C]parallaxBackgroundHorizontal\f[R] and-\f[C]parallaxBackgroundVertical\f[R] the same way and must also set-\f[C]parallaxBackgroundSize\f[R] to have your values take effect.-.PP-To set an image for a particular reveal.js slide, add-\f[C]{data\-background\-image=\[dq]/path/to/image\[dq]}\f[R] to the-first slide\-level header on the slide (which may even be empty).-.PP-In reveal.js\[aq]s overview mode, the parallaxBackgroundImage will show-up only on the first slide.-.PP-Other reveal.js background settings also work on individual slides,-including \f[C]data\-background\-size\f[R],-\f[C]data\-background\-repeat\f[R], \f[C]data\-background\-color\f[R],-\f[C]data\-transition\f[R], and \f[C]data\-transition\-speed\f[R].-.PP-See the reveal.js documentation for more details.-.PP-For example in reveal.js:-.IP-.nf-\f[C]-\-\-\--title: My Slideshow-parallaxBackgroundImage: /path/to/my/background_image.png-\-\-\---## Slide One--Slide 1 has background_image.png as its background.--## {data\-background\-image=\[dq]/path/to/special_image.jpg\[dq]}--Slide 2 has a special image for its background, even though the header has no content.-\f[R]-.fi-.SH CREATING EPUBS WITH PANDOC-.SS EPUB Metadata-.PP-EPUB metadata may be specified using the \f[C]\-\-epub\-metadata\f[R]-option, but if the source document is Markdown, it is better to use a-YAML metadata block.-Here is an example:-.IP-.nf-\f[C]-\-\-\--title:-\- type: main- text: My Book-\- type: subtitle- text: An investigation of metadata-creator:-\- role: author- text: John Smith-\- role: editor- text: Sarah Jones-identifier:-\- scheme: DOI- text: doi:10.234234.234/33-publisher: My Press-rights: \[co] 2007 John Smith, CC BY\-NC-ibooks:- version: 1.3.4-\&...-\f[R]-.fi-.PP-The following fields are recognized:-.TP-.B \f[C]identifier\f[R]-Either a string value or an object with fields \f[C]text\f[R] and-\f[C]scheme\f[R].-Valid values for \f[C]scheme\f[R] are \f[C]ISBN\-10\f[R],-\f[C]GTIN\-13\f[R], \f[C]UPC\f[R], \f[C]ISMN\-10\f[R], \f[C]DOI\f[R],-\f[C]LCCN\f[R], \f[C]GTIN\-14\f[R], \f[C]ISBN\-13\f[R],-\f[C]Legal deposit number\f[R], \f[C]URN\f[R], \f[C]OCLC\f[R],-\f[C]ISMN\-13\f[R], \f[C]ISBN\-A\f[R], \f[C]JP\f[R], \f[C]OLCC\f[R].-.TP-.B \f[C]title\f[R]-Either a string value, or an object with fields \f[C]file\-as\f[R] and-\f[C]type\f[R], or a list of such objects.-Valid values for \f[C]type\f[R] are \f[C]main\f[R], \f[C]subtitle\f[R],-\f[C]short\f[R], \f[C]collection\f[R], \f[C]edition\f[R],-\f[C]extended\f[R].-.TP-.B \f[C]creator\f[R]-Either a string value, or an object with fields \f[C]role\f[R],-\f[C]file\-as\f[R], and \f[C]text\f[R], or a list of such objects.-Valid values for \f[C]role\f[R] are MARC relators, but pandoc will-attempt to translate the human\-readable versions (like \[dq]author\[dq]-and \[dq]editor\[dq]) to the appropriate marc relators.-.TP-.B \f[C]contributor\f[R]-Same format as \f[C]creator\f[R].-.TP-.B \f[C]date\f[R]-A string value in \f[C]YYYY\-MM\-DD\f[R] format.-(Only the year is necessary.) Pandoc will attempt to convert other-common date formats.-.TP-.B \f[C]lang\f[R] (or legacy: \f[C]language\f[R])-A string value in BCP 47 format.-Pandoc will default to the local language if nothing is specified.-.TP-.B \f[C]subject\f[R]-A string value or a list of such values.-.TP-.B \f[C]description\f[R]-A string value.-.TP-.B \f[C]type\f[R]-A string value.-.TP-.B \f[C]format\f[R]-A string value.-.TP-.B \f[C]relation\f[R]-A string value.-.TP-.B \f[C]coverage\f[R]-A string value.-.TP-.B \f[C]rights\f[R]-A string value.-.TP-.B \f[C]cover\-image\f[R]-A string value (path to cover image).-.TP-.B \f[C]css\f[R] (or legacy: \f[C]stylesheet\f[R])-A string value (path to CSS stylesheet).-.TP-.B \f[C]page\-progression\-direction\f[R]-Either \f[C]ltr\f[R] or \f[C]rtl\f[R].-Specifies the \f[C]page\-progression\-direction\f[R] attribute for the-\f[C]spine\f[R] element.-.TP-.B \f[C]ibooks\f[R]-iBooks\-specific metadata, with the following fields:-.RS-.IP \[bu] 2-\f[C]version\f[R]: (string)-.IP \[bu] 2-\f[C]specified\-fonts\f[R]: \f[C]true\f[R]|\f[C]false\f[R] (default-\f[C]false\f[R])-.IP \[bu] 2-\f[C]ipad\-orientation\-lock\f[R]:-\f[C]portrait\-only\f[R]|\f[C]landscape\-only\f[R]-.IP \[bu] 2-\f[C]iphone\-orientation\-lock\f[R]:-\f[C]portrait\-only\f[R]|\f[C]landscape\-only\f[R]-.IP \[bu] 2-\f[C]binding\f[R]: \f[C]true\f[R]|\f[C]false\f[R] (default-\f[C]true\f[R])-.IP \[bu] 2-\f[C]scroll\-axis\f[R]:-\f[C]vertical\f[R]|\f[C]horizontal\f[R]|\f[C]default\f[R]-.RE-.SS The \f[C]epub:type\f[R] attribute-.PP-For \f[C]epub3\f[R] output, you can mark up the header that corresponds-to an EPUB chapter using the \f[C]epub:type\f[R] attribute.-For example, to set the attribute to the value \f[C]prologue\f[R], use-this markdown:-.IP-.nf-\f[C]-# My chapter {epub:type=prologue}-\f[R]-.fi-.PP-Which will result in:-.IP-.nf-\f[C]-<body epub:type=\[dq]frontmatter\[dq]>- <section epub:type=\[dq]prologue\[dq]>- <h1>My chapter</h1>-\f[R]-.fi-.PP-Pandoc will output \f[C]<body epub:type=\[dq]bodymatter\[dq]>\f[R],-unless you use one of the following values, in which case either-\f[C]frontmatter\f[R] or \f[C]backmatter\f[R] will be output.-.PP-.TS-tab(@);-l l.-T{-\f[C]epub:type\f[R] of first section-T}@T{-\f[C]epub:type\f[R] of body-T}-_-T{-prologue-T}@T{-frontmatter-T}-T{-abstract-T}@T{-frontmatter-T}-T{-acknowledgments-T}@T{-frontmatter-T}-T{-copyright\-page-T}@T{-frontmatter-T}-T{-dedication-T}@T{-frontmatter-T}-T{-foreword-T}@T{-frontmatter-T}-T{-halftitle,-T}@T{-frontmatter-T}-T{-introduction-T}@T{-frontmatter-T}-T{-preface-T}@T{-frontmatter-T}-T{-seriespage-T}@T{-frontmatter-T}-T{-titlepage-T}@T{-frontmatter-T}-T{-afterword-T}@T{-backmatter-T}-T{-appendix-T}@T{-backmatter-T}-T{-colophon-T}@T{-backmatter-T}-T{-conclusion-T}@T{-backmatter-T}-T{-epigraph-T}@T{-backmatter-T}-.TE-.SS Linked media-.PP-By default, pandoc will download media referenced from any-\f[C]<img>\f[R], \f[C]<audio>\f[R], \f[C]<video>\f[R] or-\f[C]<source>\f[R] element present in the generated EPUB, and include it-in the EPUB container, yielding a completely self\-contained EPUB.-If you want to link to external media resources instead, use raw HTML in-your source and add \f[C]data\-external=\[dq]1\[dq]\f[R] to the tag with-the \f[C]src\f[R] attribute.-For example:-.IP-.nf-\f[C]-<audio controls=\[dq]1\[dq]>- <source src=\[dq]http://example.com/music/toccata.mp3\[dq]- data\-external=\[dq]1\[dq] type=\[dq]audio/mpeg\[dq]>- </source>-</audio>-\f[R]-.fi-.SH SYNTAX HIGHLIGHTING-.PP-Pandoc will automatically highlight syntax in fenced code blocks that-are marked with a language name.-The Haskell library skylighting is used for highlighting.-Currently highlighting is supported only for HTML, EPUB, Docx, Ms, and-LaTeX/PDF output.-To see a list of language names that pandoc will recognize, type-\f[C]pandoc \-\-list\-highlight\-languages\f[R].-.PP-The color scheme can be selected using the-\f[C]\-\-highlight\-style\f[R] option.-The default color scheme is \f[C]pygments\f[R], which imitates the-default color scheme used by the Python library pygments (though-pygments is not actually used to do the highlighting).-To see a list of highlight styles, type-\f[C]pandoc \-\-list\-highlight\-styles\f[R].-.PP-If you are not satisfied with the predefined styles, you can use-\f[C]\-\-print\-highlight\-style\f[R] to generate a JSON-\f[C].theme\f[R] file which can be modified and used as the argument to-\f[C]\-\-highlight\-style\f[R].-To get a JSON version of the \f[C]pygments\f[R] style, for example:-.IP-.nf-\f[C]-pandoc \-\-print\-highlight\-style pygments > my.theme-\f[R]-.fi-.PP-Then edit \f[C]my.theme\f[R] and use it like this:-.IP-.nf-\f[C]-pandoc \-\-highlight\-style my.theme-\f[R]-.fi-.PP-If you are not satisfied with the built\-in highlighting, or you want-highlight a language that isn\[aq]t supported, you can use the-\f[C]\-\-syntax\-definition\f[R] option to load a KDE\-style XML syntax-definition file.-Before writing your own, have a look at KDE\[aq]s repository of syntax-definitions.-.PP-To disable highlighting, use the \f[C]\-\-no\-highlight\f[R] option.-.SH CUSTOM STYLES IN DOCX-.SS Input-.PP-The docx reader, by default, only reads those styles that it can convert-into pandoc elements, either by direct conversion or interpreting the-derivation of the input document\[aq]s styles.-.PP-By enabling the \f[C]styles\f[R] extension in the docx reader-(\f[C]\-f docx+styles\f[R]), you can produce output that maintains the-styles of the input document, using the \f[C]custom\-style\f[R] class.-Paragraph styles are interpreted as divs, while character styles are-interpreted as spans.-.PP-For example, using the \f[C]custom\-style\-reference.docx\f[R] file in-the test directory, we have the following different outputs:-.PP-Without the \f[C]+styles\f[R] extension:-.IP-.nf-\f[C]-$ pandoc test/docx/custom\-style\-reference.docx \-f docx \-t markdown-This is some text.--This is text with an *emphasized* text style. And this is text with a-**strengthened** text style.--> Here is a styled paragraph that inherits from Block Text.-\f[R]-.fi-.PP-And with the extension:-.IP-.nf-\f[C]-$ pandoc test/docx/custom\-style\-reference.docx \-f docx+styles \-t markdown--::: {custom\-style=\[dq]FirstParagraph\[dq]}-This is some text.-:::--::: {custom\-style=\[dq]BodyText\[dq]}-This is text with an [emphasized]{custom\-style=\[dq]Emphatic\[dq]} text style.-And this is text with a [strengthened]{custom\-style=\[dq]Strengthened\[dq]}-text style.-:::--::: {custom\-style=\[dq]MyBlockStyle\[dq]}-> Here is a styled paragraph that inherits from Block Text.-:::-\f[R]-.fi-.PP-With these custom styles, you can use your input document as a-reference\-doc while creating docx output (see below), and maintain the-same styles in your input and output files.-.SS Output-.PP-By default, pandoc\[aq]s docx output applies a predefined set of styles-for blocks such as paragraphs and block quotes, and uses largely default-formatting (italics, bold) for inlines.-This will work for most purposes, especially alongside a-\f[C]reference.docx\f[R] file.-However, if you need to apply your own styles to blocks, or match a-preexisting set of styles, pandoc allows you to define custom styles for-blocks and text using \f[C]div\f[R]s and \f[C]span\f[R]s, respectively.-.PP-If you define a \f[C]div\f[R] or \f[C]span\f[R] with the attribute-\f[C]custom\-style\f[R], pandoc will apply your specified style to the-contained elements.-So, for example using the \f[C]bracketed_spans\f[R] syntax,-.IP-.nf-\f[C]-[Get out]{custom\-style=\[dq]Emphatically\[dq]}, he said.-\f[R]-.fi-.PP-would produce a docx file with \[dq]Get out\[dq] styled with character-style \f[C]Emphatically\f[R].-Similarly, using the \f[C]fenced_divs\f[R] syntax,-.IP-.nf-\f[C]-Dickinson starts the poem simply:--::: {custom\-style=\[dq]Poetry\[dq]}-| A Bird came down the Walk\-\-\--| He did not know I saw\-\-\--:::-\f[R]-.fi-.PP-would style the two contained lines with the \f[C]Poetry\f[R] paragraph-style.-.PP-If the styles are not yet in your reference.docx, they will be defined-in the output file as inheriting from normal text.-If they are already defined, pandoc will not alter the definition.-.PP-This feature allows for greatest customization in conjunction with-pandoc filters.-If you want all paragraphs after block quotes to be indented, you can-write a filter to apply the styles necessary.-If you want all italics to be transformed to the \f[C]Emphasis\f[R]-character style (perhaps to change their color), you can write a filter-which will transform all italicized inlines to inlines within an-\f[C]Emphasis\f[R] custom\-style \f[C]span\f[R].-.SH CUSTOM WRITERS-.PP-Pandoc can be extended with custom writers written in lua.-(Pandoc includes a lua interpreter, so lua need not be installed-separately.)-.PP-To use a custom writer, simply specify the path to the lua script in-place of the output format.-For example:-.IP-.nf-\f[C]-pandoc \-t data/sample.lua-\f[R]-.fi-.PP-Creating a custom writer requires writing a lua function for each-possible element in a pandoc document.-To get a documented example which you can modify according to your-needs, do-.IP-.nf-\f[C]-pandoc \-\-print\-default\-data\-file sample.lua-\f[R]-.fi-.SH A NOTE ON SECURITY-.PP-If you use pandoc to convert user\-contributed content in a web-application, here are some things to keep in mind:-.IP "1." 3-Although pandoc itself will not create or modify any files other than-those you explicitly ask it create (with the exception of temporary-files used in producing PDFs), a filter or custom writer could in-principle do anything on your file system.-Please audit filters and custom writers very carefully before using-them.-.IP "2." 3-If your application uses pandoc as a Haskell library (rather than-shelling out to the executable), it is possible to use it in a mode that-fully isolates pandoc from your file system, by running the pandoc-operations in the \f[C]PandocPure\f[R] monad.-See the document Using the pandoc API for more details.-.IP "3." 3-Pandoc\[aq]s parsers can exhibit pathological performance on some corner-cases.-It is wise to put any pandoc operations under a timeout, to avoid DOS-attacks that exploit these issues.-If you are using the pandoc executable, you can add the command line-options \f[C]+RTS \-M512M \-RTS\f[R] (for example) to limit the heap-size to 512MB.-.IP "4." 3-The HTML generated by pandoc is not guaranteed to be safe.-If \f[C]raw_html\f[R] is enabled for the Markdown input, users can-inject arbitrary HTML.-Even if \f[C]raw_html\f[R] is disabled, users can include dangerous-content in attributes for headers, spans, and code blocks.-To be safe, you should run all the generated HTML through an HTML-sanitizer.-.SH AUTHORS-.PP-Copyright 2006\-2017 John MacFarlane (jgm\[at]berkeley.edu).+.TH PANDOC 1 "January 30, 2019" "pandoc 2.6"+.SH NAME+pandoc - general markup converter+.SH SYNOPSIS+.PP+\f[C]pandoc\f[R] [\f[I]options\f[R]] [\f[I]input-file\f[R]]...+.SH DESCRIPTION+.PP+Pandoc is a Haskell library for converting from one markup format to+another, and a command-line tool that uses this library.+.PP+Pandoc can convert between numerous markup and word processing formats,+including, but not limited to, various flavors of Markdown, HTML, LaTeX+and Word docx.+For the full lists of input and output formats, see the \f[C]--from\f[R]+and \f[C]--to\f[R] options below.+Pandoc can also produce PDF output: see creating a PDF, below.+.PP+Pandoc\[aq]s enhanced version of Markdown includes syntax for tables,+definition lists, metadata blocks, footnotes, citations, math, and much+more.+See below under Pandoc\[aq]s Markdown.+.PP+Pandoc has a modular design: it consists of a set of readers, which+parse text in a given format and produce a native representation of the+document (an \f[I]abstract syntax tree\f[R] or AST), and a set of+writers, which convert this native representation into a target format.+Thus, adding an input or output format requires only adding a reader or+writer.+Users can also run custom pandoc filters to modify the intermediate AST.+.PP+Because pandoc\[aq]s intermediate representation of a document is less+expressive than many of the formats it converts between, one should not+expect perfect conversions between every format and every other.+Pandoc attempts to preserve the structural elements of a document, but+not formatting details such as margin size.+And some document elements, such as complex tables, may not fit into+pandoc\[aq]s simple document model.+While conversions from pandoc\[aq]s Markdown to all formats aspire to be+perfect, conversions from formats more expressive than pandoc\[aq]s+Markdown can be expected to be lossy.+.SS Using pandoc+.PP+If no \f[I]input-files\f[R] are specified, input is read from+\f[I]stdin\f[R].+Output goes to \f[I]stdout\f[R] by default.+For output to a file, use the \f[C]-o\f[R] option:+.IP+.nf+\f[C]+pandoc -o output.html input.txt+\f[R]+.fi+.PP+By default, pandoc produces a document fragment.+To produce a standalone document (e.g.+a valid HTML file including \f[C]<head>\f[R] and \f[C]<body>\f[R]), use+the \f[C]-s\f[R] or \f[C]--standalone\f[R] flag:+.IP+.nf+\f[C]+pandoc -s -o output.html input.txt+\f[R]+.fi+.PP+For more information on how standalone documents are produced, see+Templates below.+.PP+If multiple input files are given, \f[C]pandoc\f[R] will concatenate+them all (with blank lines between them) before parsing.+(Use \f[C]--file-scope\f[R] to parse files individually.)+.SS Specifying formats+.PP+The format of the input and output can be specified explicitly using+command-line options.+The input format can be specified using the \f[C]-f/--from\f[R] option,+the output format using the \f[C]-t/--to\f[R] option.+Thus, to convert \f[C]hello.txt\f[R] from Markdown to LaTeX, you could+type:+.IP+.nf+\f[C]+pandoc -f markdown -t latex hello.txt+\f[R]+.fi+.PP+To convert \f[C]hello.html\f[R] from HTML to Markdown:+.IP+.nf+\f[C]+pandoc -f html -t markdown hello.html+\f[R]+.fi+.PP+Supported input and output formats are listed below under Options (see+\f[C]-f\f[R] for input formats and \f[C]-t\f[R] for output formats).+You can also use \f[C]pandoc --list-input-formats\f[R] and+\f[C]pandoc --list-output-formats\f[R] to print lists of supported+formats.+.PP+If the input or output format is not specified explicitly,+\f[C]pandoc\f[R] will attempt to guess it from the extensions of the+filenames.+Thus, for example,+.IP+.nf+\f[C]+pandoc -o hello.tex hello.txt+\f[R]+.fi+.PP+will convert \f[C]hello.txt\f[R] from Markdown to LaTeX.+If no output file is specified (so that output goes to+\f[I]stdout\f[R]), or if the output file\[aq]s extension is unknown, the+output format will default to HTML.+If no input file is specified (so that input comes from+\f[I]stdin\f[R]), or if the input files\[aq] extensions are unknown, the+input format will be assumed to be Markdown.+.SS Character encoding+.PP+Pandoc uses the UTF-8 character encoding for both input and output.+If your local character encoding is not UTF-8, you should pipe input and+output through \f[C]iconv\f[R]:+.IP+.nf+\f[C]+iconv -t utf-8 input.txt | pandoc | iconv -f utf-8+\f[R]+.fi+.PP+Note that in some output formats (such as HTML, LaTeX, ConTeXt, RTF,+OPML, DocBook, and Texinfo), information about the character encoding is+included in the document header, which will only be included if you use+the \f[C]-s/--standalone\f[R] option.+.SS Creating a PDF+.PP+To produce a PDF, specify an output file with a \f[C].pdf\f[R]+extension:+.IP+.nf+\f[C]+pandoc test.txt -o test.pdf+\f[R]+.fi+.PP+By default, pandoc will use LaTeX to create the PDF, which requires that+a LaTeX engine be installed (see \f[C]--pdf-engine\f[R] below).+.PP+Alternatively, pandoc can use ConTeXt, \f[C]pdfroff\f[R], or any of the+following HTML/CSS-to-PDF-engines, to create a PDF:+\f[C]wkhtmltopdf\f[R], \f[C]weasyprint\f[R] or \f[C]prince\f[R].+To do this, specify an output file with a \f[C].pdf\f[R] extension, as+before, but add the \f[C]--pdf-engine\f[R] option or+\f[C]-t context\f[R], \f[C]-t html\f[R], or \f[C]-t ms\f[R] to the+command line (\f[C]-t html\f[R] defaults to+\f[C]--pdf-engine=wkhtmltopdf\f[R]).+.PP+PDF output uses variables for LaTeX (with a LaTeX engine); variables for+ConTeXt (with ConTeXt); or variables for \f[C]wkhtmltopdf\f[R] (an+HTML/CSS-to-PDF engine; \f[C]--css\f[R] also affects the output).+.PP+To debug the PDF creation, it can be useful to look at the intermediate+representation: instead of \f[C]-o test.pdf\f[R], use for example+\f[C]-s -o test.tex\f[R] to output the generated LaTeX.+You can then test it with \f[C]pdflatex test.tex\f[R].+.PP+When using LaTeX, the following packages need to be available (they are+included with all recent versions of TeX Live): \f[C]amsfonts\f[R],+\f[C]amsmath\f[R], \f[C]lm\f[R], \f[C]unicode-math\f[R],+\f[C]ifxetex\f[R], \f[C]ifluatex\f[R], \f[C]listings\f[R] (if the+\f[C]--listings\f[R] option is used), \f[C]fancyvrb\f[R],+\f[C]longtable\f[R], \f[C]booktabs\f[R], \f[C]graphicx\f[R] and+\f[C]grffile\f[R] (if the document contains images), \f[C]hyperref\f[R],+\f[C]xcolor\f[R], \f[C]ulem\f[R], \f[C]geometry\f[R] (with the+\f[C]geometry\f[R] variable set), \f[C]setspace\f[R] (with+\f[C]linestretch\f[R]), and \f[C]babel\f[R] (with \f[C]lang\f[R]).+The use of \f[C]xelatex\f[R] or \f[C]lualatex\f[R] as the PDF engine+requires \f[C]fontspec\f[R].+\f[C]xelatex\f[R] uses \f[C]polyglossia\f[R] (with \f[C]lang\f[R]),+\f[C]xecjk\f[R], and \f[C]bidi\f[R] (with the \f[C]dir\f[R] variable+set).+If the \f[C]mathspec\f[R] variable is set, \f[C]xelatex\f[R] will use+\f[C]mathspec\f[R] instead of \f[C]unicode-math\f[R].+The \f[C]upquote\f[R] and \f[C]microtype\f[R] packages are used if+available, and \f[C]csquotes\f[R] will be used for typography if+\f[C]\[rs]usepackage{csquotes}\f[R] is present in the template or+included via \f[C]/H/--include-in-header\f[R].+The \f[C]natbib\f[R], \f[C]biblatex\f[R], \f[C]bibtex\f[R], and+\f[C]biber\f[R] packages can optionally be used for citation rendering.+The following packages will be used to improve output quality if+present, but pandoc does not require them to be present:+\f[C]upquote\f[R] (for straight quotes in verbatim environments),+\f[C]microtype\f[R] (for better spacing adjustments), \f[C]parskip\f[R]+(for better inter-paragraph spaces), \f[C]xurl\f[R] (for better line+breaks in URLs), \f[C]bookmark\f[R] (for better PDF bookmarks), and+\f[C]footnotehyper\f[R] or \f[C]footnote\f[R] (to allow footnotes in+tables).+.SS Reading from the Web+.PP+Instead of an input file, an absolute URI may be given.+In this case pandoc will fetch the content using HTTP:+.IP+.nf+\f[C]+pandoc -f html -t markdown http://www.fsf.org+\f[R]+.fi+.PP+It is possible to supply a custom User-Agent string or other header when+requesting a document from a URL:+.IP+.nf+\f[C]+pandoc -f html -t markdown --request-header User-Agent:\[dq]Mozilla/5.0\[dq] \[rs]+ http://www.fsf.org+\f[R]+.fi+.SH OPTIONS+.SS General options+.TP+.B \f[C]-f\f[R] \f[I]FORMAT\f[R], \f[C]-r\f[R] \f[I]FORMAT\f[R], \f[C]--from=\f[R]\f[I]FORMAT\f[R], \f[C]--read=\f[R]\f[I]FORMAT\f[R]+Specify input format.+\f[I]FORMAT\f[R] can be:+.RS+.IP \[bu] 2+\f[C]commonmark\f[R] (CommonMark Markdown)+.IP \[bu] 2+\f[C]creole\f[R] (Creole 1.0)+.IP \[bu] 2+\f[C]docbook\f[R] (DocBook)+.IP \[bu] 2+\f[C]docx\f[R] (Word docx)+.IP \[bu] 2+\f[C]dokuwiki\f[R] (DokuWiki markup)+.IP \[bu] 2+\f[C]epub\f[R] (EPUB)+.IP \[bu] 2+\f[C]fb2\f[R] (FictionBook2 e-book)+.IP \[bu] 2+\f[C]gfm\f[R] (GitHub-Flavored Markdown), or the deprecated and less+accurate \f[C]markdown_github\f[R]; use \f[C]markdown_github\f[R] only+if you need extensions not supported in \f[C]gfm\f[R].+.IP \[bu] 2+\f[C]haddock\f[R] (Haddock markup)+.IP \[bu] 2+\f[C]html\f[R] (HTML)+.IP \[bu] 2+\f[C]ipynb\f[R] (Jupyter notebook)+.IP \[bu] 2+\f[C]jats\f[R] (JATS XML)+.IP \[bu] 2+\f[C]json\f[R] (JSON version of native AST)+.IP \[bu] 2+\f[C]latex\f[R] (LaTeX)+.IP \[bu] 2+\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)+.IP \[bu] 2+\f[C]markdown_mmd\f[R] (MultiMarkdown)+.IP \[bu] 2+\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)+.IP \[bu] 2+\f[C]markdown_strict\f[R] (original unextended Markdown)+.IP \[bu] 2+\f[C]mediawiki\f[R] (MediaWiki markup)+.IP \[bu] 2+\f[C]man\f[R] (roff man)+.IP \[bu] 2+\f[C]muse\f[R] (Muse)+.IP \[bu] 2+\f[C]native\f[R] (native Haskell)+.IP \[bu] 2+\f[C]odt\f[R] (ODT)+.IP \[bu] 2+\f[C]opml\f[R] (OPML)+.IP \[bu] 2+\f[C]org\f[R] (Emacs Org mode)+.IP \[bu] 2+\f[C]rst\f[R] (reStructuredText)+.IP \[bu] 2+\f[C]t2t\f[R] (txt2tags)+.IP \[bu] 2+\f[C]textile\f[R] (Textile)+.IP \[bu] 2+\f[C]tikiwiki\f[R] (TikiWiki markup)+.IP \[bu] 2+\f[C]twiki\f[R] (TWiki markup)+.IP \[bu] 2+\f[C]vimwiki\f[R] (Vimwiki)+.PP+Extensions can be individually enabled or disabled by appending+\f[C]+EXTENSION\f[R] or \f[C]-EXTENSION\f[R] to the format name.+See Extensions below, for a list of extensions and their names.+See \f[C]--list-input-formats\f[R] and \f[C]--list-extensions\f[R],+below.+.RE+.TP+.B \f[C]-t\f[R] \f[I]FORMAT\f[R], \f[C]-w\f[R] \f[I]FORMAT\f[R], \f[C]--to=\f[R]\f[I]FORMAT\f[R], \f[C]--write=\f[R]\f[I]FORMAT\f[R]+Specify output format.+\f[I]FORMAT\f[R] can be:+.RS+.IP \[bu] 2+\f[C]asciidoc\f[R] (AsciiDoc)+.IP \[bu] 2+\f[C]beamer\f[R] (LaTeX beamer slide show)+.IP \[bu] 2+\f[C]commonmark\f[R] (CommonMark Markdown)+.IP \[bu] 2+\f[C]context\f[R] (ConTeXt)+.IP \[bu] 2+\f[C]docbook\f[R] or \f[C]docbook4\f[R] (DocBook 4)+.IP \[bu] 2+\f[C]docbook5\f[R] (DocBook 5)+.IP \[bu] 2+\f[C]docx\f[R] (Word docx)+.IP \[bu] 2+\f[C]dokuwiki\f[R] (DokuWiki markup)+.IP \[bu] 2+\f[C]epub\f[R] or \f[C]epub3\f[R] (EPUB v3 book)+.IP \[bu] 2+\f[C]epub2\f[R] (EPUB v2)+.IP \[bu] 2+\f[C]fb2\f[R] (FictionBook2 e-book)+.IP \[bu] 2+\f[C]gfm\f[R] (GitHub-Flavored Markdown), or the deprecated and less+accurate \f[C]markdown_github\f[R]; use \f[C]markdown_github\f[R] only+if you need extensions not supported in \f[C]gfm\f[R].+.IP \[bu] 2+\f[C]haddock\f[R] (Haddock markup)+.IP \[bu] 2+\f[C]html\f[R] or \f[C]html5\f[R] (HTML, i.e.+HTML5/XHTML polyglot markup)+.IP \[bu] 2+\f[C]html4\f[R] (XHTML 1.0 Transitional)+.IP \[bu] 2+\f[C]icml\f[R] (InDesign ICML)+.IP \[bu] 2+\f[C]ipynb\f[R] (Jupyter notebook)+.IP \[bu] 2+\f[C]jats\f[R] (JATS XML)+.IP \[bu] 2+\f[C]json\f[R] (JSON version of native AST)+.IP \[bu] 2+\f[C]latex\f[R] (LaTeX)+.IP \[bu] 2+\f[C]man\f[R] (roff man)+.IP \[bu] 2+\f[C]markdown\f[R] (Pandoc\[aq]s Markdown)+.IP \[bu] 2+\f[C]markdown_mmd\f[R] (MultiMarkdown)+.IP \[bu] 2+\f[C]markdown_phpextra\f[R] (PHP Markdown Extra)+.IP \[bu] 2+\f[C]markdown_strict\f[R] (original unextended Markdown)+.IP \[bu] 2+\f[C]mediawiki\f[R] (MediaWiki markup)+.IP \[bu] 2+\f[C]ms\f[R] (roff ms)+.IP \[bu] 2+\f[C]muse\f[R] (Muse),+.IP \[bu] 2+\f[C]native\f[R] (native Haskell),+.IP \[bu] 2+\f[C]odt\f[R] (OpenOffice text document)+.IP \[bu] 2+\f[C]opml\f[R] (OPML)+.IP \[bu] 2+\f[C]opendocument\f[R] (OpenDocument)+.IP \[bu] 2+\f[C]org\f[R] (Emacs Org mode)+.IP \[bu] 2+\f[C]plain\f[R] (plain text),+.IP \[bu] 2+\f[C]pptx\f[R] (PowerPoint slide show)+.IP \[bu] 2+\f[C]rst\f[R] (reStructuredText)+.IP \[bu] 2+\f[C]rtf\f[R] (Rich Text Format)+.IP \[bu] 2+\f[C]texinfo\f[R] (GNU Texinfo)+.IP \[bu] 2+\f[C]textile\f[R] (Textile)+.IP \[bu] 2+\f[C]slideous\f[R] (Slideous HTML and JavaScript slide show)+.IP \[bu] 2+\f[C]slidy\f[R] (Slidy HTML and JavaScript slide show)+.IP \[bu] 2+\f[C]dzslides\f[R] (DZSlides HTML5 + JavaScript slide show),+.IP \[bu] 2+\f[C]revealjs\f[R] (reveal.js HTML5 + JavaScript slide show)+.IP \[bu] 2+\f[C]s5\f[R] (S5 HTML and JavaScript slide show)+.IP \[bu] 2+\f[C]tei\f[R] (TEI Simple)+.IP \[bu] 2+\f[C]zimwiki\f[R] (ZimWiki markup)+.IP \[bu] 2+the path of a custom lua writer, see Custom writers below+.PP+Note that \f[C]odt\f[R], \f[C]docx\f[R], and \f[C]epub\f[R] output will+not be directed to \f[I]stdout\f[R] unless forced with \f[C]-o -\f[R].+.PP+Extensions can be individually enabled or disabled by appending+\f[C]+EXTENSION\f[R] or \f[C]-EXTENSION\f[R] to the format name.+See Extensions below, for a list of extensions and their names.+See \f[C]--list-output-formats\f[R] and \f[C]--list-extensions\f[R],+below.+.RE+.TP+.B \f[C]-o\f[R] \f[I]FILE\f[R], \f[C]--output=\f[R]\f[I]FILE\f[R]+Write output to \f[I]FILE\f[R] instead of \f[I]stdout\f[R].+If \f[I]FILE\f[R] is \f[C]-\f[R], output will go to \f[I]stdout\f[R],+even if a non-textual format (\f[C]docx\f[R], \f[C]odt\f[R],+\f[C]epub2\f[R], \f[C]epub3\f[R]) is specified.+.TP+.B \f[C]--data-dir=\f[R]\f[I]DIRECTORY\f[R]+Specify the user data directory to search for pandoc data files.+If this option is not specified, the default user data directory will be+used.+This is, in UNIX:+.RS+.IP+.nf+\f[C]+$HOME/.pandoc+\f[R]+.fi+.PP+in Windows XP:+.IP+.nf+\f[C]+C:\[rs]Documents And Settings\[rs]USERNAME\[rs]Application Data\[rs]pandoc+\f[R]+.fi+.PP+and in Windows Vista or later:+.IP+.nf+\f[C]+C:\[rs]Users\[rs]USERNAME\[rs]AppData\[rs]Roaming\[rs]pandoc+\f[R]+.fi+.PP+You can find the default user data directory on your system by looking+at the output of \f[C]pandoc --version\f[R].+A \f[C]reference.odt\f[R], \f[C]reference.docx\f[R], \f[C]epub.css\f[R],+\f[C]templates\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R], or+\f[C]s5\f[R] directory placed in this directory will override+pandoc\[aq]s normal defaults.+.RE+.TP+.B \f[C]--bash-completion\f[R]+Generate a bash completion script.+To enable bash completion with pandoc, add this to your+\f[C].bashrc\f[R]:+.RS+.IP+.nf+\f[C]+eval \[dq]$(pandoc --bash-completion)\[dq]+\f[R]+.fi+.RE+.TP+.B \f[C]--verbose\f[R]+Give verbose debugging output.+Currently this only has an effect with PDF output.+.TP+.B \f[C]--quiet\f[R]+Suppress warning messages.+.TP+.B \f[C]--fail-if-warnings\f[R]+Exit with error status if there are any warnings.+.TP+.B \f[C]--log=\f[R]\f[I]FILE\f[R]+Write log messages in machine-readable JSON format to \f[I]FILE\f[R].+All messages above DEBUG level will be written, regardless of verbosity+settings (\f[C]--verbose\f[R], \f[C]--quiet\f[R]).+.TP+.B \f[C]--list-input-formats\f[R]+List supported input formats, one per line.+.TP+.B \f[C]--list-output-formats\f[R]+List supported output formats, one per line.+.TP+.B \f[C]--list-extensions\f[R][\f[C]=\f[R]\f[I]FORMAT\f[R]]+List supported extensions, one per line, preceded by a \f[C]+\f[R] or+\f[C]-\f[R] indicating whether it is enabled by default in+\f[I]FORMAT\f[R].+If \f[I]FORMAT\f[R] is not specified, defaults for pandoc\[aq]s Markdown+are given.+.TP+.B \f[C]--list-highlight-languages\f[R]+List supported languages for syntax highlighting, one per line.+.TP+.B \f[C]--list-highlight-styles\f[R]+List supported styles for syntax highlighting, one per line.+See \f[C]--highlight-style\f[R].+.TP+.B \f[C]-v\f[R], \f[C]--version\f[R]+Print version.+.TP+.B \f[C]-h\f[R], \f[C]--help\f[R]+Show usage message.+.SS Reader options+.TP+.B \f[C]--base-header-level=\f[R]\f[I]NUMBER\f[R]+Specify the base level for headers (defaults to 1).+.TP+.B \f[C]--strip-empty-paragraphs\f[R]+\f[I]Deprecated. Use the \f[CI]+empty_paragraphs\f[I] extension+instead.\f[R] Ignore paragraphs with no content.+This option is useful for converting word processing documents where+users have used empty paragraphs to create inter-paragraph space.+.TP+.B \f[C]--indented-code-classes=\f[R]\f[I]CLASSES\f[R]+Specify classes to use for indented code blocks--for example,+\f[C]perl,numberLines\f[R] or \f[C]haskell\f[R].+Multiple classes may be separated by spaces or commas.+.TP+.B \f[C]--default-image-extension=\f[R]\f[I]EXTENSION\f[R]+Specify a default extension to use when image paths/URLs have no+extension.+This allows you to use the same source for formats that require+different kinds of images.+Currently this option only affects the Markdown and LaTeX readers.+.TP+.B \f[C]--file-scope\f[R]+Parse each file individually before combining for multifile documents.+This will allow footnotes in different files with the same identifiers+to work as expected.+If this option is set, footnotes and links will not work across files.+Reading binary files (docx, odt, epub) implies \f[C]--file-scope\f[R].+.TP+.B \f[C]-F\f[R] \f[I]PROGRAM\f[R], \f[C]--filter=\f[R]\f[I]PROGRAM\f[R]+Specify an executable to be used as a filter transforming the pandoc AST+after the input is parsed and before the output is written.+The executable should read JSON from stdin and write JSON to stdout.+The JSON must be formatted like pandoc\[aq]s own JSON input and output.+The name of the output format will be passed to the filter as the first+argument.+Hence,+.RS+.IP+.nf+\f[C]+pandoc --filter ./caps.py -t latex+\f[R]+.fi+.PP+is equivalent to+.IP+.nf+\f[C]+pandoc -t json | ./caps.py latex | pandoc -f json -t latex+\f[R]+.fi+.PP+The latter form may be useful for debugging filters.+.PP+Filters may be written in any language.+\f[C]Text.Pandoc.JSON\f[R] exports \f[C]toJSONFilter\f[R] to facilitate+writing filters in Haskell.+Those who would prefer to write filters in python can use the module+\f[C]pandocfilters\f[R], installable from PyPI.+There are also pandoc filter libraries in PHP, perl, and+JavaScript/node.js.+.PP+In order of preference, pandoc will look for filters in+.IP "1." 3+a specified full or relative path (executable or non-executable)+.IP "2." 3+\f[C]$DATADIR/filters\f[R] (executable or non-executable) where+\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],+above).+.IP "3." 3+\f[C]$PATH\f[R] (executable only)+.PP+Filters and lua-filters are applied in the order specified on the+command line.+.RE+.TP+.B \f[C]--lua-filter=\f[R]\f[I]SCRIPT\f[R]+Transform the document in a similar fashion as JSON filters (see+\f[C]--filter\f[R]), but use pandoc\[aq]s build-in lua filtering system.+The given lua script is expected to return a list of lua filters which+will be applied in order.+Each lua filter must contain element-transforming functions indexed by+the name of the AST element on which the filter function should be+applied.+.RS+.PP+The \f[C]pandoc\f[R] lua module provides helper functions for element+creation.+It is always loaded into the script\[aq]s lua environment.+.PP+The following is an example lua script for macro-expansion:+.IP+.nf+\f[C]+function expand_hello_world(inline)+ if inline.c == \[aq]{{helloworld}}\[aq] then+ return pandoc.Emph{ pandoc.Str \[dq]Hello, World\[dq] }+ else+ return inline+ end+end++return {{Str = expand_hello_world}}+\f[R]+.fi+.PP+In order of preference, pandoc will look for lua filters in+.IP "1." 3+a specified full or relative path (executable or non-executable)+.IP "2." 3+\f[C]$DATADIR/filters\f[R] (executable or non-executable) where+\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],+above).+.RE+.TP+.B \f[C]-M\f[R] \f[I]KEY\f[R][\f[C]=\f[R]\f[I]VAL\f[R]], \f[C]--metadata=\f[R]\f[I]KEY\f[R][\f[C]:\f[R]\f[I]VAL\f[R]]+Set the metadata field \f[I]KEY\f[R] to the value \f[I]VAL\f[R].+A value specified on the command line overrides a value specified in the+document using YAML metadata blocks.+Values will be parsed as YAML boolean or string values.+If no value is specified, the value will be treated as Boolean true.+Like \f[C]--variable\f[R], \f[C]--metadata\f[R] causes template+variables to be set.+But unlike \f[C]--variable\f[R], \f[C]--metadata\f[R] affects the+metadata of the underlying document (which is accessible from filters+and may be printed in some output formats) and metadata values will be+escaped when inserted into the template.+.TP+.B \f[C]--metadata-file=\f[R]\f[I]FILE\f[R]+Read metadata from the supplied YAML (or JSON) file.+This option can be used with every input format, but string scalars in+the YAML file will always be parsed as Markdown.+Generally, the input will be handled the same as in YAML metadata+blocks.+Metadata values specified inside the document, or by using \f[C]-M\f[R],+overwrite values specified with this option.+.TP+.B \f[C]-p\f[R], \f[C]--preserve-tabs\f[R]+Preserve tabs instead of converting them to spaces (the default).+Note that this will only affect tabs in literal code spans and code+blocks; tabs in regular text will be treated as spaces.+.TP+.B \f[C]--tab-stop=\f[R]\f[I]NUMBER\f[R]+Specify the number of spaces per tab (default is 4).+.TP+.B \f[C]--track-changes=accept\f[R]|\f[C]reject\f[R]|\f[C]all\f[R]+Specifies what to do with insertions, deletions, and comments produced+by the MS Word \[dq]Track Changes\[dq] feature.+\f[C]accept\f[R] (the default), inserts all insertions, and ignores all+deletions.+\f[C]reject\f[R] inserts all deletions and ignores insertions.+Both \f[C]accept\f[R] and \f[C]reject\f[R] ignore comments.+\f[C]all\f[R] puts in insertions, deletions, and comments, wrapped in+spans with \f[C]insertion\f[R], \f[C]deletion\f[R],+\f[C]comment-start\f[R], and \f[C]comment-end\f[R] classes,+respectively.+The author and time of change is included.+\f[C]all\f[R] is useful for scripting: only accepting changes from a+certain reviewer, say, or before a certain date.+If a paragraph is inserted or deleted, \f[C]track-changes=all\f[R]+produces a span with the class+\f[C]paragraph-insertion\f[R]/\f[C]paragraph-deletion\f[R] before the+affected paragraph break.+This option only affects the docx reader.+.TP+.B \f[C]--extract-media=\f[R]\f[I]DIR\f[R]+Extract images and other media contained in or linked from the source+document to the path \f[I]DIR\f[R], creating it if necessary, and adjust+the images references in the document so they point to the extracted+files.+If the source format is a binary container (docx, epub, or odt), the+media is extracted from the container and the original filenames are+used.+Otherwise the media is read from the file system or downloaded, and new+filenames are constructed based on SHA1 hashes of the contents.+.TP+.B \f[C]--abbreviations=\f[R]\f[I]FILE\f[R]+Specifies a custom abbreviations file, with abbreviations one to a line.+If this option is not specified, pandoc will read the data file+\f[C]abbreviations\f[R] from the user data directory or fall back on a+system default.+To see the system default, use+\f[C]pandoc --print-default-data-file=abbreviations\f[R].+The only use pandoc makes of this list is in the Markdown reader.+Strings ending in a period that are found in this list will be followed+by a nonbreaking space, so that the period will not produce+sentence-ending space in formats like LaTeX.+.SS General writer options+.TP+.B \f[C]-s\f[R], \f[C]--standalone\f[R]+Produce output with an appropriate header and footer (e.g.+a standalone HTML, LaTeX, TEI, or RTF file, not a fragment).+This option is set automatically for \f[C]pdf\f[R], \f[C]epub\f[R],+\f[C]epub3\f[R], \f[C]fb2\f[R], \f[C]docx\f[R], and \f[C]odt\f[R]+output.+For \f[C]native\f[R] output, this option causes metadata to be included;+otherwise, metadata is suppressed.+.TP+.B \f[C]--template=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]+Use the specified file as a custom template for the generated document.+Implies \f[C]--standalone\f[R].+See Templates, below, for a description of template syntax.+If no extension is specified, an extension corresponding to the writer+will be added, so that \f[C]--template=special\f[R] looks for+\f[C]special.html\f[R] for HTML output.+If the template is not found, pandoc will search for it in the+\f[C]templates\f[R] subdirectory of the user data directory (see+\f[C]--data-dir\f[R]).+If this option is not used, a default template appropriate for the+output format will be used (see \f[C]-D/--print-default-template\f[R]).+.TP+.B \f[C]-V\f[R] \f[I]KEY\f[R][\f[C]=\f[R]\f[I]VAL\f[R]], \f[C]--variable=\f[R]\f[I]KEY\f[R][\f[C]:\f[R]\f[I]VAL\f[R]]+Set the template variable \f[I]KEY\f[R] to the value \f[I]VAL\f[R] when+rendering the document in standalone mode.+This is generally only useful when the \f[C]--template\f[R] option is+used to specify a custom template, since pandoc automatically sets the+variables used in the default templates.+If no \f[I]VAL\f[R] is specified, the key will be given the value+\f[C]true\f[R].+.TP+.B \f[C]-D\f[R] \f[I]FORMAT\f[R], \f[C]--print-default-template=\f[R]\f[I]FORMAT\f[R]+Print the system default template for an output \f[I]FORMAT\f[R].+(See \f[C]-t\f[R] for a list of possible \f[I]FORMAT\f[R]s.) Templates+in the user data directory are ignored.+.TP+.B \f[C]--print-default-data-file=\f[R]\f[I]FILE\f[R]+Print a system default data file.+Files in the user data directory are ignored.+.TP+.B \f[C]--eol=crlf\f[R]|\f[C]lf\f[R]|\f[C]native\f[R]+Manually specify line endings: \f[C]crlf\f[R] (Windows), \f[C]lf\f[R]+(macOS/Linux/UNIX), or \f[C]native\f[R] (line endings appropriate to the+OS on which pandoc is being run).+The default is \f[C]native\f[R].+.TP+.B \f[C]--dpi\f[R]=\f[I]NUMBER\f[R]+Specify the dpi (dots per inch) value for conversion from pixels to+inch/centimeters and vice versa.+The default is 96dpi.+Technically, the correct term would be ppi (pixels per inch).+.TP+.B \f[C]--wrap=auto\f[R]|\f[C]none\f[R]|\f[C]preserve\f[R]+Determine how text is wrapped in the output (the source code, not the+rendered version).+With \f[C]auto\f[R] (the default), pandoc will attempt to wrap lines to+the column width specified by \f[C]--columns\f[R] (default 72).+With \f[C]none\f[R], pandoc will not wrap lines at all.+With \f[C]preserve\f[R], pandoc will attempt to preserve the wrapping+from the source document (that is, where there are nonsemantic newlines+in the source, there will be nonsemantic newlines in the output as+well).+Automatic wrapping does not currently work in HTML output.+In \f[C]ipynb\f[R] output, this option affects wrapping of the contents+of markdown cells.+.TP+.B \f[C]--columns=\f[R]\f[I]NUMBER\f[R]+Specify length of lines in characters.+This affects text wrapping in the generated source code (see+\f[C]--wrap\f[R]).+It also affects calculation of column widths for plain text tables (see+Tables below).+.TP+.B \f[C]--toc\f[R], \f[C]--table-of-contents\f[R]+Include an automatically generated table of contents (or, in the case of+\f[C]latex\f[R], \f[C]context\f[R], \f[C]docx\f[R], \f[C]odt\f[R],+\f[C]opendocument\f[R], \f[C]rst\f[R], or \f[C]ms\f[R], an instruction+to create one) in the output document.+This option has no effect unless \f[C]-s/--standalone\f[R] is used, and+it has no effect on \f[C]man\f[R], \f[C]docbook4\f[R],+\f[C]docbook5\f[R], or \f[C]jats\f[R] output.+.TP+.B \f[C]--toc-depth=\f[R]\f[I]NUMBER\f[R]+Specify the number of section levels to include in the table of+contents.+The default is 3 (which means that level 1, 2, and 3 headers will be+listed in the contents).+.TP+.B \f[C]--strip-comments\f[R]+Strip out HTML comments in the Markdown or Textile source, rather than+passing them on to Markdown, Textile or HTML output as raw HTML.+This does not apply to HTML comments inside raw HTML blocks when the+\f[C]markdown_in_html_blocks\f[R] extension is not set.+.TP+.B \f[C]--no-highlight\f[R]+Disables syntax highlighting for code blocks and inlines, even when a+language attribute is given.+.TP+.B \f[C]--highlight-style=\f[R]\f[I]STYLE\f[R]|\f[I]FILE\f[R]+Specifies the coloring style to be used in highlighted source code.+Options are \f[C]pygments\f[R] (the default), \f[C]kate\f[R],+\f[C]monochrome\f[R], \f[C]breezeDark\f[R], \f[C]espresso\f[R],+\f[C]zenburn\f[R], \f[C]haddock\f[R], and \f[C]tango\f[R].+For more information on syntax highlighting in pandoc, see Syntax+highlighting, below.+See also \f[C]--list-highlight-styles\f[R].+.RS+.PP+Instead of a \f[I]STYLE\f[R] name, a JSON file with extension+\f[C].theme\f[R] may be supplied.+This will be parsed as a KDE syntax highlighting theme and (if valid)+used as the highlighting style.+.PP+To generate the JSON version of an existing style, use+\f[C]--print-highlight-style\f[R].+.RE+.TP+.B \f[C]--print-highlight-style=\f[R]\f[I]STYLE\f[R]|\f[I]FILE\f[R]+Prints a JSON version of a highlighting style, which can be modified,+saved with a \f[C].theme\f[R] extension, and used with+\f[C]--highlight-style\f[R].+.TP+.B \f[C]--syntax-definition=\f[R]\f[I]FILE\f[R]+Instructs pandoc to load a KDE XML syntax definition file, which will be+used for syntax highlighting of appropriately marked code blocks.+This can be used to add support for new languages or to use altered+syntax definitions for existing languages.+.TP+.B \f[C]-H\f[R] \f[I]FILE\f[R], \f[C]--include-in-header=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]+Include contents of \f[I]FILE\f[R], verbatim, at the end of the header.+This can be used, for example, to include special CSS or JavaScript in+HTML documents.+This option can be used repeatedly to include multiple files in the+header.+They will be included in the order specified.+Implies \f[C]--standalone\f[R].+.TP+.B \f[C]-B\f[R] \f[I]FILE\f[R], \f[C]--include-before-body=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]+Include contents of \f[I]FILE\f[R], verbatim, at the beginning of the+document body (e.g.+after the \f[C]<body>\f[R] tag in HTML, or the+\f[C]\[rs]begin{document}\f[R] command in LaTeX).+This can be used to include navigation bars or banners in HTML+documents.+This option can be used repeatedly to include multiple files.+They will be included in the order specified.+Implies \f[C]--standalone\f[R].+.TP+.B \f[C]-A\f[R] \f[I]FILE\f[R], \f[C]--include-after-body=\f[R]\f[I]FILE\f[R]|\f[I]URL\f[R]+Include contents of \f[I]FILE\f[R], verbatim, at the end of the document+body (before the \f[C]</body>\f[R] tag in HTML, or the+\f[C]\[rs]end{document}\f[R] command in LaTeX).+This option can be used repeatedly to include multiple files.+They will be included in the order specified.+Implies \f[C]--standalone\f[R].+.TP+.B \f[C]--resource-path=\f[R]\f[I]SEARCHPATH\f[R]+List of paths to search for images and other resources.+The paths should be separated by \f[C]:\f[R] on Linux, UNIX, and macOS+systems, and by \f[C];\f[R] on Windows.+If \f[C]--resource-path\f[R] is not specified, the default resource path+is the working directory.+Note that, if \f[C]--resource-path\f[R] is specified, the working+directory must be explicitly listed or it will not be searched.+For example: \f[C]--resource-path=.:test\f[R] will search the working+directory and the \f[C]test\f[R] subdirectory, in that order.+.RS+.PP+\f[C]--resource-path\f[R] only has an effect if (a) the output format+embeds images (for example, \f[C]docx\f[R], \f[C]pdf\f[R], or+\f[C]html\f[R] with \f[C]--self-contained\f[R]) or (b) it is used+together with \f[C]--extract-media\f[R].+.RE+.TP+.B \f[C]--request-header=\f[R]\f[I]NAME\f[R]\f[C]:\f[R]\f[I]VAL\f[R]+Set the request header \f[I]NAME\f[R] to the value \f[I]VAL\f[R] when+making HTTP requests (for example, when a URL is given on the command+line, or when resources used in a document must be downloaded).+If you\[aq]re behind a proxy, you also need to set the environment+variable \f[C]http_proxy\f[R] to \f[C]http://...\f[R].+.SS Options affecting specific writers+.TP+.B \f[C]--self-contained\f[R]+Produce a standalone HTML file with no external dependencies, using+\f[C]data:\f[R] URIs to incorporate the contents of linked scripts,+stylesheets, images, and videos.+Implies \f[C]--standalone\f[R].+The resulting file should be \[dq]self-contained,\[dq] in the sense that+it needs no external files and no net access to be displayed properly by+a browser.+This option works only with HTML output formats, including+\f[C]html4\f[R], \f[C]html5\f[R], \f[C]html+lhs\f[R],+\f[C]html5+lhs\f[R], \f[C]s5\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R],+\f[C]dzslides\f[R], and \f[C]revealjs\f[R].+Scripts, images, and stylesheets at absolute URLs will be downloaded;+those at relative URLs will be sought relative to the working directory+(if the first source file is local) or relative to the base URL (if the+first source file is remote).+Elements with the attribute \f[C]data-external=\[dq]1\[dq]\f[R] will be+left alone; the documents they link to will not be incorporated in the+document.+Limitation: resources that are loaded dynamically through JavaScript+cannot be incorporated; as a result, \f[C]--self-contained\f[R] does not+work with \f[C]--mathjax\f[R], and some advanced features (e.g.+zoom or speaker notes) may not work in an offline+\[dq]self-contained\[dq] \f[C]reveal.js\f[R] slide show.+.TP+.B \f[C]--html-q-tags\f[R]+Use \f[C]<q>\f[R] tags for quotes in HTML.+.TP+.B \f[C]--ascii\f[R]+Use only ASCII characters in output.+Currently supported for XML and HTML formats (which use entities instead+of UTF-8 when this option is selected), CommonMark, gfm, and Markdown+(which use entities), roff ms (which use hexadecimal escapes), and to a+limited degree LaTeX (which uses standard commands for accented+characters when possible).+roff man output uses ASCII by default.+.TP+.B \f[C]--reference-links\f[R]+Use reference-style links, rather than inline links, in writing Markdown+or reStructuredText.+By default inline links are used.+The placement of link references is affected by the+\f[C]--reference-location\f[R] option.+.TP+.B \f[C]--reference-location = block\f[R]|\f[C]section\f[R]|\f[C]document\f[R]+Specify whether footnotes (and references, if \f[C]reference-links\f[R]+is set) are placed at the end of the current (top-level) block, the+current section, or the document.+The default is \f[C]document\f[R].+Currently only affects the markdown writer.+.TP+.B \f[C]--atx-headers\f[R]+Use ATX-style headers in Markdown output.+The default is to use setext-style headers for levels 1-2, and then ATX+headers.+(Note: for \f[C]gfm\f[R] output, ATX headers are always used.) This+option also affects markdown cells in \f[C]ipynb\f[R] output.+.TP+.B \f[C]--top-level-division=[default|section|chapter|part]\f[R]+Treat top-level headers as the given division type in LaTeX, ConTeXt,+DocBook, and TEI output.+The hierarchy order is part, chapter, then section; all headers are+shifted such that the top-level header becomes the specified type.+The default behavior is to determine the best division type via+heuristics: unless other conditions apply, \f[C]section\f[R] is chosen.+When the LaTeX document class is set to \f[C]report\f[R],+\f[C]book\f[R], or \f[C]memoir\f[R] (unless the \f[C]article\f[R] option+is specified), \f[C]chapter\f[R] is implied as the setting for this+option.+If \f[C]beamer\f[R] is the output format, specifying either+\f[C]chapter\f[R] or \f[C]part\f[R] will cause top-level headers to+become \f[C]\[rs]part{..}\f[R], while second-level headers remain as+their default type.+.TP+.B \f[C]-N\f[R], \f[C]--number-sections\f[R]+Number section headings in LaTeX, ConTeXt, HTML, or EPUB output.+By default, sections are not numbered.+Sections with class \f[C]unnumbered\f[R] will never be numbered, even if+\f[C]--number-sections\f[R] is specified.+.TP+.B \f[C]--number-offset=\f[R]\f[I]NUMBER\f[R][\f[C],\f[R]\f[I]NUMBER\f[R]\f[C],\f[R]\f[I]...\f[R]]+Offset for section headings in HTML output (ignored in other output+formats).+The first number is added to the section number for top-level headers,+the second for second-level headers, and so on.+So, for example, if you want the first top-level header in your document+to be numbered \[dq]6\[dq], specify \f[C]--number-offset=5\f[R].+If your document starts with a level-2 header which you want to be+numbered \[dq]1.5\[dq], specify \f[C]--number-offset=1,4\f[R].+Offsets are 0 by default.+Implies \f[C]--number-sections\f[R].+.TP+.B \f[C]--listings\f[R]+Use the \f[C]listings\f[R] package for LaTeX code blocks.+The package does not support multi-byte encoding for source code.+To handle UTF-8 you would need to use a custom template.+This issue is fully documented here: Encoding issue with the listings+package.+.TP+.B \f[C]-i\f[R], \f[C]--incremental\f[R]+Make list items in slide shows display incrementally (one by one).+The default is for lists to be displayed all at once.+.TP+.B \f[C]--slide-level=\f[R]\f[I]NUMBER\f[R]+Specifies that headers with the specified level create slides (for+\f[C]beamer\f[R], \f[C]s5\f[R], \f[C]slidy\f[R], \f[C]slideous\f[R],+\f[C]dzslides\f[R]).+Headers above this level in the hierarchy are used to divide the slide+show into sections; headers below this level create subheads within a+slide.+Note that content that is not contained under slide-level headers will+not appear in the slide show.+The default is to set the slide level based on the contents of the+document; see Structuring the slide show.+.TP+.B \f[C]--section-divs\f[R]+Wrap sections in \f[C]<section>\f[R] tags (or \f[C]<div>\f[R] tags for+\f[C]html4\f[R]), and attach identifiers to the enclosing+\f[C]<section>\f[R] (or \f[C]<div>\f[R]) rather than the header itself.+See Header identifiers, below.+.TP+.B \f[C]--email-obfuscation=none\f[R]|\f[C]javascript\f[R]|\f[C]references\f[R]+Specify a method for obfuscating \f[C]mailto:\f[R] links in HTML+documents.+\f[C]none\f[R] leaves \f[C]mailto:\f[R] links as they are.+\f[C]javascript\f[R] obfuscates them using JavaScript.+\f[C]references\f[R] obfuscates them by printing their letters as+decimal or hexadecimal character references.+The default is \f[C]none\f[R].+.TP+.B \f[C]--id-prefix=\f[R]\f[I]STRING\f[R]+Specify a prefix to be added to all identifiers and internal links in+HTML and DocBook output, and to footnote numbers in Markdown and Haddock+output.+This is useful for preventing duplicate identifiers when generating+fragments to be included in other pages.+.TP+.B \f[C]-T\f[R] \f[I]STRING\f[R], \f[C]--title-prefix=\f[R]\f[I]STRING\f[R]+Specify \f[I]STRING\f[R] as a prefix at the beginning of the title that+appears in the HTML header (but not in the title as it appears at the+beginning of the HTML body).+Implies \f[C]--standalone\f[R].+.TP+.B \f[C]-c\f[R] \f[I]URL\f[R], \f[C]--css=\f[R]\f[I]URL\f[R]+Link to a CSS style sheet.+This option can be used repeatedly to include multiple files.+They will be included in the order specified.+.RS+.PP+A stylesheet is required for generating EPUB.+If none is provided using this option (or the \f[C]css\f[R] or+\f[C]stylesheet\f[R] metadata fields), pandoc will look for a file+\f[C]epub.css\f[R] in the user data directory (see+\f[C]--data-dir\f[R]).+If it is not found there, sensible defaults will be used.+.RE+.TP+.B \f[C]--reference-doc=\f[R]\f[I]FILE\f[R]+Use the specified file as a style reference in producing a docx or ODT+file.+.RS+.TP+.B Docx+For best results, the reference docx should be a modified version of a+docx file produced using pandoc.+The contents of the reference docx are ignored, but its stylesheets and+document properties (including margins, page size, header, and footer)+are used in the new docx.+If no reference docx is specified on the command line, pandoc will look+for a file \f[C]reference.docx\f[R] in the user data directory (see+\f[C]--data-dir\f[R]).+If this is not found either, sensible defaults will be used.+.RS+.PP+To produce a custom \f[C]reference.docx\f[R], first get a copy of the+default \f[C]reference.docx\f[R]:+\f[C]pandoc --print-default-data-file reference.docx > custom-reference.docx\f[R].+Then open \f[C]custom-reference.docx\f[R] in Word, modify the styles as+you wish, and save the file.+For best results, do not make changes to this file other than modifying+the styles used by pandoc:+.PP+Paragraph styles:+.IP \[bu] 2+Normal+.IP \[bu] 2+Body Text+.IP \[bu] 2+First Paragraph+.IP \[bu] 2+Compact+.IP \[bu] 2+Title+.IP \[bu] 2+Subtitle+.IP \[bu] 2+Author+.IP \[bu] 2+Date+.IP \[bu] 2+Abstract+.IP \[bu] 2+Bibliography+.IP \[bu] 2+Heading 1+.IP \[bu] 2+Heading 2+.IP \[bu] 2+Heading 3+.IP \[bu] 2+Heading 4+.IP \[bu] 2+Heading 5+.IP \[bu] 2+Heading 6+.IP \[bu] 2+Heading 7+.IP \[bu] 2+Heading 8+.IP \[bu] 2+Heading 9+.IP \[bu] 2+Block Text+.IP \[bu] 2+Footnote Text+.IP \[bu] 2+Definition Term+.IP \[bu] 2+Definition+.IP \[bu] 2+Caption+.IP \[bu] 2+Table Caption+.IP \[bu] 2+Image Caption+.IP \[bu] 2+Figure+.IP \[bu] 2+Captioned Figure+.IP \[bu] 2+TOC Heading+.PP+Character styles:+.IP \[bu] 2+Default Paragraph Font+.IP \[bu] 2+Body Text Char+.IP \[bu] 2+Verbatim Char+.IP \[bu] 2+Footnote Reference+.IP \[bu] 2+Hyperlink+.PP+Table style:+.IP \[bu] 2+Table+.RE+.TP+.B ODT+For best results, the reference ODT should be a modified version of an+ODT produced using pandoc.+The contents of the reference ODT are ignored, but its stylesheets are+used in the new ODT.+If no reference ODT is specified on the command line, pandoc will look+for a file \f[C]reference.odt\f[R] in the user data directory (see+\f[C]--data-dir\f[R]).+If this is not found either, sensible defaults will be used.+.RS+.PP+To produce a custom \f[C]reference.odt\f[R], first get a copy of the+default \f[C]reference.odt\f[R]:+\f[C]pandoc --print-default-data-file reference.odt > custom-reference.odt\f[R].+Then open \f[C]custom-reference.odt\f[R] in LibreOffice, modify the+styles as you wish, and save the file.+.RE+.TP+.B PowerPoint+Any template included with a recent install of Microsoft PowerPoint+(either with \f[C].pptx\f[R] or \f[C].potx\f[R] extension) should work,+as will most templates derived from these.+.RS+.PP+The specific requirement is that the template should contain the+following four layouts as its first four layouts:+.IP "1." 3+Title Slide+.IP "2." 3+Title and Content+.IP "3." 3+Section Header+.IP "4." 3+Two Content+.PP+All templates included with a recent version of MS PowerPoint will fit+these criteria.+(You can click on \f[C]Layout\f[R] under the \f[C]Home\f[R] menu to+check.)+.PP+You can also modify the default \f[C]reference.pptx\f[R]: first run+\f[C]pandoc --print-default-data-file reference.pptx > custom-reference.pptx\f[R],+and then modify \f[C]custom-reference.pptx\f[R] in MS PowerPoint (pandoc+will use the first four layout slides, as mentioned above).+.RE+.RE+.TP+.B \f[C]--epub-cover-image=\f[R]\f[I]FILE\f[R]+Use the specified image as the EPUB cover.+It is recommended that the image be less than 1000px in width and+height.+Note that in a Markdown source document you can also specify+\f[C]cover-image\f[R] in a YAML metadata block (see EPUB Metadata,+below).+.TP+.B \f[C]--epub-metadata=\f[R]\f[I]FILE\f[R]+Look in the specified XML file for metadata for the EPUB.+The file should contain a series of Dublin Core elements.+For example:+.RS+.IP+.nf+\f[C]+ <dc:rights>Creative Commons</dc:rights>+ <dc:language>es-AR</dc:language>+\f[R]+.fi+.PP+By default, pandoc will include the following metadata elements:+\f[C]<dc:title>\f[R] (from the document title), \f[C]<dc:creator>\f[R]+(from the document authors), \f[C]<dc:date>\f[R] (from the document+date, which should be in ISO 8601 format), \f[C]<dc:language>\f[R] (from+the \f[C]lang\f[R] variable, or, if is not set, the locale), and+\f[C]<dc:identifier id=\[dq]BookId\[dq]>\f[R] (a randomly generated+UUID).+Any of these may be overridden by elements in the metadata file.+.PP+Note: if the source document is Markdown, a YAML metadata block in the+document can be used instead.+See below under EPUB Metadata.+.RE+.TP+.B \f[C]--epub-embed-font=\f[R]\f[I]FILE\f[R]+Embed the specified font in the EPUB.+This option can be repeated to embed multiple fonts.+Wildcards can also be used: for example, \f[C]DejaVuSans-*.ttf\f[R].+However, if you use wildcards on the command line, be sure to escape+them or put the whole filename in single quotes, to prevent them from+being interpreted by the shell.+To use the embedded fonts, you will need to add declarations like the+following to your CSS (see \f[C]--css\f[R]):+.RS+.IP+.nf+\f[C]+\[at]font-face {+font-family: DejaVuSans;+font-style: normal;+font-weight: normal;+src:url(\[dq]DejaVuSans-Regular.ttf\[dq]);+}+\[at]font-face {+font-family: DejaVuSans;+font-style: normal;+font-weight: bold;+src:url(\[dq]DejaVuSans-Bold.ttf\[dq]);+}+\[at]font-face {+font-family: DejaVuSans;+font-style: italic;+font-weight: normal;+src:url(\[dq]DejaVuSans-Oblique.ttf\[dq]);+}+\[at]font-face {+font-family: DejaVuSans;+font-style: italic;+font-weight: bold;+src:url(\[dq]DejaVuSans-BoldOblique.ttf\[dq]);+}+body { font-family: \[dq]DejaVuSans\[dq]; }+\f[R]+.fi+.RE+.TP+.B \f[C]--epub-chapter-level=\f[R]\f[I]NUMBER\f[R]+Specify the header level at which to split the EPUB into separate+\[dq]chapter\[dq] files.+The default is to split into chapters at level 1 headers.+This option only affects the internal composition of the EPUB, not the+way chapters and sections are displayed to users.+Some readers may be slow if the chapter files are too large, so for+large documents with few level 1 headers, one might want to use a+chapter level of 2 or 3.+.TP+.B \f[C]--epub-subdirectory=\f[R]\f[I]DIRNAME\f[R]+Specify the subdirectory in the OCF container that is to hold the+EPUB-specific contents.+The default is \f[C]EPUB\f[R].+To put the EPUB contents in the top level, use an empty string.+.TP+.B \f[C]--pdf-engine=pdflatex\f[R]|\f[C]lualatex\f[R]|\f[C]xelatex\f[R]|\f[C]wkhtmltopdf\f[R]|\f[C]weasyprint\f[R]|\f[C]prince\f[R]|\f[C]context\f[R]|\f[C]pdfroff\f[R]+Use the specified engine when producing PDF output.+The default is \f[C]pdflatex\f[R].+If the engine is not in your PATH, the full path of the engine may be+specified here.+.TP+.B \f[C]--pdf-engine-opt=\f[R]\f[I]STRING\f[R]+Use the given string as a command-line argument to the+\f[C]pdf-engine\f[R].+If used multiple times, the arguments are provided with spaces between+them.+Note that no check for duplicate options is done.+.SS Citation rendering+.TP+.B \f[C]--bibliography=\f[R]\f[I]FILE\f[R]+Set the \f[C]bibliography\f[R] field in the document\[aq]s metadata to+\f[I]FILE\f[R], overriding any value set in the metadata, and process+citations using \f[C]pandoc-citeproc\f[R].+(This is equivalent to+\f[C]--metadata bibliography=FILE --filter pandoc-citeproc\f[R].) If+\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] is also supplied,+\f[C]pandoc-citeproc\f[R] is not used, making this equivalent to+\f[C]--metadata bibliography=FILE\f[R].+If you supply this argument multiple times, each \f[I]FILE\f[R] will be+added to bibliography.+.TP+.B \f[C]--csl=\f[R]\f[I]FILE\f[R]+Set the \f[C]csl\f[R] field in the document\[aq]s metadata to+\f[I]FILE\f[R], overriding any value set in the metadata.+(This is equivalent to \f[C]--metadata csl=FILE\f[R].) This option is+only relevant with \f[C]pandoc-citeproc\f[R].+.TP+.B \f[C]--citation-abbreviations=\f[R]\f[I]FILE\f[R]+Set the \f[C]citation-abbreviations\f[R] field in the document\[aq]s+metadata to \f[I]FILE\f[R], overriding any value set in the metadata.+(This is equivalent to+\f[C]--metadata citation-abbreviations=FILE\f[R].) This option is only+relevant with \f[C]pandoc-citeproc\f[R].+.TP+.B \f[C]--natbib\f[R]+Use \f[C]natbib\f[R] for citations in LaTeX output.+This option is not for use with the \f[C]pandoc-citeproc\f[R] filter or+with PDF output.+It is intended for use in producing a LaTeX file that can be processed+with \f[C]bibtex\f[R].+.TP+.B \f[C]--biblatex\f[R]+Use \f[C]biblatex\f[R] for citations in LaTeX output.+This option is not for use with the \f[C]pandoc-citeproc\f[R] filter or+with PDF output.+It is intended for use in producing a LaTeX file that can be processed+with \f[C]bibtex\f[R] or \f[C]biber\f[R].+.SS Math rendering in HTML+.PP+The default is to render TeX math as far as possible using Unicode+characters.+Formulas are put inside a \f[C]span\f[R] with+\f[C]class=\[dq]math\[dq]\f[R], so that they may be styled differently+from the surrounding text if needed.+However, this gives acceptable results only for basic math, usually you+will want to use \f[C]--mathjax\f[R] or another of the following+options.+.TP+.B \f[C]--mathjax\f[R][\f[C]=\f[R]\f[I]URL\f[R]]+Use MathJax to display embedded TeX math in HTML output.+TeX math will be put between \f[C]\[rs](...\[rs])\f[R] (for inline math)+or \f[C]\[rs][...\[rs]]\f[R] (for display math) and wrapped in+\f[C]<span>\f[R] tags with class \f[C]math\f[R].+Then the MathJax JavaScript will render it.+The \f[I]URL\f[R] should point to the \f[C]MathJax.js\f[R] load script.+If a \f[I]URL\f[R] is not provided, a link to the Cloudflare CDN will be+inserted.+.TP+.B \f[C]--mathml\f[R]+Convert TeX math to MathML (in \f[C]epub3\f[R], \f[C]docbook4\f[R],+\f[C]docbook5\f[R], \f[C]jats\f[R], \f[C]html4\f[R] and+\f[C]html5\f[R]).+This is the default in \f[C]odt\f[R] output.+Note that currently only Firefox and Safari (and select e-book readers)+natively support MathML.+.TP+.B \f[C]--webtex\f[R][\f[C]=\f[R]\f[I]URL\f[R]]+Convert TeX formulas to \f[C]<img>\f[R] tags that link to an external+script that converts formulas to images.+The formula will be URL-encoded and concatenated with the URL provided.+For SVG images you can for example use+\f[C]--webtex https://latex.codecogs.com/svg.latex?\f[R].+If no URL is specified, the CodeCogs URL generating PNGs will be used+(\f[C]https://latex.codecogs.com/png.latex?\f[R]).+Note: the \f[C]--webtex\f[R] option will affect Markdown output as well+as HTML, which is useful if you\[aq]re targeting a version of Markdown+without native math support.+.TP+.B \f[C]--katex\f[R][\f[C]=\f[R]\f[I]URL\f[R]]+Use KaTeX to display embedded TeX math in HTML output.+The \f[I]URL\f[R] is the base URL for the KaTeX library.+That directory should contain a \f[C]katex.min.js\f[R] and a+\f[C]katex.min.css\f[R] file.+If a \f[I]URL\f[R] is not provided, a link to the KaTeX CDN will be+inserted.+.TP+.B \f[C]--gladtex\f[R]+Enclose TeX math in \f[C]<eq>\f[R] tags in HTML output.+The resulting HTML can then be processed by GladTeX to produce images of+the typeset formulas and an HTML file with links to these images.+So, the procedure is:+.RS+.IP+.nf+\f[C]+pandoc -s --gladtex input.md -o myfile.htex+gladtex -d myfile-images myfile.htex+# produces myfile.html and images in myfile-images+\f[R]+.fi+.RE+.SS Options for wrapper scripts+.TP+.B \f[C]--dump-args\f[R]+Print information about command-line arguments to \f[I]stdout\f[R], then+exit.+This option is intended primarily for use in wrapper scripts.+The first line of output contains the name of the output file specified+with the \f[C]-o\f[R] option, or \f[C]-\f[R] (for \f[I]stdout\f[R]) if+no output file was specified.+The remaining lines contain the command-line arguments, one per line, in+the order they appear.+These do not include regular pandoc options and their arguments, but do+include any options appearing after a \f[C]--\f[R] separator at the end+of the line.+.TP+.B \f[C]--ignore-args\f[R]+Ignore command-line arguments (for use in wrapper scripts).+Regular pandoc options are not ignored.+Thus, for example,+.RS+.IP+.nf+\f[C]+pandoc --ignore-args -o foo.html -s foo.txt -- -e latin1+\f[R]+.fi+.PP+is equivalent to+.IP+.nf+\f[C]+pandoc -o foo.html -s+\f[R]+.fi+.RE+.SH TEMPLATES+.PP+When the \f[C]-s/--standalone\f[R] option is used, pandoc uses a+template to add header and footer material that is needed for a+self-standing document.+To see the default template that is used, just type+.IP+.nf+\f[C]+pandoc -D *FORMAT*+\f[R]+.fi+.PP+where \f[I]FORMAT\f[R] is the name of the output format.+A custom template can be specified using the \f[C]--template\f[R]+option.+You can also override the system default templates for a given output+format \f[I]FORMAT\f[R] by putting a file+\f[C]templates/default.*FORMAT*\f[R] in the user data directory (see+\f[C]--data-dir\f[R], above).+\f[I]Exceptions:\f[R]+.IP \[bu] 2+For \f[C]odt\f[R] output, customize the \f[C]default.opendocument\f[R]+template.+.IP \[bu] 2+For \f[C]pdf\f[R] output, customize the \f[C]default.latex\f[R] template+(or the \f[C]default.context\f[R] template, if you use+\f[C]-t context\f[R], or the \f[C]default.ms\f[R] template, if you use+\f[C]-t ms\f[R], or the \f[C]default.html\f[R] template, if you use+\f[C]-t html\f[R]).+.IP \[bu] 2+\f[C]docx\f[R] and \f[C]pptx\f[R] have no template (however, you can use+\f[C]--reference-doc\f[R] to customize the output).+.PP+Templates contain \f[I]variables\f[R], which allow for the inclusion of+arbitrary information at any point in the file.+They may be set at the command line using the \f[C]-V/--variable\f[R]+option.+If a variable is not set, pandoc will look for the key in the+document\[aq]s metadata \[en] which can be set using either YAML+metadata blocks or with the \f[C]-M/--metadata\f[R] option.+.SS Metadata variables+.TP+.B \f[C]title\f[R], \f[C]author\f[R], \f[C]date\f[R]+allow identification of basic aspects of the document.+Included in PDF metadata through LaTeX and ConTeXt.+These can be set through a pandoc title block, which allows for multiple+authors, or through a YAML metadata block:+.RS+.IP+.nf+\f[C]+---+author:+- Aristotle+- Peter Abelard+\&...+\f[R]+.fi+.RE+.TP+.B \f[C]subtitle\f[R]+document subtitle, included in HTML, EPUB, LaTeX, ConTeXt, and docx+documents+.TP+.B \f[C]abstract\f[R]+document summary, included in LaTeX, ConTeXt, AsciiDoc, and docx+documents+.TP+.B \f[C]keywords\f[R]+list of keywords to be included in HTML, PDF, ODT, pptx, docx and+AsciiDoc metadata; repeat as for \f[C]author\f[R], above+.TP+.B \f[C]subject\f[R]+document subject, included in ODT, docx and pptx metadata+.TP+.B \f[C]description\f[R]+document description, included in ODT, docx and pptx metadata.+Some applications show this as \f[C]Comments\f[R] metadata.+.TP+.B \f[C]category\f[R]+document category, included in docx and pptx metadata+.PP+Additionally, any root-level string metadata, not included in ODT, docx+or pptx metadata is added as a \f[I]custom property\f[R].+The following YAML metadata block for instance:+.IP+.nf+\f[C]+---+title: \[aq]This is the title\[aq]+subtitle: \[dq]This is the subtitle\[dq]+author:+- Author One+- Author Two+description: |+ This is a long+ description.++ It consists of two paragraphs+\&...+\f[R]+.fi+.PP+will include \f[C]title\f[R], \f[C]author\f[R] and \f[C]description\f[R]+as standard document properties and \f[C]subtitle\f[R] as a custom+property when converting to docx, ODT or pptx.+.SS Language variables+.TP+.B \f[C]lang\f[R]+identifies the main language of the document using IETF language tags+(following the BCP 47 standard), such as \f[C]en\f[R] or+\f[C]en-GB\f[R].+The Language subtag lookup tool can look up or verify these tags.+This affects most formats, and controls hyphenation in PDF output when+using LaTeX (through \f[C]babel\f[R] and \f[C]polyglossia\f[R]) or+ConTeXt.+.RS+.PP+Use native pandoc Divs and Spans with the \f[C]lang\f[R] attribute to+switch the language:+.IP+.nf+\f[C]+---+lang: en-GB+\&...++Text in the main document language (British English).++::: {lang=fr-CA}+> Cette citation est \['e]crite en fran\[,c]ais canadien.+:::++More text in English. [\[aq]Zitat auf Deutsch.\[aq]]{lang=de}+\f[R]+.fi+.RE+.TP+.B \f[C]dir\f[R]+the base script direction, either \f[C]rtl\f[R] (right-to-left) or+\f[C]ltr\f[R] (left-to-right).+.RS+.PP+For bidirectional documents, native pandoc \f[C]span\f[R]s and+\f[C]div\f[R]s with the \f[C]dir\f[R] attribute (value \f[C]rtl\f[R] or+\f[C]ltr\f[R]) can be used to override the base direction in some output+formats.+This may not always be necessary if the final renderer (e.g.+the browser, when generating HTML) supports the Unicode Bidirectional+Algorithm.+.PP+When using LaTeX for bidirectional documents, only the \f[C]xelatex\f[R]+engine is fully supported (use \f[C]--pdf-engine=xelatex\f[R]).+.RE+.SS Variables for HTML slides+.PP+These affect HTML output when producing slide shows with pandoc.+All reveal.js configuration options are available as variables.+.TP+.B \f[C]revealjs-url\f[R]+base URL for reveal.js documents (defaults to \f[C]reveal.js\f[R])+.TP+.B \f[C]s5-url\f[R]+base URL for S5 documents (defaults to \f[C]s5/default\f[R])+.TP+.B \f[C]slidy-url\f[R]+base URL for Slidy documents (defaults to+\f[C]https://www.w3.org/Talks/Tools/Slidy2\f[R])+.TP+.B \f[C]slideous-url\f[R]+base URL for Slideous documents (defaults to \f[C]slideous\f[R])+.SS Variables for Beamer slides+.PP+These variables change the appearance of PDF slides using+\f[C]beamer\f[R].+.TP+.B \f[C]aspectratio\f[R]+slide aspect ratio (\f[C]43\f[R] for 4:3 [default], \f[C]169\f[R] for+16:9, \f[C]1610\f[R] for 16:10, \f[C]149\f[R] for 14:9, \f[C]141\f[R]+for 1.41:1, \f[C]54\f[R] for 5:4, \f[C]32\f[R] for 3:2)+.TP+.B \f[C]beamerarticle\f[R]+produce an article from Beamer slides+.TP+.B \f[C]beameroption\f[R]+add extra beamer option with \f[C]\[rs]setbeameroption{}\f[R]+.TP+.B \f[C]institute\f[R]+author affiliations: can be a list when there are multiple authors+.TP+.B \f[C]logo\f[R]+logo image for slides+.TP+.B \f[C]navigation\f[R]+controls navigation symbols (default is \f[C]empty\f[R] for no+navigation symbols; other valid values are \f[C]frame\f[R],+\f[C]vertical\f[R], and \f[C]horizontal\f[R])+.TP+.B \f[C]section-titles\f[R]+enables \[dq]title pages\[dq] for new sections (default is true)+.TP+.B \f[C]theme\f[R], \f[C]colortheme\f[R], \f[C]fonttheme\f[R], \f[C]innertheme\f[R], \f[C]outertheme\f[R]+beamer themes:+.TP+.B \f[C]themeoptions\f[R]+options for LaTeX beamer themes (a list).+.TP+.B \f[C]titlegraphic\f[R]+image for title slide+.SS Variables for LaTeX+.PP+Pandoc uses these variables when creating a PDF with a LaTeX engine.+.SS Layout+.TP+.B \f[C]classoption\f[R]+option for document class, e.g.+\f[C]oneside\f[R]; repeat for multiple options+.TP+.B \f[C]documentclass\f[R]+document class: usually one of the standard classes, \f[C]article\f[R],+\f[C]report\f[R], and \f[C]book\f[R]; the KOMA-Script equivalents,+\f[C]scrartcl\f[R], \f[C]scrreprt\f[R], and \f[C]scrbook\f[R], which+default to smaller margins; or \f[C]memoir\f[R]+.TP+.B \f[C]geometry\f[R]+option for \f[C]geometry\f[R] package, e.g.+\f[C]margin=1in\f[R]; repeat for multiple options+.TP+.B \f[C]indent\f[R]+uses document class settings for indentation (the default LaTeX template+otherwise removes indentation and adds space between paragraphs)+.TP+.B \f[C]linestretch\f[R]+adjusts line spacing using the \f[C]setspace\f[R] package, e.g.+\f[C]1.25\f[R], \f[C]1.5\f[R]+.TP+.B \f[C]margin-left\f[R], \f[C]margin-right\f[R], \f[C]margin-top\f[R], \f[C]margin-bottom\f[R]+sets margins if \f[C]geometry\f[R] is not used (otherwise+\f[C]geometry\f[R] overrides these)+.TP+.B \f[C]pagestyle\f[R]+control \f[C]\[rs]pagestyle{}\f[R]: the default article class supports+\f[C]plain\f[R] (default), \f[C]empty\f[R] (no running heads or page+numbers), and \f[C]headings\f[R] (section titles in running heads)+.TP+.B \f[C]papersize\f[R]+paper size, e.g.+\f[C]letter\f[R], \f[C]a4\f[R]+.TP+.B \f[C]secnumdepth\f[R]+numbering depth for sections (with \f[C]--number-sections\f[R] option or+\f[C]numbersections\f[R] variable)+.TP+.B \f[C]subparagraph\f[R]+disables default behavior of LaTeX template that redefines+(sub)paragraphs as sections, changing the appearance of nested headings+in some classes+.SS Fonts+.TP+.B \f[C]fontenc\f[R]+allows font encoding to be specified through \f[C]fontenc\f[R] package+(with \f[C]pdflatex\f[R]); default is \f[C]T1\f[R] (see LaTeX font+encodings guide)+.TP+.B \f[C]fontfamily\f[R]+font package for use with \f[C]pdflatex\f[R]: TeX Live includes many+options, documented in the LaTeX Font Catalogue.+The default is Latin Modern.+.TP+.B \f[C]fontfamilyoptions\f[R]+options for package used as \f[C]fontfamily\f[R]; repeat for multiple+options.+For example, to use the Libertine font with proportional lowercase+(old-style) figures through the \f[C]libertinus\f[R] package:+.RS+.IP+.nf+\f[C]+---+fontfamily: libertinus+fontfamilyoptions:+- osf+- p+\&...+\f[R]+.fi+.RE+.TP+.B \f[C]fontsize\f[R]+font size for body text.+The standard classes allow 10pt, 11pt, and 12pt.+To use another size, set \f[C]documentclass\f[R] to one of the+KOMA-Script classes, such as \f[C]scrartcl\f[R] or \f[C]scrbook\f[R].+.TP+.B \f[C]mainfont\f[R], \f[C]sansfont\f[R], \f[C]monofont\f[R], \f[C]mathfont\f[R], \f[C]CJKmainfont\f[R]+font families for use with \f[C]xelatex\f[R] or \f[C]lualatex\f[R]: take+the name of any system font, using the \f[C]fontspec\f[R] package.+\f[C]CJKmainfont\f[R] uses the \f[C]xecjk\f[R] package.+.TP+.B \f[C]mainfontoptions\f[R], \f[C]sansfontoptions\f[R], \f[C]monofontoptions\f[R], \f[C]mathfontoptions\f[R], \f[C]CJKoptions\f[R]+options to use with \f[C]mainfont\f[R], \f[C]sansfont\f[R],+\f[C]monofont\f[R], \f[C]mathfont\f[R], \f[C]CJKmainfont\f[R] in+\f[C]xelatex\f[R] and \f[C]lualatex\f[R].+Allow for any choices available through \f[C]fontspec\f[R]; repeat for+multiple options.+For example, to use the TeX Gyre version of Palatino with lowercase+figures:+.RS+.IP+.nf+\f[C]+---+mainfont: TeX Gyre Pagella+mainfontoptions:+- Numbers=Lowercase+- Numbers=Proportional+\&...+\f[R]+.fi+.RE+.TP+.B \f[C]microtypeoptions\f[R]+options to pass to the microtype package+.SS Links+.TP+.B \f[C]colorlinks\f[R]+add color to link text; automatically enabled if any of+\f[C]linkcolor\f[R], \f[C]filecolor\f[R], \f[C]citecolor\f[R],+\f[C]urlcolor\f[R], or \f[C]toccolor\f[R] are set+.TP+.B \f[C]linkcolor\f[R], \f[C]filecolor\f[R], \f[C]citecolor\f[R], \f[C]urlcolor\f[R], \f[C]toccolor\f[R]+color for internal links, external links, citation links, linked URLs,+and links in table of contents, respectively: uses options allowed by+\f[C]xcolor\f[R], including the \f[C]dvipsnames\f[R],+\f[C]svgnames\f[R], and \f[C]x11names\f[R] lists+.TP+.B \f[C]links-as-notes\f[R]+causes links to be printed as footnotes+.SS Front matter+.TP+.B \f[C]lof\f[R], \f[C]lot\f[R]+include list of figures, list of tables+.TP+.B \f[C]thanks\f[R]+contents of acknowledgments footnote after document title+.TP+.B \f[C]toc\f[R]+include table of contents (can also be set using+\f[C]--toc/--table-of-contents\f[R])+.TP+.B \f[C]toc-depth\f[R]+level of section to include in table of contents+.SS BibLaTeX Bibliographies+.PP+These variables function when using BibLaTeX for citation rendering.+.TP+.B \f[C]biblatexoptions\f[R]+list of options for biblatex+.TP+.B \f[C]biblio-style\f[R]+bibliography style, when used with \f[C]--natbib\f[R] and+\f[C]--biblatex\f[R].+.TP+.B \f[C]biblio-title\f[R]+bibliography title, when used with \f[C]--natbib\f[R] and+\f[C]--biblatex\f[R].+.TP+.B \f[C]bibliography\f[R]+bibliography to use for resolving references+.TP+.B \f[C]natbiboptions\f[R]+list of options for natbib+.SS Variables for ConTeXt+.PP+Pandoc uses these variables when creating a PDF with ConTeXt.+.TP+.B \f[C]fontsize\f[R]+font size for body text (e.g.+\f[C]10pt\f[R], \f[C]12pt\f[R])+.TP+.B \f[C]headertext\f[R], \f[C]footertext\f[R]+text to be placed in running header or footer (see ConTeXt Headers and+Footers); repeat up to four times for different placement+.TP+.B \f[C]indenting\f[R]+controls indentation of paragraphs, e.g.+\f[C]yes,small,next\f[R] (see ConTeXt Indentation); repeat for multiple+options+.TP+.B \f[C]interlinespace\f[R]+adjusts line spacing, e.g.+\f[C]4ex\f[R] (using \f[C]setupinterlinespace\f[R]); repeat for multiple+options+.TP+.B \f[C]layout\f[R]+options for page margins and text arrangement (see ConTeXt Layout);+repeat for multiple options+.TP+.B \f[C]linkcolor\f[R], \f[C]contrastcolor\f[R]+color for links outside and inside a page, e.g.+\f[C]red\f[R], \f[C]blue\f[R] (see ConTeXt Color)+.TP+.B \f[C]linkstyle\f[R]+typeface style for links, e.g.+\f[C]normal\f[R], \f[C]bold\f[R], \f[C]slanted\f[R],+\f[C]boldslanted\f[R], \f[C]type\f[R], \f[C]cap\f[R], \f[C]small\f[R]+.TP+.B \f[C]lof\f[R], \f[C]lot\f[R]+include list of figures, list of tables+.TP+.B \f[C]mainfont\f[R], \f[C]sansfont\f[R], \f[C]monofont\f[R], \f[C]mathfont\f[R]+font families: take the name of any system font (see ConTeXt Font+Switching)+.TP+.B \f[C]margin-left\f[R], \f[C]margin-right\f[R], \f[C]margin-top\f[R], \f[C]margin-bottom\f[R]+sets margins, if \f[C]layout\f[R] is not used (otherwise+\f[C]layout\f[R] overrides these)+.TP+.B \f[C]pagenumbering\f[R]+page number style and location (using \f[C]setuppagenumbering\f[R]);+repeat for multiple options+.TP+.B \f[C]papersize\f[R]+paper size, e.g.+\f[C]letter\f[R], \f[C]A4\f[R], \f[C]landscape\f[R] (see ConTeXt Paper+Setup); repeat for multiple options+.TP+.B \f[C]pdfa\f[R]+adds to the preamble the setup necessary to generate PDF/A-1b:2005.+To successfully generate PDF/A the required ICC color profiles have to+be available and the content and all included files (such as images)+have to be standard conforming.+The ICC profiles can be obtained from ConTeXt ICC Profiles.+See also ConTeXt PDFA for more details.+.TP+.B \f[C]toc\f[R]+include table of contents (can also be set using+\f[C]--toc/--table-of-contents\f[R])+.TP+.B \f[C]whitespace\f[R]+spacing between paragraphs, e.g.+\f[C]none\f[R], \f[C]small\f[R] (using \f[C]setupwhitespace\f[R])+.SS Variables for \f[C]wkhtmltopdf\f[R]+.PP+Pandoc uses these variables when creating a PDF with+\f[C]wkhtmltopdf\f[R].+The \f[C]--css\f[R] option also affects the output.+.TP+.B \f[C]footer-html\f[R], \f[C]header-html\f[R]+add information to the header and footer+.TP+.B \f[C]margin-left\f[R], \f[C]margin-right\f[R], \f[C]margin-top\f[R], \f[C]margin-bottom\f[R]+set the page margins+.TP+.B \f[C]papersize\f[R]+sets the PDF paper size+.SS Variables for man pages+.TP+.B \f[C]adjusting\f[R]+adjusts text to left (\f[C]l\f[R]), right (\f[C]r\f[R]), center+(\f[C]c\f[R]), or both (\f[C]b\f[R]) margins+.TP+.B \f[C]footer\f[R]+footer in man pages+.TP+.B \f[C]header\f[R]+header in man pages+.TP+.B \f[C]hyphenate\f[R]+if \f[C]true\f[R] (the default), hyphenation will be used+.TP+.B \f[C]section\f[R]+section number in man pages+.SS Variables for ms+.TP+.B \f[C]fontfamily\f[R]+font family (e.g.+\f[C]T\f[R] or \f[C]P\f[R])+.TP+.B \f[C]indent\f[R]+paragraph indent (e.g.+\f[C]2m\f[R])+.TP+.B \f[C]lineheight\f[R]+line height (e.g.+\f[C]12p\f[R])+.TP+.B \f[C]pointsize\f[R]+point size (e.g.+\f[C]10p\f[R])+.SS Structural variables+.PP+Pandoc sets these variables automatically in response to options or+document contents; users can also modify them.+These vary depending on the output format, and include the following:+.TP+.B \f[C]body\f[R]+body of document+.TP+.B \f[C]date-meta\f[R]+the \f[C]date\f[R] variable converted to ISO 8601 YYYY-MM-DD, included+in all HTML based formats (dzslides, epub, html, html4, html5, revealjs,+s5, slideous, slidy).+The recognized formats for \f[C]date\f[R] are: \f[C]mm/dd/yyyy\f[R],+\f[C]mm/dd/yy\f[R], \f[C]yyyy-mm-dd\f[R] (ISO 8601),+\f[C]dd MM yyyy\f[R] (e.g.+either \f[C]02 Apr 2018\f[R] or \f[C]02 April 2018\f[R]),+\f[C]MM dd, yyyy\f[R] (e.g.+\f[C]Apr. 02, 2018\f[R] or+\f[C]April 02, 2018),\f[R]yyyy[mm[dd]]]\f[C](e.g.\f[R]20180402,+\f[C]201804\f[R] or \f[C]2018\f[R]).+.TP+.B \f[C]header-includes\f[R]+contents specified by \f[C]-H/--include-in-header\f[R] (may have+multiple values)+.TP+.B \f[C]include-before\f[R]+contents specified by \f[C]-B/--include-before-body\f[R] (may have+multiple values)+.TP+.B \f[C]include-after\f[R]+contents specified by \f[C]-A/--include-after-body\f[R] (may have+multiple values)+.TP+.B \f[C]meta-json\f[R]+JSON representation of all of the document\[aq]s metadata.+Field values are transformed to the selected output format.+.TP+.B \f[C]numbersections\f[R]+non-null value if \f[C]-N/--number-sections\f[R] was specified+.TP+.B \f[C]sourcefile\f[R], \f[C]outputfile\f[R]+source and destination filenames, as given on the command line.+\f[C]sourcefile\f[R] can also be a list if input comes from multiple+files, or empty if input is from stdin.+You can use the following snippet in your template to distinguish them:+.RS+.IP+.nf+\f[C]+$if(sourcefile)$+$for(sourcefile)$+$sourcefile$+$endfor$+$else$+(stdin)+$endif$+\f[R]+.fi+.PP+Similarly, \f[C]outputfile\f[R] can be \f[C]-\f[R] if output goes to the+terminal.+.RE+.TP+.B \f[C]toc\f[R]+non-null value if \f[C]--toc/--table-of-contents\f[R] was specified+.TP+.B \f[C]toc-title\f[R]+title of table of contents (works only with EPUB, opendocument, odt,+docx, pptx, beamer, LaTeX)+.SS Using variables in templates+.PP+Variable names are sequences of alphanumerics, \f[C]-\f[R], and+\f[C]_\f[R], starting with a letter.+A variable name surrounded by \f[C]$\f[R] signs will be replaced by its+value.+For example, the string \f[C]$title$\f[R] in+.IP+.nf+\f[C]+<title>$title$</title>+\f[R]+.fi+.PP+will be replaced by the document title.+.PP+To write a literal \f[C]$\f[R] in a template, use \f[C]$$\f[R].+.PP+Templates may contain conditionals.+The syntax is as follows:+.IP+.nf+\f[C]+$if(variable)$+X+$else$+Y+$endif$+\f[R]+.fi+.PP+This will include \f[C]X\f[R] in the template if \f[C]variable\f[R] has+a truthy value; otherwise it will include \f[C]Y\f[R].+Here a truthy value is any of the following:+.IP \[bu] 2+a string that is not entirely white space,+.IP \[bu] 2+a non-empty array where the first value is truthy,+.IP \[bu] 2+any number (including zero),+.IP \[bu] 2+any object,+.IP \[bu] 2+the boolean \f[C]true\f[R] (to specify the boolean \f[C]true\f[R] value+using YAML metadata or the \f[C]--metadata\f[R] flag, use+\f[C]true\f[R], \f[C]True\f[R], or \f[C]TRUE\f[R]; with the+\f[C]--variable\f[R] flag, simply omit a value for the variable, e.g.+\f[C]--variable draft\f[R]).+.PP+\f[C]X\f[R] and \f[C]Y\f[R] are placeholders for any valid template+text, and may include interpolated variables or other conditionals.+The \f[C]$else$\f[R] section may be omitted.+.PP+When variables can have multiple values (for example, \f[C]author\f[R]+in a multi-author document), you can use the \f[C]$for$\f[R] keyword:+.IP+.nf+\f[C]+$for(author)$+<meta name=\[dq]author\[dq] content=\[dq]$author$\[dq] />+$endfor$+\f[R]+.fi+.PP+You can optionally specify a separator to be used between consecutive+items:+.IP+.nf+\f[C]+$for(author)$$author$$sep$, $endfor$+\f[R]+.fi+.PP+Note that the separator needs to be specified immediately before the+\f[C]$endfor\f[R] keyword.+.PP+A dot can be used to select a field of a variable that takes an object+as its value.+So, for example:+.IP+.nf+\f[C]+$author.name$ ($author.affiliation$)+\f[R]+.fi+.PP+If you use custom templates, you may need to revise them as pandoc+changes.+We recommend tracking the changes in the default templates, and+modifying your custom templates accordingly.+An easy way to do this is to fork the pandoc-templates repository and+merge in changes after each pandoc release.+.PP+Templates may contain comments: anything on a line after \f[C]$--\f[R]+will be treated as a comment and ignored.+.SH EXTENSIONS+.PP+The behavior of some of the readers and writers can be adjusted by+enabling or disabling various extensions.+.PP+An extension can be enabled by adding \f[C]+EXTENSION\f[R] to the format+name and disabled by adding \f[C]-EXTENSION\f[R].+For example, \f[C]--from markdown_strict+footnotes\f[R] is strict+Markdown with footnotes enabled, while+\f[C]--from markdown-footnotes-pipe_tables\f[R] is pandoc\[aq]s Markdown+without footnotes or pipe tables.+.PP+The markdown reader and writer make by far the most use of extensions.+Extensions only used by them are therefore covered in the section+Pandoc\[aq]s Markdown below (See Markdown variants for+\f[C]commonmark\f[R] and \f[C]gfm\f[R].) In the following, extensions+that also work for other formats are covered.+.PP+Note that markdown extensions added to the \f[C]ipynb\f[R] format affect+Markdown cells in Jupyter notebooks (as do command-line options like+\f[C]--atx-headers\f[R]).+.SS Typography+.SS Extension: \f[C]smart\f[R]+.PP+Interpret straight quotes as curly quotes, \f[C]---\f[R] as em-dashes,+\f[C]--\f[R] as en-dashes, and \f[C]...\f[R] as ellipses.+Nonbreaking spaces are inserted after certain abbreviations, such as+\[dq]Mr.\[dq]+.PP+This extension can be enabled/disabled for the following formats:+.TP+.B input formats+\f[C]markdown\f[R], \f[C]commonmark\f[R], \f[C]latex\f[R],+\f[C]mediawiki\f[R], \f[C]org\f[R], \f[C]rst\f[R], \f[C]twiki\f[R]+.TP+.B output formats+\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]context\f[R], \f[C]rst\f[R]+.TP+.B enabled by default in+\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]context\f[R] (both input and+output)+.PP+Note: If you are \f[I]writing\f[R] Markdown, then the \f[C]smart\f[R]+extension has the reverse effect: what would have been curly quotes+comes out straight.+.PP+In LaTeX, \f[C]smart\f[R] means to use the standard TeX ligatures for+quotation marks (\f[C]\[ga]\[ga]\f[R] and \f[C]\[aq]\[aq]\f[R] for+double quotes, \f[C]\[ga]\f[R] and \f[C]\[aq]\f[R] for single quotes)+and dashes (\f[C]--\f[R] for en-dash and \f[C]---\f[R] for em-dash).+If \f[C]smart\f[R] is disabled, then in reading LaTeX pandoc will parse+these characters literally.+In writing LaTeX, enabling \f[C]smart\f[R] tells pandoc to use the+ligatures when possible; if \f[C]smart\f[R] is disabled pandoc will use+unicode quotation mark and dash characters.+.SS Headers and sections+.SS Extension: \f[C]auto_identifiers\f[R]+.PP+A header without an explicitly specified identifier will be+automatically assigned a unique identifier based on the header text.+.PP+This extension can be enabled/disabled for the following formats:+.TP+.B input formats+\f[C]markdown\f[R], \f[C]latex\f[R], \f[C]rst\f[R], \f[C]mediawiki\f[R],+\f[C]textile\f[R]+.TP+.B output formats+\f[C]markdown\f[R], \f[C]muse\f[R]+.TP+.B enabled by default in+\f[C]markdown\f[R], \f[C]muse\f[R]+.PP+The default algorithm used to derive the identifier from the header text+is:+.IP \[bu] 2+Remove all formatting, links, etc.+.IP \[bu] 2+Remove all footnotes.+.IP \[bu] 2+Remove all non-alphanumeric characters, except underscores, hyphens, and+periods.+.IP \[bu] 2+Replace all spaces and newlines with hyphens.+.IP \[bu] 2+Convert all alphabetic characters to lowercase.+.IP \[bu] 2+Remove everything up to the first letter (identifiers may not begin with+a number or punctuation mark).+.IP \[bu] 2+If nothing is left after this, use the identifier \f[C]section\f[R].+.PP+Thus, for example,+.PP+.TS+tab(@);+l l.+T{+Header+T}@T{+Identifier+T}+_+T{+\f[C]Header identifiers in HTML\f[R]+T}@T{+\f[C]header-identifiers-in-html\f[R]+T}+T{+\f[C]Ma\[^i]tre d\[aq]h\[^o]tel\f[R]+T}@T{+\f[C]ma\[^i]tre-dh\[^o]tel\f[R]+T}+T{+\f[C]*Dogs*?--in *my* house?\f[R]+T}@T{+\f[C]dogs--in-my-house\f[R]+T}+T{+\f[C][HTML], [S5], or [RTF]?\f[R]+T}@T{+\f[C]html-s5-or-rtf\f[R]+T}+T{+\f[C]3. Applications\f[R]+T}@T{+\f[C]applications\f[R]+T}+T{+\f[C]33\f[R]+T}@T{+\f[C]section\f[R]+T}+.TE+.PP+These rules should, in most cases, allow one to determine the identifier+from the header text.+The exception is when several headers have the same text; in this case,+the first will get an identifier as described above; the second will get+the same identifier with \f[C]-1\f[R] appended; the third with+\f[C]-2\f[R]; and so on.+.PP+(However, a different algorithm is used if+\f[C]gfm_auto_identifiers\f[R] is enabled; see below.)+.PP+These identifiers are used to provide link targets in the table of+contents generated by the \f[C]--toc|--table-of-contents\f[R] option.+They also make it easy to provide links from one section of a document+to another.+A link to this section, for example, might look like this:+.IP+.nf+\f[C]+See the section on+[header identifiers](#header-identifiers-in-html-latex-and-context).+\f[R]+.fi+.PP+Note, however, that this method of providing links to sections works+only in HTML, LaTeX, and ConTeXt formats.+.PP+If the \f[C]--section-divs\f[R] option is specified, then each section+will be wrapped in a \f[C]section\f[R] (or a \f[C]div\f[R], if+\f[C]html4\f[R] was specified), and the identifier will be attached to+the enclosing \f[C]<section>\f[R] (or \f[C]<div>\f[R]) tag rather than+the header itself.+This allows entire sections to be manipulated using JavaScript or+treated differently in CSS.+.SS Extension: \f[C]ascii_identifiers\f[R]+.PP+Causes the identifiers produced by \f[C]auto_identifiers\f[R] to be pure+ASCII.+Accents are stripped off of accented Latin letters, and non-Latin+letters are omitted.+.SS Extension: \f[C]gfm_auto_identifiers\f[R]+.PP+Changes the algorithm used by \f[C]auto_identifiers\f[R] to conform to+GitHub\[aq]s method.+Spaces are converted to dashes (\f[C]-\f[R]), uppercase characters to+lowercase characters, and punctuation characters other than \f[C]-\f[R]+and \f[C]_\f[R] are removed.+.SS Math Input+.PP+The extensions \f[C]tex_math_dollars\f[R],+\f[C]tex_math_single_backslash\f[R], and+\f[C]tex_math_double_backslash\f[R] are described in the section about+Pandoc\[aq]s Markdown.+.PP+However, they can also be used with HTML input.+This is handy for reading web pages formatted using MathJax, for+example.+.SS Raw HTML/TeX+.PP+The following extensions (especially how they affect Markdown+input/output) are also described in more detail in their respective+sections of Pandoc\[aq]s Markdown.+.SS Extension: \f[C]raw_html\f[R]+.PP+When converting from HTML, parse elements to raw HTML which are not+representable in pandoc\[aq]s AST.+By default, this is disabled for HTML input.+.SS Extension: \f[C]raw_tex\f[R]+.PP+Allows raw LaTeX, TeX, and ConTeXt to be included in a document.+.PP+This extension can be enabled/disabled for the following formats (in+addition to \f[C]markdown\f[R]):+.TP+.B input formats+\f[C]latex\f[R], \f[C]org\f[R], \f[C]textile\f[R], \f[C]html\f[R]+(environments, \f[C]\[rs]ref\f[R], and \f[C]\[rs]eqref\f[R] only),+\f[C]ipynb\f[R]+.TP+.B output formats+\f[C]textile\f[R], \f[C]commonmark\f[R]+.PP+Note: as applied to \f[C]ipynb\f[R], \f[C]raw_html\f[R] and+\f[C]raw_tex\f[R] affect not only raw TeX in markdown cells, but data+with mime type \f[C]text/html\f[R] in output cells.+Since the \f[C]ipynb\f[R] reader attempts to preserve the richest+possible outputs when several options are given, you will get best+results if you disable \f[C]raw_html\f[R] and \f[C]raw_tex\f[R] when+converting to formats like \f[C]docx\f[R] which don\[aq]t allow raw+\f[C]html\f[R] or \f[C]tex\f[R].+.SS Extension: \f[C]native_divs\f[R]+.PP+This extension is enabled by default for HTML input.+This means that \f[C]div\f[R]s are parsed to pandoc native elements.+(Alternatively, you can parse them to raw HTML using+\f[C]-f html-native_divs+raw_html\f[R].)+.PP+When converting HTML to Markdown, for example, you may want to drop all+\f[C]div\f[R]s and \f[C]span\f[R]s:+.IP+.nf+\f[C]+pandoc -f html-native_divs-native_spans -t markdown+\f[R]+.fi+.SS Extension: \f[C]native_spans\f[R]+.PP+Analogous to \f[C]native_divs\f[R] above.+.SS Literate Haskell support+.SS Extension: \f[C]literate_haskell\f[R]+.PP+Treat the document as literate Haskell source.+.PP+This extension can be enabled/disabled for the following formats:+.TP+.B input formats+\f[C]markdown\f[R], \f[C]rst\f[R], \f[C]latex\f[R]+.TP+.B output formats+\f[C]markdown\f[R], \f[C]rst\f[R], \f[C]latex\f[R], \f[C]html\f[R]+.PP+If you append \f[C]+lhs\f[R] (or \f[C]+literate_haskell\f[R]) to one of+the formats above, pandoc will treat the document as literate Haskell+source.+This means that+.IP \[bu] 2+In Markdown input, \[dq]bird track\[dq] sections will be parsed as+Haskell code rather than block quotations.+Text between \f[C]\[rs]begin{code}\f[R] and \f[C]\[rs]end{code}\f[R]+will also be treated as Haskell code.+For ATX-style headers the character \[aq]=\[aq] will be used instead of+\[aq]#\[aq].+.IP \[bu] 2+In Markdown output, code blocks with classes \f[C]haskell\f[R] and+\f[C]literate\f[R] 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 \[aq]#\[aq] characters).+(This is because ghc treats \[aq]#\[aq] characters in column 1 as+introducing line numbers.)+.IP \[bu] 2+In restructured text input, \[dq]bird track\[dq] sections will be parsed+as Haskell code.+.IP \[bu] 2+In restructured text output, code blocks with class \f[C]haskell\f[R]+will be rendered using bird tracks.+.IP \[bu] 2+In LaTeX input, text in \f[C]code\f[R] environments will be parsed as+Haskell code.+.IP \[bu] 2+In LaTeX output, code blocks with class \f[C]haskell\f[R] will be+rendered inside \f[C]code\f[R] environments.+.IP \[bu] 2+In HTML output, code blocks with class \f[C]haskell\f[R] will be+rendered with class \f[C]literatehaskell\f[R] and bird tracks.+.PP+Examples:+.IP+.nf+\f[C]+pandoc -f markdown+lhs -t html+\f[R]+.fi+.PP+reads literate Haskell source formatted with Markdown conventions and+writes ordinary HTML (without bird tracks).+.IP+.nf+\f[C]+pandoc -f markdown+lhs -t html+lhs+\f[R]+.fi+.PP+writes HTML with the Haskell code in bird tracks, so it can be copied+and pasted as literate Haskell source.+.PP+Note that GHC expects the bird tracks in the first column, so indented+literate code blocks (e.g.+inside an itemized environment) will not be picked up by the Haskell+compiler.+.SS Other extensions+.SS Extension: \f[C]empty_paragraphs\f[R]+.PP+Allows empty paragraphs.+By default empty paragraphs are omitted.+.PP+This extension can be enabled/disabled for the following formats:+.TP+.B input formats+\f[C]docx\f[R], \f[C]html\f[R]+.TP+.B output formats+\f[C]docx\f[R], \f[C]odt\f[R], \f[C]opendocument\f[R], \f[C]html\f[R]+.SS Extension: \f[C]styles\f[R]+.PP+Read all docx styles as divs (for paragraph styles) and spans (for+character styles) regardless of whether pandoc understands the meaning+of these styles.+This can be used with docx custom styles.+Disabled by default.+.TP+.B input formats+\f[C]docx\f[R]+.SS Extension: \f[C]amuse\f[R]+.PP+In the \f[C]muse\f[R] input format, this enables Text::Amuse extensions+to Emacs Muse markup.+.SS Extension: \f[C]citations\f[R]+.PP+Some aspects of Pandoc\[aq]s Markdown citation syntax are also accepted+in \f[C]org\f[R] input.+.SS Extension: \f[C]ntb\f[R]+.PP+In the \f[C]context\f[R] output format this enables the use of Natural+Tables (TABLE) instead of the default Extreme Tables (xtables).+Natural tables allow more fine-grained global customization but come at+a performance penalty compared to extreme tables.+.SH PANDOC\[aq]S MARKDOWN+.PP+Pandoc understands an extended and slightly revised version of John+Gruber\[aq]s Markdown syntax.+This document explains the syntax, noting differences from standard+Markdown.+Except where noted, these differences can be suppressed by using the+\f[C]markdown_strict\f[R] format instead of \f[C]markdown\f[R].+Extensions can be enabled or disabled to specify the behavior more+granularly.+They are described in the following.+See also Extensions above, for extensions that work also on other+formats.+.SS Philosophy+.PP+Markdown is designed to be easy to write, and, even more importantly,+easy to read:+.RS+.PP+A Markdown-formatted document should be publishable as-is, as plain+text, without looking like it\[aq]s been marked up with tags or+formatting instructions.+-- John Gruber+.RE+.PP+This principle has guided pandoc\[aq]s decisions in finding syntax for+tables, footnotes, and other extensions.+.PP+There is, however, one respect in which pandoc\[aq]s aims are different+from the original aims of Markdown.+Whereas Markdown was originally designed with HTML generation in mind,+pandoc is designed for multiple output formats.+Thus, while pandoc allows the embedding of raw HTML, it discourages it,+and provides other, non-HTMLish ways of representing important document+elements like definition lists, tables, mathematics, and footnotes.+.SS Paragraphs+.PP+A paragraph is one or more lines of text followed by one or more blank+lines.+Newlines are treated as spaces, so you can reflow your paragraphs as you+like.+If you need a hard line break, put two or more spaces at the end of a+line.+.SS Extension: \f[C]escaped_line_breaks\f[R]+.PP+A backslash followed by a newline is also a hard line break.+Note: in multiline and grid table cells, this is the only way to create+a hard line break, since trailing spaces in the cells are ignored.+.SS Headers+.PP+There are two kinds of headers: Setext and ATX.+.SS Setext-style headers+.PP+A setext-style header is a line of text \[dq]underlined\[dq] with a row+of \f[C]=\f[R] signs (for a level one header) or \f[C]-\f[R] signs (for+a level two header):+.IP+.nf+\f[C]+A level-one header+==================++A level-two header+------------------+\f[R]+.fi+.PP+The header text can contain inline formatting, such as emphasis (see+Inline formatting, below).+.SS ATX-style headers+.PP+An ATX-style header consists of one to six \f[C]#\f[R] signs and a line+of text, optionally followed by any number of \f[C]#\f[R] signs.+The number of \f[C]#\f[R] signs at the beginning of the line is the+header level:+.IP+.nf+\f[C]+## A level-two header++### A level-three header ###+\f[R]+.fi+.PP+As with setext-style headers, the header text can contain formatting:+.IP+.nf+\f[C]+# A level-one header with a [link](/url) and *emphasis*+\f[R]+.fi+.SS Extension: \f[C]blank_before_header\f[R]+.PP+Standard Markdown syntax does not require a blank line before a header.+Pandoc does require this (except, of course, at the beginning of the+document).+The reason for the requirement is that it is all too easy for a+\f[C]#\f[R] to end up at the beginning of a line by accident (perhaps+through line wrapping).+Consider, for example:+.IP+.nf+\f[C]+I like several of their flavors of ice cream:+#22, for example, and #5.+\f[R]+.fi+.SS Extension: \f[C]space_in_atx_header\f[R]+.PP+Many Markdown implementations do not require a space between the opening+\f[C]#\f[R]s of an ATX header and the header text, so that+\f[C]#5 bolt\f[R] and \f[C]#hashtag\f[R] count as headers.+With this extension, pandoc does require the space.+.SS Header identifiers+.PP+See also the \f[C]auto_identifiers\f[R] extension above.+.SS Extension: \f[C]header_attributes\f[R]+.PP+Headers can be assigned attributes using this syntax at the end of the+line containing the header text:+.IP+.nf+\f[C]+{#identifier .class .class key=value key=value}+\f[R]+.fi+.PP+Thus, for example, the following headers will all be assigned the+identifier \f[C]foo\f[R]:+.IP+.nf+\f[C]+# My header {#foo}++## My header ## {#foo}++My other header {#foo}+---------------+\f[R]+.fi+.PP+(This syntax is compatible with PHP Markdown Extra.)+.PP+Note that although this syntax allows assignment of classes and+key/value attributes, writers generally don\[aq]t use all of this+information.+Identifiers, classes, and key/value attributes are used in HTML and+HTML-based formats such as EPUB and slidy.+Identifiers are used for labels and link anchors in the LaTeX, ConTeXt,+Textile, and AsciiDoc writers.+.PP+Headers with the class \f[C]unnumbered\f[R] will not be numbered, even+if \f[C]--number-sections\f[R] is specified.+A single hyphen (\f[C]-\f[R]) in an attribute context is equivalent to+\f[C].unnumbered\f[R], and preferable in non-English documents.+So,+.IP+.nf+\f[C]+# My header {-}+\f[R]+.fi+.PP+is just the same as+.IP+.nf+\f[C]+# My header {.unnumbered}+\f[R]+.fi+.SS Extension: \f[C]implicit_header_references\f[R]+.PP+Pandoc behaves as if reference links have been defined for each header.+So, to link to a header+.IP+.nf+\f[C]+# Header identifiers in HTML+\f[R]+.fi+.PP+you can simply write+.IP+.nf+\f[C]+[Header identifiers in HTML]+\f[R]+.fi+.PP+or+.IP+.nf+\f[C]+[Header identifiers in HTML][]+\f[R]+.fi+.PP+or+.IP+.nf+\f[C]+[the section on header identifiers][header identifiers in+HTML]+\f[R]+.fi+.PP+instead of giving the identifier explicitly:+.IP+.nf+\f[C]+[Header identifiers in HTML](#header-identifiers-in-html)+\f[R]+.fi+.PP+If there are multiple headers with identical text, the corresponding+reference will link to the first one only, and you will need to use+explicit links to link to the others, as described above.+.PP+Like regular reference links, these references are case-insensitive.+.PP+Explicit link reference definitions always take priority over implicit+header references.+So, in the following example, the link will point to \f[C]bar\f[R], not+to \f[C]#foo\f[R]:+.IP+.nf+\f[C]+# Foo++[foo]: bar++See [foo]+\f[R]+.fi+.SS Block quotations+.PP+Markdown uses email conventions for quoting blocks of text.+A block quotation is one or more paragraphs or other block elements+(such as lists or headers), with each line preceded by a \f[C]>\f[R]+character and an optional space.+(The \f[C]>\f[R] need not start at the left margin, but it should not be+indented more than three spaces.)+.IP+.nf+\f[C]+> This is a block quote. This+> paragraph has two lines.+>+> 1. This is a list inside a block quote.+> 2. Second item.+\f[R]+.fi+.PP+A \[dq]lazy\[dq] form, which requires the \f[C]>\f[R] character only on+the first line of each block, is also allowed:+.IP+.nf+\f[C]+> This is a block quote. This+paragraph has two lines.++> 1. This is a list inside a block quote.+2. Second item.+\f[R]+.fi+.PP+Among the block elements that can be contained in a block quote are+other block quotes.+That is, block quotes can be nested:+.IP+.nf+\f[C]+> This is a block quote.+>+> > A block quote within a block quote.+\f[R]+.fi+.PP+If the \f[C]>\f[R] character is followed by an optional space, that+space will be considered part of the block quote marker and not part of+the indentation of the contents.+Thus, to put an indented code block in a block quote, you need five+spaces after the \f[C]>\f[R]:+.IP+.nf+\f[C]+> code+\f[R]+.fi+.SS Extension: \f[C]blank_before_blockquote\f[R]+.PP+Standard Markdown syntax does not require a blank line before a block+quote.+Pandoc does require this (except, of course, at the beginning of the+document).+The reason for the requirement is that it is all too easy for a+\f[C]>\f[R] to end up at the beginning of a line by accident (perhaps+through line wrapping).+So, unless the \f[C]markdown_strict\f[R] format is used, the following+does not produce a nested block quote in pandoc:+.IP+.nf+\f[C]+> This is a block quote.+>> Nested.+\f[R]+.fi+.SS Verbatim (code) blocks+.SS Indented code blocks+.PP+A block of text indented four spaces (or one tab) is treated as verbatim+text: that is, special characters do not trigger special formatting, and+all spaces and line breaks are preserved.+For example,+.IP+.nf+\f[C]+ if (a > 3) {+ moveShip(5 * gravity, DOWN);+ }+\f[R]+.fi+.PP+The initial (four space or one tab) indentation is not considered part+of the verbatim text, and is removed in the output.+.PP+Note: blank lines in the verbatim text need not begin with four spaces.+.SS Fenced code blocks+.SS Extension: \f[C]fenced_code_blocks\f[R]+.PP+In addition to standard indented code blocks, pandoc supports+\f[I]fenced\f[R] code blocks.+These begin with a row of three or more tildes (\f[C]\[ti]\f[R]) and end+with a row of tildes that must be at least as long as the starting row.+Everything between these lines is treated as code.+No indentation is necessary:+.IP+.nf+\f[C]+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+if (a > 3) {+ moveShip(5 * gravity, DOWN);+}+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+\f[R]+.fi+.PP+Like regular code blocks, fenced code blocks must be separated from+surrounding text by blank lines.+.PP+If the code itself contains a row of tildes or backticks, just use a+longer row of tildes or backticks at the start and end:+.IP+.nf+\f[C]+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+code including tildes+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+\f[R]+.fi+.SS Extension: \f[C]backtick_code_blocks\f[R]+.PP+Same as \f[C]fenced_code_blocks\f[R], but uses backticks+(\f[C]\[ga]\f[R]) instead of tildes (\f[C]\[ti]\f[R]).+.SS Extension: \f[C]fenced_code_attributes\f[R]+.PP+Optionally, you may attach attributes to fenced or backtick code block+using this syntax:+.IP+.nf+\f[C]+\[ti]\[ti]\[ti]\[ti] {#mycode .haskell .numberLines startFrom=\[dq]100\[dq]}+qsort [] = []+qsort (x:xs) = qsort (filter (< x) xs) ++ [x] +++ qsort (filter (>= x) xs)+\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]\[ti]+\f[R]+.fi+.PP+Here \f[C]mycode\f[R] is an identifier, \f[C]haskell\f[R] and+\f[C]numberLines\f[R] are classes, and \f[C]startFrom\f[R] is an+attribute with value \f[C]100\f[R].+Some output formats can use this information to do syntax highlighting.+Currently, the only output formats that uses this information are HTML,+LaTeX, Docx, Ms, and PowerPoint.+If highlighting is supported for your output format and language, then+the code block above will appear highlighted, with numbered lines.+(To see which languages are supported, type+\f[C]pandoc --list-highlight-languages\f[R].) Otherwise, the code block+above will appear as follows:+.IP+.nf+\f[C]+<pre id=\[dq]mycode\[dq] class=\[dq]haskell numberLines\[dq] startFrom=\[dq]100\[dq]>+ <code>+ ...+ </code>+</pre>+\f[R]+.fi+.PP+The \f[C]numberLines\f[R] (or \f[C]number-lines\f[R]) class will cause+the lines of the code block to be numbered, starting with \f[C]1\f[R] or+the value of the \f[C]startFrom\f[R] attribute.+The \f[C]lineAnchors\f[R] (or \f[C]line-anchors\f[R]) class will cause+the lines to be clickable anchors in HTML output.+.PP+A shortcut form can also be used for specifying the language of the code+block:+.IP+.nf+\f[C]+\[ga]\[ga]\[ga]haskell+qsort [] = []+\[ga]\[ga]\[ga]+\f[R]+.fi+.PP+This is equivalent to:+.IP+.nf+\f[C]+\[ga]\[ga]\[ga] {.haskell}+qsort [] = []+\[ga]\[ga]\[ga]+\f[R]+.fi+.PP+If the \f[C]fenced_code_attributes\f[R] extension is disabled, but input+contains class attribute(s) for the code block, the first class+attribute will be printed after the opening fence as a bare word.+.PP+To prevent all highlighting, use the \f[C]--no-highlight\f[R] flag.+To set the highlighting style, use \f[C]--highlight-style\f[R].+For more information on highlighting, see Syntax highlighting, below.+.SS Line blocks+.SS Extension: \f[C]line_blocks\f[R]+.PP+A line block is a sequence of lines beginning with a vertical bar+(\f[C]|\f[R]) followed by a space.+The division into lines will be preserved in the output, as will any+leading spaces; otherwise, the lines will be formatted as Markdown.+This is useful for verse and addresses:+.IP+.nf+\f[C]+| The limerick packs laughs anatomical+| In space that is quite economical.+| But the good ones I\[aq]ve seen+| So seldom are clean+| And the clean ones so seldom are comical++| 200 Main St.+| Berkeley, CA 94718+\f[R]+.fi+.PP+The lines can be hard-wrapped if needed, but the continuation line must+begin with a space.+.IP+.nf+\f[C]+| The Right Honorable Most Venerable and Righteous Samuel L.+ Constable, Jr.+| 200 Main St.+| Berkeley, CA 94718+\f[R]+.fi+.PP+This syntax is borrowed from reStructuredText.+.SS Lists+.SS Bullet lists+.PP+A bullet list is a list of bulleted list items.+A bulleted list item begins with a bullet (\f[C]*\f[R], \f[C]+\f[R], or+\f[C]-\f[R]).+Here is a simple example:+.IP+.nf+\f[C]+* one+* two+* three+\f[R]+.fi+.PP+This will produce a \[dq]compact\[dq] list.+If you want a \[dq]loose\[dq] list, in which each item is formatted as a+paragraph, put spaces between the items:+.IP+.nf+\f[C]+* one++* two++* three+\f[R]+.fi+.PP+The bullets need not be flush with the left margin; they may be indented+one, two, or three spaces.+The bullet must be followed by whitespace.+.PP+List items look best if subsequent lines are flush with the first line+(after the bullet):+.IP+.nf+\f[C]+* here is my first+ list item.+* and my second.+\f[R]+.fi+.PP+But Markdown also allows a \[dq]lazy\[dq] format:+.IP+.nf+\f[C]+* here is my first+list item.+* and my second.+\f[R]+.fi+.SS Block content in list items+.PP+A list item may contain multiple paragraphs and other block-level+content.+However, subsequent paragraphs must be preceded by a blank line and+indented to line up with the first non-space content after the list+marker.+.IP+.nf+\f[C]+ * First paragraph.++ Continued.++ * Second paragraph. With a code block, which must be indented+ eight spaces:++ { code }+\f[R]+.fi+.PP+Exception: if the list marker is followed by an indented code block,+which must begin 5 spaces after the list marker, then subsequent+paragraphs must begin two columns after the last character of the list+marker:+.IP+.nf+\f[C]+* code++ continuation paragraph+\f[R]+.fi+.PP+List items may include other lists.+In this case the preceding blank line is optional.+The nested list must be indented to line up with the first non-space+character after the list marker of the containing list item.+.IP+.nf+\f[C]+* fruits+ + apples+ - macintosh+ - red delicious+ + pears+ + peaches+* vegetables+ + broccoli+ + chard+\f[R]+.fi+.PP+As noted above, Markdown allows you to write list items+\[dq]lazily,\[dq] instead of indenting continuation lines.+However, if there are multiple paragraphs or other blocks in a list+item, the first line of each must be indented.+.IP+.nf+\f[C]++ A lazy, lazy, list+item.+++ Another one; this looks+bad but is legal.++ Second paragraph of second+list item.+\f[R]+.fi+.SS Ordered lists+.PP+Ordered lists work just like bulleted lists, except that the items begin+with enumerators rather than bullets.+.PP+In standard Markdown, enumerators are decimal numbers followed by a+period and a space.+The numbers themselves are ignored, so there is no difference between+this list:+.IP+.nf+\f[C]+1. one+2. two+3. three+\f[R]+.fi+.PP+and this one:+.IP+.nf+\f[C]+5. one+7. two+1. three+\f[R]+.fi+.SS Extension: \f[C]fancy_lists\f[R]+.PP+Unlike standard Markdown, pandoc allows ordered list items to be marked+with uppercase and lowercase letters and roman numerals, in addition to+Arabic numerals.+List markers may be enclosed in parentheses or followed by a single+right-parentheses or period.+They must be separated from the text that follows by at least one space,+and, if the list marker is a capital letter with a period, by at least+two spaces.+.PP+The \f[C]fancy_lists\f[R] extension also allows \[aq]\f[C]#\f[R]\[aq] to+be used as an ordered list marker in place of a numeral:+.IP+.nf+\f[C]+#. one+#. two+\f[R]+.fi+.SS Extension: \f[C]startnum\f[R]+.PP+Pandoc also pays attention to the type of list marker used, and to the+starting number, and both of these are preserved where possible in the+output format.+Thus, the following yields a list with numbers followed by a single+parenthesis, starting with 9, and a sublist with lowercase roman+numerals:+.IP+.nf+\f[C]+ 9) Ninth+10) Tenth+11) Eleventh+ i. subone+ ii. subtwo+ iii. subthree+\f[R]+.fi+.PP+Pandoc will start a new list each time a different type of list marker+is used.+So, the following will create three lists:+.IP+.nf+\f[C]+(2) Two+(5) Three+1. Four+* Five+\f[R]+.fi+.PP+If default list markers are desired, use \f[C]#.\f[R]:+.IP+.nf+\f[C]+#. one+#. two+#. three+\f[R]+.fi+.SS Extension: \f[C]task_lists\f[R]+.PP+Pandoc supports task lists, using the syntax of GitHub-Flavored+Markdown.+.IP+.nf+\f[C]+- [ ] an unchecked task list item+- [x] checked item+\f[R]+.fi+.SS Definition lists+.SS Extension: \f[C]definition_lists\f[R]+.PP+Pandoc supports definition lists, using the syntax of PHP Markdown Extra+with some extensions.+.IP+.nf+\f[C]+Term 1++: Definition 1++Term 2 with *inline markup*++: Definition 2++ { some code, part of Definition 2 }++ Third paragraph of definition 2.+\f[R]+.fi+.PP+Each term must fit on one line, which may optionally be followed by a+blank line, and must be followed by one or more definitions.+A definition begins with a colon or tilde, which may be indented one or+two spaces.+.PP+A term may have multiple definitions, and each definition may consist of+one or more block elements (paragraph, code block, list, etc.), each+indented four spaces or one tab stop.+The body of the definition (including the first line, aside from the+colon or tilde) should be indented four spaces.+However, as with other Markdown lists, you can \[dq]lazily\[dq] omit+indentation except at the beginning of a paragraph or other block+element:+.IP+.nf+\f[C]+Term 1++: Definition+with lazy continuation.++ Second paragraph of the definition.+\f[R]+.fi+.PP+If you leave space before the definition (as in the example above), the+text of the definition will be treated as a paragraph.+In some output formats, this will mean greater spacing between+term/definition pairs.+For a more compact definition list, omit the space before the+definition:+.IP+.nf+\f[C]+Term 1+ \[ti] Definition 1++Term 2+ \[ti] Definition 2a+ \[ti] Definition 2b+\f[R]+.fi+.PP+Note that space between items in a definition list is required.+(A variant that loosens this requirement, but disallows \[dq]lazy\[dq]+hard wrapping, can be activated with \f[C]compact_definition_lists\f[R]:+see Non-pandoc extensions, below.)+.SS Numbered example lists+.SS Extension: \f[C]example_lists\f[R]+.PP+The special list marker \f[C]\[at]\f[R] can be used for sequentially+numbered examples.+The first list item with a \f[C]\[at]\f[R] marker will be numbered+\[aq]1\[aq], the next \[aq]2\[aq], and so on, throughout the document.+The numbered examples need not occur in a single list; each new list+using \f[C]\[at]\f[R] will take up where the last stopped.+So, for example:+.IP+.nf+\f[C]+(\[at]) My first example will be numbered (1).+(\[at]) My second example will be numbered (2).++Explanation of examples.++(\[at]) My third example will be numbered (3).+\f[R]+.fi+.PP+Numbered examples can be labeled and referred to elsewhere in the+document:+.IP+.nf+\f[C]+(\[at]good) This is a good example.++As (\[at]good) illustrates, ...+\f[R]+.fi+.PP+The label can be any string of alphanumeric characters, underscores, or+hyphens.+.PP+Note: continuation paragraphs in example lists must always be indented+four spaces, regardless of the length of the list marker.+That is, example lists always behave as if the \f[C]four_space_rule\f[R]+extension is set.+This is because example labels tend to be long, and indenting content to+the first non-space character after the label would be awkward.+.SS Compact and loose lists+.PP+Pandoc behaves differently from \f[C]Markdown.pl\f[R] on some \[dq]edge+cases\[dq] involving lists.+Consider this source:+.IP+.nf+\f[C]++ First++ Second:+ - Fee+ - Fie+ - Foe+++ Third+\f[R]+.fi+.PP+Pandoc transforms this into a \[dq]compact list\[dq] (with no+\f[C]<p>\f[R] tags around \[dq]First\[dq], \[dq]Second\[dq], or+\[dq]Third\[dq]), while Markdown puts \f[C]<p>\f[R] tags around+\[dq]Second\[dq] and \[dq]Third\[dq] (but not \[dq]First\[dq]), because+of the blank space around \[dq]Third\[dq].+Pandoc follows a simple rule: if the text is followed by a blank line,+it is treated as a paragraph.+Since \[dq]Second\[dq] is followed by a list, and not a blank line, it+isn\[aq]t treated as a paragraph.+The fact that the list is followed by a blank line is irrelevant.+(Note: Pandoc works this way even when the \f[C]markdown_strict\f[R]+format is specified.+This behavior is consistent with the official Markdown syntax+description, even though it is different from that of+\f[C]Markdown.pl\f[R].)+.SS Ending a list+.PP+What if you want to put an indented code block after a list?+.IP+.nf+\f[C]+- item one+- item two++ { my code block }+\f[R]+.fi+.PP+Trouble! Here pandoc (like other Markdown implementations) will treat+\f[C]{ my code block }\f[R] as the second paragraph of item two, and not+as a code block.+.PP+To \[dq]cut off\[dq] the list after item two, you can insert some+non-indented content, like an HTML comment, which won\[aq]t produce+visible output in any format:+.IP+.nf+\f[C]+- item one+- item two++<!-- end of list -->++ { my code block }+\f[R]+.fi+.PP+You can use the same trick if you want two consecutive lists instead of+one big list:+.IP+.nf+\f[C]+1. one+2. two+3. three++<!-- -->++1. uno+2. dos+3. tres+\f[R]+.fi+.SS Horizontal rules+.PP+A line containing a row of three or more \f[C]*\f[R], \f[C]-\f[R], or+\f[C]_\f[R] characters (optionally separated by spaces) produces a+horizontal rule:+.IP+.nf+\f[C]+* * * *++---------------+\f[R]+.fi+.SS Tables+.PP+Four kinds of tables may be used.+The first three kinds presuppose the use of a fixed-width font, such as+Courier.+The fourth kind can be used with proportionally spaced fonts, as it does+not require lining up columns.+.SS Extension: \f[C]table_captions\f[R]+.PP+A caption may optionally be provided with all 4 kinds of tables (as+illustrated in the examples below).+A caption is a paragraph beginning with the string \f[C]Table:\f[R] (or+just \f[C]:\f[R]), which will be stripped off.+It may appear either before or after the table.+.SS Extension: \f[C]simple_tables\f[R]+.PP+Simple tables look like this:+.IP+.nf+\f[C]+ Right Left Center Default+------- ------ ---------- -------+ 12 12 12 12+ 123 123 123 123+ 1 1 1 1++Table: Demonstration of simple table syntax.+\f[R]+.fi+.PP+The headers and table rows must each fit on one line.+Column alignments are determined by the position of the header text+relative to the dashed line below it:+.IP \[bu] 2+If the dashed line is flush with the header text on the right side but+extends beyond it on the left, the column is right-aligned.+.IP \[bu] 2+If the dashed line is flush with the header text on the left side but+extends beyond it on the right, the column is left-aligned.+.IP \[bu] 2+If the dashed line extends beyond the header text on both sides, the+column is centered.+.IP \[bu] 2+If the dashed line is flush with the header text on both sides, the+default alignment is used (in most cases, this will be left).+.PP+The table must end with a blank line, or a line of dashes followed by a+blank line.+.PP+The column headers may be omitted, provided a dashed line is used to end+the table.+For example:+.IP+.nf+\f[C]+------- ------ ---------- -------+ 12 12 12 12+ 123 123 123 123+ 1 1 1 1+------- ------ ---------- -------+\f[R]+.fi+.PP+When headers are omitted, column alignments are determined on the basis+of the first line of the table body.+So, in the tables above, the columns would be right, left, center, and+right aligned, respectively.+.SS Extension: \f[C]multiline_tables\f[R]+.PP+Multiline tables allow headers and table rows to span multiple lines of+text (but cells that span multiple columns or rows of the table are not+supported).+Here is an example:+.IP+.nf+\f[C]+-------------------------------------------------------------+ Centered Default Right Left+ Header Aligned Aligned Aligned+----------- ------- --------------- -------------------------+ First row 12.0 Example of a row that+ spans multiple lines.++ Second row 5.0 Here\[aq]s another one. Note+ the blank line between+ rows.+-------------------------------------------------------------++Table: Here\[aq]s the caption. It, too, may span+multiple lines.+\f[R]+.fi+.PP+These work like simple tables, but with the following differences:+.IP \[bu] 2+They must begin with a row of dashes, before the header text (unless the+headers are omitted).+.IP \[bu] 2+They must end with a row of dashes, then a blank line.+.IP \[bu] 2+The rows must be separated by blank lines.+.PP+In multiline tables, the table parser pays attention to the widths of+the columns, and the writers try to reproduce these relative widths in+the output.+So, if you find that one of the columns is too narrow in the output, try+widening it in the Markdown source.+.PP+Headers may be omitted in multiline tables as well as simple tables:+.IP+.nf+\f[C]+----------- ------- --------------- -------------------------+ First row 12.0 Example of a row that+ spans multiple lines.++ Second row 5.0 Here\[aq]s another one. Note+ the blank line between+ rows.+----------- ------- --------------- -------------------------++: Here\[aq]s a multiline table without headers.+\f[R]+.fi+.PP+It is possible for a multiline table to have just one row, but the row+should be followed by a blank line (and then the row of dashes that ends+the table), or the table may be interpreted as a simple table.+.SS Extension: \f[C]grid_tables\f[R]+.PP+Grid tables look like this:+.IP+.nf+\f[C]+: Sample grid table.+++---------------+---------------+--------------------++| Fruit | Price | Advantages |++===============+===============+====================++| Bananas | $1.34 | - built-in wrapper |+| | | - bright color |++---------------+---------------+--------------------++| Oranges | $2.10 | - cures scurvy |+| | | - tasty |++---------------+---------------+--------------------++\f[R]+.fi+.PP+The row of \f[C]=\f[R]s separates the header from the table body, and+can be omitted for a headerless table.+The cells of grid tables may contain arbitrary block elements (multiple+paragraphs, code blocks, lists, etc.).+Cells that span multiple columns or rows are not supported.+Grid tables can be created easily using Emacs table mode.+.PP+Alignments can be specified as with pipe tables, by putting colons at+the boundaries of the separator line after the header:+.IP+.nf+\f[C]++---------------+---------------+--------------------++| Right | Left | Centered |++==============:+:==============+:==================:++| Bananas | $1.34 | built-in wrapper |++---------------+---------------+--------------------++\f[R]+.fi+.PP+For headerless tables, the colons go on the top line instead:+.IP+.nf+\f[C]++--------------:+:--------------+:------------------:++| Right | Left | Centered |++---------------+---------------+--------------------++\f[R]+.fi+.SS Grid Table Limitations+.PP+Pandoc does not support grid tables with row spans or column spans.+This means that neither variable numbers of columns across rows nor+variable numbers of rows across columns are supported by Pandoc.+All grid tables must have the same number of columns in each row, and+the same number of rows in each column.+For example, the Docutils sample grid tables will not render as expected+with Pandoc.+.SS Extension: \f[C]pipe_tables\f[R]+.PP+Pipe tables look like this:+.IP+.nf+\f[C]+| Right | Left | Default | Center |+|------:|:-----|---------|:------:|+| 12 | 12 | 12 | 12 |+| 123 | 123 | 123 | 123 |+| 1 | 1 | 1 | 1 |++ : Demonstration of pipe table syntax.+\f[R]+.fi+.PP+The syntax is identical to PHP Markdown Extra tables.+The beginning and ending pipe characters are optional, but pipes are+required between all columns.+The colons indicate column alignment as shown.+The header cannot be omitted.+To simulate a headerless table, include a header with blank cells.+.PP+Since the pipes indicate column boundaries, columns need not be+vertically aligned, as they are in the above example.+So, this is a perfectly legal (though ugly) pipe table:+.IP+.nf+\f[C]+fruit| price+-----|-----:+apple|2.05+pear|1.37+orange|3.09+\f[R]+.fi+.PP+The cells of pipe tables cannot contain block elements like paragraphs+and lists, and cannot span multiple lines.+If a pipe table contains a row whose printable content is wider than the+column width (see \f[C]--columns\f[R]), then the table will take up the+full text width and the cell contents will wrap, with the relative cell+widths determined by the number of dashes in the line separating the+table header from the table body.+(For example \f[C]---|-\f[R] would make the first column 3/4 and the+second column 1/4 of the full text width.) On the other hand, if no+lines are wider than column width, then cell contents will not be+wrapped, and the cells will be sized to their contents.+.PP+Note: pandoc also recognizes pipe tables of the following form, as can+be produced by Emacs\[aq] orgtbl-mode:+.IP+.nf+\f[C]+| One | Two |+|-----+-------|+| my | table |+| is | nice |+\f[R]+.fi+.PP+The difference is that \f[C]+\f[R] is used instead of \f[C]|\f[R].+Other orgtbl features are not supported.+In particular, to get non-default column alignment, you\[aq]ll need to+add colons as above.+.SS Metadata blocks+.SS Extension: \f[C]pandoc_title_block\f[R]+.PP+If the file begins with a title block+.IP+.nf+\f[C]+% title+% author(s) (separated by semicolons)+% date+\f[R]+.fi+.PP+it will be parsed as bibliographic information, not regular text.+(It will be used, for example, in the title of standalone LaTeX or HTML+output.) The block may contain just a title, a title and an author, or+all three elements.+If you want to include an author but no title, or a title and a date but+no author, you need a blank line:+.IP+.nf+\f[C]+%+% Author++% My title+%+% June 15, 2006+\f[R]+.fi+.PP+The title may occupy multiple lines, but continuation lines must begin+with leading space, thus:+.IP+.nf+\f[C]+% My title+ on multiple lines+\f[R]+.fi+.PP+If a document has multiple authors, the authors may be put on separate+lines with leading space, or separated by semicolons, or both.+So, all of the following are equivalent:+.IP+.nf+\f[C]+% Author One+ Author Two++% Author One; Author Two++% Author One;+ Author Two+\f[R]+.fi+.PP+The date must fit on one line.+.PP+All three metadata fields may contain standard inline formatting+(italics, links, footnotes, etc.).+.PP+Title blocks will always be parsed, but they will affect the output only+when the \f[C]--standalone\f[R] (\f[C]-s\f[R]) option is chosen.+In HTML output, titles will appear twice: once in the document head --+this is the title that will appear at the top of the window in a browser+-- and once at the beginning of the document body.+The title in the document head can have an optional prefix attached+(\f[C]--title-prefix\f[R] or \f[C]-T\f[R] option).+The title in the body appears as an H1 element with class+\[dq]title\[dq], so it can be suppressed or reformatted with CSS.+If a title prefix is specified with \f[C]-T\f[R] and no title block+appears in the document, the title prefix will be used by itself as the+HTML title.+.PP+The man page writer extracts a title, man page section number, and other+header and footer information from the title line.+The title is assumed to be the first word on the title line, which may+optionally end with a (single-digit) section number in parentheses.+(There should be no space between the title and the parentheses.)+Anything after this is assumed to be additional footer and header text.+A single pipe character (\f[C]|\f[R]) should be used to separate the+footer text from the header text.+Thus,+.IP+.nf+\f[C]+% PANDOC(1)+\f[R]+.fi+.PP+will yield a man page with the title \f[C]PANDOC\f[R] and section 1.+.IP+.nf+\f[C]+% PANDOC(1) Pandoc User Manuals+\f[R]+.fi+.PP+will also have \[dq]Pandoc User Manuals\[dq] in the footer.+.IP+.nf+\f[C]+% PANDOC(1) Pandoc User Manuals | Version 4.0+\f[R]+.fi+.PP+will also have \[dq]Version 4.0\[dq] in the header.+.SS Extension: \f[C]yaml_metadata_block\f[R]+.PP+A YAML metadata block is a valid YAML object, delimited by a line of+three hyphens (\f[C]---\f[R]) at the top and a line of three hyphens+(\f[C]---\f[R]) or three dots (\f[C]...\f[R]) at the bottom.+A YAML metadata block may occur anywhere in the document, but if it is+not at the beginning, it must be preceded by a blank line.+(Note that, because of the way pandoc concatenates input files when+several are provided, you may also keep the metadata in a separate YAML+file and pass it to pandoc as an argument, along with your Markdown+files:+.IP+.nf+\f[C]+pandoc chap1.md chap2.md chap3.md metadata.yaml -s -o book.html+\f[R]+.fi+.PP+Just be sure that the YAML file begins with \f[C]---\f[R] and ends with+\f[C]---\f[R] or \f[C]...\f[R].) Alternatively, you can use the+\f[C]--metadata-file\f[R] option.+Using that approach however, you cannot reference content (like+footnotes) from the main markdown input document.+.PP+Metadata will be taken from the fields of the YAML object and added to+any existing document metadata.+Metadata can contain lists and objects (nested arbitrarily), but all+string scalars will be interpreted as Markdown.+Fields with names ending in an underscore will be ignored by pandoc.+(They may be given a role by external processors.) Field names must not+be interpretable as YAML numbers or boolean values (so, for example,+\f[C]yes\f[R], \f[C]True\f[R], and \f[C]15\f[R] cannot be used as field+names).+.PP+A document may contain multiple metadata blocks.+The metadata fields will be combined through a \f[I]left-biased+union\f[R]: if two metadata blocks attempt to set the same field, the+value from the first block will be taken.+.PP+When pandoc is used with \f[C]-t markdown\f[R] to create a Markdown+document, a YAML metadata block will be produced only if the+\f[C]-s/--standalone\f[R] option is used.+All of the metadata will appear in a single block at the beginning of+the document.+.PP+Note that YAML escaping rules must be followed.+Thus, for example, if a title contains a colon, it must be quoted.+The pipe character (\f[C]|\f[R]) can be used to begin an indented block+that will be interpreted literally, without need for escaping.+This form is necessary when the field contains blank lines or+block-level formatting:+.IP+.nf+\f[C]+---+title: \[aq]This is the title: it contains a colon\[aq]+author:+- Author One+- Author Two+keywords: [nothing, nothingness]+abstract: |+ This is the abstract.++ It consists of two paragraphs.+\&...+\f[R]+.fi+.PP+Template variables will be set automatically from the metadata.+Thus, for example, in writing HTML, the variable \f[C]abstract\f[R] will+be set to the HTML equivalent of the Markdown in the \f[C]abstract\f[R]+field:+.IP+.nf+\f[C]+<p>This is the abstract.</p>+<p>It consists of two paragraphs.</p>+\f[R]+.fi+.PP+Variables can contain arbitrary YAML structures, but the template must+match this structure.+The \f[C]author\f[R] variable in the default templates expects a simple+list or string, but can be changed to support more complicated+structures.+The following combination, for example, would add an affiliation to the+author if one is given:+.IP+.nf+\f[C]+---+title: The document title+author:+- name: Author One+ affiliation: University of Somewhere+- name: Author Two+ affiliation: University of Nowhere+\&...+\f[R]+.fi+.PP+To use the structured authors in the example above, you would need a+custom template:+.IP+.nf+\f[C]+$for(author)$+$if(author.name)$+$author.name$$if(author.affiliation)$ ($author.affiliation$)$endif$+$else$+$author$+$endif$+$endfor$+\f[R]+.fi+.PP+Raw content to include in the document\[aq]s header may be specified+using \f[C]header-includes\f[R]; however, it is important to mark up+this content as raw code for a particular output format, using the+\f[C]raw_attribute\f[R] extension), or it will be interpreted as+markdown.+For example:+.IP+.nf+\f[C]+header-includes:+- |+ \[ga]\[ga]\[ga]{=latex}+ \[rs]let\[rs]oldsection\[rs]section+ \[rs]renewcommand{\[rs]section}[1]{\[rs]clearpage\[rs]oldsection{#1}}+ \[ga]\[ga]\[ga]+\f[R]+.fi+.SS Backslash escapes+.SS Extension: \f[C]all_symbols_escapable\f[R]+.PP+Except inside a code block or inline code, any punctuation or space+character preceded by a backslash will be treated literally, even if it+would normally indicate formatting.+Thus, for example, if one writes+.IP+.nf+\f[C]+*\[rs]*hello\[rs]**+\f[R]+.fi+.PP+one will get+.IP+.nf+\f[C]+<em>*hello*</em>+\f[R]+.fi+.PP+instead of+.IP+.nf+\f[C]+<strong>hello</strong>+\f[R]+.fi+.PP+This rule is easier to remember than standard Markdown\[aq]s rule, which+allows only the following characters to be backslash-escaped:+.IP+.nf+\f[C]+\[rs]\[ga]*_{}[]()>#+-.!+\f[R]+.fi+.PP+(However, if the \f[C]markdown_strict\f[R] format is used, the standard+Markdown rule will be used.)+.PP+A backslash-escaped space is parsed as a nonbreaking space.+It will appear in TeX output as \f[C]\[ti]\f[R] and in HTML and XML as+\f[C]\[rs] \f[R] or \f[C]\[rs] \f[R].+.PP+A backslash-escaped newline (i.e.+a backslash occurring at the end of a line) is parsed as a hard line+break.+It will appear in TeX output as \f[C]\[rs]\[rs]\f[R] and in HTML as+\f[C]<br />\f[R].+This is a nice alternative to Markdown\[aq]s \[dq]invisible\[dq] way of+indicating hard line breaks using two trailing spaces on a line.+.PP+Backslash escapes do not work in verbatim contexts.+.SS Inline formatting+.SS Emphasis+.PP+To \f[I]emphasize\f[R] some text, surround it with \f[C]*\f[R]s or+\f[C]_\f[R], like this:+.IP+.nf+\f[C]+This text is _emphasized with underscores_, and this+is *emphasized with asterisks*.+\f[R]+.fi+.PP+Double \f[C]*\f[R] or \f[C]_\f[R] produces \f[B]strong emphasis\f[R]:+.IP+.nf+\f[C]+This is **strong emphasis** and __with underscores__.+\f[R]+.fi+.PP+A \f[C]*\f[R] or \f[C]_\f[R] character surrounded by spaces, or+backslash-escaped, will not trigger emphasis:+.IP+.nf+\f[C]+This is * not emphasized *, and \[rs]*neither is this\[rs]*.+\f[R]+.fi+.SS Extension: \f[C]intraword_underscores\f[R]+.PP+Because \f[C]_\f[R] is sometimes used inside words and identifiers,+pandoc does not interpret a \f[C]_\f[R] surrounded by alphanumeric+characters as an emphasis marker.+If you want to emphasize just part of a word, use \f[C]*\f[R]:+.IP+.nf+\f[C]+feas*ible*, not feas*able*.+\f[R]+.fi+.SS Strikeout+.SS Extension: \f[C]strikeout\f[R]+.PP+To strikeout a section of text with a horizontal line, begin and end it+with \f[C]\[ti]\[ti]\f[R].+Thus, for example,+.IP+.nf+\f[C]+This \[ti]\[ti]is deleted text.\[ti]\[ti]+\f[R]+.fi+.SS Superscripts and subscripts+.SS Extension: \f[C]superscript\f[R], \f[C]subscript\f[R]+.PP+Superscripts may be written by surrounding the superscripted text by+\f[C]\[ha]\f[R] characters; subscripts may be written by surrounding the+subscripted text by \f[C]\[ti]\f[R] characters.+Thus, for example,+.IP+.nf+\f[C]+H\[ti]2\[ti]O is a liquid. 2\[ha]10\[ha] is 1024.+\f[R]+.fi+.PP+If the superscripted or subscripted text contains spaces, these spaces+must be escaped with backslashes.+(This is to prevent accidental superscripting and subscripting through+the ordinary use of \f[C]\[ti]\f[R] and \f[C]\[ha]\f[R].) Thus, if you+want the letter P with \[aq]a cat\[aq] in subscripts, use+\f[C]P\[ti]a\[rs] cat\[ti]\f[R], not \f[C]P\[ti]a cat\[ti]\f[R].+.SS Verbatim+.PP+To make a short span of text verbatim, put it inside backticks:+.IP+.nf+\f[C]+What is the difference between \[ga]>>=\[ga] and \[ga]>>\[ga]?+\f[R]+.fi+.PP+If the verbatim text includes a backtick, use double backticks:+.IP+.nf+\f[C]+Here is a literal backtick \[ga]\[ga] \[ga] \[ga]\[ga].+\f[R]+.fi+.PP+(The spaces after the opening backticks and before the closing backticks+will be ignored.)+.PP+The general rule is that a verbatim span starts with a string of+consecutive backticks (optionally followed by a space) and ends with a+string of the same number of backticks (optionally preceded by a space).+.PP+Note that backslash-escapes (and other Markdown constructs) do not work+in verbatim contexts:+.IP+.nf+\f[C]+This is a backslash followed by an asterisk: \[ga]\[rs]*\[ga].+\f[R]+.fi+.SS Extension: \f[C]inline_code_attributes\f[R]+.PP+Attributes can be attached to verbatim text, just as with fenced code+blocks:+.IP+.nf+\f[C]+\[ga]<$>\[ga]{.haskell}+\f[R]+.fi+.SS Small caps+.PP+To write small caps, use the \f[C]smallcaps\f[R] class:+.IP+.nf+\f[C]+[Small caps]{.smallcaps}+\f[R]+.fi+.PP+Or, without the \f[C]bracketed_spans\f[R] extension:+.IP+.nf+\f[C]+<span class=\[dq]smallcaps\[dq]>Small caps</span>+\f[R]+.fi+.PP+For compatibility with other Markdown flavors, CSS is also supported:+.IP+.nf+\f[C]+<span style=\[dq]font-variant:small-caps;\[dq]>Small caps</span>+\f[R]+.fi+.PP+This will work in all output formats that support small caps.+.SS Math+.SS Extension: \f[C]tex_math_dollars\f[R]+.PP+Anything between two \f[C]$\f[R] characters will be treated as TeX math.+The opening \f[C]$\f[R] must have a non-space character immediately to+its right, while the closing \f[C]$\f[R] must have a non-space character+immediately to its left, and must not be followed immediately by a+digit.+Thus, \f[C]$20,000 and $30,000\f[R] won\[aq]t parse as math.+If for some reason you need to enclose text in literal \f[C]$\f[R]+characters, backslash-escape them and they won\[aq]t be treated as math+delimiters.+.PP+TeX math will be printed in all output formats.+How it is rendered depends on the output format:+.TP+.B LaTeX+It will appear verbatim surrounded by \f[C]\[rs](...\[rs])\f[R] (for+inline math) or \f[C]\[rs][...\[rs]]\f[R] (for display math).+.TP+.B Markdown, Emacs Org mode, ConTeXt, ZimWiki+It will appear verbatim surrounded by \f[C]$...$\f[R] (for inline math)+or \f[C]$$...$$\f[R] (for display math).+.TP+.B reStructuredText+It will be rendered using an interpreted text role \f[C]:math:\f[R].+.TP+.B AsciiDoc+It will be rendered as \f[C]latexmath:[...]\f[R].+.TP+.B Texinfo+It will be rendered inside a \f[C]\[at]math\f[R] command.+.TP+.B roff man+It will be rendered verbatim without \f[C]$\f[R]\[aq]s.+.TP+.B MediaWiki, DokuWiki+It will be rendered inside \f[C]<math>\f[R] tags.+.TP+.B Textile+It will be rendered inside \f[C]<span class=\[dq]math\[dq]>\f[R] tags.+.TP+.B RTF, OpenDocument+It will be rendered, if possible, using Unicode characters, and will+otherwise appear verbatim.+.TP+.B ODT+It will be rendered, if possible, using MathML.+.TP+.B DocBook+If the \f[C]--mathml\f[R] flag is used, it will be rendered using MathML+in an \f[C]inlineequation\f[R] or \f[C]informalequation\f[R] tag.+Otherwise it will be rendered, if possible, using Unicode characters.+.TP+.B Docx+It will be rendered using OMML math markup.+.TP+.B FictionBook2+If the \f[C]--webtex\f[R] option is used, formulas are rendered as+images using CodeCogs or other compatible web service, downloaded and+embedded in the e-book.+Otherwise, they will appear verbatim.+.TP+.B HTML, Slidy, DZSlides, S5, EPUB+The way math is rendered in HTML will depend on the command-line options+selected.+Therefore see Math rendering in HTML above.+.SS Raw HTML+.SS Extension: \f[C]raw_html\f[R]+.PP+Markdown allows you to insert raw HTML (or DocBook) anywhere in a+document (except verbatim contexts, where \f[C]<\f[R], \f[C]>\f[R], and+\f[C]&\f[R] are interpreted literally).+(Technically this is not an extension, since standard Markdown allows+it, but it has been made an extension so that it can be disabled if+desired.)+.PP+The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous,+DZSlides, EPUB, Markdown, CommonMark, Emacs Org mode, and Textile+output, and suppressed in other formats.+.PP+For a more explicit way of including raw HTML in a Markdown document,+see the \f[C]raw_attribute\f[R] extension.+.PP+In the CommonMark format, if \f[C]raw_html\f[R] is enabled,+superscripts, subscripts, strikeouts and small capitals will be+represented as HTML.+Otherwise, plain-text fallbacks will be used.+Note that even if \f[C]raw_html\f[R] is disabled, tables will be+rendered with HTML syntax if they cannot use pipe syntax.+.SS Extension: \f[C]markdown_in_html_blocks\f[R]+.PP+Standard Markdown allows you to include HTML \[dq]blocks\[dq]: blocks of+HTML between balanced tags that are separated from the surrounding text+with blank lines, and start and end at the left margin.+Within these blocks, everything is interpreted as HTML, not Markdown; so+(for example), \f[C]*\f[R] does not signify emphasis.+.PP+Pandoc behaves this way when the \f[C]markdown_strict\f[R] format is+used; but by default, pandoc interprets material between HTML block tags+as Markdown.+Thus, for example, pandoc will turn+.IP+.nf+\f[C]+<table>+<tr>+<td>*one*</td>+<td>[a link](http://google.com)</td>+</tr>+</table>+\f[R]+.fi+.PP+into+.IP+.nf+\f[C]+<table>+<tr>+<td><em>one</em></td>+<td><a href=\[dq]http://google.com\[dq]>a link</a></td>+</tr>+</table>+\f[R]+.fi+.PP+whereas \f[C]Markdown.pl\f[R] will preserve it as is.+.PP+There is one exception to this rule: text between \f[C]<script>\f[R] and+\f[C]<style>\f[R] tags is not interpreted as Markdown.+.PP+This departure from standard Markdown should make it easier to mix+Markdown with HTML block elements.+For example, one can surround a block of Markdown text with+\f[C]<div>\f[R] tags without preventing it from being interpreted as+Markdown.+.SS Extension: \f[C]native_divs\f[R]+.PP+Use native pandoc \f[C]Div\f[R] blocks for content inside+\f[C]<div>\f[R] tags.+For the most part this should give the same output as+\f[C]markdown_in_html_blocks\f[R], but it makes it easier to write+pandoc filters to manipulate groups of blocks.+.SS Extension: \f[C]native_spans\f[R]+.PP+Use native pandoc \f[C]Span\f[R] blocks for content inside+\f[C]<span>\f[R] tags.+For the most part this should give the same output as+\f[C]raw_html\f[R], but it makes it easier to write pandoc filters to+manipulate groups of inlines.+.SS Extension: \f[C]raw_tex\f[R]+.PP+In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be+included in a document.+Inline TeX commands will be preserved and passed unchanged to the LaTeX+and ConTeXt writers.+Thus, for example, you can use LaTeX to include BibTeX citations:+.IP+.nf+\f[C]+This result was proved in \[rs]cite{jones.1967}.+\f[R]+.fi+.PP+Note that in LaTeX environments, like+.IP+.nf+\f[C]+\[rs]begin{tabular}{|l|l|}\[rs]hline+Age & Frequency \[rs]\[rs] \[rs]hline+18--25 & 15 \[rs]\[rs]+26--35 & 33 \[rs]\[rs]+36--45 & 22 \[rs]\[rs] \[rs]hline+\[rs]end{tabular}+\f[R]+.fi+.PP+the material between the begin and end tags will be interpreted as raw+LaTeX, not as Markdown.+.PP+For a more explicit and flexible way of including raw TeX in a Markdown+document, see the \f[C]raw_attribute\f[R] extension.+.PP+Inline LaTeX is ignored in output formats other than Markdown, LaTeX,+Emacs Org mode, and ConTeXt.+.SS Generic raw attribute+.SS Extension: \f[C]raw_attribute\f[R]+.PP+Inline spans and fenced code blocks with a special kind of attribute+will be parsed as raw content with the designated format.+For example, the following produces a raw roff \f[C]ms\f[R] block:+.IP+.nf+\f[C]+\[ga]\[ga]\[ga]{=ms}+\&.MYMACRO+blah blah+\[ga]\[ga]\[ga]+\f[R]+.fi+.PP+And the following produces a raw \f[C]html\f[R] inline element:+.IP+.nf+\f[C]+This is \[ga]<a>html</a>\[ga]{=html}+\f[R]+.fi+.PP+This can be useful to insert raw xml into \f[C]docx\f[R] documents, e.g.+a pagebreak:+.IP+.nf+\f[C]+\[ga]\[ga]\[ga]{=openxml}+<w:p>+ <w:r>+ <w:br w:type=\[dq]page\[dq]/>+ </w:r>+</w:p>+\[ga]\[ga]\[ga]+\f[R]+.fi+.PP+The format name should match the target format name (see+\f[C]-t/--to\f[R], above, for a list, or use+\f[C]pandoc --list-output-formats\f[R]).+Use \f[C]openxml\f[R] for \f[C]docx\f[R] output, \f[C]opendocument\f[R]+for \f[C]odt\f[R] output, \f[C]html5\f[R] for \f[C]epub3\f[R] output,+\f[C]html4\f[R] for \f[C]epub2\f[R] output, and \f[C]latex\f[R],+\f[C]beamer\f[R], \f[C]ms\f[R], or \f[C]html5\f[R] for \f[C]pdf\f[R]+output (depending on what you use for \f[C]--pdf-engine\f[R]).+.PP+This extension presupposes that the relevant kind of inline code or+fenced code block is enabled.+Thus, for example, to use a raw attribute with a backtick code block,+\f[C]backtick_code_blocks\f[R] must be enabled.+.PP+The raw attribute cannot be combined with regular attributes.+.SS LaTeX macros+.SS Extension: \f[C]latex_macros\f[R]+.PP+When this extension is enabled, pandoc will parse LaTeX macro+definitions and apply the resulting macros to all LaTeX math and raw+LaTeX.+So, for example, the following will work in all output formats, not just+LaTeX:+.IP+.nf+\f[C]+\[rs]newcommand{\[rs]tuple}[1]{\[rs]langle #1 \[rs]rangle}++$\[rs]tuple{a, b, c}$+\f[R]+.fi+.PP+Note that LaTeX macros will not be applied if they occur inside inside a+raw span or block marked with the \f[C]raw_attribute\f[R] extension.+.PP+When \f[C]latex_macros\f[R] is disabled, the raw LaTeX and math will not+have macros applied.+This is usually a better approach when you are targeting LaTeX or PDF.+.PP+Whether or not \f[C]latex_macros\f[R] is enabled, the macro definitions+will still be passed through as raw LaTeX.+.SS Links+.PP+Markdown allows links to be specified in several ways.+.SS Automatic links+.PP+If you enclose a URL or email address in pointy brackets, it will become+a link:+.IP+.nf+\f[C]+<http://google.com>+<sam\[at]green.eggs.ham>+\f[R]+.fi+.SS Inline links+.PP+An inline link consists of the link text in square brackets, followed by+the URL in parentheses.+(Optionally, the URL can be followed by a link title, in quotes.)+.IP+.nf+\f[C]+This is an [inline link](/url), and here\[aq]s [one with+a title](http://fsf.org \[dq]click here for a good time!\[dq]).+\f[R]+.fi+.PP+There can be no space between the bracketed part and the parenthesized+part.+The link text can contain formatting (such as emphasis), but the title+cannot.+.PP+Email addresses in inline links are not autodetected, so they have to be+prefixed with \f[C]mailto\f[R]:+.IP+.nf+\f[C]+[Write me!](mailto:sam\[at]green.eggs.ham)+\f[R]+.fi+.SS Reference links+.PP+An \f[I]explicit\f[R] reference link has two parts, the link itself and+the link definition, which may occur elsewhere in the document (either+before or after the link).+.PP+The link consists of link text in square brackets, followed by a label+in square brackets.+(There cannot be space between the two unless the+\f[C]spaced_reference_links\f[R] extension is enabled.) The link+definition consists of the bracketed label, followed by a colon and a+space, followed by the URL, and optionally (after a space) a link title+either in quotes or in parentheses.+The label must not be parseable as a citation (assuming the+\f[C]citations\f[R] extension is enabled): citations take precedence+over link labels.+.PP+Here are some examples:+.IP+.nf+\f[C]+[my label 1]: /foo/bar.html \[dq]My title, optional\[dq]+[my label 2]: /foo+[my label 3]: http://fsf.org (The free software foundation)+[my label 4]: /bar#special \[aq]A title in single quotes\[aq]+\f[R]+.fi+.PP+The URL may optionally be surrounded by angle brackets:+.IP+.nf+\f[C]+[my label 5]: <http://foo.bar.baz>+\f[R]+.fi+.PP+The title may go on the next line:+.IP+.nf+\f[C]+[my label 3]: http://fsf.org+ \[dq]The free software foundation\[dq]+\f[R]+.fi+.PP+Note that link labels are not case sensitive.+So, this will work:+.IP+.nf+\f[C]+Here is [my link][FOO]++[Foo]: /bar/baz+\f[R]+.fi+.PP+In an \f[I]implicit\f[R] reference link, the second pair of brackets is+empty:+.IP+.nf+\f[C]+See [my website][].++[my website]: http://foo.bar.baz+\f[R]+.fi+.PP+Note: In \f[C]Markdown.pl\f[R] and most other Markdown implementations,+reference link definitions cannot occur in nested constructions such as+list items or block quotes.+Pandoc lifts this arbitrary seeming restriction.+So the following is fine in pandoc, though not in most other+implementations:+.IP+.nf+\f[C]+> My block [quote].+>+> [quote]: /foo+\f[R]+.fi+.SS Extension: \f[C]shortcut_reference_links\f[R]+.PP+In a \f[I]shortcut\f[R] reference link, the second pair of brackets may+be omitted entirely:+.IP+.nf+\f[C]+See [my website].++[my website]: http://foo.bar.baz+\f[R]+.fi+.SS Internal links+.PP+To link to another section of the same document, use the automatically+generated identifier (see Header identifiers).+For example:+.IP+.nf+\f[C]+See the [Introduction](#introduction).+\f[R]+.fi+.PP+or+.IP+.nf+\f[C]+See the [Introduction].++[Introduction]: #introduction+\f[R]+.fi+.PP+Internal links are currently supported for HTML formats (including HTML+slide shows and EPUB), LaTeX, and ConTeXt.+.SS Images+.PP+A link immediately preceded by a \f[C]!\f[R] will be treated as an+image.+The link text will be used as the image\[aq]s alt text:+.IP+.nf+\f[C]+++![movie reel]++[movie reel]: movie.gif+\f[R]+.fi+.SS Extension: \f[C]implicit_figures\f[R]+.PP+An image with nonempty alt text, occurring by itself in a paragraph,+will be rendered as a figure with a caption.+The image\[aq]s alt text will be used as the caption.+.IP+.nf+\f[C]++\f[R]+.fi+.PP+How this is rendered depends on the output format.+Some output formats (e.g.+RTF) do not yet support figures.+In those formats, you\[aq]ll just get an image in a paragraph by itself,+with no caption.+.PP+If you just want a regular inline image, just make sure it is not the+only thing in the paragraph.+One way to do this is to insert a nonbreaking space after the image:+.IP+.nf+\f[C]+![This image won\[aq]t be a figure](/url/of/image.png)\[rs]+\f[R]+.fi+.PP+Note that in reveal.js slide shows, an image in a paragraph by itself+that has the \f[C]stretch\f[R] class will fill the screen, and the+caption and figure tags will be omitted.+.SS Extension: \f[C]link_attributes\f[R]+.PP+Attributes can be set on links and images:+.IP+.nf+\f[C]+An inline {#id .class width=30 height=20px}+and a reference ![image][ref] with attributes.++[ref]: foo.jpg \[dq]optional title\[dq] {#id .class key=val key2=\[dq]val 2\[dq]}+\f[R]+.fi+.PP+(This syntax is compatible with PHP Markdown Extra when only+\f[C]#id\f[R] and \f[C].class\f[R] are used.)+.PP+For HTML and EPUB, all attributes except \f[C]width\f[R] and+\f[C]height\f[R] (but including \f[C]srcset\f[R] and \f[C]sizes\f[R])+are passed through as is.+The other writers ignore attributes that are not supported by their+output format.+.PP+The \f[C]width\f[R] and \f[C]height\f[R] attributes on images are+treated specially.+When used without a unit, the unit is assumed to be pixels.+However, any of the following unit identifiers can be used:+\f[C]px\f[R], \f[C]cm\f[R], \f[C]mm\f[R], \f[C]in\f[R], \f[C]inch\f[R]+and \f[C]%\f[R].+There must not be any spaces between the number and the unit.+For example:+.IP+.nf+\f[C]+{ width=50% }+\f[R]+.fi+.IP \[bu] 2+Dimensions are converted to inches for output in page-based formats like+LaTeX.+Dimensions are converted to pixels for output in HTML-like formats.+Use the \f[C]--dpi\f[R] option to specify the number of pixels per inch.+The default is 96dpi.+.IP \[bu] 2+The \f[C]%\f[R] unit is generally relative to some available space.+For example the above example will render to the following.+.RS 2+.IP \[bu] 2+HTML:+\f[C]<img href=\[dq]file.jpg\[dq] style=\[dq]width: 50%;\[dq] />\f[R]+.IP \[bu] 2+LaTeX:+\f[C]\[rs]includegraphics[width=0.5\[rs]textwidth,height=\[rs]textheight]{file.jpg}\f[R]+(If you\[aq]re using a custom template, you need to configure+\f[C]graphicx\f[R] as in the default template.)+.IP \[bu] 2+ConTeXt:+\f[C]\[rs]externalfigure[file.jpg][width=0.5\[rs]textwidth]\f[R]+.RE+.IP \[bu] 2+Some output formats have a notion of a class (ConTeXt) or a unique+identifier (LaTeX \f[C]\[rs]caption\f[R]), or both (HTML).+.IP \[bu] 2+When no \f[C]width\f[R] or \f[C]height\f[R] attributes are specified,+the fallback is to look at the image resolution and the dpi metadata+embedded in the image file.+.SS Divs and Spans+.PP+Using the \f[C]native_divs\f[R] and \f[C]native_spans\f[R] extensions+(see above), HTML syntax can be used as part of markdown to create+native \f[C]Div\f[R] and \f[C]Span\f[R] elements in the pandoc AST (as+opposed to raw HTML).+However, there is also nicer syntax available:+.SS Extension: \f[C]fenced_divs\f[R]+.PP+Allow special fenced syntax for native \f[C]Div\f[R] blocks.+A Div starts with a fence containing at least three consecutive colons+plus some attributes.+The attributes may optionally be followed by another string of+consecutive colons.+The attribute syntax is exactly as in fenced code blocks (see Extension:+\f[C]fenced_code_attributes\f[R]).+As with fenced code blocks, one can use either attributes in curly+braces or a single unbraced word, which will be treated as a class name.+The Div ends with another line containing a string of at least three+consecutive colons.+The fenced Div should be separated by blank lines from preceding and+following blocks.+.PP+Example:+.IP+.nf+\f[C]+::::: {#special .sidebar}+Here is a paragraph.++And another.+:::::+\f[R]+.fi+.PP+Fenced divs can be nested.+Opening fences are distinguished because they \f[I]must\f[R] have+attributes:+.IP+.nf+\f[C]+::: Warning ::::::+This is a warning.++::: Danger+This is a warning within a warning.+:::+::::::::::::::::::+\f[R]+.fi+.PP+Fences without attributes are always closing fences.+Unlike with fenced code blocks, the number of colons in the closing+fence need not match the number in the opening fence.+However, it can be helpful for visual clarity to use fences of different+lengths to distinguish nested divs from their parents.+.SS Extension: \f[C]bracketed_spans\f[R]+.PP+A bracketed sequence of inlines, as one would use to begin a link, will+be treated as a \f[C]Span\f[R] with attributes if it is followed+immediately by attributes:+.IP+.nf+\f[C]+[This is *some text*]{.class key=\[dq]val\[dq]}+\f[R]+.fi+.SS Footnotes+.SS Extension: \f[C]footnotes\f[R]+.PP+Pandoc\[aq]s Markdown allows footnotes, using the following syntax:+.IP+.nf+\f[C]+Here is a footnote reference,[\[ha]1] and another.[\[ha]longnote]++[\[ha]1]: Here is the footnote.++[\[ha]longnote]: Here\[aq]s one with multiple blocks.++ Subsequent paragraphs are indented to show that they+belong to the previous footnote.++ { some.code }++ The whole paragraph can be indented, or just the first+ line. In this way, multi-paragraph footnotes work like+ multi-paragraph list items.++This paragraph won\[aq]t be part of the note, because it+isn\[aq]t indented.+\f[R]+.fi+.PP+The identifiers in footnote references may not contain spaces, tabs, or+newlines.+These identifiers are used only to correlate the footnote reference with+the note itself; in the output, footnotes will be numbered sequentially.+.PP+The footnotes themselves need not be placed at the end of the document.+They may appear anywhere except inside other block elements (lists,+block quotes, tables, etc.).+Each footnote should be separated from surrounding content (including+other footnotes) by blank lines.+.SS Extension: \f[C]inline_notes\f[R]+.PP+Inline footnotes are also allowed (though, unlike regular notes, they+cannot contain multiple paragraphs).+The syntax is as follows:+.IP+.nf+\f[C]+Here is an inline note.\[ha][Inlines notes are easier to write, since+you don\[aq]t have to pick an identifier and move down to type the+note.]+\f[R]+.fi+.PP+Inline and regular footnotes may be mixed freely.+.SS Citations+.SS Extension: \f[C]citations\f[R]+.PP+Using an external filter, \f[C]pandoc-citeproc\f[R], pandoc can+automatically generate citations and a bibliography in a number of+styles.+Basic usage is+.IP+.nf+\f[C]+pandoc --filter pandoc-citeproc myinput.txt+\f[R]+.fi+.PP+In order to use this feature, you will need to specify a bibliography+file using the \f[C]bibliography\f[R] metadata field in a YAML metadata+section, or \f[C]--bibliography\f[R] command line argument.+You can supply multiple \f[C]--bibliography\f[R] arguments or set+\f[C]bibliography\f[R] metadata field to YAML array, if you want to use+multiple bibliography files.+The bibliography may have any of these formats:+.PP+.TS+tab(@);+l l.+T{+Format+T}@T{+File extension+T}+_+T{+BibLaTeX+T}@T{+\&.bib+T}+T{+BibTeX+T}@T{+\&.bibtex+T}+T{+Copac+T}@T{+\&.copac+T}+T{+CSL JSON+T}@T{+\&.json+T}+T{+CSL YAML+T}@T{+\&.yaml+T}+T{+EndNote+T}@T{+\&.enl+T}+T{+EndNote XML+T}@T{+\&.xml+T}+T{+ISI+T}@T{+\&.wos+T}+T{+MEDLINE+T}@T{+\&.medline+T}+T{+MODS+T}@T{+\&.mods+T}+T{+RIS+T}@T{+\&.ris+T}+.TE+.PP+Note that \f[C].bib\f[R] can be used with both BibTeX and BibLaTeX+files; use \f[C].bibtex\f[R] to force BibTeX.+.PP+Note that \f[C]pandoc-citeproc --bib2json\f[R] and+\f[C]pandoc-citeproc --bib2yaml\f[R] can produce \f[C].json\f[R] and+\f[C].yaml\f[R] files from any of the supported formats.+.PP+In-field markup: In BibTeX and BibLaTeX databases, pandoc-citeproc+parses a subset of LaTeX markup; in CSL YAML databases, pandoc Markdown;+and in CSL JSON databases, an HTML-like markup:+.TP+.B \f[C]<i>...</i>\f[R]+italics+.TP+.B \f[C]<b>...</b>\f[R]+bold+.TP+.B \f[C]<span style=\[dq]font-variant:small-caps;\[dq]>...</span>\f[R] or \f[C]<sc>...</sc>\f[R]+small capitals+.TP+.B \f[C]<sub>...</sub>\f[R]+subscript+.TP+.B \f[C]<sup>...</sup>\f[R]+superscript+.TP+.B \f[C]<span class=\[dq]nocase\[dq]>...</span>\f[R]+prevent a phrase from being capitalized as title case+.PP+\f[C]pandoc-citeproc -j\f[R] and \f[C]-y\f[R] interconvert the CSL JSON+and CSL YAML formats as far as possible.+.PP+As an alternative to specifying a bibliography file using+\f[C]--bibliography\f[R] or the YAML metadata field+\f[C]bibliography\f[R], you can include the citation data directly in+the \f[C]references\f[R] field of the document\[aq]s YAML metadata.+The field should contain an array of YAML-encoded references, for+example:+.IP+.nf+\f[C]+---+references:+- type: article-journal+ id: WatsonCrick1953+ author:+ - family: Watson+ given: J. D.+ - family: Crick+ given: F. H. C.+ issued:+ date-parts:+ - - 1953+ - 4+ - 25+ title: \[aq]Molecular structure of nucleic acids: a structure for deoxyribose+ nucleic acid\[aq]+ title-short: Molecular structure of nucleic acids+ container-title: Nature+ volume: 171+ issue: 4356+ page: 737-738+ DOI: 10.1038/171737a0+ URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html+ language: en-GB+\&...+\f[R]+.fi+.PP+(\f[C]pandoc-citeproc --bib2yaml\f[R] can produce these from a+bibliography file in one of the supported formats.)+.PP+Citations and references can be formatted using any style supported by+the Citation Style Language, listed in the Zotero Style Repository.+These files are specified using the \f[C]--csl\f[R] option or the+\f[C]csl\f[R] metadata field.+By default, \f[C]pandoc-citeproc\f[R] will use the Chicago Manual of+Style author-date format.+The CSL project provides further information on finding and editing+styles.+.PP+To make your citations hyperlinks to the corresponding bibliography+entries, add \f[C]link-citations: true\f[R] to your YAML metadata.+.PP+Citations go inside square brackets and are separated by semicolons.+Each citation must have a key, composed of \[aq]\[at]\[aq] + the+citation identifier from the database, and may optionally have a prefix,+a locator, and a suffix.+The citation key must begin with a letter, digit, or \f[C]_\f[R], and+may contain alphanumerics, \f[C]_\f[R], and internal punctuation+characters (\f[C]:.#$%&-+?<>\[ti]/\f[R]).+Here are some examples:+.IP+.nf+\f[C]+Blah blah [see \[at]doe99, pp. 33-35; also \[at]smith04, chap. 1].++Blah blah [\[at]doe99, pp. 33-35, 38-39 and *passim*].++Blah blah [\[at]smith04; \[at]doe99].+\f[R]+.fi+.PP+\f[C]pandoc-citeproc\f[R] detects locator terms in the CSL locale files.+Either abbreviated or unabbreviated forms are accepted.+In the \f[C]en-US\f[R] locale, locator terms can be written in either+singular or plural forms, as \f[C]book\f[R],+\f[C]bk.\f[R]/\f[C]bks.\f[R]; \f[C]chapter\f[R],+\f[C]chap.\f[R]/\f[C]chaps.\f[R]; \f[C]column\f[R],+\f[C]col.\f[R]/\f[C]cols.\f[R]; \f[C]figure\f[R],+\f[C]fig.\f[R]/\f[C]figs.\f[R]; \f[C]folio\f[R],+\f[C]fol.\f[R]/\f[C]fols.\f[R]; \f[C]number\f[R],+\f[C]no.\f[R]/\f[C]nos.\f[R]; \f[C]line\f[R],+\f[C]l.\f[R]/\f[C]ll.\f[R]; \f[C]note\f[R], \f[C]n.\f[R]/\f[C]nn.\f[R];+\f[C]opus\f[R], \f[C]op.\f[R]/\f[C]opp.\f[R]; \f[C]page\f[R],+\f[C]p.\f[R]/\f[C]pp.\f[R]; \f[C]paragraph\f[R],+\f[C]para.\f[R]/\f[C]paras.\f[R]; \f[C]part\f[R],+\f[C]pt.\f[R]/\f[C]pts.\f[R]; \f[C]section\f[R],+\f[C]sec.\f[R]/\f[C]secs.\f[R]; \f[C]sub verbo\f[R],+\f[C]s.v.\f[R]/\f[C]s.vv.\f[R]; \f[C]verse\f[R],+\f[C]v.\f[R]/\f[C]vv.\f[R]; \f[C]volume\f[R],+\f[C]vol.\f[R]/\f[C]vols.\f[R]; \f[C]\[ps]\f[R]/\f[C]\[ps]\[ps]\f[R];+\f[C]\[sc]\f[R]/\f[C]\[sc]\[sc]\f[R].+If no locator term is used, \[dq]page\[dq] is assumed.+.PP+\f[C]pandoc-citeproc\f[R] will use heuristics to distinguish the locator+from the suffix.+In complex cases, the locator can be enclosed in curly braces (using+\f[C]pandoc-citeproc\f[R] 0.15 and higher only):+.IP+.nf+\f[C]+[\[at]smith{ii, A, D-Z}, with a suffix]+[\[at]smith, {pp. iv, vi-xi, (xv)-(xvii)} with suffix here]+\f[R]+.fi+.PP+A minus sign (\f[C]-\f[R]) before the \f[C]\[at]\f[R] will suppress+mention of the author in the citation.+This can be useful when the author is already mentioned in the text:+.IP+.nf+\f[C]+Smith says blah [-\[at]smith04].+\f[R]+.fi+.PP+You can also write an in-text citation, as follows:+.IP+.nf+\f[C]+\[at]smith04 says blah.++\[at]smith04 [p. 33] says blah.+\f[R]+.fi+.PP+If the style calls for a list of works cited, it will be placed in a div+with id \f[C]refs\f[R], if one exists:+.IP+.nf+\f[C]+::: {#refs}+:::+\f[R]+.fi+.PP+Otherwise, it will be placed at the end of the document.+Generation of the bibliography can be suppressed by setting+\f[C]suppress-bibliography: true\f[R] in the YAML metadata.+.PP+If you wish the bibliography to have a section header, you can set+\f[C]reference-section-title\f[R] in the metadata, or put the header at+the beginning of the div with id \f[C]refs\f[R] (if you are using it) or+at the end of your document:+.IP+.nf+\f[C]+last paragraph...++# References+\f[R]+.fi+.PP+The bibliography will be inserted after this header.+Note that the \f[C]unnumbered\f[R] class will be added to this header,+so that the section will not be numbered.+.PP+If you want to include items in the bibliography without actually citing+them in the body text, you can define a dummy \f[C]nocite\f[R] metadata+field and put the citations there:+.IP+.nf+\f[C]+---+nocite: |+ \[at]item1, \[at]item2+\&...++\[at]item3+\f[R]+.fi+.PP+In this example, the document will contain a citation for+\f[C]item3\f[R] only, but the bibliography will contain entries for+\f[C]item1\f[R], \f[C]item2\f[R], and \f[C]item3\f[R].+.PP+It is possible to create a bibliography with all the citations, whether+or not they appear in the document, by using a wildcard:+.IP+.nf+\f[C]+---+nocite: |+ \[at]*+\&...+\f[R]+.fi+.PP+For LaTeX output, you can also use \f[C]natbib\f[R] or+\f[C]biblatex\f[R] to render the bibliography.+In order to do so, specify bibliography files as outlined above, and add+\f[C]--natbib\f[R] or \f[C]--biblatex\f[R] argument to \f[C]pandoc\f[R]+invocation.+Bear in mind that bibliography files have to be in respective format+(either BibTeX or BibLaTeX).+.PP+For more information, see the pandoc-citeproc man page.+.SS Non-pandoc extensions+.PP+The following Markdown syntax extensions are not enabled by default in+pandoc, but may be enabled by adding \f[C]+EXTENSION\f[R] to the format+name, where \f[C]EXTENSION\f[R] is the name of the extension.+Thus, for example, \f[C]markdown+hard_line_breaks\f[R] is Markdown with+hard line breaks.+.SS Extension: \f[C]old_dashes\f[R]+.PP+Selects the pandoc <= 1.8.2.1 behavior for parsing smart dashes:+\f[C]-\f[R] before a numeral is an en-dash, and \f[C]--\f[R] is an+em-dash.+This option only has an effect if \f[C]smart\f[R] is enabled.+It is selected automatically for \f[C]textile\f[R] input.+.SS Extension: \f[C]angle_brackets_escapable\f[R]+.PP+Allow \f[C]<\f[R] and \f[C]>\f[R] to be backslash-escaped, as they can+be in GitHub flavored Markdown but not original Markdown.+This is implied by pandoc\[aq]s default \f[C]all_symbols_escapable\f[R].+.SS Extension: \f[C]lists_without_preceding_blankline\f[R]+.PP+Allow a list to occur right after a paragraph, with no intervening blank+space.+.SS Extension: \f[C]four_space_rule\f[R]+.PP+Selects the pandoc <= 2.0 behavior for parsing lists, so that four+spaces indent are needed for list item continuation paragraphs.+.SS Extension: \f[C]spaced_reference_links\f[R]+.PP+Allow whitespace between the two components of a reference link, for+example,+.IP+.nf+\f[C]+[foo] [bar].+\f[R]+.fi+.SS Extension: \f[C]hard_line_breaks\f[R]+.PP+Causes all newlines within a paragraph to be interpreted as hard line+breaks instead of spaces.+.SS Extension: \f[C]ignore_line_breaks\f[R]+.PP+Causes newlines within a paragraph to be ignored, rather than being+treated as spaces or as hard line breaks.+This option is intended for use with East Asian languages where spaces+are not used between words, but text is divided into lines for+readability.+.SS Extension: \f[C]east_asian_line_breaks\f[R]+.PP+Causes newlines within a paragraph to be ignored, rather than being+treated as spaces or as hard line breaks, when they occur between two+East Asian wide characters.+This is a better choice than \f[C]ignore_line_breaks\f[R] for texts that+include a mix of East Asian wide characters and other characters.+.SS Extension: \f[C]emoji\f[R]+.PP+Parses textual emojis like \f[C]:smile:\f[R] as Unicode emoticons.+.SS Extension: \f[C]tex_math_single_backslash\f[R]+.PP+Causes anything between \f[C]\[rs](\f[R] and \f[C]\[rs])\f[R] to be+interpreted as inline TeX math, and anything between \f[C]\[rs][\f[R]+and \f[C]\[rs]]\f[R] to be interpreted as display TeX math.+Note: a drawback of this extension is that it precludes escaping+\f[C](\f[R] and \f[C][\f[R].+.SS Extension: \f[C]tex_math_double_backslash\f[R]+.PP+Causes anything between \f[C]\[rs]\[rs](\f[R] and \f[C]\[rs]\[rs])\f[R]+to be interpreted as inline TeX math, and anything between+\f[C]\[rs]\[rs][\f[R] and \f[C]\[rs]\[rs]]\f[R] to be interpreted as+display TeX math.+.SS Extension: \f[C]markdown_attribute\f[R]+.PP+By default, pandoc interprets material inside block-level tags as+Markdown.+This extension changes the behavior so that Markdown is only parsed+inside block-level tags if the tags have the attribute+\f[C]markdown=1\f[R].+.SS Extension: \f[C]mmd_title_block\f[R]+.PP+Enables a MultiMarkdown style title block at the top of the document,+for example:+.IP+.nf+\f[C]+Title: My title+Author: John Doe+Date: September 1, 2008+Comment: This is a sample mmd title block, with+ a field spanning multiple lines.+\f[R]+.fi+.PP+See the MultiMarkdown documentation for details.+If \f[C]pandoc_title_block\f[R] or \f[C]yaml_metadata_block\f[R] is+enabled, it will take precedence over \f[C]mmd_title_block\f[R].+.SS Extension: \f[C]abbreviations\f[R]+.PP+Parses PHP Markdown Extra abbreviation keys, like+.IP+.nf+\f[C]+*[HTML]: Hypertext Markup Language+\f[R]+.fi+.PP+Note that the pandoc document model does not support abbreviations, so+if this extension is enabled, abbreviation keys are simply skipped (as+opposed to being parsed as paragraphs).+.SS Extension: \f[C]autolink_bare_uris\f[R]+.PP+Makes all absolute URIs into links, even when not surrounded by pointy+braces \f[C]<...>\f[R].+.SS Extension: \f[C]mmd_link_attributes\f[R]+.PP+Parses multimarkdown style key-value attributes on link and image+references.+This extension should not be confused with the \f[C]link_attributes\f[R]+extension.+.IP+.nf+\f[C]+This is a reference ![image][ref] with multimarkdown attributes.++[ref]: http://path.to/image \[dq]Image title\[dq] width=20px height=30px+ id=myId class=\[dq]myClass1 myClass2\[dq]+\f[R]+.fi+.SS Extension: \f[C]mmd_header_identifiers\f[R]+.PP+Parses multimarkdown style header identifiers (in square brackets, after+the header but before any trailing \f[C]#\f[R]s in an ATX header).+.SS Extension: \f[C]compact_definition_lists\f[R]+.PP+Activates the definition list syntax of pandoc 1.12.x and earlier.+This syntax differs from the one described above under Definition lists+in several respects:+.IP \[bu] 2+No blank line is required between consecutive items of the definition+list.+.IP \[bu] 2+To get a \[dq]tight\[dq] or \[dq]compact\[dq] list, omit space between+consecutive items; the space between a term and its definition does not+affect anything.+.IP \[bu] 2+Lazy wrapping of paragraphs is not allowed: the entire definition must+be indented four spaces.+.SS Markdown variants+.PP+In addition to pandoc\[aq]s extended Markdown, the following Markdown+variants are supported:+.TP+.B \f[C]markdown_phpextra\f[R] (PHP Markdown Extra)+\f[C]footnotes\f[R], \f[C]pipe_tables\f[R], \f[C]raw_html\f[R],+\f[C]markdown_attribute\f[R], \f[C]fenced_code_blocks\f[R],+\f[C]definition_lists\f[R], \f[C]intraword_underscores\f[R],+\f[C]header_attributes\f[R], \f[C]link_attributes\f[R],+\f[C]abbreviations\f[R], \f[C]shortcut_reference_links\f[R],+\f[C]spaced_reference_links\f[R].+.TP+.B \f[C]markdown_github\f[R] (deprecated GitHub-Flavored Markdown)+\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],+\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],+\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],+\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],+\f[C]strikeout\f[R], \f[C]task_lists\f[R], \f[C]emoji\f[R],+\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],+\f[C]lists_without_preceding_blankline\f[R].+.TP+.B \f[C]markdown_mmd\f[R] (MultiMarkdown)+\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]markdown_attribute\f[R],+\f[C]mmd_link_attributes\f[R], \f[C]tex_math_double_backslash\f[R],+\f[C]intraword_underscores\f[R], \f[C]mmd_title_block\f[R],+\f[C]footnotes\f[R], \f[C]definition_lists\f[R],+\f[C]all_symbols_escapable\f[R], \f[C]implicit_header_references\f[R],+\f[C]auto_identifiers\f[R], \f[C]mmd_header_identifiers\f[R],+\f[C]shortcut_reference_links\f[R], \f[C]implicit_figures\f[R],+\f[C]superscript\f[R], \f[C]subscript\f[R],+\f[C]backtick_code_blocks\f[R], \f[C]spaced_reference_links\f[R],+\f[C]raw_attribute\f[R].+.TP+.B \f[C]markdown_strict\f[R] (Markdown.pl)+\f[C]raw_html\f[R], \f[C]shortcut_reference_links\f[R],+\f[C]spaced_reference_links\f[R].+.PP+We also support \f[C]commonmark\f[R] and \f[C]gfm\f[R] (GitHub-Flavored+Markdown, which is implemented as a set of extensions on+\f[C]commonmark\f[R]).+.PP+Note, however, that \f[C]commonmark\f[R] and \f[C]gfm\f[R] have limited+support for extensions.+Only those listed below (and \f[C]smart\f[R], \f[C]raw_tex\f[R], and+\f[C]hard_line_breaks\f[R]) will work.+The extensions can, however, all be individually disabled.+Also, \f[C]raw_tex\f[R] only affects \f[C]gfm\f[R] output, not input.+.TP+.B \f[C]gfm\f[R] (GitHub-Flavored Markdown)+\f[C]pipe_tables\f[R], \f[C]raw_html\f[R], \f[C]fenced_code_blocks\f[R],+\f[C]auto_identifiers\f[R], \f[C]gfm_auto_identifiers\f[R],+\f[C]backtick_code_blocks\f[R], \f[C]autolink_bare_uris\f[R],+\f[C]space_in_atx_header\f[R], \f[C]intraword_underscores\f[R],+\f[C]strikeout\f[R], \f[C]task_lists\f[R], \f[C]emoji\f[R],+\f[C]shortcut_reference_links\f[R], \f[C]angle_brackets_escapable\f[R],+\f[C]lists_without_preceding_blankline\f[R].+.SH PRODUCING SLIDE SHOWS WITH PANDOC+.PP+You can use pandoc to produce an HTML + JavaScript slide presentation+that can be viewed via a web browser.+There are five ways to do this, using S5, DZSlides, Slidy, Slideous, or+reveal.js.+You can also produce a PDF slide show using LaTeX \f[C]beamer\f[R], or+slides shows in Microsoft PowerPoint format.+.PP+Here\[aq]s the Markdown source for a simple slide show,+\f[C]habits.txt\f[R]:+.IP+.nf+\f[C]+% Habits+% John Doe+% March 22, 2005++# In the morning++## Getting up++- Turn off alarm+- Get out of bed++## Breakfast++- Eat eggs+- Drink coffee++# In the evening++## Dinner++- Eat spaghetti+- Drink wine++------------------++++## Going to sleep++- Get in bed+- Count sheep+\f[R]+.fi+.PP+To produce an HTML/JavaScript slide show, simply type+.IP+.nf+\f[C]+pandoc -t FORMAT -s habits.txt -o habits.html+\f[R]+.fi+.PP+where \f[C]FORMAT\f[R] is either \f[C]s5\f[R], \f[C]slidy\f[R],+\f[C]slideous\f[R], \f[C]dzslides\f[R], or \f[C]revealjs\f[R].+.PP+For Slidy, Slideous, reveal.js, and S5, the file produced by pandoc with+the \f[C]-s/--standalone\f[R] option embeds a link to JavaScript and CSS+files, which are assumed to be available at the relative path+\f[C]s5/default\f[R] (for S5), \f[C]slideous\f[R] (for Slideous),+\f[C]reveal.js\f[R] (for reveal.js), or at the Slidy website at+\f[C]w3.org\f[R] (for Slidy).+(These paths can be changed by setting the \f[C]slidy-url\f[R],+\f[C]slideous-url\f[R], \f[C]revealjs-url\f[R], or \f[C]s5-url\f[R]+variables; see Variables for HTML slides, above.) For DZSlides, the+(relatively short) JavaScript and CSS are included in the file by+default.+.PP+With all HTML slide formats, the \f[C]--self-contained\f[R] option can+be used to produce a single file that contains all of the data necessary+to display the slide show, including linked scripts, stylesheets,+images, and videos.+.PP+To produce a PDF slide show using beamer, type+.IP+.nf+\f[C]+pandoc -t beamer habits.txt -o habits.pdf+\f[R]+.fi+.PP+Note that a reveal.js slide show can also be converted to a PDF by+printing it to a file from the browser.+.PP+To produce a Powerpoint slide show, type+.IP+.nf+\f[C]+pandoc habits.txt -o habits.pptx+\f[R]+.fi+.SS Structuring the slide show+.PP+By default, the \f[I]slide level\f[R] is the highest header level in the+hierarchy that is followed immediately by content, and not another+header, somewhere in the document.+In the example above, level 1 headers are always followed by level 2+headers, which are followed by content, so 2 is the slide level.+This default can be overridden using the \f[C]--slide-level\f[R] option.+.PP+The document is carved up into slides according to the following rules:+.IP \[bu] 2+A horizontal rule always starts a new slide.+.IP \[bu] 2+A header at the slide level always starts a new slide.+.IP \[bu] 2+Headers \f[I]below\f[R] the slide level in the hierarchy create headers+\f[I]within\f[R] a slide.+.IP \[bu] 2+Headers \f[I]above\f[R] the slide level in the hierarchy create+\[dq]title slides,\[dq] which just contain the section title and help to+break the slide show into sections.+.IP \[bu] 2+Content \f[I]above\f[R] the slide level will not appear in the slide+show.+.IP \[bu] 2+A title page is constructed automatically from the document\[aq]s title+block, if present.+(In the case of beamer, this can be disabled by commenting out some+lines in the default template.)+.PP+These rules are designed to support many different styles of slide show.+If you don\[aq]t care about structuring your slides into sections and+subsections, you can just use level 1 headers for all each slide.+(In that case, level 1 will be the slide level.) But you can also+structure the slide show into sections, as in the example above.+.PP+Note: in reveal.js slide shows, if slide level is 2, a two-dimensional+layout will be produced, with level 1 headers building horizontally and+level 2 headers building vertically.+It is not recommended that you use deeper nesting of section levels with+reveal.js.+.SS Incremental lists+.PP+By default, these writers produce lists that display \[dq]all at+once.\[dq] If you want your lists to display incrementally (one item at+a time), use the \f[C]-i\f[R] option.+If you want a particular list to depart from the default, put it in a+\f[C]div\f[R] block with class \f[C]incremental\f[R] or+\f[C]nonincremental\f[R].+So, for example, using the \f[C]fenced div\f[R] syntax, the following+would be incremental regardless of the document default:+.IP+.nf+\f[C]+::: incremental++- Eat spaghetti+- Drink wine++:::+\f[R]+.fi+.PP+or+.IP+.nf+\f[C]+::: nonincremental++- Eat spaghetti+- Drink wine++:::+\f[R]+.fi+.PP+While using \f[C]incremental\f[R] and \f[C]nonincremental\f[R] divs are+the recommended method of setting incremental lists on a per-case basis,+an older method is also supported: putting lists inside a blockquote+will depart from the document default (that is, it will display+incrementally without the \f[C]-i\f[R] option and all at once with the+\f[C]-i\f[R] option):+.IP+.nf+\f[C]+> - Eat spaghetti+> - Drink wine+\f[R]+.fi+.PP+Both methods allow incremental and nonincremental lists to be mixed in a+single document.+.SS Inserting pauses+.PP+You can add \[dq]pauses\[dq] within a slide by including a paragraph+containing three dots, separated by spaces:+.IP+.nf+\f[C]+# Slide with a pause++content before the pause++\&. . .++content after the pause+\f[R]+.fi+.SS Styling the slides+.PP+You can change the style of HTML slides by putting customized CSS files+in \f[C]$DATADIR/s5/default\f[R] (for S5), \f[C]$DATADIR/slidy\f[R] (for+Slidy), or \f[C]$DATADIR/slideous\f[R] (for Slideous), where+\f[C]$DATADIR\f[R] is the user data directory (see \f[C]--data-dir\f[R],+above).+The originals may be found in pandoc\[aq]s system data directory+(generally \f[C]$CABALDIR/pandoc-VERSION/s5/default\f[R]).+Pandoc will look there for any files it does not find in the user data+directory.+.PP+For dzslides, the CSS is included in the HTML file itself, and may be+modified there.+.PP+All reveal.js configuration options can be set through variables.+For example, themes can be used by setting the \f[C]theme\f[R] variable:+.IP+.nf+\f[C]+-V theme=moon+\f[R]+.fi+.PP+Or you can specify a custom stylesheet using the \f[C]--css\f[R] option.+.PP+To style beamer slides, you can specify a \f[C]theme\f[R],+\f[C]colortheme\f[R], \f[C]fonttheme\f[R], \f[C]innertheme\f[R], and+\f[C]outertheme\f[R], using the \f[C]-V\f[R] option:+.IP+.nf+\f[C]+pandoc -t beamer habits.txt -V theme:Warsaw -o habits.pdf+\f[R]+.fi+.PP+Note that header attributes will turn into slide attributes (on a+\f[C]<div>\f[R] or \f[C]<section>\f[R]) in HTML slide formats, allowing+you to style individual slides.+In beamer, the only header attribute that affects slides is the+\f[C]allowframebreaks\f[R] class, which sets the+\f[C]allowframebreaks\f[R] option, causing multiple slides to be created+if the content overfills the frame.+This is recommended especially for bibliographies:+.IP+.nf+\f[C]+# References {.allowframebreaks}+\f[R]+.fi+.SS Speaker notes+.PP+Speaker notes are supported in reveal.js and PowerPoint (pptx) output.+You can add notes to your Markdown document thus:+.IP+.nf+\f[C]+::: notes++This is my note.++- It can contain Markdown+- like this list++:::+\f[R]+.fi+.PP+To show the notes window in reveal.js, press \f[C]s\f[R] while viewing+the presentation.+Speaker notes in PowerPoint will be available, as usual, in handouts and+presenter view.+.PP+Notes are not yet supported for other slide formats, but the notes will+not appear on the slides themselves.+.SS Columns+.PP+To put material in side by side columns, you can use a native div+container with class \f[C]columns\f[R], containing two or more div+containers with class \f[C]column\f[R] and a \f[C]width\f[R] attribute:+.IP+.nf+\f[C]+:::::::::::::: {.columns}+::: {.column width=\[dq]40%\[dq]}+contents...+:::+::: {.column width=\[dq]60%\[dq]}+contents...+:::+::::::::::::::+\f[R]+.fi+.SS Frame attributes in beamer+.PP+Sometimes it is necessary to add the LaTeX \f[C][fragile]\f[R] option to+a frame in beamer (for example, when using the \f[C]minted\f[R]+environment).+This can be forced by adding the \f[C]fragile\f[R] class to the header+introducing the slide:+.IP+.nf+\f[C]+# Fragile slide {.fragile}+\f[R]+.fi+.PP+All of the other frame attributes described in Section 8.1 of the Beamer+User\[aq]s Guide may also be used: \f[C]allowdisplaybreaks\f[R],+\f[C]allowframebreaks\f[R], \f[C]b\f[R], \f[C]c\f[R], \f[C]t\f[R],+\f[C]environment\f[R], \f[C]label\f[R], \f[C]plain\f[R],+\f[C]shrink\f[R], \f[C]standout\f[R], \f[C]noframenumbering\f[R].+.SS Background in reveal.js and beamer+.PP+Background images can be added to self-contained reveal.js slideshows+and to beamer slideshows.+.PP+For the same image on every slide, use the configuration option+\f[C]background-image\f[R] either in the YAML metadata block or as a+command-line variable.+(There are no other options in beamer and the rest of this section+concerns reveal.js slideshows.)+.PP+For reveal.js, you can instead use the reveal.js-native option+\f[C]parallaxBackgroundImage\f[R].+You can also set \f[C]parallaxBackgroundHorizontal\f[R] and+\f[C]parallaxBackgroundVertical\f[R] the same way and must also set+\f[C]parallaxBackgroundSize\f[R] to have your values take effect.+.PP+To set an image for a particular reveal.js slide, add+\f[C]{data-background-image=\[dq]/path/to/image\[dq]}\f[R] to the first+slide-level header on the slide (which may even be empty).+.PP+In reveal.js\[aq]s overview mode, the parallaxBackgroundImage will show+up only on the first slide.+.PP+Other reveal.js background settings also work on individual slides,+including \f[C]data-background-size\f[R],+\f[C]data-background-repeat\f[R], \f[C]data-background-color\f[R],+\f[C]data-transition\f[R], and \f[C]data-transition-speed\f[R].+.PP+See the reveal.js documentation for more details.+.PP+For example in reveal.js:+.IP+.nf+\f[C]+---+title: My Slideshow+parallaxBackgroundImage: /path/to/my/background_image.png+---++## Slide One++Slide 1 has background_image.png as its background.++## {data-background-image=\[dq]/path/to/special_image.jpg\[dq]}++Slide 2 has a special image for its background, even though the header has no content.+\f[R]+.fi+.SH CREATING EPUBS WITH PANDOC+.SS EPUB Metadata+.PP+EPUB metadata may be specified using the \f[C]--epub-metadata\f[R]+option, but if the source document is Markdown, it is better to use a+YAML metadata block.+Here is an example:+.IP+.nf+\f[C]+---+title:+- type: main+ text: My Book+- type: subtitle+ text: An investigation of metadata+creator:+- role: author+ text: John Smith+- role: editor+ text: Sarah Jones+identifier:+- scheme: DOI+ text: doi:10.234234.234/33+publisher: My Press+rights: \[co] 2007 John Smith, CC BY-NC+ibooks:+ version: 1.3.4+\&...+\f[R]+.fi+.PP+The following fields are recognized:+.TP+.B \f[C]identifier\f[R]+Either a string value or an object with fields \f[C]text\f[R] and+\f[C]scheme\f[R].+Valid values for \f[C]scheme\f[R] are \f[C]ISBN-10\f[R],+\f[C]GTIN-13\f[R], \f[C]UPC\f[R], \f[C]ISMN-10\f[R], \f[C]DOI\f[R],+\f[C]LCCN\f[R], \f[C]GTIN-14\f[R], \f[C]ISBN-13\f[R],+\f[C]Legal deposit number\f[R], \f[C]URN\f[R], \f[C]OCLC\f[R],+\f[C]ISMN-13\f[R], \f[C]ISBN-A\f[R], \f[C]JP\f[R], \f[C]OLCC\f[R].+.TP+.B \f[C]title\f[R]+Either a string value, or an object with fields \f[C]file-as\f[R] and+\f[C]type\f[R], or a list of such objects.+Valid values for \f[C]type\f[R] are \f[C]main\f[R], \f[C]subtitle\f[R],+\f[C]short\f[R], \f[C]collection\f[R], \f[C]edition\f[R],+\f[C]extended\f[R].+.TP+.B \f[C]creator\f[R]+Either a string value, or an object with fields \f[C]role\f[R],+\f[C]file-as\f[R], and \f[C]text\f[R], or a list of such objects.+Valid values for \f[C]role\f[R] are MARC relators, but pandoc will+attempt to translate the human-readable versions (like \[dq]author\[dq]+and \[dq]editor\[dq]) to the appropriate marc relators.+.TP+.B \f[C]contributor\f[R]+Same format as \f[C]creator\f[R].+.TP+.B \f[C]date\f[R]+A string value in \f[C]YYYY-MM-DD\f[R] format.+(Only the year is necessary.) Pandoc will attempt to convert other+common date formats.+.TP+.B \f[C]lang\f[R] (or legacy: \f[C]language\f[R])+A string value in BCP 47 format.+Pandoc will default to the local language if nothing is specified.+.TP+.B \f[C]subject\f[R]+A string value or a list of such values.+.TP+.B \f[C]description\f[R]+A string value.+.TP+.B \f[C]type\f[R]+A string value.+.TP+.B \f[C]format\f[R]+A string value.+.TP+.B \f[C]relation\f[R]+A string value.+.TP+.B \f[C]coverage\f[R]+A string value.+.TP+.B \f[C]rights\f[R]+A string value.+.TP+.B \f[C]cover-image\f[R]+A string value (path to cover image).+.TP+.B \f[C]css\f[R] (or legacy: \f[C]stylesheet\f[R])+A string value (path to CSS stylesheet).+.TP+.B \f[C]page-progression-direction\f[R]+Either \f[C]ltr\f[R] or \f[C]rtl\f[R].+Specifies the \f[C]page-progression-direction\f[R] attribute for the+\f[C]spine\f[R] element.+.TP+.B \f[C]ibooks\f[R]+iBooks-specific metadata, with the following fields:+.RS+.IP \[bu] 2+\f[C]version\f[R]: (string)+.IP \[bu] 2+\f[C]specified-fonts\f[R]: \f[C]true\f[R]|\f[C]false\f[R] (default+\f[C]false\f[R])+.IP \[bu] 2+\f[C]ipad-orientation-lock\f[R]:+\f[C]portrait-only\f[R]|\f[C]landscape-only\f[R]+.IP \[bu] 2+\f[C]iphone-orientation-lock\f[R]:+\f[C]portrait-only\f[R]|\f[C]landscape-only\f[R]+.IP \[bu] 2+\f[C]binding\f[R]: \f[C]true\f[R]|\f[C]false\f[R] (default+\f[C]true\f[R])+.IP \[bu] 2+\f[C]scroll-axis\f[R]:+\f[C]vertical\f[R]|\f[C]horizontal\f[R]|\f[C]default\f[R]+.RE+.SS The \f[C]epub:type\f[R] attribute+.PP+For \f[C]epub3\f[R] output, you can mark up the header that corresponds+to an EPUB chapter using the \f[C]epub:type\f[R] attribute.+For example, to set the attribute to the value \f[C]prologue\f[R], use+this markdown:+.IP+.nf+\f[C]+# My chapter {epub:type=prologue}+\f[R]+.fi+.PP+Which will result in:+.IP+.nf+\f[C]+<body epub:type=\[dq]frontmatter\[dq]>+ <section epub:type=\[dq]prologue\[dq]>+ <h1>My chapter</h1>+\f[R]+.fi+.PP+Pandoc will output \f[C]<body epub:type=\[dq]bodymatter\[dq]>\f[R],+unless you use one of the following values, in which case either+\f[C]frontmatter\f[R] or \f[C]backmatter\f[R] will be output.+.PP+.TS+tab(@);+l l.+T{+\f[C]epub:type\f[R] of first section+T}@T{+\f[C]epub:type\f[R] of body+T}+_+T{+prologue+T}@T{+frontmatter+T}+T{+abstract+T}@T{+frontmatter+T}+T{+acknowledgments+T}@T{+frontmatter+T}+T{+copyright-page+T}@T{+frontmatter+T}+T{+dedication+T}@T{+frontmatter+T}+T{+foreword+T}@T{+frontmatter+T}+T{+halftitle,+T}@T{+frontmatter+T}+T{+introduction+T}@T{+frontmatter+T}+T{+preface+T}@T{+frontmatter+T}+T{+seriespage+T}@T{+frontmatter+T}+T{+titlepage+T}@T{+frontmatter+T}+T{+afterword+T}@T{+backmatter+T}+T{+appendix+T}@T{+backmatter+T}+T{+colophon+T}@T{+backmatter+T}+T{+conclusion+T}@T{+backmatter+T}+T{+epigraph+T}@T{+backmatter+T}+.TE+.SS Linked media+.PP+By default, pandoc will download media referenced from any+\f[C]<img>\f[R], \f[C]<audio>\f[R], \f[C]<video>\f[R] or+\f[C]<source>\f[R] element present in the generated EPUB, and include it+in the EPUB container, yielding a completely self-contained EPUB.+If you want to link to external media resources instead, use raw HTML in+your source and add \f[C]data-external=\[dq]1\[dq]\f[R] to the tag with+the \f[C]src\f[R] attribute.+For example:+.IP+.nf+\f[C]+<audio controls=\[dq]1\[dq]>+ <source src=\[dq]http://example.com/music/toccata.mp3\[dq]+ data-external=\[dq]1\[dq] type=\[dq]audio/mpeg\[dq]>+ </source>+</audio>+\f[R]+.fi+.SH CREATING JUPYTER NOTEBOOKS WITH PANDOC+.PP+When creating a Jupyter notebook, pandoc will try to infer the notebook+structure.+Code blocks with the class \f[C]code\f[R] will be taken as code cells,+and intervening content will be taken as Markdown cells.+Attachments will automatically be created for images in Markdown cells.+Metadata will be taken from the \f[C]jupyter\f[R] metadata field.+For example:+.IP+.nf+\f[C]+---+title: My notebook+jupyter:+ nbformat: 4+ nbformat_minor: 5+ kernelspec:+ display_name: Python 2+ language: python+ name: python2+ language_info:+ codemirror_mode:+ name: ipython+ version: 2+ file_extension: \[dq].py\[dq]+ mimetype: \[dq]text/x-python\[dq]+ name: \[dq]python\[dq]+ nbconvert_exporter: \[dq]python\[dq]+ pygments_lexer: \[dq]ipython2\[dq]+ version: \[dq]2.7.15\[dq]+---++# Lorem ipsum++**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus+bibendum felis dictum sodales.++\[ga]\[ga]\[ga] code+print(\[dq]hello\[dq])+\[ga]\[ga]\[ga]++## Pyout++\[ga]\[ga]\[ga] code+from IPython.display import HTML+HTML(\[dq]\[dq]\[dq]+<script>+console.log(\[dq]hello\[dq]);+</script>+<b>HTML</b>+\[dq]\[dq]\[dq])+\[ga]\[ga]\[ga]++## Image++This image  will be+included as a cell attachment.+\f[R]+.fi+.PP+If you want to add cell attributes, group cells differently, or add+output to code cells, then you need to include divs to indicate the+structure.+You can use either fenced divs or native divs for this.+Here is an example:+.IP+.nf+\f[C]+:::::: {.cell .markdown}+# Lorem++**Lorem ipsum** dolor sit amet, consectetur adipiscing elit. Nunc luctus+bibendum felis dictum sodales.+::::::++:::::: {.cell .code execution_count=1}+\[ga]\[ga]\[ga] {.python}+print(\[dq]hello\[dq])+\[ga]\[ga]\[ga]++::: {.output .stream .stdout}+\[ga]\[ga]\[ga]+hello+\[ga]\[ga]\[ga]+:::+::::::++:::::: {.cell .code execution_count=2}+\[ga]\[ga]\[ga] {.python}+from IPython.display import HTML+HTML(\[dq]\[dq]\[dq]+<script>+console.log(\[dq]hello\[dq]);+</script>+<b>HTML</b>+\[dq]\[dq]\[dq])+\[ga]\[ga]\[ga]++::: {.output .execute_result execution_count=2}+\[ga]\[ga]\[ga]{=html}+<script>+console.log(\[dq]hello\[dq]);+</script>+<b>HTML</b>+hello+\[ga]\[ga]\[ga]+:::+::::::+\f[R]+.fi+.SH SYNTAX HIGHLIGHTING+.PP+Pandoc will automatically highlight syntax in fenced code blocks that+are marked with a language name.+The Haskell library skylighting is used for highlighting.+Currently highlighting is supported only for HTML, EPUB, Docx, Ms, and+LaTeX/PDF output.+To see a list of language names that pandoc will recognize, type+\f[C]pandoc --list-highlight-languages\f[R].+.PP+The color scheme can be selected using the \f[C]--highlight-style\f[R]+option.+The default color scheme is \f[C]pygments\f[R], which imitates the+default color scheme used by the Python library pygments (though+pygments is not actually used to do the highlighting).+To see a list of highlight styles, type+\f[C]pandoc --list-highlight-styles\f[R].+.PP+If you are not satisfied with the predefined styles, you can use+\f[C]--print-highlight-style\f[R] to generate a JSON \f[C].theme\f[R]+file which can be modified and used as the argument to+\f[C]--highlight-style\f[R].+To get a JSON version of the \f[C]pygments\f[R] style, for example:+.IP+.nf+\f[C]+pandoc --print-highlight-style pygments > my.theme+\f[R]+.fi+.PP+Then edit \f[C]my.theme\f[R] and use it like this:+.IP+.nf+\f[C]+pandoc --highlight-style my.theme+\f[R]+.fi+.PP+If you are not satisfied with the built-in highlighting, or you want+highlight a language that isn\[aq]t supported, you can use the+\f[C]--syntax-definition\f[R] option to load a KDE-style XML syntax+definition file.+Before writing your own, have a look at KDE\[aq]s repository of syntax+definitions.+.PP+To disable highlighting, use the \f[C]--no-highlight\f[R] option.+.SH CUSTOM STYLES+.PP+Custom styles can be used in the docx and ICML formats.+.SS Input+.PP+The docx reader, by default, only reads those styles that it can convert+into pandoc elements, either by direct conversion or interpreting the+derivation of the input document\[aq]s styles.+.PP+By enabling the \f[C]styles\f[R] extension in the docx reader+(\f[C]-f docx+styles\f[R]), you can produce output that maintains the+styles of the input document, using the \f[C]custom-style\f[R] class.+Paragraph styles are interpreted as divs, while character styles are+interpreted as spans.+.PP+For example, using the \f[C]custom-style-reference.docx\f[R] file in the+test directory, we have the following different outputs:+.PP+Without the \f[C]+styles\f[R] extension:+.IP+.nf+\f[C]+$ pandoc test/docx/custom-style-reference.docx -f docx -t markdown+This is some text.++This is text with an *emphasized* text style. And this is text with a+**strengthened** text style.++> Here is a styled paragraph that inherits from Block Text.+\f[R]+.fi+.PP+And with the extension:+.IP+.nf+\f[C]+$ pandoc test/docx/custom-style-reference.docx -f docx+styles -t markdown++::: {custom-style=\[dq]FirstParagraph\[dq]}+This is some text.+:::++::: {custom-style=\[dq]BodyText\[dq]}+This is text with an [emphasized]{custom-style=\[dq]Emphatic\[dq]} text style.+And this is text with a [strengthened]{custom-style=\[dq]Strengthened\[dq]}+text style.+:::++::: {custom-style=\[dq]MyBlockStyle\[dq]}+> Here is a styled paragraph that inherits from Block Text.+:::+\f[R]+.fi+.PP+With these custom styles, you can use your input document as a+reference-doc while creating docx output (see below), and maintain the+same styles in your input and output files.+.SS Output+.PP+By default, pandoc\[aq]s docx and ICML output applies a predefined set+of styles for blocks such as paragraphs and block quotes, and uses+largely default formatting (italics, bold) for inlines.+This will work for most purposes, especially alongside a+\f[C]reference.docx\f[R] file.+However, if you need to apply your own styles to blocks, or match a+preexisting set of styles, pandoc allows you to define custom styles for+blocks and text using \f[C]div\f[R]s and \f[C]span\f[R]s, respectively.+.PP+If you define a \f[C]div\f[R] or \f[C]span\f[R] with the attribute+\f[C]custom-style\f[R], pandoc will apply your specified style to the+contained elements.+So, for example using the \f[C]bracketed_spans\f[R] syntax,+.IP+.nf+\f[C]+[Get out]{custom-style=\[dq]Emphatically\[dq]}, he said.+\f[R]+.fi+.PP+would produce a docx file with \[dq]Get out\[dq] styled with character+style \f[C]Emphatically\f[R].+Similarly, using the \f[C]fenced_divs\f[R] syntax,+.IP+.nf+\f[C]+Dickinson starts the poem simply:++::: {custom-style=\[dq]Poetry\[dq]}+| A Bird came down the Walk---+| He did not know I saw---+:::+\f[R]+.fi+.PP+would style the two contained lines with the \f[C]Poetry\f[R] paragraph+style.+.PP+For docx output, styles will be defined in the output file as inheriting+from normal text, if the styles are not yet in your reference.docx.+If they are already defined, pandoc will not alter the definition.+.PP+This feature allows for greatest customization in conjunction with+pandoc filters.+If you want all paragraphs after block quotes to be indented, you can+write a filter to apply the styles necessary.+If you want all italics to be transformed to the \f[C]Emphasis\f[R]+character style (perhaps to change their color), you can write a filter+which will transform all italicized inlines to inlines within an+\f[C]Emphasis\f[R] custom-style \f[C]span\f[R].+.SH CUSTOM WRITERS+.PP+Pandoc can be extended with custom writers written in lua.+(Pandoc includes a lua interpreter, so lua need not be installed+separately.)+.PP+To use a custom writer, simply specify the path to the lua script in+place of the output format.+For example:+.IP+.nf+\f[C]+pandoc -t data/sample.lua+\f[R]+.fi+.PP+Creating a custom writer requires writing a lua function for each+possible element in a pandoc document.+To get a documented example which you can modify according to your+needs, do+.IP+.nf+\f[C]+pandoc --print-default-data-file sample.lua+\f[R]+.fi+.SH A NOTE ON SECURITY+.PP+If you use pandoc to convert user-contributed content in a web+application, here are some things to keep in mind:+.IP "1." 3+Although pandoc itself will not create or modify any files other than+those you explicitly ask it create (with the exception of temporary+files used in producing PDFs), a filter or custom writer could in+principle do anything on your file system.+Please audit filters and custom writers very carefully before using+them.+.IP "2." 3+If your application uses pandoc as a Haskell library (rather than+shelling out to the executable), it is possible to use it in a mode that+fully isolates pandoc from your file system, by running the pandoc+operations in the \f[C]PandocPure\f[R] monad.+See the document Using the pandoc API for more details.+.IP "3." 3+Pandoc\[aq]s parsers can exhibit pathological performance on some corner+cases.+It is wise to put any pandoc operations under a timeout, to avoid DOS+attacks that exploit these issues.+If you are using the pandoc executable, you can add the command line+options \f[C]+RTS -M512M -RTS\f[R] (for example) to limit the heap size+to 512MB.+.IP "4." 3+The HTML generated by pandoc is not guaranteed to be safe.+If \f[C]raw_html\f[R] is enabled for the Markdown input, users can+inject arbitrary HTML.+Even if \f[C]raw_html\f[R] is disabled, users can include dangerous+content in attributes for headers, spans, and code blocks.+To be safe, you should run all the generated HTML through an HTML+sanitizer.+.SH AUTHORS+.PP+Copyright 2006--2019 John MacFarlane (jgm\[at]berkeley.edu). Released under the GPL, version 2 or greater. This software carries no warranty of any kind. (See COPYRIGHT for full copyright and warranty notices.) For a full list
@@ -1,7 +1,7 @@ name: pandoc-version: 2.5+version: 2.6 cabal-version: 2.0-build-type: Custom+build-type: Simple license: GPL-2 license-file: COPYING.md copyright: (c) 2006-2018 John MacFarlane@@ -18,15 +18,16 @@ format to another, and a command-line tool that uses this library. It can read several dialects of Markdown and (subsets of) HTML, reStructuredText, LaTeX, DocBook, JATS,- MediaWiki markup, TWiki markup, TikiWiki markup, Creole 1.0,- Haddock markup, OPML, Emacs Org-Mode, Emacs Muse, txt2tags,- Vimwiki, Word Docx, ODT, EPUB, FictionBook2, roff man,- and Textile, and it can write Markdown, reStructuredText,- XHTML, HTML 5, LaTeX, ConTeXt, DocBook, JATS, OPML, TEI,- OpenDocument, ODT, Word docx, PowerPoint pptx,- RTF, MediaWiki, DokuWiki, ZimWiki, Textile,+ MediaWiki markup, DokuWiki markup, TWiki markup,+ TikiWiki markup, Creole 1.0, Haddock markup, OPML,+ Emacs Org-Mode, Emacs Muse, txt2tags, ipynb (Jupyter+ notebooks), Vimwiki, Word Docx, ODT, EPUB, FictionBook2,+ roff man, and Textile, and it can write Markdown,+ reStructuredText, XHTML, HTML 5, LaTeX, ConTeXt, DocBook,+ JATS, OPML, TEI, OpenDocument, ODT, Word docx,+ PowerPoint pptx, RTF, MediaWiki, DokuWiki, ZimWiki, Textile, roff man, roff ms, plain text, Emacs Org-Mode,- AsciiDoc, Haddock markup, EPUB (v2 and v3),+ AsciiDoc, Haddock markup, EPUB (v2 and v3), ipynb, FictionBook2, InDesign ICML, Muse, LaTeX beamer slides, and several kinds of HTML/JavaScript slide shows (S5, Slidy, Slideous, DZSlides, reveal.js).@@ -188,6 +189,7 @@ test/command/*.md test/command/3533-rst-csv-tables.csv test/command/3880.txt+ test/command/5182.txt test/command/abbrevs test/command/SVG_logo-without-xml-declaration.svg test/command/SVG_logo.svg@@ -206,6 +208,7 @@ test/docbook-xref.docbook test/html-reader.html test/opml-reader.opml+ test/org-select-tags.org test/haddock-reader.haddock test/insert test/lalune.jpg@@ -346,9 +349,6 @@ Description: Build trypandoc cgi executable. Default: False -custom-setup- setup-depends: base, Cabal >= 2.0- library build-depends: base >= 4.8 && < 5, syb >= 0.1 && < 0.8,@@ -364,7 +364,7 @@ text >= 1.1.1.0 && < 1.3, time >= 1.5 && < 1.10, safe >= 0.3 && < 0.4,- zip-archive >= 0.2.3.4 && < 0.4,+ zip-archive >= 0.2.3.4 && < 0.5, HTTP >= 4000.0.5 && < 4000.4, texmath >= 0.11 && < 0.12, xml >= 1.3.12 && < 1.4,@@ -376,7 +376,7 @@ tagsoup >= 0.14.6 && < 0.15, base64-bytestring >= 0.1 && < 1.1, zlib >= 0.5 && < 0.7,- skylighting >= 0.7.4 && < 0.8,+ skylighting >= 0.7.5 && < 0.8, data-default >= 0.4 && < 0.8, temporary >= 1.1 && < 1.4, blaze-html >= 0.9 && < 0.10,@@ -389,17 +389,18 @@ haddock-library >= 1.7 && < 1.8, deepseq >= 1.3 && < 1.5, JuicyPixels >= 3.1.6.1 && < 3.4,- Glob >= 0.7 && < 0.10,+ Glob >= 0.7 && < 0.11, cmark-gfm >= 0.1.1 && < 0.2, doctemplates >= 0.2.1 && < 0.3, network-uri >= 2.6 && < 2.7, network >= 2.6,- http-client >= 0.4.30 && < 0.6,+ http-client >= 0.4.30 && < 0.7, http-client-tls >= 0.2.4 && < 0.4, http-types >= 0.8 && < 0.13, case-insensitive >= 1.2 && < 1.3, unicode-transforms >= 0.3 && < 0.4,- HsYAML >= 0.1.1.1 && < 0.2+ HsYAML >= 0.1.1.1 && < 0.2,+ ipynb >= 0.1 && < 0.2 if impl(ghc < 8.0) build-depends: semigroups == 0.18.*, -- basement 0.0.8 and foundation 0.0.21, transitive@@ -470,12 +471,15 @@ Text.Pandoc.Readers.Muse, Text.Pandoc.Readers.Man, Text.Pandoc.Readers.FB2,+ Text.Pandoc.Readers.DokuWiki,+ Text.Pandoc.Readers.Ipynb, Text.Pandoc.Writers, Text.Pandoc.Writers.Native, Text.Pandoc.Writers.Docbook, Text.Pandoc.Writers.JATS, Text.Pandoc.Writers.OPML, Text.Pandoc.Writers.HTML,+ Text.Pandoc.Writers.Ipynb, Text.Pandoc.Writers.ICML, Text.Pandoc.Writers.LaTeX, Text.Pandoc.Writers.ConTeXt,@@ -651,16 +655,16 @@ process >= 1.2.3 && < 1.7, temporary >= 1.1 && < 1.4, Diff >= 0.2 && < 0.4,- tasty >= 0.11 && < 1.2,+ tasty >= 0.11 && < 1.3, tasty-hunit >= 0.9 && < 0.11, tasty-quickcheck >= 0.8 && < 0.11, tasty-golden >= 2.3 && < 2.4, QuickCheck >= 2.4 && < 2.13, containers >= 0.4.2.1 && < 0.7, executable-path >= 0.0 && < 0.1,- zip-archive >= 0.2.3.4 && < 0.4,+ zip-archive >= 0.2.3.4 && < 0.5, xml >= 1.3.12 && < 1.4,- Glob >= 0.7 && < 0.10+ Glob >= 0.7 && < 0.11 if impl(ghc < 8.0) build-depends: semigroups == 0.18.* if impl(ghc < 8.4)@@ -699,6 +703,7 @@ Tests.Readers.Creole Tests.Readers.Man Tests.Readers.FB2+ Tests.Readers.DokuWiki Tests.Writers.Native Tests.Writers.ConTeXt Tests.Writers.Docbook@@ -716,6 +721,8 @@ Tests.Writers.FB2 Tests.Writers.Powerpoint Tests.Writers.OOXML+ if os(windows)+ cpp-options: -D_WINDOWS ghc-options: -rtsopts -Wall -fno-warn-unused-do-bind -threaded default-language: Haskell2010 other-extensions: NoImplicitPrelude
@@ -54,7 +54,7 @@ import qualified Data.Text.Lazy as TL import qualified Data.Text.Lazy.Encoding as TE import qualified Data.Text.Encoding.Error as TE-import qualified Data.YAML as YAML+import qualified Data.Text.Encoding.Error as TSE import Network.URI (URI (..), parseURI) import System.Directory (getAppUserDataDirectory) import System.Exit (exitSuccess)@@ -331,12 +331,14 @@ removeMetaKeys kvs pdc = foldr (deleteMeta . fst) pdc kvs readMetaValue :: String -> MetaValue-readMetaValue s = case YAML.decodeStrict (UTF8.fromString s) of- Right [YAML.Scalar (YAML.SStr t)]- -> MetaString $ T.unpack t- Right [YAML.Scalar (YAML.SBool b)]- -> MetaBool b- _ -> MetaString s+readMetaValue s+ | s == "true" = MetaBool True+ | s == "True" = MetaBool True+ | s == "TRUE" = MetaBool True+ | s == "false" = MetaBool False+ | s == "False" = MetaBool False+ | s == "FALSE" = MetaBool False+ | otherwise = MetaString s -- Transformations of a Pandoc document post-parsing: @@ -344,15 +346,25 @@ applyTransforms transforms d = return $ foldr ($) d transforms readSource :: FilePath -> PandocIO Text-readSource "-" = liftIO (UTF8.toText <$> BS.getContents) readSource src = case parseURI src of Just u | uriScheme u `elem` ["http:","https:"] -> readURI src- | uriScheme u == "file:" ->- liftIO $ UTF8.toText <$>- BS.readFile (uriPathToPath $ uriPath u)- _ -> liftIO $ UTF8.toText <$>- BS.readFile src+ | uriScheme u == "file:" -> liftIO $+ readTextFile (uriPathToPath $ uriPath u)+ _ -> liftIO $ readTextFile src+ where readTextFile :: FilePath -> IO Text+ readTextFile fp = do+ bs <- if src == "-"+ then BS.getContents+ else BS.readFile fp+ E.catch (return $! UTF8.toText bs)+ (\e -> case e of+ TSE.DecodeError _ (Just w) -> do+ case BS.elemIndex w bs of+ Just offset -> E.throwIO $+ PandocUTF8DecodingError fp offset w+ _ -> E.throwIO $ PandocUTF8DecodingError fp 0 w+ _ -> E.throwIO $ PandocAppError (show e)) readURI :: FilePath -> PandocIO Text readURI src = UTF8.toText . fst <$> openURL src
@@ -46,6 +46,11 @@ defConfig, Indent(..), NumberFormat(..)) import Data.Char (toLower, toUpper) import Data.List (intercalate, sort)+#ifdef _WINDOWS+#if MIN_VERSION_base(4,12,0)+import Data.List (isPrefixOf)+#endif+#endif import Data.Maybe (fromMaybe) import Skylighting (Style, Syntax (..), defaultSyntaxMap, parseTheme, pygments)@@ -96,7 +101,7 @@ -- thread option data structure through all supplied option actions opts <- foldl (>>=) (return defaults) actions- return (opts{ optInputFiles = args })+ return (opts{ optInputFiles = map normalizePath args }) latexEngines :: [String] latexEngines = ["pdflatex", "lualatex", "xelatex"]@@ -149,13 +154,15 @@ , Option "o" ["output"] (ReqArg- (\arg opt -> return opt { optOutputFile = Just arg })+ (\arg opt -> return opt { optOutputFile =+ Just (normalizePath arg) }) "FILE") "" -- "Name of output file" , Option "" ["data-dir"] (ReqArg- (\arg opt -> return opt { optDataDir = Just arg })+ (\arg opt -> return opt { optDataDir =+ Just (normalizePath arg) }) "DIRECTORY") -- "Directory containing pandoc data files." "" @@ -188,14 +195,16 @@ , Option "F" ["filter"] (ReqArg (\arg opt -> return opt { optFilters =- JSONFilter arg : optFilters opt })+ JSONFilter (normalizePath arg) :+ optFilters opt }) "PROGRAM") "" -- "External JSON filter" , Option "" ["lua-filter"] (ReqArg (\arg opt -> return opt { optFilters =- LuaFilter arg : optFilters opt })+ LuaFilter (normalizePath arg) :+ optFilters opt }) "SCRIPTPATH") "" -- "Lua filter" @@ -235,7 +244,8 @@ , Option "" ["extract-media"] (ReqArg (\arg opt ->- return opt { optExtractMedia = Just arg })+ return opt { optExtractMedia =+ Just (normalizePath arg) }) "PATH") "" -- "Directory to which to extract embedded media" @@ -247,7 +257,7 @@ , Option "" ["template"] (ReqArg (\arg opt ->- return opt{ optTemplate = Just arg,+ return opt{ optTemplate = Just (normalizePath arg), optStandalone = True }) "FILE") "" -- "Use custom template"@@ -262,7 +272,8 @@ , Option "" ["metadata-file"] (ReqArg- (\arg opt -> return opt{ optMetadataFile = Just arg })+ (\arg opt -> return opt{ optMetadataFile =+ Just (normalizePath arg) }) "FILE") "" @@ -405,7 +416,7 @@ -- HXT confuses Windows path with URI _:':':'\\':_ -> "file:///" ++ tr '\\' '/' arg- _ -> arg+ _ -> normalizePath arg return opt{ optSyntaxDefinitions = arg' : optSyntaxDefinitions opt }) "FILE")@@ -869,7 +880,7 @@ copyrightMessage :: String copyrightMessage = intercalate "\n" [ "",- "Copyright (C) 2006-2018 John MacFarlane",+ "Copyright (C) 2006-2019 John MacFarlane", "Web: http://pandoc.org", "This is free software; see the source for copying conditions.", "There is no warranty, not even for merchantability or fitness",@@ -931,3 +942,19 @@ \r -> case r of Right () -> return () Left e -> E.throwIO e++-- On Windows with ghc 8.6+, we need to rewrite paths+-- beginning with \\ to \\?\UNC\. -- See #5127.+normalizePath :: FilePath -> FilePath+#ifdef _WINDOWS+#if MIN_VERSION_base(4,12,0)+normalizePath fp =+ if "\\\\" `isPrefixOf` fp && not ("\\\\?\\" `isPrefixOf` fp)+ then "\\\\?\\UNC\\" ++ drop 2 fp+ else fp+#else+normalizePath = id+#endif+#else+normalizePath = id+#endif
@@ -90,5 +90,6 @@ ".txt" -> Just "markdown" ".wiki" -> Just "mediawiki" ".xhtml" -> Just "html"+ ".ipynb" -> Just "ipynb" ['.',y] | y `elem` ['1'..'9'] -> Just "man" _ -> Nothing
@@ -91,10 +91,10 @@ return (formatFromFilePaths "html" [outputFile], Nothing) Just f -> return (f, Nothing) - let format = map toLower $ baseWriterName- $ takeFileName writerName -- in case path to lua script+ let format = if ".lua" `isSuffixOf` writerName+ then writerName+ else map toLower $ baseWriterName writerName - -- disabling the custom writer for now (writer, writerExts) <- if ".lua" `isSuffixOf` format then return (TextWriter@@ -128,8 +128,8 @@ withList f (x:xs) vars = f x vars >>= withList f xs let addContentsAsVariable varname fp vars = do- s <- UTF8.toString <$> readFileStrict fp- return $ (varname, s) : vars+ s <- UTF8.toString . fst <$> fetchItem fp+ return $ (varname, s) : vars variables <- withList (addStringAsVariable "sourcefile")
@@ -38,11 +38,13 @@ import Prelude import Control.Exception (Exception) import Data.Typeable (Typeable)+import Data.Word (Word8) import GHC.Generics (Generic) import Network.HTTP.Client (HttpException) import System.Exit (ExitCode (..), exitWith) import System.IO (stderr) import qualified Text.Pandoc.UTF8 as UTF8+import Text.Printf (printf) import Text.Parsec.Error import Text.Parsec.Pos hiding (Line) @@ -67,6 +69,8 @@ | PandocAppError String | PandocEpubSubdirectoryError String | PandocMacroLoop String+ | PandocUTF8DecodingError String Int Word8+ | PandocIpynbDecodingError String deriving (Show, Typeable, Generic) instance Exception PandocError@@ -117,6 +121,12 @@ "EPUB subdirectory name '" ++ s ++ "' contains illegal characters" PandocMacroLoop s -> err 91 $ "Loop encountered in expanding macro " ++ s+ PandocUTF8DecodingError f offset w -> err 92 $+ "UTF-8 decoding error in " ++ f ++ " at byte offset " ++ show offset +++ " (" ++ printf "%2x" w ++ ").\n" +++ "The input must be a UTF-8 encoded text."+ PandocIpynbDecodingError w -> err 93 $+ "ipynb decoding error: " ++ w err :: Int -> String -> IO a err exitCode msg = do
@@ -167,6 +167,7 @@ | Ext_subscript -- ^ Subscript using ~this~ syntax | Ext_superscript -- ^ Superscript using ^this^ syntax | Ext_styles -- ^ Read styles that pandoc doesn't know+ | Ext_task_lists -- ^ Parse certain list items as task list items | Ext_table_captions -- ^ Pandoc-style table captions | Ext_tex_math_dollars -- ^ TeX math between $..$ or $$..$$ | Ext_tex_math_double_backslash -- ^ TeX math btw \\(..\\) \\[..\\]@@ -215,6 +216,7 @@ , Ext_strikeout , Ext_superscript , Ext_subscript+ , Ext_task_lists , Ext_auto_identifiers , Ext_header_attributes , Ext_link_attributes@@ -274,6 +276,7 @@ , Ext_space_in_atx_header , Ext_intraword_underscores , Ext_strikeout+ , Ext_task_lists , Ext_emoji , Ext_lists_without_preceding_blankline , Ext_shortcut_reference_links@@ -329,6 +332,8 @@ getDefaultExtensions "markdown_mmd" = multimarkdownExtensions getDefaultExtensions "markdown_github" = githubMarkdownExtensions getDefaultExtensions "markdown" = pandocExtensions+getDefaultExtensions "ipynb" = enableExtension Ext_tex_math_dollars+ githubMarkdownExtensions getDefaultExtensions "muse" = extensionsFromList [Ext_amuse, Ext_auto_identifiers]
@@ -93,7 +93,6 @@ reportLogMessages, ParserState (..), HasReaderOptions (..),- HasHeaderMap (..), HasIdentifierList (..), HasMacros (..), HasLogMessages (..),@@ -736,7 +735,7 @@ decimal :: Stream s m Char => ParserT s st m (ListNumberStyle, Int) decimal = do num <- many1 digit- return (Decimal, read num)+ return (Decimal, fromMaybe 1 $ safeRead num) -- | Parses a '@' and optional label and -- returns (DefaultStyle, [next example number]). The next@@ -1079,7 +1078,6 @@ stateMeta' :: F Meta, -- ^ Document metadata stateCitations :: M.Map String String, -- ^ RST-style citations stateHeaderTable :: [HeaderType], -- ^ Ordered list of header types used- stateHeaders :: M.Map Inlines String, -- ^ List of headers and ids (used for implicit ref links) stateIdentifiers :: Set.Set String, -- ^ Header identifiers used stateNextExample :: Int, -- ^ Number of next example stateExamples :: M.Map String Int, -- ^ Map from example labels to numbers@@ -1129,15 +1127,6 @@ setState newState { stateQuoteContext = oldQuoteContext } return result -class HasHeaderMap st where- extractHeaderMap :: st -> M.Map Inlines String- updateHeaderMap :: (M.Map Inlines String -> M.Map Inlines String) ->- st -> st--instance HasHeaderMap ParserState where- extractHeaderMap = stateHeaders- updateHeaderMap f st = st{ stateHeaders = f $ stateHeaders st }- class HasIdentifierList st where extractIdentifierList :: st -> Set.Set String updateIdentifierList :: (Set.Set String -> Set.Set String) -> st -> st@@ -1198,7 +1187,6 @@ stateMeta' = return nullMeta, stateCitations = M.empty, stateHeaderTable = [],- stateHeaders = M.empty, stateIdentifiers = Set.empty, stateNextExample = 1, stateExamples = M.empty,@@ -1283,12 +1271,11 @@ -- is encountered that duplicates an earlier identifier -- (explicit or automatically generated). registerHeader :: (Stream s m a, HasReaderOptions st,- HasHeaderMap st, HasLogMessages st, HasIdentifierList st)+ HasLogMessages st, HasIdentifierList st) => Attr -> Inlines -> ParserT s st m Attr registerHeader (ident,classes,kvs) header' = do ids <- extractIdentifierList <$> getState exts <- getOption readerExtensions- let insert' = M.insertWith (\_new old -> old) if null ident && Ext_auto_identifiers `extensionEnabled` exts then do let id' = uniqueIdent exts (B.toList header') ids@@ -1297,7 +1284,6 @@ else id' updateState $ updateIdentifierList $ Set.insert id' updateState $ updateIdentifierList $ Set.insert id''- updateState $ updateHeaderMap $ insert' header' id' return (id'',classes,kvs) else do unless (null ident) $ do@@ -1305,7 +1291,6 @@ pos <- getPosition logMessage $ DuplicateIdentifier ident pos updateState $ updateIdentifierList $ Set.insert ident- updateState $ updateHeaderMap $ insert' header' ident return (ident,classes,kvs) smartPunctuation :: (HasReaderOptions st, HasLastStrPosition st, HasQuoteContext st m, Stream s m Char)
@@ -31,12 +31,17 @@ module Text.Pandoc.Process (pipeProcess) where import Prelude-import Control.Concurrent (forkIO, newEmptyMVar, putMVar, takeMVar)-import Control.Exception+import Control.Concurrent (MVar, forkIO, killThread, newEmptyMVar, putMVar,+ takeMVar)+import Control.Exception (SomeException (..))+import qualified Control.Exception as E import Control.Monad (unless)+import Control.DeepSeq (rnf) import qualified Data.ByteString.Lazy as BL+import Foreign.C (Errno (Errno), ePIPE)+import GHC.IO.Exception (IOErrorType(..), IOException(..)) import System.Exit (ExitCode (..))-import System.IO (hClose, hFlush)+import System.IO (hClose) import System.Process {- |@@ -52,49 +57,76 @@ @readProcessWithExitCode@, the forked process will be terminated and @readProcessWithExitCode@ will wait (block) until the process has been terminated.--} +This function was adapted from @readProcessWithExitCode@ of module+System.Process, package process-1.6.3.0. The original code is BSD+licensed and © University of Glasgow 2004-2008.+-} pipeProcess :: Maybe [(String, String)] -- ^ environment variables -> FilePath -- ^ Filename of the executable (see 'proc' for details) -> [String] -- ^ any arguments -> BL.ByteString -- ^ standard input -> IO (ExitCode,BL.ByteString) -- ^ exitcode, stdout-pipeProcess mbenv cmd args input =- mask $ \restore -> do- (Just inh, Just outh, Nothing, pid) <- createProcess (proc cmd args)- { env = mbenv,- std_in = CreatePipe,- std_out = CreatePipe,- std_err = Inherit }- flip onException- (do hClose inh; hClose outh;- terminateProcess pid; waitForProcess pid) $ restore $ do- -- fork off a thread to start consuming stdout+pipeProcess mbenv cmd args input = do+ let cp_opts = (proc cmd args)+ { env = mbenv+ , std_in = CreatePipe+ , std_out = CreatePipe+ , std_err = Inherit+ }+ withCreateProcess cp_opts $+ \mbInh mbOuth _ pid -> do+ let (inh, outh) =+ case (mbInh, mbOuth) of+ (Just i, Just o) -> (i, o)+ (Nothing, _) -> error "withCreateProcess no inh"+ (_, Nothing) -> error "withCreateProcess no outh"+ out <- BL.hGetContents outh- waitOut <- forkWait $ evaluate $ BL.length out - -- now write and flush any input- let writeInput = do- unless (BL.null input) $ do- BL.hPutStr inh input- hFlush inh- hClose inh+ -- fork off threads to start consuming stdout & stderr+ withForkWait (E.evaluate $ rnf out) $ \waitOut -> do - writeInput+ -- now write any input+ unless (BL.null input) $+ ignoreSigPipe $ BL.hPutStr inh input+ -- hClose performs implicit hFlush, and thus may trigger a SIGPIPE+ ignoreSigPipe $ hClose inh - -- wait on the output- waitOut+ -- wait on the output+ waitOut - hClose outh+ hClose outh -- wait on the process ex <- waitForProcess pid return (ex, out) -forkWait :: IO a -> IO (IO a)-forkWait a = do- res <- newEmptyMVar- _ <- mask $ \restore -> forkIO $ try (restore a) >>= putMVar res- return (takeMVar res >>= either (\ex -> throwIO (ex :: SomeException)) return)+-- | Fork a thread while doing something else, but kill it if there's an+-- exception.+--+-- This is important in the cases above because we want to kill the thread+-- that is holding the Handle lock, because when we clean up the process we+-- try to close that handle, which could otherwise deadlock.+--+-- This function was copied verbatim from module System.Process of package+-- process-1.6.3.0.+withForkWait :: IO () -> (IO () -> IO a) -> IO a+withForkWait async body = do+ waitVar <- newEmptyMVar :: IO (MVar (Either SomeException ()))+ E.mask $ \restore -> do+ tid <- forkIO $ E.try (restore async) >>= putMVar waitVar+ let wait = takeMVar waitVar >>= either E.throwIO return+ restore (body wait) `E.onException` killThread tid++-- This function was copied verbatim from module System.Process of package+-- process-1.6.3.0.+ignoreSigPipe :: IO () -> IO ()+ignoreSigPipe = E.handle $ \e ->+ case e of+ IOError { ioe_type = ResourceVanished+ , ioe_errno = Just ioe }+ | Errno ioe == ePIPE -> return ()+ _ -> E.throwIO e
@@ -47,6 +47,7 @@ , readMarkdown , readCommonMark , readCreole+ , readDokuWiki , readMediaWiki , readVimwiki , readRST@@ -66,6 +67,7 @@ , readEPUB , readMuse , readFB2+ , readIpynb -- * Miscellaneous , getReader , getDefaultExtensions@@ -86,8 +88,10 @@ import Text.Pandoc.Readers.Creole import Text.Pandoc.Readers.DocBook import Text.Pandoc.Readers.Docx+import Text.Pandoc.Readers.DokuWiki import Text.Pandoc.Readers.EPUB import Text.Pandoc.Readers.FB2+import Text.Pandoc.Readers.Ipynb import Text.Pandoc.Readers.Haddock import Text.Pandoc.Readers.HTML (readHtml) import Text.Pandoc.Readers.JATS (readJATS)@@ -106,7 +110,6 @@ import Text.Pandoc.Readers.Txt2Tags import Text.Pandoc.Readers.Vimwiki import Text.Pandoc.Readers.Man-import Text.Pandoc.Shared (mapLeft) import qualified Text.Pandoc.UTF8 as UTF8 import Text.Parsec.Error @@ -116,10 +119,7 @@ -- | Association list of formats and readers. readers :: PandocMonad m => [(String, Reader m)] readers = [ ("native" , TextReader readNative)- ,("json" , TextReader $ \o s ->- case readJSON o s of- Right doc -> return doc- Left _ -> throwError $ PandocParseError "JSON parse error")+ ,("json" , TextReader readJSON) ,("markdown" , TextReader readMarkdown) ,("markdown_strict" , TextReader readMarkdown) ,("markdown_phpextra" , TextReader readMarkdown)@@ -127,6 +127,7 @@ ,("markdown_mmd", TextReader readMarkdown) ,("commonmark" , TextReader readCommonMark) ,("creole" , TextReader readCreole)+ ,("dokuwiki" , TextReader readDokuWiki) ,("gfm" , TextReader readCommonMark) ,("rst" , TextReader readRST) ,("mediawiki" , TextReader readMediaWiki)@@ -148,6 +149,7 @@ ,("muse" , TextReader readMuse) ,("man" , TextReader readMan) ,("fb2" , TextReader readFB2)+ ,("ipynb" , TextReader readIpynb) ] -- | Retrieve reader, extensions based on formatSpec (format+extensions).@@ -162,6 +164,9 @@ getDefaultExtensions readerName) -- | Read pandoc document from JSON format.-readJSON :: ReaderOptions -> Text -> Either PandocError Pandoc-readJSON _ =- mapLeft PandocParseError . eitherDecode' . BL.fromStrict . UTF8.fromText+readJSON :: PandocMonad m+ => ReaderOptions -> Text -> m Pandoc+readJSON _ t =+ case eitherDecode' . BL.fromStrict . UTF8.fromText $ t of+ Right doc -> return doc+ Left _ -> throwError $ PandocParseError "JSON parse error"
@@ -43,7 +43,7 @@ import Text.Pandoc.Definition import Text.Pandoc.Emoji (emojiToInline) import Text.Pandoc.Options-import Text.Pandoc.Shared (uniqueIdent)+import Text.Pandoc.Shared (uniqueIdent, taskListItemFromAscii) import Text.Pandoc.Walk (walkM) -- | Parse a CommonMark formatted string into a 'Pandoc' structure.@@ -111,12 +111,14 @@ addBlock opts (Node _ (HEADING lev) nodes) = (Header lev ("",[],[]) (addInlines opts nodes) :) addBlock opts (Node _ (LIST listAttrs) nodes) =- (constructor (map (setTightness . addBlocks opts . children) nodes) :)+ (constructor (map listItem nodes) :) where constructor = case listType listAttrs of BULLET_LIST -> BulletList ORDERED_LIST -> OrderedList (start, DefaultStyle, delim) start = listStart listAttrs+ listItem = taskListItemFromAscii exts . setTightness+ . addBlocks opts . children setTightness = if listTight listAttrs then map paraToPlain else id@@ -125,6 +127,7 @@ delim = case listDelim listAttrs of PERIOD_DELIM -> Period PAREN_DELIM -> OneParen+ exts = readerExtensions opts addBlock opts (Node _ (TABLE alignments) nodes) = (Table [] aligns widths headers rows :) where aligns = map fromTableCellAlignment alignments
@@ -655,7 +655,7 @@ -- since Docx expects us to pick up where we left off. listState <- gets docxListState let startFromState = M.lookup (numId, lvl) listState- (_, fmt,txt, startFromLevelInfo) = levelInfo+ Level _ fmt txt startFromLevelInfo = levelInfo start = case startFromState of Just n -> n + 1 Nothing -> fromMaybe 1 startFromLevelInfo
@@ -39,21 +39,21 @@ import Data.Maybe import Text.Pandoc.Generic (bottomUp) import Text.Pandoc.JSON-import Text.Pandoc.Shared (trim)+import Text.Pandoc.Shared (trim, safeRead) isListItem :: Block -> Bool isListItem (Div (_, classes, _) _) | "list-item" `elem` classes = True isListItem _ = False getLevel :: Block -> Maybe Integer-getLevel (Div (_, _, kvs) _) = read <$> lookup "level" kvs+getLevel (Div (_, _, kvs) _) = lookup "level" kvs >>= safeRead getLevel _ = Nothing getLevelN :: Block -> Integer getLevelN b = fromMaybe (-1) (getLevel b) getNumId :: Block -> Maybe Integer-getNumId (Div (_, _, kvs) _) = read <$> lookup "num-id" kvs+getNumId (Div (_, _, kvs) _) = lookup "num-id" kvs >>= safeRead getNumId _ = Nothing getNumIdN :: Block -> Integer@@ -89,7 +89,7 @@ Just f -> case txt of Just t -> Just $ Enumerated (- read (fromMaybe "1" start) :: Int,+ fromMaybe 1 (start >>= safeRead) :: Int, fromMaybe DefaultStyle (lookup f listStyleMap), fromMaybe DefaultDelim (lookup t listDelimMap)) Nothing -> Nothing
@@ -56,6 +56,7 @@ , ChangeType(..) , ChangeInfo(..) , FieldInfo(..)+ , Level(..) , archiveToDocx , archiveToDocxWithWarnings ) where@@ -188,14 +189,19 @@ data Numbering = Numbering NameSpaces [Numb] [AbstractNumb] deriving Show -data Numb = Numb String String -- right now, only a key to an abstract num+data Numb = Numb String String [LevelOverride] deriving Show +-- ilvl startOverride lvl+data LevelOverride = LevelOverride String (Maybe Integer) (Maybe Level)+ deriving Show+ data AbstractNumb = AbstractNumb String [Level] deriving Show --- (ilvl, format, string, start)-type Level = (String, String, String, Maybe Integer)+-- ilvl format string start+data Level = Level String String String (Maybe Integer)+ deriving Show data DocumentLocation = InDocument | InFootnote | InEndnote deriving (Eq,Show)@@ -503,10 +509,31 @@ lookupLevel :: String -> String -> Numbering -> Maybe Level lookupLevel numId ilvl (Numbering _ numbs absNumbs) = do- absNumId <- lookup numId $ map (\(Numb nid absnumid) -> (nid, absnumid)) numbs- lvls <- lookup absNumId $ map (\(AbstractNumb aid ls) -> (aid, ls)) absNumbs- lookup ilvl $ map (\l@(i, _, _, _) -> (i, l)) lvls+ (absNumId, ovrrides) <- lookup numId $+ map (\(Numb nid absnumid ovrRides) -> (nid, (absnumid, ovrRides))) numbs+ lvls <- lookup absNumId $+ map (\(AbstractNumb aid ls) -> (aid, ls)) absNumbs+ -- this can be a maybe, so we do a let+ let lvlOverride = lookup ilvl $+ map (\lo@(LevelOverride ilvl' _ _) -> (ilvl', lo)) ovrrides+ case lvlOverride of+ Just (LevelOverride _ _ (Just lvl')) -> Just lvl'+ Just (LevelOverride _ (Just strt) _) ->+ lookup ilvl $ map (\(Level i fmt s _) -> (i, (Level i fmt s (Just strt)))) lvls+ _ ->+ lookup ilvl $ map (\l@(Level i _ _ _) -> (i, l)) lvls +loElemToLevelOverride :: NameSpaces -> Element -> Maybe LevelOverride+loElemToLevelOverride ns element+ | isElem ns "w" "lvlOverride" element = do+ ilvl <- findAttrByName ns "w" "ilvl" element+ let startOverride = findChildByName ns "w" "startOverride" element+ >>= findAttrByName ns "w" "val"+ >>= (\s -> listToMaybe (map fst (reads s :: [(Integer, String)])))+ lvl = findChildByName ns "w" "lvl" element+ >>= levelElemToLevel ns+ return $ LevelOverride ilvl startOverride lvl+loElemToLevelOverride _ _ = Nothing numElemToNum :: NameSpaces -> Element -> Maybe Numb numElemToNum ns element@@ -514,7 +541,10 @@ numId <- findAttrByName ns "w" "numId" element absNumId <- findChildByName ns "w" "abstractNumId" element >>= findAttrByName ns "w" "val"- return $ Numb numId absNumId+ let lvlOverrides = mapMaybe+ (loElemToLevelOverride ns)+ (findChildrenByName ns "w" "lvlOverride" element)+ return $ Numb numId absNumId lvlOverrides numElemToNum _ _ = Nothing absNumElemToAbsNum :: NameSpaces -> Element -> Maybe AbstractNumb@@ -537,7 +567,7 @@ let start = findChildByName ns "w" "start" element >>= findAttrByName ns "w" "val" >>= (\s -> listToMaybe (map fst (reads s :: [(Integer, String)])))- return (ilvl, fmt, txt, start)+ return (Level ilvl fmt txt start) levelElemToLevel _ _ = Nothing archiveToNumbering' :: Archive -> Maybe Numbering
@@ -0,0 +1,529 @@+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TupleSections #-}++{-+ Copyright (C) 2018-2019 Alexander Krotov <ilabdsf@gmail.com>++This program is free software; you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation; either version 2 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+-}++{- |+ Module : Text.Pandoc.Readers.DokuWiki+ Copyright : Copyright (C) 2018 Alexander Krotov+ License : GNU GPL, version 2 or above++ Maintainer : Alexander Krotov <ilabdsf@gmail.com>+ Stability : alpha+ Portability : portable++Conversion of DokuWiki text to 'Pandoc' document.+-}+module Text.Pandoc.Readers.DokuWiki (readDokuWiki) where++import Prelude+import Control.Monad+import Control.Monad.Except (throwError)+import Data.Char (isAlphaNum, isDigit)+import qualified Data.Foldable as F+import Data.List (intercalate, transpose, isPrefixOf, isSuffixOf)+import Data.List.Split (splitOn)+import Data.Maybe (fromMaybe, catMaybes)+import Data.Text (Text)+import qualified Data.Text as T+import qualified Text.Pandoc.Builder as B+import Text.Pandoc.Class (PandocMonad (..))+import Text.Pandoc.Definition+import Text.Pandoc.Error (PandocError (PandocParsecError))+import Text.Pandoc.Options+import Text.Pandoc.Parsing hiding (enclosed, nested)+import Text.Pandoc.Shared (crFilter, trim, underlineSpan)++-- | Read DokuWiki from an input string and return a Pandoc document.+readDokuWiki :: PandocMonad m+ => ReaderOptions+ -> Text+ -> m Pandoc+readDokuWiki opts s = do+ let input = crFilter s+ res <- runParserT parseDokuWiki def {stateOptions = opts } "source" input+ case res of+ Left e -> throwError $ PandocParsecError (T.unpack input) e+ Right d -> return d++type DWParser = ParserT Text ParserState++-- * Utility functions++-- | Parse end-of-line, which can be either a newline or end-of-file.+eol :: Stream s m Char => ParserT s st m ()+eol = void newline <|> eof++nested :: PandocMonad m => DWParser m a -> DWParser m a+nested p = do+ nestlevel <- stateMaxNestingLevel <$> getState+ guard $ nestlevel > 0+ updateState $ \st -> st{ stateMaxNestingLevel = stateMaxNestingLevel st - 1 }+ res <- p+ updateState $ \st -> st{ stateMaxNestingLevel = nestlevel }+ return res++guardColumnOne :: PandocMonad m => DWParser m ()+guardColumnOne = getPosition >>= \pos -> guard (sourceColumn pos == 1)++-- | Parse DokuWiki document.+parseDokuWiki :: PandocMonad m => DWParser m Pandoc+parseDokuWiki =+ B.doc . mconcat <$> many block <* spaces <* eof++-- | Parse <code> and <file> attributes+codeLanguage :: PandocMonad m => DWParser m (String, [String], [(String, String)])+codeLanguage = try $ do+ rawLang <- option "-" (spaceChar *> manyTill anyChar (lookAhead (spaceChar <|> char '>')))+ let attr = case rawLang of+ "-" -> []+ l -> [l]+ return ("", attr, [])++-- | Generic parser for <code> and <file> tags+codeTag :: PandocMonad m+ => ((String, [String], [(String, String)]) -> String -> a)+ -> String+ -> DWParser m a+codeTag f tag = try $ f+ <$ char '<'+ <* string tag+ <*> codeLanguage+ <* manyTill anyChar (char '>')+ <* optional (manyTill spaceChar eol)+ <*> manyTill anyChar (try $ string "</" <* string tag <* char '>')++-- * Inline parsers++-- | Parse any inline element but softbreak.+inline' :: PandocMonad m => DWParser m B.Inlines+inline' = whitespace+ <|> br+ <|> bold+ <|> italic+ <|> underlined+ <|> nowiki+ <|> percent+ <|> link+ <|> image+ <|> monospaced+ <|> subscript+ <|> superscript+ <|> deleted+ <|> footnote+ <|> inlineCode+ <|> inlineFile+ <|> inlineHtml+ <|> inlinePhp+ <|> autoLink+ <|> autoEmail+ <|> notoc+ <|> nocache+ <|> str+ <|> symbol+ <?> "inline"++-- | Parse any inline element, including soft break.+inline :: PandocMonad m => DWParser m B.Inlines+inline = endline <|> inline'++endline :: PandocMonad m => DWParser m B.Inlines+endline = try $ B.softbreak <$ skipMany spaceChar <* linebreak++whitespace :: PandocMonad m => DWParser m B.Inlines+whitespace = try $ B.space <$ skipMany1 spaceChar++br :: PandocMonad m => DWParser m B.Inlines+br = try $ B.linebreak <$ string "\\\\" <* space++linebreak :: PandocMonad m => DWParser m B.Inlines+linebreak = newline >> notFollowedBy newline >> (lastNewline <|> innerNewline)+ where lastNewline = mempty <$ eof+ innerNewline = pure B.space++between :: (Monoid c, PandocMonad m, Show b)+ => DWParser m a -> DWParser m b -> (DWParser m b -> DWParser m c)+ -> DWParser m c+between start end p =+ mconcat <$> try (start >> notFollowedBy whitespace >> many1Till (p end) end)++enclosed :: (Monoid b, PandocMonad m, Show a)+ => DWParser m a -> (DWParser m a -> DWParser m b) -> DWParser m b+enclosed sep p = between sep (try sep) p++nestedInlines :: (Show a, PandocMonad m)+ => DWParser m a -> DWParser m B.Inlines+nestedInlines end = innerSpace <|> nestedInline+ where+ innerSpace = try $ whitespace <* notFollowedBy end+ nestedInline = notFollowedBy whitespace >> nested inline++bold :: PandocMonad m => DWParser m B.Inlines+bold = try $ B.strong <$> enclosed (string "**") nestedInlines++italic :: PandocMonad m => DWParser m B.Inlines+italic = try $ B.emph <$> enclosed (string "//") nestedInlines++underlined :: PandocMonad m => DWParser m B.Inlines+underlined = try $ underlineSpan <$> enclosed (string "__") nestedInlines++nowiki :: PandocMonad m => DWParser m B.Inlines+nowiki = try $ B.text <$ string "<nowiki>" <*> manyTill anyChar (try $ string "</nowiki>")++percent :: PandocMonad m => DWParser m B.Inlines+percent = try $ B.text <$> enclosed (string "%%") nestedString++nestedString :: (Show a, PandocMonad m)+ => DWParser m a -> DWParser m String+nestedString end = innerSpace <|> count 1 nonspaceChar+ where+ innerSpace = try $ many1 spaceChar <* notFollowedBy end++monospaced :: PandocMonad m => DWParser m B.Inlines+monospaced = try $ B.code <$> enclosed (string "''") nestedString++subscript :: PandocMonad m => DWParser m B.Inlines+subscript = try $ B.subscript <$> between (string "<sub>") (try $ string "</sub>") nestedInlines++superscript :: PandocMonad m => DWParser m B.Inlines+superscript = try $ B.superscript <$> between (string "<sup>") (try $ string "</sup>") nestedInlines++deleted :: PandocMonad m => DWParser m B.Inlines+deleted = try $ B.strikeout <$> between (string "<del>") (try $ string "</del>") nestedInlines++-- | Parse a footnote.+footnote :: PandocMonad m => DWParser m B.Inlines+footnote = try $ B.note . B.para <$> between (string "((") (try $ string "))") nestedInlines++inlineCode :: PandocMonad m => DWParser m B.Inlines+inlineCode = codeTag B.codeWith "code"++inlineFile :: PandocMonad m => DWParser m B.Inlines+inlineFile = codeTag B.codeWith "file"++inlineHtml :: PandocMonad m => DWParser m B.Inlines+inlineHtml = try $ B.rawInline "html" <$ string "<html>" <*> manyTill anyChar (try $ string "</html>")++inlinePhp :: PandocMonad m => DWParser m B.Inlines+inlinePhp = try $ B.codeWith ("", ["php"], []) <$ string "<php>" <*> manyTill anyChar (try $ string "</php>")++makeLink :: (String, String) -> B.Inlines+makeLink (text, url) = B.link url "" $ B.str text++autoEmail :: PandocMonad m => DWParser m B.Inlines+autoEmail = try $ do+ state <- getState+ guard $ stateAllowLinks state+ makeLink <$ char '<' <*> emailAddress <* char '>'++autoLink :: PandocMonad m => DWParser m B.Inlines+autoLink = try $ do+ state <- getState+ guard $ stateAllowLinks state+ (text, url) <- uri+ guard $ checkLink (last url)+ return $ makeLink (text, url)+ where+ checkLink c+ | c == '/' = True+ | otherwise = isAlphaNum c++notoc :: PandocMonad m => DWParser m B.Inlines+notoc = try $ mempty <$ string "~~NOTOC~~"++nocache :: PandocMonad m => DWParser m B.Inlines+nocache = try $ mempty <$ string "~~NOCACHE~~"++str :: PandocMonad m => DWParser m B.Inlines+str = B.str <$> (many1 alphaNum <|> count 1 characterReference)++symbol :: PandocMonad m => DWParser m B.Inlines+symbol = B.str <$> count 1 nonspaceChar++link :: PandocMonad m => DWParser m B.Inlines+link = try $ do+ st <- getState+ guard $ stateAllowLinks st+ setState $ st{ stateAllowLinks = False }+ l <- linkText+ setState $ st{ stateAllowLinks = True }+ return l++isExternalLink :: String -> Bool+isExternalLink s =+ case dropWhile (\c -> isAlphaNum c || (c `elem` ['-', '.', '+'])) s of+ (':':'/':'/':_) -> True+ _ -> False++isAbsolutePath :: String -> Bool+isAbsolutePath ('.':_) = False+isAbsolutePath s = ':' `elem` s++normalizeDots :: String -> String+normalizeDots path@('.':_) =+ case dropWhile (== '.') path of+ ':':_ -> path+ _ -> takeWhile (== '.') path ++ ':':dropWhile (== '.') path+normalizeDots path = path++normalizeInternalPath :: String -> String+normalizeInternalPath path =+ if isAbsolutePath path+ then ensureAbsolute normalizedPath+ else normalizedPath+ where+ normalizedPath = intercalate "/" $ dropWhile (== ".") $ splitOn ":" $ normalizeDots path+ ensureAbsolute s@('/':_) = s+ ensureAbsolute s = '/':s++normalizePath :: String -> String+normalizePath path =+ if isExternalLink path+ then path+ else normalizeInternalPath path++urlToText :: String -> String+urlToText url =+ if isExternalLink url+ then url+ else reverse $ takeWhile (/= ':') $ reverse url++-- Parse link or image+parseLink :: PandocMonad m+ => (String -> Maybe B.Inlines -> B.Inlines)+ -> String+ -> String+ -> DWParser m B.Inlines+parseLink f l r = f+ <$ string l+ <*> many1Till anyChar (lookAhead (void (char '|') <|> try (void $ string r)))+ <*> optionMaybe (B.trimInlines . mconcat <$> (char '|' *> manyTill inline (try $ lookAhead $ string r)))+ <* string r++-- | Split Interwiki link into left and right part+-- | Return Nothing if it is not Interwiki link+splitInterwiki :: String -> Maybe (String, String)+splitInterwiki path =+ case span (\c -> isAlphaNum c || c == '.') path of+ (l, '>':r) -> Just (l, r)+ _ -> Nothing++interwikiToUrl :: String -> String -> String+interwikiToUrl "callto" page = "callto://" ++ page+interwikiToUrl "doku" page = "https://www.dokuwiki.org/" ++ page+interwikiToUrl "phpfn" page = "https://secure.php.net/" ++ page+interwikiToUrl "tel" page = "tel:" ++ page+interwikiToUrl "wp" page = "https://en.wikipedia.org/wiki/" ++ page+interwikiToUrl "wpde" page = "https://de.wikipedia.org/wiki/" ++ page+interwikiToUrl "wpes" page = "https://es.wikipedia.org/wiki/" ++ page+interwikiToUrl "wpfr" page = "https://fr.wikipedia.org/wiki/" ++ page+interwikiToUrl "wpjp" page = "https://jp.wikipedia.org/wiki/" ++ page+interwikiToUrl "wppl" page = "https://pl.wikipedia.org/wiki/" ++ page+interwikiToUrl _ page = "https://www.google.com/search?q=" ++ page ++ "&btnI=lucky"++linkText :: PandocMonad m => DWParser m B.Inlines+linkText = parseLink fromRaw "[[" "]]"+ where+ fromRaw path description =+ B.link normalizedPath "" (fromMaybe (B.str defaultDescription) description)+ where+ path' = trim path+ interwiki = splitInterwiki path'+ normalizedPath =+ case interwiki of+ Nothing -> normalizePath path'+ Just (l, r) -> interwikiToUrl l r+ defaultDescription =+ case interwiki of+ Nothing -> urlToText path'+ Just (_, r) -> r++-- Matches strings like "100x100" (width x height) and "50" (width)+isWidthHeightParameter :: String -> Bool+isWidthHeightParameter s =+ case s of+ (x:xs) ->+ isDigit x && case dropWhile isDigit xs of+ ('x':ys@(_:_)) -> all isDigit ys+ "" -> True+ _ -> False+ _ -> False++parseWidthHeight :: String -> (Maybe String, Maybe String)+parseWidthHeight s = (width, height)+ where+ width = Just $ takeWhile isDigit s+ height =+ case dropWhile isDigit s of+ ('x':xs) -> Just xs+ _ -> Nothing++image :: PandocMonad m => DWParser m B.Inlines+image = parseLink fromRaw "{{" "}}"+ where+ fromRaw path description =+ if linkOnly+ then B.link normalizedPath "" (fromMaybe defaultDescription description)+ else B.imageWith ("", classes, attributes) normalizedPath "" (fromMaybe defaultDescription description)+ where+ (path', parameters) = span (/= '?') $ trim path+ normalizedPath = normalizePath path'+ leftPadding = " " `isPrefixOf` path+ rightPadding = " " `isSuffixOf` path+ classes =+ case (leftPadding, rightPadding) of+ (False, False) -> []+ (False, True) -> ["align-left"]+ (True, False) -> ["align-right"]+ (True, True) -> ["align-center"]+ parameterList = splitOn "&" $ drop 1 parameters+ linkOnly = "linkonly" `elem` parameterList+ (width, height) = maybe (Nothing, Nothing) parseWidthHeight (F.find isWidthHeightParameter parameterList)+ attributes = catMaybes [fmap ("width",) width, fmap ("height",) height]+ defaultDescription = B.str $ urlToText path'++-- * Block parsers++block :: PandocMonad m => DWParser m B.Blocks+block = do+ res <- mempty <$ skipMany1 blankline+ <|> blockElements+ <|> para+ skipMany blankline+ trace (take 60 $ show $ B.toList res)+ return res++blockElements :: PandocMonad m => DWParser m B.Blocks+blockElements = horizontalLine+ <|> header+ <|> list " "+ <|> indentedCode+ <|> quote+ <|> blockCode+ <|> blockFile+ <|> blockHtml+ <|> blockPhp+ <|> table++horizontalLine :: PandocMonad m => DWParser m B.Blocks+horizontalLine = try $ B.horizontalRule <$ string "---" <* many1 (char '-') <* eol++header :: PandocMonad m => DWParser m B.Blocks+header = try $ do+ guardColumnOne+ eqs <- many1 (char '=')+ let lev = length eqs+ guard $ lev < 7+ contents <- B.trimInlines . mconcat <$> manyTill inline (try $ char '=' *> many1 (char '='))+ attr <- registerHeader nullAttr contents+ return $ B.headerWith attr (7 - lev) contents++list :: PandocMonad m => String -> DWParser m B.Blocks+list prefix = bulletList prefix <|> orderedList prefix++bulletList :: PandocMonad m => String -> DWParser m B.Blocks+bulletList prefix = try $ B.bulletList <$> parseList prefix '*'++orderedList :: PandocMonad m => String -> DWParser m B.Blocks+orderedList prefix = try $ B.orderedList <$> parseList prefix '-'++parseList :: PandocMonad m+ => String+ -> Char+ -> DWParser m [B.Blocks]+parseList prefix marker =+ many1 ((<>) <$> item <*> fmap mconcat (many continuation))+ where+ continuation = try $ list (" " ++ prefix)+ item = try $ string prefix *> char marker *> char ' ' *> itemContents+ itemContents = B.plain . mconcat <$> many1Till inline' eol++indentedCode :: PandocMonad m => DWParser m B.Blocks+indentedCode = try $ B.codeBlock . unlines <$> many1 indentedLine+ where+ indentedLine = try $ string " " *> manyTill anyChar eol++quote :: PandocMonad m => DWParser m B.Blocks+quote = try $ nestedQuote 0+ where+ prefix level = count level (char '>')+ contents level = nestedQuote level <|> quoteLine+ quoteLine = try $ B.plain . B.trimInlines . mconcat <$> many1Till inline' eol+ quoteContents level = (<>) <$> contents level <*> quoteContinuation level+ quoteContinuation level = mconcat <$> many (try $ prefix level *> contents level)+ nestedQuote level = B.blockQuote <$ char '>' <*> quoteContents (level + 1 :: Int)++blockHtml :: PandocMonad m => DWParser m B.Blocks+blockHtml = try $ B.rawBlock "html"+ <$ string "<HTML>"+ <* optional (manyTill spaceChar eol)+ <*> manyTill anyChar (try $ string "</HTML>")++blockPhp :: PandocMonad m => DWParser m B.Blocks+blockPhp = try $ B.codeBlockWith ("", ["php"], [])+ <$ string "<PHP>"+ <* optional (manyTill spaceChar eol)+ <*> manyTill anyChar (try $ string "</PHP>")++table :: PandocMonad m => DWParser m B.Blocks+table = do+ firstSeparator <- lookAhead tableCellSeparator+ rows <- tableRows+ let (headerRow, body) = if firstSeparator == '^'+ then (head rows, tail rows)+ else ([], rows)+ let attrs = const (AlignDefault, 0.0) <$> transpose rows+ pure $ B.table mempty attrs headerRow body++tableRows :: PandocMonad m => DWParser m [[B.Blocks]]+tableRows = many1 tableRow++tableRow :: PandocMonad m => DWParser m [B.Blocks]+tableRow = many1Till tableCell tableRowEnd++tableRowEnd :: PandocMonad m => DWParser m Char+tableRowEnd = try $ tableCellSeparator <* manyTill spaceChar eol++tableCellSeparator :: PandocMonad m => DWParser m Char+tableCellSeparator = char '|' <|> char '^'++tableCell :: PandocMonad m => DWParser m B.Blocks+tableCell = try $ B.plain . B.trimInlines . mconcat <$> (normalCell <|> headerCell)+ where+ normalCell = char '|' *> manyTill inline' (lookAhead tableCellSeparator)+ headerCell = char '^' *> manyTill inline' (lookAhead tableCellSeparator)++blockCode :: PandocMonad m => DWParser m B.Blocks+blockCode = codeTag B.codeBlockWith "code"++blockFile :: PandocMonad m => DWParser m B.Blocks+blockFile = codeTag B.codeBlockWith "file"++para :: PandocMonad m => DWParser m B.Blocks+para = result . mconcat <$> many1Till inline endOfParaElement+ where+ endOfParaElement = lookAhead $ endOfInput <|> endOfPara <|> newBlockElement+ endOfInput = try $ skipMany blankline >> skipSpaces >> eof+ endOfPara = try $ blankline >> skipMany1 blankline+ newBlockElement = try $ blankline >> void blockElements+ result content = if F.all (==Space) content+ then mempty+ else B.para $ B.trimInlines content
@@ -49,7 +49,7 @@ import Control.Monad (guard, mplus, msum, mzero, unless, void) import Control.Monad.Except (throwError) import Control.Monad.Reader (ReaderT, ask, asks, lift, local, runReaderT)-import Data.Char (isAlphaNum, isDigit, isLetter)+import Data.Char (isAlphaNum, isLetter) import Data.Default (Default (..), def) import Data.Foldable (for_) import Data.List (isPrefixOf)@@ -105,7 +105,7 @@ result <- flip runReaderT def $ runParserT parseDoc (HTMLState def{ stateOptions = opts }- [] Nothing Set.empty M.empty [] M.empty)+ [] Nothing Set.empty [] M.empty) "source" tags case result of Right doc -> return doc@@ -126,7 +126,6 @@ noteTable :: [(String, Blocks)], baseHref :: Maybe URI, identifiers :: Set.Set String,- headerMap :: M.Map Inlines String, logMessages :: [LogMessage], macros :: M.Map Text Macro }@@ -319,9 +318,7 @@ let (start, style) = (sta', sty') where sta = fromMaybe "1" $ lookup "start" attribs- sta' = if all isDigit sta- then read sta- else 1+ sta' = fromMaybe 1 $ safeRead sta pickListStyle = pickStyleAttrProps ["list-style-type", "list-style"] @@ -415,7 +412,9 @@ pRawHtmlBlock :: PandocMonad m => TagParser m Blocks pRawHtmlBlock = do- raw <- T.unpack <$> (pHtmlBlock "script" <|> pHtmlBlock "style" <|> pRawTag)+ raw <- T.unpack <$>+ (pHtmlBlock "script" <|> pHtmlBlock "style" <|> pHtmlBlock "textarea"+ <|> pRawTag) exts <- getOption readerExtensions if extensionEnabled Ext_raw_html exts && not (null raw) then return $ B.rawBlock "html" raw@@ -1296,10 +1295,6 @@ instance HasIdentifierList HTMLState where extractIdentifierList = identifiers updateIdentifierList f s = s{ identifiers = f (identifiers s) }--instance HasHeaderMap HTMLState where- extractHeaderMap = headerMap- updateHeaderMap f s = s{ headerMap = f (headerMap s) } instance HasLogMessages HTMLState where addLogMessage m s = s{ logMessages = m : logMessages s }
@@ -0,0 +1,249 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-+Copyright (C) 2019 John MacFarlane <jgm@berkeley.edu>++This program is free software; you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation; either version 2 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+-}++{- |+ Module : Text.Pandoc.Readers.Ipynb+ Copyright : Copyright (C) 2019 John MacFarlane+ License : GNU GPL, version 2 or above++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Ipynb (Jupyter notebook JSON format) reader for pandoc.+-}+module Text.Pandoc.Readers.Ipynb ( readIpynb )+where+import Prelude+import Data.Maybe (fromMaybe)+import Data.Digest.Pure.SHA (sha1, showDigest)+import Text.Pandoc.Options+import qualified Text.Pandoc.Builder as B+import Text.Pandoc.Logging+import Text.Pandoc.Definition+import Data.Ipynb as Ipynb+import Text.Pandoc.Class+import Text.Pandoc.MIME (extensionFromMimeType)+import Text.Pandoc.UTF8+import Text.Pandoc.Error+import Data.Text (Text)+import qualified Data.Map as M+import qualified Data.Text as T+import qualified Data.Text.Encoding as TE+import qualified Data.ByteString.Lazy as BL+import Data.Aeson as Aeson+import Control.Monad.Except (throwError)+import Text.Pandoc.Readers.Markdown (readMarkdown)+import Text.Pandoc.Readers.HTML (readHtml)++readIpynb :: PandocMonad m => ReaderOptions -> Text -> m Pandoc+readIpynb opts t = do+ let src = BL.fromStrict (TE.encodeUtf8 t)+ case eitherDecode src of+ Right (notebook4 :: Notebook NbV4) -> notebookToPandoc opts notebook4+ Left _ ->+ case eitherDecode src of+ Right (notebook3 :: Notebook NbV3) -> notebookToPandoc opts notebook3+ Left err -> throwError $ PandocIpynbDecodingError err++notebookToPandoc :: (PandocMonad m, FromJSON (Notebook a))+ => ReaderOptions -> Notebook a -> m Pandoc+notebookToPandoc opts notebook = do+ let cells = notebookCells notebook+ let (fmt,fmtminor) = notebookFormat notebook+ let m = M.insert "nbformat" (MetaString $ show fmt) $+ M.insert "nbformat_minor" (MetaString $ show fmtminor) $+ jsonMetaToMeta (notebookMetadata notebook)+ let lang = case M.lookup "kernelspec" m of+ Just (MetaMap ks) ->+ case M.lookup "language" ks of+ Just (MetaString l) -> l+ _ -> "python"+ _ -> "python"+ bs <- mconcat <$> mapM (cellToBlocks opts lang) cells+ let Pandoc _ blocks = B.doc bs+ return $ Pandoc (Meta $ M.insert "jupyter" (MetaMap m) mempty) blocks++cellToBlocks :: PandocMonad m+ => ReaderOptions -> String -> Cell a -> m B.Blocks+cellToBlocks opts lang c = do+ let Source ts = cellSource c+ let source = mconcat ts+ let kvs = jsonMetaToPairs (cellMetadata c)+ let attachments = maybe mempty M.toList $ cellAttachments c+ mapM_ addAttachment attachments+ case cellType c of+ Ipynb.Markdown -> do+ Pandoc _ bs <- readMarkdown opts source+ return $ B.divWith ("",["cell","markdown"],kvs)+ $ B.fromList bs+ Ipynb.Heading lev -> do+ Pandoc _ bs <- readMarkdown opts+ (T.replicate lev "#" <> " " <> source)+ return $ B.divWith ("",["cell","markdown"],kvs)+ $ B.fromList bs+ Ipynb.Raw -> do+ let format = fromMaybe "" $ lookup "format" kvs+ let format' =+ case format of+ "text/html" -> "html"+ "text/latex" -> "latex"+ "application/pdf" -> "latex"+ "text/markdown" -> "markdown"+ "text/x-rsrt" -> "rst"+ _ -> format+ return $ B.divWith ("",["cell","raw"],kvs) $ B.rawBlock format'+ $ T.unpack source+ Ipynb.Code{ codeOutputs = outputs, codeExecutionCount = ec } -> do+ outputBlocks <- mconcat <$> mapM (outputToBlock opts) outputs+ let kvs' = maybe kvs (\x -> ("execution_count", show x):kvs) ec+ return $ B.divWith ("",["cell","code"],kvs') $+ B.codeBlockWith ("",[lang],[]) (T.unpack source)+ <> outputBlocks++addAttachment :: PandocMonad m => (Text, MimeBundle) -> m ()+addAttachment (fname, mimeBundle) = do+ let fp = T.unpack fname+ case M.toList (unMimeBundle mimeBundle) of+ (mimeType, BinaryData bs):_ ->+ insertMedia fp (Just $ T.unpack mimeType) (BL.fromStrict bs)+ (mimeType, TextualData t):_ ->+ insertMedia fp (Just $ T.unpack mimeType)+ (BL.fromStrict $ TE.encodeUtf8 t)+ (mimeType, JsonData v):_ ->+ insertMedia fp (Just $ T.unpack mimeType) (encode v)+ [] -> report $ CouldNotFetchResource fp "no attachment"++outputToBlock :: PandocMonad m => ReaderOptions -> Output a -> m B.Blocks+outputToBlock _ Stream{ streamName = sName,+ streamText = Source text } = do+ return $ B.divWith ("",["output","stream",T.unpack sName],[])+ $ B.codeBlock $ T.unpack . mconcat $ text+outputToBlock opts DisplayData{ displayData = data',+ displayMetadata = metadata' } =+ B.divWith ("",["output", "display_data"],[]) <$>+ handleData opts metadata' data'+outputToBlock opts ExecuteResult{ executeCount = ec,+ executeData = data',+ executeMetadata = metadata' } =+ B.divWith ("",["output", "execute_result"],[("execution_count",show ec)])+ <$> handleData opts metadata' data'+outputToBlock _ Err{ errName = ename,+ errValue = evalue,+ errTraceback = traceback } = do+ return $ B.divWith ("",["output","error"],+ [("ename",T.unpack ename),+ ("evalue",T.unpack evalue)])+ $ B.codeBlock $ T.unpack . T.unlines $ traceback++-- We want to display the richest output possible given+-- the output format.+handleData :: PandocMonad m+ => ReaderOptions -> JSONMeta -> MimeBundle -> m B.Blocks+handleData opts metadata (MimeBundle mb) = do+ let mimePairs = M.toList mb++ results <- mapM dataBlock mimePairs++ -- return the result with highest priority:++ let highest = maximum (0 : map fst results)+ return $ case [r | (pr, r) <- results, pr == highest] of+ x:_ -> x+ [] -> mempty++ where++ exts = readerExtensions opts++ dataBlock :: PandocMonad m => (MimeType, MimeData) -> m (Int, B.Blocks)+ dataBlock (mt, BinaryData bs)+ | "image/" `T.isPrefixOf` mt+ = do+ -- normally metadata maps from mime types to key-value map;+ -- but not always...+ let meta = case M.lookup mt metadata of+ Just v@(Object{}) ->+ case fromJSON v of+ Success m' -> m'+ Error _ -> mempty+ _ -> mempty+ let metaPairs = jsonMetaToPairs meta+ let bl = BL.fromStrict bs+ -- SHA1 hash for filename+ let mt' = T.unpack mt+ let fname = showDigest (sha1 bl) +++ case extensionFromMimeType mt' of+ Nothing -> ""+ Just ext -> '.':ext+ insertMedia fname (Just mt') bl+ return (3, B.para $ B.imageWith ("",[],metaPairs) fname "" mempty)++ dataBlock (_, BinaryData _) = return (0, mempty)++ dataBlock ("text/html", TextualData t)+ | extensionEnabled Ext_raw_html exts+ = return (2, B.rawBlock "html" $ T.unpack t)+ | otherwise = do -- try parsing the HTML+ Pandoc _ bls <- readHtml opts t+ return (1, B.fromList bls)++ dataBlock ("text/latex", TextualData t) =+ return $ if extensionEnabled Ext_raw_tex exts+ then (2, B.rawBlock "latex" $ T.unpack t)+ else (0, mempty)++ dataBlock ("text/plain", TextualData t) =+ return (0, B.codeBlock $ T.unpack t)++ dataBlock (_, JsonData v) =+ return (2, B.codeBlockWith ("",["json"],[]) $ toStringLazy $ encode v)++ dataBlock _ = return (0, mempty)++jsonMetaToMeta :: JSONMeta -> M.Map String MetaValue+jsonMetaToMeta = M.mapKeys T.unpack . M.map valueToMetaValue+ where+ valueToMetaValue :: Value -> MetaValue+ valueToMetaValue x@(Object{}) =+ case fromJSON x of+ Error s -> MetaString s+ Success jm' -> MetaMap $ jsonMetaToMeta jm'+ valueToMetaValue x@(Array{}) =+ case fromJSON x of+ Error s -> MetaString s+ Success xs -> MetaList $ map valueToMetaValue xs+ valueToMetaValue (Bool b) = MetaBool b+ valueToMetaValue (String t) = MetaString (T.unpack t)+ valueToMetaValue (Number n) = MetaString (show n)+ valueToMetaValue Aeson.Null = MetaString ""++jsonMetaToPairs :: JSONMeta -> [(String, String)]+jsonMetaToPairs = M.toList . M.mapMaybe+ (\case+ MetaString s -> Just s+ MetaBool True -> Just "true"+ MetaBool False -> Just "false"+ -- for now we skip complex cell metadata:+ _ -> Nothing) . jsonMetaToMeta
@@ -1448,11 +1448,14 @@ skipMany opt fs <- (map (T.unpack . removeDoubleQuotes . T.strip) . T.splitOn "," . untokenize) <$> braced- let fs' = if name == "usepackage"- then map (maybeAddExtension ".sty") fs- else map (maybeAddExtension ".tex") fs+ let addExt f = case takeExtension f of+ ".tex" -> f+ ".sty" -> f+ -- note, we can have cc_by_4.0 for example...+ _ | name == "usepackage" -> addExtension f ".sty"+ | otherwise -> addExtension f ".tex" dirs <- (splitBy (==':') . fromMaybe ".") <$> lookupEnv "TEXINPUTS"- mapM_ (insertIncluded dirs) fs'+ mapM_ (insertIncluded dirs) (map addExt fs) return mempty insertIncluded :: PandocMonad m@@ -1474,12 +1477,6 @@ getInput >>= setInput . (tokenize f (T.pack contents) ++) updateState dropLatestIncludeFile -maybeAddExtension :: String -> FilePath -> FilePath-maybeAddExtension ext fp =- if null (takeExtension fp)- then addExtension fp ext- else fp- addMeta :: PandocMonad m => ToMetaValue a => String -> a -> LP m () addMeta field val = updateState $ \st -> st{ sMeta = addMetaField field val $ sMeta st }@@ -1557,6 +1554,7 @@ Tok _ (CtrlSeq mtype) _ <- controlSeq "newcommand" <|> controlSeq "renewcommand" <|> controlSeq "providecommand" <|>+ controlSeq "DeclareMathOperator" <|> controlSeq "DeclareRobustCommand" withVerbatimMode $ do Tok _ (CtrlSeq name) txt <- do@@ -1569,7 +1567,16 @@ spaces optarg <- option Nothing $ Just <$> try bracketedToks spaces- contents <- bracedOrToken+ contents' <- bracedOrToken+ let contents =+ case mtype of+ "DeclareMathOperator" ->+ Tok pos (CtrlSeq "mathop") "\\mathop"+ : Tok pos (CtrlSeq "mathrm") "\\mathrm"+ : Tok pos Symbol "{"+ : (contents' +++ [ Tok pos Symbol "}" ])+ _ -> contents' when (mtype == "newcommand") $ do macros <- sMacros <$> getState case M.lookup name macros of@@ -1758,8 +1765,10 @@ addMeta "bibliography" . splitBibs . toksToString)) , ("addbibresource", mempty <$ (skipopts *> braced >>= addMeta "bibliography" . splitBibs . toksToString))+ , ("endinput", mempty <$ skipMany tok) -- includes , ("lstinputlisting", inputListing)+ , ("inputminted", inputMinted) , ("graphicspath", graphicsPath) -- polyglossia , ("setdefaultlanguage", setDefaultLanguage)@@ -1812,8 +1821,7 @@ , ("enumerate", orderedList') , ("alltt", alltt <$> env "alltt" blocks) , ("code", guardEnabled Ext_literate_haskell *>- (codeBlockWith ("",["sourceCode","literate","haskell"],[]) <$>- verbEnv "code"))+ (codeBlockWith ("",["haskell","literate"],[]) <$> verbEnv "code")) , ("comment", mempty <$ verbEnv "comment") , ("verbatim", codeBlock <$> verbEnv "verbatim") , ("Verbatim", fancyverbEnv "Verbatim")@@ -1918,6 +1926,11 @@ minted :: PandocMonad m => LP m Blocks minted = do+ attr <- mintedAttr+ codeBlockWith attr <$> verbEnv "minted"++mintedAttr :: PandocMonad m => LP m Attr+mintedAttr = do options <- option [] keyvals lang <- toksToString <$> braced let kvs = [ (if k == "firstnumber"@@ -1926,8 +1939,21 @@ let classes = [ lang | not (null lang) ] ++ [ "numberLines" | lookup "linenos" options == Just "true" ]- let attr = ("",classes,kvs)- codeBlockWith attr <$> verbEnv "minted"+ return ("",classes,kvs)++inputMinted :: PandocMonad m => LP m Blocks+inputMinted = do+ pos <- getPosition+ attr <- mintedAttr+ f <- filter (/='"') . toksToString <$> braced+ dirs <- (splitBy (==':') . fromMaybe ".") <$> lookupEnv "TEXINPUTS"+ mbCode <- readFileFromDirs dirs f+ rawcode <- case mbCode of+ Just s -> return s+ Nothing -> do+ report $ CouldNotLoadIncludeFile f pos+ return []+ return $ B.codeBlockWith attr rawcode letterContents :: PandocMonad m => LP m Blocks letterContents = do
@@ -131,7 +131,6 @@ , sQuoteContext :: QuoteContext , sMacros :: M.Map Text Macro , sContainers :: [String]- , sHeaders :: M.Map Inlines String , sLogMessages :: [LogMessage] , sIdentifiers :: Set.Set String , sVerbatimMode :: Bool@@ -153,7 +152,6 @@ , sQuoteContext = NoQuote , sMacros = M.empty , sContainers = []- , sHeaders = M.empty , sLogMessages = [] , sIdentifiers = Set.empty , sVerbatimMode = False@@ -191,10 +189,6 @@ getIncludeFiles = sContainers addIncludeFile f s = s{ sContainers = f : sContainers s } dropLatestIncludeFile s = s { sContainers = drop 1 $ sContainers s }--instance HasHeaderMap LaTeXState where- extractHeaderMap = sHeaders- updateHeaderMap f st = st{ sHeaders = f $ sHeaders st } instance HasMacros LaTeXState where extractMacros st = sMacros st
@@ -49,7 +49,7 @@ import Text.Pandoc.Options import Text.Pandoc.Parsing import Text.Pandoc.Walk (query)-import Text.Pandoc.Shared (crFilter)+import Text.Pandoc.Shared (crFilter, mapLeft) import Text.Pandoc.Readers.Roff -- TODO explicit imports import Text.Parsec hiding (tokenPrim) import qualified Text.Parsec as Parsec@@ -87,11 +87,6 @@ let leftF = PandocParsecError . intercalate "\n" $ show <$> input in mapLeft leftF `liftM` runParserT parser state "source" input -mapLeft :: (a -> c) -> Either a b -> Either c b-mapLeft f (Left x) = Left $ f x-mapLeft _ (Right r) = Right r-- parseMan :: PandocMonad m => ManParser m Pandoc parseMan = do bs <- many parseBlock <* eof@@ -109,7 +104,7 @@ , parseBlockQuote , parseNewParagraph , parsePara- , skipUnkownMacro+ , skipUnknownMacro ] parseTable :: PandocMonad m => ManParser m Blocks@@ -512,8 +507,8 @@ [] -> mempty (x:_) -> linePartsToInlines x -skipUnkownMacro :: PandocMonad m => ManParser m Blocks-skipUnkownMacro = do+skipUnknownMacro :: PandocMonad m => ManParser m Blocks+skipUnknownMacro = do tok <- mmacroAny case tok of ControlLine mkind _ pos -> do
@@ -748,9 +748,9 @@ lhsCodeBlock :: PandocMonad m => MarkdownParser m (F Blocks) lhsCodeBlock = do guardEnabled Ext_literate_haskell- (return . B.codeBlockWith ("",["sourceCode","literate","haskell"],[]) <$>+ (return . B.codeBlockWith ("",["haskell","literate"],[]) <$> (lhsCodeBlockBird <|> lhsCodeBlockLaTeX))- <|> (return . B.codeBlockWith ("",["sourceCode","haskell"],[]) <$>+ <|> (return . B.codeBlockWith ("",["haskell"],[]) <$> lhsCodeBlockInverseBird) lhsCodeBlockLaTeX :: PandocMonad m => MarkdownParser m String@@ -958,7 +958,8 @@ let raw = concat (first:continuations) contents <- parseFromString' parseBlocks raw updateState (\st -> st {stateParserContext = oldContext})- return contents+ exts <- getOption readerExtensions+ return $ B.fromList . taskListItemFromAscii exts . B.toList <$> contents orderedList :: PandocMonad m => MarkdownParser m (F Blocks) orderedList = try $ do@@ -1105,9 +1106,8 @@ htmlBlock = do guardEnabled Ext_raw_html try (do- (TagOpen t attrs) <- lookAhead $ fst <$> htmlTag isBlockTag- (guard (t `elem` ["pre","style","script"]) >>- (return . B.rawBlock "html") <$> rawVerbatimBlock)+ (TagOpen _ attrs) <- lookAhead $ fst <$> htmlTag isBlockTag+ (return . B.rawBlock "html") <$> rawVerbatimBlock <|> (do guardEnabled Ext_markdown_attribute oldMarkdownAttribute <- stateMarkdownAttribute <$> getState markdownAttribute <-@@ -1140,10 +1140,11 @@ rawVerbatimBlock :: PandocMonad m => MarkdownParser m String rawVerbatimBlock = htmlInBalanced isVerbTag- where isVerbTag (TagOpen "pre" _) = True- isVerbTag (TagOpen "style" _) = True- isVerbTag (TagOpen "script" _) = True- isVerbTag _ = False+ where isVerbTag (TagOpen "pre" _) = True+ isVerbTag (TagOpen "style" _) = True+ isVerbTag (TagOpen "script" _) = True+ isVerbTag (TagOpen "textarea" _) = True+ isVerbTag _ = False rawTeXBlock :: PandocMonad m => MarkdownParser m (F Blocks) rawTeXBlock = do
@@ -43,7 +43,6 @@ import Data.Char (isDigit, isSpace) import qualified Data.Foldable as F import Data.List (intercalate, intersperse, isPrefixOf)-import qualified Data.Map as M import Data.Maybe (fromMaybe, maybeToList) import Data.Sequence (ViewL (..), viewl, (<|)) import qualified Data.Set as Set@@ -72,7 +71,6 @@ , mwMaxNestingLevel = 4 , mwNextLinkNumber = 1 , mwCategoryLinks = []- , mwHeaderMap = M.empty , mwIdentifierList = Set.empty , mwLogMessages = [] , mwInTT = False@@ -86,7 +84,6 @@ , mwMaxNestingLevel :: Int , mwNextLinkNumber :: Int , mwCategoryLinks :: [Inlines]- , mwHeaderMap :: M.Map Inlines String , mwIdentifierList :: Set.Set String , mwLogMessages :: [LogMessage] , mwInTT :: Bool@@ -97,10 +94,6 @@ instance HasReaderOptions MWState where extractReaderOptions = mwOptions -instance HasHeaderMap MWState where- extractHeaderMap = mwHeaderMap- updateHeaderMap f st = st{ mwHeaderMap = f $ mwHeaderMap st }- instance HasIdentifierList MWState where extractIdentifierList = mwIdentifierList updateIdentifierList f st = st{ mwIdentifierList = f $ mwIdentifierList st }@@ -418,8 +411,13 @@ lev <- length <$> many1 (char '=') guard $ lev <= 6 contents <- trimInlines . mconcat <$> manyTill inline (count lev $ char '=')- attr <- registerHeader nullAttr contents+ attr <- modifyIdentifier <$> registerHeader nullAttr contents return $ B.headerWith attr lev contents++-- See #4731:+modifyIdentifier :: Attr -> Attr+modifyIdentifier (ident,cl,kv) = (ident',cl,kv)+ where ident' = map (\c -> if c == '-' then '_' else c) ident bulletList :: PandocMonad m => MWParser m Blocks bulletList = B.bulletList <$>
@@ -74,7 +74,6 @@ data MuseState = MuseState { museMeta :: F Meta -- ^ Document metadata , museOptions :: ReaderOptions- , museHeaders :: M.Map Inlines String -- ^ List of headers and ids (used for implicit ref links) , museIdentifierList :: Set.Set String , museLastSpacePos :: Maybe SourcePos -- ^ Position after last space or newline parsed , museLastStrPos :: Maybe SourcePos -- ^ Position after last str parsed@@ -85,7 +84,6 @@ instance Default MuseState where def = MuseState { museMeta = return nullMeta , museOptions = def- , museHeaders = M.empty , museIdentifierList = Set.empty , museLastStrPos = Nothing , museLastSpacePos = Nothing@@ -107,10 +105,6 @@ instance HasReaderOptions MuseState where extractReaderOptions = museOptions--instance HasHeaderMap MuseState where- extractHeaderMap = museHeaders- updateHeaderMap f st = st{ museHeaders = f $ museHeaders st } instance HasIdentifierList MuseState where extractIdentifierList = museIdentifierList
@@ -62,7 +62,6 @@ import Control.Applicative hiding (liftA, liftA2, liftA3) import Control.Arrow -import Data.Char (isDigit) import Data.Default import qualified Data.Foldable as F import Data.List (unfoldr)@@ -72,6 +71,8 @@ import qualified Text.XML.Light as XML +import Text.Pandoc.Shared (safeRead)+ import Text.Pandoc.Readers.Odt.Arrows.Utils import Text.Pandoc.Readers.Odt.Generic.Fallible@@ -576,11 +577,7 @@ toListLevelStyle _ p s LinfNone b = ListLevelStyle LltBullet p s LinfNone (startValue b) toListLevelStyle _ p s f@(LinfString _) b = ListLevelStyle LltBullet p s f (startValue b) toListLevelStyle t p s f b = ListLevelStyle t p s f (startValue b)- startValue (Just "") = 1- startValue (Just v) = if all isDigit v- then read v- else 1- startValue Nothing = 1+ startValue mbx = fromMaybe 1 (mbx >>= safeRead) -- chooseMostSpecificListLevelStyle :: S.Set ListLevelStyle -> Maybe ListLevelStyle
@@ -34,7 +34,8 @@ import Prelude import Text.Pandoc.Readers.Org.BlockStarts-import Text.Pandoc.Readers.Org.DocumentTree (documentTree, headlineToBlocks)+import Text.Pandoc.Readers.Org.DocumentTree (documentTree,+ unprunedHeadlineToBlocks) import Text.Pandoc.Readers.Org.Inlines import Text.Pandoc.Readers.Org.Meta (metaExport, metaKey, metaLine) import Text.Pandoc.Readers.Org.ParserState@@ -64,11 +65,10 @@ -- | Get a list of blocks. blockList :: PandocMonad m => OrgParser m [Block] blockList = do- headlines <- documentTree blocks inline+ fHeadlineTree <- documentTree blocks inline st <- getState- headlineBlocks <- headlineToBlocks $ runF headlines st- -- ignore first headline, it's the document's title- return . drop 1 . B.toList $ headlineBlocks+ let headlineTree = runF fHeadlineTree st+ unprunedHeadlineToBlocks headlineTree st -- | Get the meta information saved in the state. meta :: Monad m => OrgParser m Meta@@ -547,10 +547,10 @@ shiftHeader :: Int -> Block -> Block shiftHeader shift blk =- if shift <= 0- then blk- else case blk of- (Header lvl attr content) -> Header (lvl - shift) attr content+ case blk of+ (Header lvl attr content)+ | lvl - shift > 0 -> Header (lvl - shift) attr content+ | otherwise -> Para content _ -> blk rawExportLine :: PandocMonad m => OrgParser m Blocks
@@ -28,7 +28,7 @@ -} module Text.Pandoc.Readers.Org.DocumentTree ( documentTree- , headlineToBlocks+ , unprunedHeadlineToBlocks ) where import Prelude@@ -36,6 +36,7 @@ import Control.Monad (guard, void) import Data.Char (toLower, toUpper) import Data.List (intersperse)+import Data.Maybe (mapMaybe) import Text.Pandoc.Builder (Blocks, Inlines) import Text.Pandoc.Class (PandocMonad) import Text.Pandoc.Definition@@ -154,6 +155,22 @@ let tag = orgTagWord <* char ':' in map toTag <$> (skipSpaces *> char ':' *> many1 tag <* skipSpaces) +unprunedHeadlineToBlocks :: Monad m => Headline -> OrgParserState -> OrgParser m [Block]+unprunedHeadlineToBlocks hdln st =+ let usingSelectedTags = docContainsSelectTags hdln st+ rootNode = if not usingSelectedTags+ then hdln+ else includeRootAndSelected hdln st+ rootNode' = removeExplicitlyExcludedNodes rootNode st+ in if not usingSelectedTags ||+ any (`Set.member` orgStateSelectTags st) (headlineTags rootNode')+ then do headlineBlocks <- headlineToBlocks rootNode'+ -- ignore first headline, it's the document's title+ return . drop 1 . B.toList $ headlineBlocks+ else do headlineBlocks <- mconcat <$> mapM headlineToBlocks+ (headlineChildren rootNode')+ return . B.toList $ headlineBlocks+ -- | Convert an Org mode headline (i.e. a document tree) into pandoc's Blocks headlineToBlocks :: Monad m => Headline -> OrgParser m Blocks headlineToBlocks hdln = do@@ -161,17 +178,46 @@ let tags = headlineTags hdln let text = headlineText hdln let level = headlineLevel hdln- shouldNotExport <- hasDoNotExportTag tags case () of- _ | shouldNotExport -> return mempty _ | any isArchiveTag tags -> archivedHeadlineToBlocks hdln _ | isCommentTitle text -> return mempty _ | maxLevel <= level -> headlineToHeaderWithList hdln _ | otherwise -> headlineToHeaderWithContents hdln -hasDoNotExportTag :: Monad m => [Tag] -> OrgParser m Bool-hasDoNotExportTag tags = containsExcludedTag . orgStateExcludedTags <$> getState- where containsExcludedTag s = any (`Set.member` s) tags+removeExplicitlyExcludedNodes :: Headline -> OrgParserState -> Headline+removeExplicitlyExcludedNodes hdln st =+ hdln { headlineChildren =+ [removeExplicitlyExcludedNodes childHdln st |+ childHdln <- headlineChildren hdln,+ not $ headlineContainsExcludeTags childHdln st] }++includeRootAndSelected :: Headline -> OrgParserState -> Headline+includeRootAndSelected hdln st =+ hdln { headlineChildren = mapMaybe (`includeAncestorsAndSelected` st)+ (headlineChildren hdln)}++docContainsSelectTags :: Headline -> OrgParserState -> Bool+docContainsSelectTags hdln st =+ headlineContainsSelectTags hdln st ||+ any (`docContainsSelectTags` st) (headlineChildren hdln)++includeAncestorsAndSelected :: Headline -> OrgParserState -> Maybe Headline+includeAncestorsAndSelected hdln st =+ if headlineContainsSelectTags hdln st+ then Just hdln+ else let children = mapMaybe (`includeAncestorsAndSelected` st)+ (headlineChildren hdln)+ in case children of+ [] -> Nothing+ _ -> Just $ hdln { headlineChildren = children }++headlineContainsSelectTags :: Headline -> OrgParserState -> Bool+headlineContainsSelectTags hdln st =+ any (`Set.member` orgStateSelectTags st) (headlineTags hdln)++headlineContainsExcludeTags :: Headline -> OrgParserState -> Bool+headlineContainsExcludeTags hdln st =+ any (`Set.member` orgStateExcludeTags st) (headlineTags hdln) isArchiveTag :: Tag -> Bool isArchiveTag = (== toTag "ARCHIVE")
@@ -432,21 +432,28 @@ explicitOrImageLink = try $ do char '[' srcF <- applyCustomLinkFormat =<< possiblyEmptyLinkTarget- title <- enclosedRaw (char '[') (char ']')- title' <- parseFromString (mconcat <$> many inline) title+ descr <- enclosedRaw (char '[') (char ']')+ titleF <- parseFromString (mconcat <$> many inline) descr char ']' return $ do src <- srcF- case cleanLinkString title of+ title <- titleF+ case cleanLinkString descr of Just imgSrc | isImageFilename imgSrc ->- pure . B.link src "" $ B.image imgSrc mempty mempty+ return . B.link src "" $ B.image imgSrc mempty mempty _ ->- linkToInlinesF src =<< title'+ linkToInlinesF src title selflinkOrImage :: PandocMonad m => OrgParser m (F Inlines) selflinkOrImage = try $ do- src <- char '[' *> linkTarget <* char ']'- return $ linkToInlinesF src (B.str src)+ target <- char '[' *> linkTarget <* char ']'+ case cleanLinkString target of+ Nothing -> case target of+ '#':_ -> returnF $ B.link target "" (B.str target)+ _ -> return $ internalLink target (B.str target)+ Just nonDocTgt -> if isImageFilename nonDocTgt+ then returnF $ B.image nonDocTgt "" ""+ else returnF $ B.link nonDocTgt "" (B.str target) plainLink :: PandocMonad m => OrgParser m (F Inlines) plainLink = try $ do@@ -481,10 +488,8 @@ "" -> pure . B.link mempty "" -- wiki link (empty by convention) ('#':_) -> pure . B.link linkStr "" -- document-local fraction _ -> case cleanLinkString linkStr of- (Just cleanedLink) -> if isImageFilename cleanedLink- then const . pure $ B.image cleanedLink "" ""- else pure . B.link cleanedLink ""- Nothing -> internalLink linkStr -- other internal link+ Just extTgt -> return . B.link extTgt ""+ Nothing -> internalLink linkStr -- other internal link internalLink :: String -> Inlines -> F Inlines internalLink link title = do@@ -530,7 +535,7 @@ let attrClasses = [translateLang lang] let attrKeyVal = originalLang lang <> opts let codeInlineBlck = B.codeWith ("", attrClasses, attrKeyVal) inlineCode- returnF $ (if exportsCode opts then codeInlineBlck else mempty)+ returnF $ if exportsCode opts then codeInlineBlck else mempty where inlineBlockOption :: PandocMonad m => OrgParser m (String, String) inlineBlockOption = try $ do@@ -739,7 +744,7 @@ rest m cs = (\x -> (minus1 <$> m, cs ++ x ++ "\n")) <$> try (manyTill p newline) finalLine = try $ manyTill p end minus1 k = k - 1- oneOrMore cs = guard (not $ null cs) *> return cs+ oneOrMore cs = cs <$ guard (not $ null cs) -- Org allows customization of the way it reads emphasis. We use the defaults -- here (see, e.g., the Emacs Lisp variable `org-emphasis-regexp-components`
@@ -159,7 +159,8 @@ "seq_todo" -> todoSequence >>= updateState . registerTodoSequence "typ_todo" -> todoSequence >>= updateState . registerTodoSequence "macro" -> macroDefinition >>= updateState . registerMacro- "exclude_tags" -> excludedTagList >>= updateState . setExcludedTags+ "exclude_tags" -> tagList >>= updateState . setExcludedTags+ "select_tags" -> tagList >>= updateState . setSelectedTags "pandoc-emphasis-pre" -> emphChars >>= updateState . setEmphasisPreChar "pandoc-emphasis-post" -> emphChars >>= updateState . setEmphasisPostChar _ -> mzero@@ -192,18 +193,25 @@ rest = manyTill anyChar (eof <|> () <$ oneOf "\n\r") tillSpecifier c = manyTill (noneOf "\n\r") (try $ string ('%':c:"")) -excludedTagList :: Monad m => OrgParser m [Tag]-excludedTagList = do+tagList :: Monad m => OrgParser m [Tag]+tagList = do skipSpaces map Tag <$> many (orgTagWord <* skipSpaces) <* newline setExcludedTags :: [Tag] -> OrgParserState -> OrgParserState-setExcludedTags tagList st =- let finalSet = if orgStateExcludedTagsChanged st- then foldr Set.insert (orgStateExcludedTags st) tagList- else Set.fromList tagList- in st { orgStateExcludedTags = finalSet, orgStateExcludedTagsChanged = True }+setExcludedTags tags st =+ let finalSet = if orgStateExcludeTagsChanged st+ then foldr Set.insert (orgStateExcludeTags st) tags+ else Set.fromList tags+ in st { orgStateExcludeTags = finalSet, orgStateExcludeTagsChanged = True } +setSelectedTags :: [Tag] -> OrgParserState -> OrgParserState+setSelectedTags tags st =+ let finalSet = if orgStateSelectTagsChanged st+ then foldr Set.insert (orgStateSelectTags st) tags+ else Set.fromList tags+ in st { orgStateSelectTags = finalSet, orgStateSelectTagsChanged = True }+ setEmphasisPreChar :: Maybe [Char] -> OrgParserState -> OrgParserState setEmphasisPreChar csMb st = let preChars = fromMaybe (orgStateEmphasisPostChars defaultOrgParserState) csMb@@ -265,7 +273,7 @@ return (macroName, expander) where placeholder :: Monad m => OrgParser m Int- placeholder = try . fmap read $ char '$' *> many1 digit+ placeholder = try . fmap (fromMaybe 1 . safeRead) $ char '$' *> many1 digit expansionPart :: Monad m => OrgParser m String expansionPart = try $ many (notFollowedBy placeholder *> noneOf "\n\r")
@@ -64,11 +64,11 @@ import qualified Data.Set as Set import Data.Text (Text) -import Text.Pandoc.Builder (Blocks, Inlines)+import Text.Pandoc.Builder (Blocks) import Text.Pandoc.Definition (Meta (..), nullMeta) import Text.Pandoc.Logging import Text.Pandoc.Options (ReaderOptions (..))-import Text.Pandoc.Parsing (Future, HasHeaderMap (..), HasIdentifierList (..),+import Text.Pandoc.Parsing (Future, HasIdentifierList (..), HasIncludeFiles (..), HasLastStrPosition (..), HasLogMessages (..), HasMacros (..), HasQuoteContext (..), HasReaderOptions (..),@@ -117,10 +117,9 @@ -- specified here. , orgStateEmphasisPostChars :: [Char] -- ^ Chars allowed at after emphasis , orgStateEmphasisNewlines :: Maybe Int- , orgStateExcludedTags :: Set.Set Tag- , orgStateExcludedTagsChanged :: Bool+ , orgStateExcludeTags :: Set.Set Tag+ , orgStateExcludeTagsChanged :: Bool , orgStateExportSettings :: ExportSettings- , orgStateHeaderMap :: M.Map Inlines String , orgStateIdentifiers :: Set.Set String , orgStateIncludeFiles :: [String] , orgStateLastForbiddenCharPos :: Maybe SourcePos@@ -133,6 +132,8 @@ , orgStateNotes' :: OrgNoteTable , orgStateOptions :: ReaderOptions , orgStateParserContext :: ParserContext+ , orgStateSelectTags :: Set.Set Tag+ , orgStateSelectTagsChanged :: Bool , orgStateTodoSequences :: [TodoSequence] , orgLogMessages :: [LogMessage] , orgMacros :: M.Map Text Macro@@ -160,10 +161,6 @@ extractIdentifierList = orgStateIdentifiers updateIdentifierList f s = s{ orgStateIdentifiers = f (orgStateIdentifiers s) } -instance HasHeaderMap OrgParserState where- extractHeaderMap = orgStateHeaderMap- updateHeaderMap f s = s{ orgStateHeaderMap = f (orgStateHeaderMap s) }- instance HasLogMessages OrgParserState where addLogMessage msg st = st{ orgLogMessages = msg : orgLogMessages st } getLogMessages st = reverse $ orgLogMessages st@@ -189,9 +186,8 @@ , orgStateEmphasisCharStack = [] , orgStateEmphasisNewlines = Nothing , orgStateExportSettings = def- , orgStateExcludedTags = Set.singleton $ Tag "noexport"- , orgStateExcludedTagsChanged = False- , orgStateHeaderMap = M.empty+ , orgStateExcludeTags = Set.singleton $ Tag "noexport"+ , orgStateExcludeTagsChanged = False , orgStateIdentifiers = Set.empty , orgStateIncludeFiles = [] , orgStateLastForbiddenCharPos = Nothing@@ -204,6 +200,8 @@ , orgStateNotes' = [] , orgStateOptions = def , orgStateParserContext = NullState+ , orgStateSelectTags = Set.singleton $ Tag "export"+ , orgStateSelectTagsChanged = False , orgStateTodoSequences = [] , orgLogMessages = [] , orgMacros = M.empty
@@ -61,8 +61,7 @@ '.':'.':'/':_ -> Just s -- relative path -- Relative path or URL (file schema) 'f':'i':'l':'e':':':s' -> Just $ if "//" `isPrefixOf` s' then s else s'- _ | isUrl s -> Just s -- URL- _ -> Nothing+ _ -> if isUrl s then Just s else Nothing where isUrl :: String -> Bool isUrl cs =
@@ -39,9 +39,9 @@ import Control.Monad.Identity (Identity (..)) import Data.Char (isHexDigit, isSpace, toLower, toUpper, isAlphaNum) import Data.List (deleteFirstsBy, elemIndex, intercalate, isInfixOf, isSuffixOf,- nub, sort, transpose, union)+ nub, sort, transpose) import qualified Data.Map as M-import Data.Maybe (fromMaybe, isJust)+import Data.Maybe (fromMaybe) import Data.Sequence (ViewR (..), viewr) import Data.Text (Text) import qualified Data.Text as T@@ -179,7 +179,6 @@ st' <- getState let reversedNotes = stateNotes st' updateState $ \s -> s { stateNotes = reverse reversedNotes- , stateHeaders = mempty , stateIdentifiers = mempty } -- now parse it for real... blocks <- B.toList <$> parseBlocks@@ -422,7 +421,7 @@ optional codeBlockStart lns <- latexCodeBlock <|> birdCodeBlock blanklines- return $ B.codeBlockWith ("", ["sourceCode", "literate", "haskell"], [])+ return $ B.codeBlockWith ("", ["haskell","literate"], []) $ intercalate "\n" lns latexCodeBlock :: Monad m => ParserT [Char] st m [[Char]]@@ -504,12 +503,9 @@ case lookup "code" fields of Just lang -> do let numberLines = lookup "number-lines" fields- let classes = trimr lang : ["numberLines" | isJust numberLines] ++- maybe [] words (lookup "class" fields)- let kvs = maybe [] (\n -> [("startFrom", trimr n)]) numberLines+ let classes = maybe [] words (lookup "class" fields) let ident = maybe "" trimr $ lookup "name" fields- let attribs = (ident, classes, kvs)- return $ B.codeBlockWith attribs contents'+ codeblock ident classes numberLines (trimr lang) contents' False Nothing -> case lookup "literal" fields of Just _ -> return $ B.rawBlock "rst" contents' Nothing -> do@@ -738,9 +734,9 @@ case trim top of "" -> stateRstDefaultRole def role -> role })- x | x == "code" || x == "code-block" ->+ x | x == "code" || x == "code-block" || x == "sourcecode" -> codeblock name classes- (lookup "number-lines" fields) (trim top) body+ (lookup "number-lines" fields) (trim top) body True "aafig" -> do let attribs = (name, ["aafig"], map (second trimr) fields) return $ B.codeBlockWith attribs $ stripTrailingNewlines body@@ -991,18 +987,21 @@ then "\\begin{aligned}\n" ++ s ++ "\n\\end{aligned}" else s -codeblock :: String -> [String] -> Maybe String -> String -> String+codeblock :: String -> [String] -> Maybe String -> String -> String -> Bool -> RSTParser m Blocks-codeblock ident classes numberLines lang body =- return $ B.codeBlockWith attribs $ stripTrailingNewlines body- where attribs = (ident, classes', kvs)- classes' = "sourceCode" : lang+codeblock ident classes numberLines lang body rmTrailingNewlines =+ return $ B.codeBlockWith attribs $ stripTrailingNewlines' body+ where stripTrailingNewlines' = if rmTrailingNewlines+ then stripTrailingNewlines+ else id+ attribs = (ident, classes', kvs)+ classes' = lang : maybe [] (const ["numberLines"]) numberLines ++ classes- kvs = case numberLines of- Just "" -> []- Nothing -> []- Just n -> [("startFrom",trim n)]+ kvs = maybe [] (\n -> case trimr n of+ [] -> []+ xs -> [("startFrom", xs)])+ numberLines --- --- note block@@ -1415,7 +1414,7 @@ "title-reference" -> titleRef contents "title" -> titleRef contents "t" -> titleRef contents- "code" -> return $ B.codeWith (addClass "sourceCode" attr) contents+ "code" -> return $ B.codeWith attr contents "span" -> return $ B.spanWith attr $ treatAsText contents "raw" -> return $ B.rawInline (fromMaybe "" fmt) contents custom -> do@@ -1438,9 +1437,6 @@ handleEscapes ('\\':' ':cs) = handleEscapes cs handleEscapes ('\\':c:cs) = c : handleEscapes cs handleEscapes (c:cs) = c : handleEscapes cs--addClass :: String -> Attr -> Attr-addClass c (ident, classes, keyValues) = (ident, classes `union` [c], keyValues) roleName :: PandocMonad m => RSTParser m String roleName = many1 (letter <|> char '-')
@@ -424,7 +424,9 @@ strongAndEmph = try $ B.emph . B.strong <$> enclosed (string "__") nestedInlines emph :: PandocMonad m => TWParser m B.Inlines-emph = try $ B.emph <$> enclosed (char '_') nestedInlines+emph = try $ B.emph <$> enclosed (char '_')+ (\p -> notFollowedBy (char '|') >> nestedInlines p)+-- emphasis closers can't cross table cell boundaries, see #3921 emphHtml :: PandocMonad m => TWParser m B.Inlines emphHtml = B.emph . mconcat <$> (parseHtmlContent "em" inline <|> parseHtmlContent "i" inline)
@@ -32,7 +32,7 @@ import Text.Pandoc.Logging (Verbosity (..)) import Text.Pandoc.Options import Text.Pandoc.Parsing hiding (enclosed, nested)-import Text.Pandoc.Shared (crFilter)+import Text.Pandoc.Shared (crFilter, safeRead) import Text.Pandoc.XML (fromEntities) import Text.Printf (printf) @@ -500,9 +500,12 @@ escapedChar :: PandocMonad m => TikiWikiParser m B.Inlines escapedChar = try $ do string "~"- inner <- many1 $ oneOf "0123456789"+ mNumber <- safeRead <$> many1 digit string "~"- return $B.str [toEnum (read inner :: Int) :: Char]+ return $ B.str $+ case mNumber of+ Just number -> [toEnum (number :: Int) :: Char]+ Nothing -> [] -- UNSUPPORTED, as there doesn't seem to be any facility in calibre -- for this
@@ -53,7 +53,6 @@ , ('`', "\\[ga]") , ('^', "\\[ha]") , ('~', "\\[ti]")- , ('-', "\\-") -- minus; - will be interpreted as hyphen U+2010 , ('\\', "\\[rs]") , ('@', "\\[at]") -- because we use @ as a table and math delimiter , ('\x2026', "\\&...") -- because u2026 doesn't render on tty
@@ -250,7 +250,7 @@ getData mimetype src = do let ext = map toLower $ takeExtension src (raw, respMime) <- fetchItem src- let raw' = if ext == ".gz"+ let raw' = if ext `elem` [".gz", ".svgz"] then B.concat $ L.toChunks $ Gzip.decompress $ L.fromChunks [raw] else raw mime <- case (mimetype, respMime) of
@@ -79,6 +79,8 @@ headerShift, stripEmptyParagraphs, isTightList,+ taskListItemFromAscii,+ taskListItemToAscii, addMetaField, makeMeta, eastAsianLineBreakFilter,@@ -587,6 +589,36 @@ isTightList = all firstIsPlain where firstIsPlain (Plain _ : _) = True firstIsPlain _ = False++-- | Convert a list item containing tasklist syntax (e.g. @[x]@)+-- to using @U+2610 BALLOT BOX@ or @U+2612 BALLOT BOX WITH X@.+taskListItemFromAscii :: Extensions -> [Block] -> [Block]+taskListItemFromAscii = handleTaskListItem fromMd+ where+ fromMd (Str "[" : Space : Str "]" : Space : is) = (Str "☐") : Space : is+ fromMd (Str "[x]" : Space : is) = (Str "☒") : Space : is+ fromMd (Str "[X]" : Space : is) = (Str "☒") : Space : is+ fromMd is = is++-- | Convert a list item containing text starting with @U+2610 BALLOT BOX@+-- or @U+2612 BALLOT BOX WITH X@ to tasklist syntax (e.g. @[x]@).+taskListItemToAscii :: Extensions -> [Block] -> [Block]+taskListItemToAscii = handleTaskListItem toMd+ where+ toMd (Str "☐" : Space : is) = rawMd "[ ]" : Space : is+ toMd (Str "☒" : Space : is) = rawMd "[x]" : Space : is+ toMd is = is+ rawMd = RawInline (Format "markdown")++handleTaskListItem :: ([Inline] -> [Inline]) -> Extensions -> [Block] -> [Block]+handleTaskListItem handleInlines exts bls =+ if Ext_task_lists `extensionEnabled` exts+ then handleItem bls+ else bls+ where+ handleItem (Plain is : bs) = Plain (handleInlines is) : bs+ handleItem (Para is : bs) = Para (handleInlines is) : bs+ handleItem bs = bs -- | Set a field of a 'Meta' object. If the field already has a value, -- convert it into a list with the new value appended to the old value(s).
@@ -58,6 +58,7 @@ "docx" -> return "" "fb2" -> return "" "pptx" -> return ""+ "ipynb" -> return "" "odt" -> getDefaultTemplate "opendocument" "html" -> getDefaultTemplate "html5" "docbook" -> getDefaultTemplate "docbook5"
@@ -49,6 +49,7 @@ , writeEPUB2 , writeEPUB3 , writeFB2+ , writeIpynb , writeHaddock , writeHtml4 , writeHtml4String@@ -101,6 +102,7 @@ import Text.Pandoc.Writers.DokuWiki import Text.Pandoc.Writers.EPUB import Text.Pandoc.Writers.FB2+import Text.Pandoc.Writers.Ipynb import Text.Pandoc.Writers.Haddock import Text.Pandoc.Writers.HTML import Text.Pandoc.Writers.ICML@@ -132,7 +134,7 @@ writers :: PandocMonad m => [ ( String, Writer m) ] writers = [ ("native" , TextWriter writeNative)- ,("json" , TextWriter $ \o d -> return $ writeJSON o d)+ ,("json" , TextWriter $ \o d -> writeJSON o d) ,("docx" , ByteStringWriter writeDocx) ,("odt" , ByteStringWriter writeODT) ,("pptx" , ByteStringWriter writePowerpoint)@@ -140,6 +142,7 @@ ,("epub2" , ByteStringWriter writeEPUB2) ,("epub3" , ByteStringWriter writeEPUB3) ,("fb2" , TextWriter writeFB2)+ ,("ipynb" , TextWriter writeIpynb) ,("html" , TextWriter writeHtml5String) ,("html4" , TextWriter writeHtml4String) ,("html5" , TextWriter writeHtml5String)@@ -193,5 +196,5 @@ Just r -> Right (r, setExts $ getDefaultExtensions writerName) -writeJSON :: WriterOptions -> Pandoc -> Text-writeJSON _ = UTF8.toText . BL.toStrict . encode+writeJSON :: PandocMonad m => WriterOptions -> Pandoc -> m Text+writeJSON _ = return . UTF8.toText . BL.toStrict . encode
@@ -194,8 +194,7 @@ let contents' = if any isBlock blocks then "--" $$ contents $$ "--" else contents- let cols = offset contents'- let bar = text $ replicate cols '_'+ let bar = text "____" return $ bar $$ chomp contents' $$ bar <> blankline blockToAsciiDoc opts (Table caption aligns widths headers rows) = do caption' <- inlineListToAsciiDoc opts caption@@ -252,7 +251,7 @@ else 100000 let maxwidth = maximum $ map offset (head':rows') let body = if maxwidth > colwidth then vsep rows' else vcat rows'- let border = text $ "|" ++ replicate (max 5 (min maxwidth colwidth) - 1) '='+ let border = text "|===" return $ caption'' $$ tablespec $$ border $$ head'' $$ body $$ border $$ blankline blockToAsciiDoc opts (BulletList items) = do
@@ -46,7 +46,8 @@ import Text.Pandoc.Class (PandocMonad) import Text.Pandoc.Definition import Text.Pandoc.Options-import Text.Pandoc.Shared (isTightList, linesToPara, substitute, capitalize)+import Text.Pandoc.Shared (isTightList, taskListItemToAscii, linesToPara,+ substitute, capitalize, isHeaderBlock) import Text.Pandoc.Templates (renderTemplate') import Text.Pandoc.Walk (query, walk, walkM) import Text.Pandoc.Writers.HTML (writeHtml5String, tagWithAttributes)@@ -56,6 +57,12 @@ -- | Convert Pandoc to CommonMark. writeCommonMark :: PandocMonad m => WriterOptions -> Pandoc -> m Text writeCommonMark opts (Pandoc meta blocks) = do+ let headerBlocks = filter isHeaderBlock blocks+ toc <- if writerTableOfContents opts+ then blocksToCommonMark opts+ [ toTableOfContents opts headerBlocks ]+ else return mempty+ let (blocks', notes) = runState (walkM processNotes blocks) [] notes' = if null notes then []@@ -65,7 +72,12 @@ (blocksToCommonMark opts) (inlinesToCommonMark opts) meta- let context = defField "body" main metadata+ let context =+ -- for backwards compatibility we populate toc+ -- with the contents of the toc, rather than a boolean:+ defField "toc" toc+ $ defField "table-of-contents" toc+ $ defField "body" main metadata case writerTemplate opts of Nothing -> return main Just tpl -> renderTemplate' tpl context@@ -115,24 +127,28 @@ blockToNodes opts (LineBlock lns) ns = blockToNodes opts (linesToPara lns) ns blockToNodes _ (CodeBlock (_,classes,_) xs) ns = return (node (CODE_BLOCK (T.pack (unwords classes)) (T.pack xs)) [] : ns)-blockToNodes opts (RawBlock fmt xs) ns- | fmt == Format "html" && isEnabled Ext_raw_html opts+blockToNodes opts (RawBlock (Format f) xs) ns+ | f == "html" && isEnabled Ext_raw_html opts = return (node (HTML_BLOCK (T.pack xs)) [] : ns)- | (fmt == Format "latex" || fmt == Format "tex") && isEnabled Ext_raw_tex opts+ | (f == "latex" || f == "tex") && isEnabled Ext_raw_tex opts = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns)+ | f == "markdown"+ = return (node (CUSTOM_BLOCK (T.pack xs) T.empty) [] : ns) | otherwise = return ns blockToNodes opts (BlockQuote bs) ns = do nodes <- blocksToNodes opts bs return (node BLOCK_QUOTE nodes : ns) blockToNodes opts (BulletList items) ns = do- nodes <- mapM (blocksToNodes opts) items+ let exts = writerExtensions opts+ nodes <- mapM (blocksToNodes opts . taskListItemToAscii exts) items return (node (LIST ListAttributes{ listType = BULLET_LIST, listDelim = PERIOD_DELIM, listTight = isTightList items, listStart = 1 }) (map (node ITEM) nodes) : ns) blockToNodes opts (OrderedList (start, _sty, delim) items) ns = do- nodes <- mapM (blocksToNodes opts) items+ let exts = writerExtensions opts+ nodes <- mapM (blocksToNodes opts . taskListItemToAscii exts) items return (node (LIST ListAttributes{ listType = ORDERED_LIST, listDelim = case delim of@@ -247,7 +263,7 @@ inlineToNodes _ Space = (node (TEXT (T.pack " ")) [] :) inlineToNodes _ LineBreak = (node LINEBREAK [] :) inlineToNodes opts SoftBreak- | isEnabled Ext_hard_line_breaks opts = (node LINEBREAK [] :)+ | isEnabled Ext_hard_line_breaks opts = (node (TEXT " ") [] :) | writerWrapText opts == WrapNone = (node (TEXT " ") [] :) | otherwise = (node SOFTBREAK [] :) inlineToNodes opts (Emph xs) = (node EMPH (inlinesToNodes opts xs) :)@@ -292,10 +308,12 @@ inlineToNodes opts (Image alt ils (url,tit)) inlineToNodes opts (Image _ ils (url,tit)) = (node (IMAGE (T.pack url) (T.pack tit)) (inlinesToNodes opts ils) :)-inlineToNodes opts (RawInline fmt xs)- | fmt == Format "html" && isEnabled Ext_raw_html opts+inlineToNodes opts (RawInline (Format f) xs)+ | f == "html" && isEnabled Ext_raw_html opts = (node (HTML_INLINE (T.pack xs)) [] :)- | (fmt == Format "latex" || fmt == Format "tex") && isEnabled Ext_raw_tex opts+ | (f == "latex" || f == "tex") && isEnabled Ext_raw_tex opts+ = (node (CUSTOM_INLINE (T.pack xs) T.empty) [] :)+ | f == "markdown" = (node (CUSTOM_INLINE (T.pack xs) T.empty) [] :) | otherwise = id inlineToNodes opts (Quoted qt ils) =
@@ -234,11 +234,11 @@ -- Get the available area (converting the size and the margins to int and -- doing the difference- let pgContentWidth = (-) <$> (read <$> mbAttrSzWidth ::Maybe Integer)- <*> (- (+) <$> (read <$> mbAttrMarRight ::Maybe Integer)- <*> (read <$> mbAttrMarLeft ::Maybe Integer)- )+ let pgContentWidth = mbAttrSzWidth >>= safeRead+ >>= subtrct mbAttrMarRight+ >>= subtrct mbAttrMarLeft+ where+ subtrct mbStr = \x -> mbStr >>= safeRead >>= (\y -> Just $ x - y) -- styles mblang <- toLang $ getLang opts meta@@ -496,7 +496,17 @@ Just (MetaList xs) -> map stringify xs _ -> [] + -- docProps/core.xml let docPropsPath = "docProps/core.xml"+ let extraCoreProps = ["subject","lang","category","description"]+ let extraCorePropsMap = M.fromList $ zip extraCoreProps+ ["dc:subject","dc:language","cp:category","dc:description"]+ let lookupMetaString' :: String -> Meta -> String+ lookupMetaString' key' meta' =+ case key' of+ "description" -> intercalate "_x000d_\n" (map stringify $ lookupMetaBlocks "description" meta')+ _ -> lookupMetaString key' meta'+ let docProps = mknode "cp:coreProperties" [("xmlns:cp","http://schemas.openxmlformats.org/package/2006/metadata/core-properties") ,("xmlns:dc","http://purl.org/dc/elements/1.1/")@@ -505,14 +515,19 @@ ,("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance")] $ mknode "dc:title" [] (stringify $ docTitle meta) : mknode "dc:creator" [] (intercalate "; " (map stringify $ docAuthors meta))- : mknode "cp:keywords" [] (intercalate ", " keywords)+ : [ mknode (M.findWithDefault "" k extraCorePropsMap) [] (lookupMetaString' k meta)+ | k <- M.keys (unMeta meta), k `elem` extraCoreProps]+ ++ mknode "cp:keywords" [] (intercalate ", " keywords) : (\x -> [ mknode "dcterms:created" [("xsi:type","dcterms:W3CDTF")] x , mknode "dcterms:modified" [("xsi:type","dcterms:W3CDTF")] x ]) (formatTime defaultTimeLocale "%FT%XZ" utctime) let docPropsEntry = toEntry docPropsPath epochtime $ renderXml docProps + -- docProps/custom.xml let customProperties :: [(String, String)]- customProperties = [] -- FIXME+ customProperties = [(k, lookupMetaString k meta) | k <- M.keys (unMeta meta)+ , k `notElem` (["title", "author", "keywords"]+ ++ extraCoreProps)] let mkCustomProp (k, v) pid = mknode "property" [("fmtid","{D5CDD505-2E9C-101B-9397-08002B2CF9AE}") ,("pid", show pid)
@@ -130,9 +130,7 @@ let opt = if null txt then "" else "|" ++ if null tit then capt else tit ++ capt- -- Relative links fail isURI and receive a colon- prefix = if isURI src then "" else ":"- return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"+ return $ "{{" ++ src ++ imageDims opts attr ++ opt ++ "}}\n" blockToDokuWiki opts (Para inlines) = do indent <- asks stIndent@@ -516,9 +514,7 @@ ("", []) -> "" ("", _ ) -> "|" ++ alt' (_ , _ ) -> "|" ++ tit- -- Relative links fail isURI and receive a colon- prefix = if isURI source then "" else ":"- return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"+ return $ "{{" ++ source ++ imageDims opts attr ++ txt ++ "}}" inlineToDokuWiki opts (Note contents) = do contents' <- blockListToDokuWiki opts contents
@@ -416,7 +416,12 @@ -> WriterOptions -> Pandoc -> E m B.ByteString-pandocToEPUB version opts doc@(Pandoc meta _) = do+pandocToEPUB version opts doc = do+ -- handle pictures+ Pandoc meta blocks <- walkM (transformInline opts) doc >>=+ walkM transformBlock+ picEntries <- mapMaybe (snd . snd) <$> gets stMediaPaths+ epubSubdir <- gets stEpubSubdir let epub3 = version == EPUB3 let writeHtml o = fmap (UTF8.fromTextLazy . TL.fromStrict) .@@ -486,11 +491,6 @@ (Pandoc meta []) tpEntry <- mkEntry "text/title_page.xhtml" tpContent - -- handle pictures- -- mediaRef <- P.newIORef []- Pandoc _ blocks <- walkM (transformInline opts') doc >>=- walkM transformBlock- picEntries <- mapMaybe (snd . snd) <$> gets stMediaPaths -- handle fonts let matchingGlob f = do xs <- lift $ P.glob f@@ -814,6 +814,7 @@ let landmarks = if epub3 then [RawBlock (Format "html") $ ppElement $ unode "nav" ! [("epub:type","landmarks")+ ,("id","landmarks") ,("hidden","hidden")] $ [ unode "ol" $ [ unode "li"
@@ -266,7 +266,7 @@ then fmap renderHtml' <$> tableOfContents opts sects else return Nothing blocks' <- liftM (mconcat . intersperse (nl opts)) $- mapM (elementToHtml slideLevel opts) sects+ mapM (elementToHtml Nothing slideLevel opts) sects st <- get notes <- footnoteSection opts (reverse (stNotes st)) let thebody = blocks' >> notes@@ -365,6 +365,24 @@ => WriterOptions -> [Html] -> StateT WriterState m Html defList opts items = toList H.dl opts (items ++ [nl opts]) +listItemToHtml :: PandocMonad m+ => WriterOptions -> [Block] -> StateT WriterState m Html+listItemToHtml opts bls+ | Plain (Str "☐":Space:is) : bs <- bls = taskListItem False id is bs+ | Plain (Str "☒":Space:is) : bs <- bls = taskListItem True id is bs+ | Para (Str "☐":Space:is) : bs <- bls = taskListItem False H.p is bs+ | Para (Str "☒":Space:is) : bs <- bls = taskListItem True H.p is bs+ | otherwise = blockListToHtml opts bls+ where+ taskListItem checked constr is bs = do+ let checkbox = if checked+ then checkbox' ! A.checked ""+ else checkbox'+ checkbox' = H.input ! A.type_ "checkbox" ! A.disabled "" >> nl opts+ isContents <- inlineListToHtml opts is+ bsContents <- blockListToHtml opts bs+ return $ constr (checkbox >> isContents) >> bsContents+ -- | Construct table of contents from list of elements. tableOfContents :: PandocMonad m => WriterOptions -> [Element] -> StateT WriterState m (Maybe Html)@@ -417,12 +435,17 @@ deLink x = x -- | Convert an Element to Html.-elementToHtml :: PandocMonad m => Int -> WriterOptions -> Element+elementToHtml :: PandocMonad m => Maybe Int -> Int -> WriterOptions -> Element -> StateT WriterState m Html-elementToHtml _slideLevel opts (Blk block) = blockToHtml opts block-elementToHtml slideLevel opts (Sec level num (id',classes,keyvals) title' elements) = do+elementToHtml _ _ opts (Blk block) = blockToHtml opts block+elementToHtml mbparentlevel slideLevel opts+ (Sec level num (id',classes,keyvals) title' elements)+ = do slideVariant <- gets stSlideVariant- let slide = slideVariant /= NoSlides && level <= slideLevel+ let slide = slideVariant /= NoSlides &&+ (level <= slideLevel ||+ -- we're missing a header at slide level (see #5168)+ maybe False (< slideLevel) mbparentlevel) let num' = zipWith (+) num (writerNumberOffset opts ++ repeat 0) modify $ \st -> st{stSecNum = num'} -- update section number html5 <- gets stHtml5@@ -450,7 +473,7 @@ let inDiv xs = Blk (RawBlock (Format "html") ("<div class=\"" ++ fragmentClass ++ "\">")) : (xs ++ [Blk (RawBlock (Format "html") "</div>")])- innerContents <- mapM (elementToHtml slideLevel opts)+ innerContents <- mapM (elementToHtml (Just level) slideLevel opts) $ if titleSlide -- title slides have no content of their own then filter isSec elements@@ -473,6 +496,8 @@ secttag header' return $ (if slideVariant == RevealJsSlides && not (null innerContents)+ -- revealjs doesn't like more than one level of section nesting:+ && isNothing mbparentlevel then H5.section else id) $ mconcat $ t : innerContents else if writerSectionDivs opts || slide@@ -824,10 +849,10 @@ 6 -> H.h6 contents' _ -> H.p contents' blockToHtml opts (BulletList lst) = do- contents <- mapM (blockListToHtml opts) lst+ contents <- mapM (listItemToHtml opts) lst unordList opts contents blockToHtml opts (OrderedList (startnum, numstyle, _) lst) = do- contents <- mapM (blockListToHtml opts) lst+ contents <- mapM (listItemToHtml opts) lst html5 <- gets stHtml5 let numstyle' = case numstyle of Example -> "decimal"
@@ -21,7 +21,7 @@ import Control.Monad.Except (catchError) import Control.Monad.State.Strict import Data.List (intersperse, isInfixOf, isPrefixOf, stripPrefix)-import Data.Maybe (fromMaybe)+import Data.Maybe (fromMaybe, maybeToList) import qualified Data.Set as Set import Data.Text as Text (breakOnAll, pack) import Data.Text (Text)@@ -287,6 +287,9 @@ $ inTags False "BorderColor" [("type","enumeration")] (text "Black") $$ inTags False "Destination" [("type","object")] (text $ "HyperlinkURLDestination/"++escapeColons (escapeStringForXML url)) -- HyperlinkURLDestination with more than one colon crashes CS6 +-- | Key for specifying user-defined styles+dynamicStyleKey :: String+dynamicStyleKey = "custom-style" -- | Convert a list of Pandoc blocks to ICML. blocksToICML :: PandocMonad m => WriterOptions -> Style -> [Block] -> WS m Doc@@ -315,8 +318,11 @@ blockToICML opts style (OrderedList attribs lst) = listItemsToICML opts orderedListName style (Just attribs) lst blockToICML opts style (BulletList lst) = listItemsToICML opts bulletListName style Nothing lst blockToICML opts style (DefinitionList lst) = intersperseBrs `fmap` mapM (definitionListItemToICML opts style) lst-blockToICML opts style (Header lvl _ lst) =- let stl = (headerName ++ show lvl):style+blockToICML opts style (Header lvl (_, cls, _) lst) =+ let stl = (headerName ++ show lvl ++ unnumbered):style+ unnumbered = if "unnumbered" `elem` cls+ then " (unnumbered)"+ else "" in parStyle opts stl lst blockToICML _ _ HorizontalRule = return empty -- we could insert a page break instead blockToICML opts style (Table caption aligns widths headers rows) =@@ -362,7 +368,9 @@ , ("ColumnCount", show nrCols) ] (colDescs $$ cells) liftM2 ($$) tableDoc $ parStyle opts (tableCaptionName:style) caption-blockToICML opts style (Div _ lst) = blocksToICML opts style lst+blockToICML opts style (Div (_, _, kvs) lst) =+ let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs+ in blocksToICML opts (dynamicStyle <> style) lst blockToICML _ _ Null = return empty -- | Convert a list of lists of blocks to ICML list items.@@ -460,7 +468,9 @@ in (cont, newst) inlineToICML opts style (Image attr _ target) = imageICML opts style attr target inlineToICML opts style (Note lst) = footnoteToICML opts style lst-inlineToICML opts style (Span _ lst) = inlinesToICML opts style lst+inlineToICML opts style (Span (_, _, kvs) lst) =+ let dynamicStyle = maybeToList $ lookup dynamicStyleKey kvs+ in inlinesToICML opts (dynamicStyle <> style) lst -- | Convert a list of block elements to an ICML footnote. footnoteToICML :: PandocMonad m => WriterOptions -> Style -> [Block] -> WS m Doc
@@ -0,0 +1,237 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-+Copyright (C) 2019 John MacFarlane <jgm@berkeley.edu>++This program is free software; you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation; either version 2 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful,+but WITHOUT ANY WARRANTY; without even the implied warranty of+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+GNU General Public License for more details.++You should have received a copy of the GNU General Public License+along with this program; if not, write to the Free Software+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA+-}++{- |+ Module : Text.Pandoc.Writers.Ipynb+ Copyright : Copyright (C) 2019 John MacFarlane+ License : GNU GPL, version 2 or above++ Maintainer : John MacFarlane <jgm@berkeley.edu>+ Stability : alpha+ Portability : portable++Ipynb (Jupyter notebook JSON format) writer for pandoc.++-}+module Text.Pandoc.Writers.Ipynb ( writeIpynb )+where+import Prelude+import Control.Monad.State+import qualified Data.Map as M+import Data.Maybe (catMaybes, fromMaybe)+import Text.Pandoc.Options+import Text.Pandoc.Definition+import Data.Ipynb as Ipynb+import Text.Pandoc.Walk (walkM)+import qualified Text.Pandoc.Builder as B+import Text.Pandoc.Class+import Text.Pandoc.Logging+import Data.Text (Text)+import qualified Data.Text as T+import Data.Aeson as Aeson+import qualified Text.Pandoc.UTF8 as UTF8+import Text.Pandoc.Shared (safeRead)+import Text.Pandoc.Writers.Shared (metaToJSON')+import Text.Pandoc.Writers.Markdown (writeMarkdown)+import qualified Data.Text.Encoding as TE+import qualified Data.ByteString.Lazy as BL+import Data.Aeson.Encode.Pretty (Config(..), defConfig,+ encodePretty', keyOrder, Indent(Spaces))++writeIpynb :: PandocMonad m => WriterOptions -> Pandoc -> m Text+writeIpynb opts d = do+ notebook <- pandocToNotebook opts d+ return $ TE.decodeUtf8 . BL.toStrict . encodePretty' defConfig{+ confIndent = Spaces 1,+ confCompare = keyOrder+ [ "cells", "nbformat", "nbformat_minor",+ "cell_type", "output_type",+ "execution_count", "metadata",+ "outputs", "source",+ "data", "name", "text" ] }+ $ notebook++pandocToNotebook :: PandocMonad m+ => WriterOptions -> Pandoc -> m (Notebook NbV4)+pandocToNotebook opts (Pandoc meta blocks) = do+ let blockWriter bs = writeMarkdown+ opts{ writerTemplate = Nothing } (Pandoc nullMeta bs)+ let inlineWriter ils = T.stripEnd <$> writeMarkdown+ opts{ writerTemplate = Nothing } (Pandoc nullMeta [Plain ils])+ let jupyterMeta =+ case lookupMeta "jupyter" meta of+ Just (MetaMap m) -> (Meta m <> B.deleteMeta "jupyter" meta)+ _ -> meta+ metadata' <- metaToJSON' blockWriter inlineWriter $+ B.deleteMeta "nbformat" $+ B.deleteMeta "nbformat_minor" $ jupyterMeta+ -- convert from a Value (JSON object) to a M.Map Text Value:+ let metadata = case fromJSON metadata' of+ Error _ -> mempty -- TODO warning here? shouldn't happen+ Success x -> x+ cells <- extractCells opts blocks+ return $ Notebook{+ notebookMetadata = metadata+ , notebookFormat = (4, 5)+ , notebookCells = cells }++addAttachment :: PandocMonad m+ => Inline+ -> StateT (M.Map Text MimeBundle) m Inline+addAttachment (Image attr lab (src,tit)) = do+ (img, mbmt) <- fetchItem src+ let mt = maybe "application/octet-stream" (T.pack) mbmt+ modify $ M.insert (T.pack src)+ (MimeBundle (M.insert mt (BinaryData img) mempty))+ return $ Image attr lab ("attachment:" <> src, tit)+addAttachment x = return x++extractCells :: PandocMonad m => WriterOptions -> [Block] -> m [Cell a]+extractCells _ [] = return []+extractCells opts (Div (_id,classes,kvs) xs : bs)+ | "cell" `elem` classes+ , "markdown" `elem` classes = do+ let meta = pairsToJSONMeta kvs+ (newdoc, attachments) <-+ runStateT (walkM addAttachment (Pandoc nullMeta xs)) mempty+ source <- writeMarkdown opts{ writerTemplate = Nothing } newdoc+ (Cell{+ cellType = Markdown+ , cellSource = Source $ breakLines source+ , cellMetadata = meta+ , cellAttachments = if M.null attachments+ then Nothing+ else Just attachments } :)+ <$> extractCells opts bs+ | "cell" `elem` classes+ , "code" `elem` classes = do+ let (codeContent, rest) =+ case xs of+ (CodeBlock _ t : ys) -> (T.pack t, ys)+ ys -> (mempty, ys)+ let meta = pairsToJSONMeta kvs+ outputs <- catMaybes <$> mapM blockToOutput rest+ let exeCount = lookup "execution_count" kvs >>= safeRead+ (Cell{+ cellType = Ipynb.Code {+ codeExecutionCount = exeCount+ , codeOutputs = outputs+ }+ , cellSource = Source $ breakLines codeContent+ , cellMetadata = meta+ , cellAttachments = Nothing } :) <$> extractCells opts bs+ | "cell" `elem` classes+ , "raw" `elem` classes =+ case xs of+ [RawBlock (Format f) raw] -> do+ let format' =+ case f of+ "html" -> "text/html"+ "revealjs" -> "text/html"+ "latex" -> "text/latex"+ "markdown" -> "text/markdown"+ "rst" -> "text/x-rst"+ _ -> f+ (Cell{+ cellType = Raw+ , cellSource = Source $ breakLines $ T.pack raw+ , cellMetadata = M.insert "format"+ (Aeson.String $ T.pack format') mempty+ , cellAttachments = Nothing } :) <$> extractCells opts bs+ _ -> extractCells opts bs+extractCells opts (CodeBlock (_id,classes,kvs) raw : bs)+ | "code" `elem` classes = do+ let meta = pairsToJSONMeta kvs+ let exeCount = lookup "execution_count" kvs >>= safeRead+ (Cell{+ cellType = Ipynb.Code {+ codeExecutionCount = exeCount+ , codeOutputs = []+ }+ , cellSource = Source $ breakLines $ T.pack raw+ , cellMetadata = meta+ , cellAttachments = Nothing } :) <$> extractCells opts bs+extractCells opts (b:bs) = do+ let isCodeOrDiv (CodeBlock (_,cl,_) _) = "code" `elem` cl+ isCodeOrDiv (Div (_,cl,_) _) = "cell" `elem` cl+ isCodeOrDiv _ = False+ let (mds, rest) = break (isCodeOrDiv) bs+ extractCells opts (Div ("",["cell","markdown"],[]) (b:mds) : rest)++blockToOutput :: PandocMonad m => Block -> m (Maybe (Output a))+blockToOutput (Div (_,["output","stream",sname],_) (CodeBlock _ t:_)) =+ return $ Just+ $ Stream{ streamName = T.pack sname+ , streamText = Source (breakLines $ T.pack t) }+blockToOutput (Div (_,["output","error"],kvs) (CodeBlock _ t:_)) =+ return $ Just+ $ Err{ errName = maybe mempty T.pack (lookup "ename" kvs)+ , errValue = maybe mempty T.pack (lookup "evalue" kvs)+ , errTraceback = breakLines $ T.pack t }+blockToOutput (Div (_,["output","execute_result"],kvs) bs) = do+ (data', metadata') <- extractData bs+ return $ Just+ $ ExecuteResult{ executeCount = fromMaybe 0 $+ lookup "execution_count" kvs >>= safeRead+ , executeData = data'+ , executeMetadata = pairsToJSONMeta kvs <> metadata'}+blockToOutput (Div (_,["output","display_data"],kvs) bs) = do+ (data', metadata') <- extractData bs+ return $ Just+ $ DisplayData { displayData = data'+ , displayMetadata = pairsToJSONMeta kvs <> metadata'}+blockToOutput _ = return Nothing++extractData :: PandocMonad m => [Block] -> m (MimeBundle, JSONMeta)+extractData bs = do+ (mmap, meta) <- foldM go mempty bs+ return (MimeBundle mmap, meta)+ where+ go (mmap, meta) b@(Para [Image (_,_,kvs) _ (src,_)]) = do+ (img, mbmt) <- fetchItem src+ case mbmt of+ Just mt -> return+ (M.insert (T.pack mt) (BinaryData img) mmap,+ meta <> pairsToJSONMeta kvs)+ Nothing -> (mmap, meta) <$ report (BlockNotRendered b)+ go (mmap, meta) b@(CodeBlock (_,["json"],_) code) =+ case decode (UTF8.fromStringLazy code) of+ Just v -> return+ (M.insert "application/json" (JsonData v) mmap, meta)+ Nothing -> (mmap, meta) <$ report (BlockNotRendered b)+ go (mmap, meta) (CodeBlock ("",[],[]) code) =+ return (M.insert "text/plain" (TextualData (T.pack code)) mmap, meta)+ go (mmap, meta) (RawBlock (Format "html") raw) =+ return (M.insert "text/html" (TextualData (T.pack raw)) mmap, meta)+ go (mmap, meta) (RawBlock (Format "latex") raw) =+ return (M.insert "text/latex" (TextualData (T.pack raw)) mmap, meta)+ go (mmap, meta) b = (mmap, meta) <$ report (BlockNotRendered b)++pairsToJSONMeta :: [(String, String)] -> JSONMeta+pairsToJSONMeta kvs =+ M.fromList [(T.pack k, case v of+ "true" -> Bool True+ "false" -> Bool False+ _ -> case safeRead v of+ Just n -> Number n+ _ -> String (T.pack v))+ | (k,v) <- kvs , k /= "execution_count" ]
@@ -471,7 +471,9 @@ "b", "c", "t", "environment", "label", "plain", "shrink", "standout", "noframenumbering"]- let optionslist = ["fragile" | fragile && isNothing (lookup "fragile" kvs)] +++ let optionslist = ["fragile" | fragile+ , isNothing (lookup "fragile" kvs)+ , "fragile" `notElem` classes] ++ [k | k <- classes, k `elem` frameoptions] ++ [k ++ "=" ++ v | (k,v) <- kvs, k `elem` frameoptions] let options = if null optionslist@@ -553,16 +555,18 @@ else id wrapColumn = if "column" `elem` classes then \contents ->- let fromPct xs =- case reverse xs of- '%':ds -> showFl (read (reverse ds) / 100 :: Double)- _ -> xs- w = maybe "0.48" fromPct (lookup "width" kvs)+ let w = maybe "0.48" fromPct (lookup "width" kvs) in inCmd "begin" "column" <> braces (text w <> "\\textwidth") $$ contents $$ inCmd "end" "column" else id+ fromPct xs =+ case reverse xs of+ '%':ds -> case safeRead (reverse ds) of+ Just digits -> showFl (digits / 100 :: Double)+ Nothing -> xs+ _ -> xs wrapDir = case lookup "dir" kvs of Just "rtl" -> align "RTL" Just "ltr" -> align "LTR"@@ -689,12 +693,14 @@ | not (null classes) && isJust (writerHighlightStyle opts) -> highlightedCodeBlock | otherwise -> rawCodeBlock-blockToLaTeX b@(RawBlock f x)- | f == Format "latex" || f == Format "tex"- = return $ text x- | otherwise = do- report $ BlockNotRendered b- return empty+blockToLaTeX b@(RawBlock f x) = do+ beamer <- gets stBeamer+ if (f == Format "latex" || f == Format "tex" ||+ (f == Format "beamer" && beamer))+ then return $ text x+ else do+ report $ BlockNotRendered b+ return empty blockToLaTeX (BulletList []) = return empty -- otherwise latex error blockToLaTeX (BulletList lst) = do incremental <- gets stIncremental@@ -922,8 +928,20 @@ -- this will keep the typesetter from throwing an error. | (Header{} :_) <- lst = blockListToLaTeX lst >>= return . (text "\\item ~" $$) . nest 2- | otherwise = blockListToLaTeX lst >>= return . (text "\\item" $$) .- nest 2+ | Plain (Str "☐":Space:is) : bs <- lst = taskListItem False is bs+ | Plain (Str "☒":Space:is) : bs <- lst = taskListItem True is bs+ | Para (Str "☐":Space:is) : bs <- lst = taskListItem False is bs+ | Para (Str "☒":Space:is) : bs <- lst = taskListItem True is bs+ | otherwise = blockListToLaTeX lst >>= return . (text "\\item" $$) . nest 2+ where+ taskListItem checked is bs = do+ let checkbox = if checked+ then "$\\boxtimes$"+ else "$\\square$"+ isContents <- inlineListToLaTeX is+ bsContents <- blockListToLaTeX bs+ return $ "\\item" <> brackets checkbox+ $$ nest 2 (isContents $+$ bsContents) defListItemToLaTeX :: PandocMonad m => ([Inline], [[Block]]) -> LW m Doc defListItemToLaTeX (term, defs) = do@@ -1118,7 +1136,7 @@ let chr = case "!\"'()*,-./:;?@" \\ str of (c:_) -> c [] -> '!'- let str' = escapeStringUsing (backslashEscapes "\\{}%~_&") str+ let str' = escapeStringUsing (backslashEscapes "\\{}%~_&#") str -- we always put lstinline in a dummy 'passthrough' command -- (defined in the default template) so that we don't have -- to change the way we escape characters depending on whether@@ -1173,14 +1191,16 @@ inlineToLaTeX (Math DisplayMath str) = do setEmptyLine False return $ "\\[" <> text (handleMathComment str) <> "\\]"-inlineToLaTeX il@(RawInline f str)- | f == Format "latex" || f == Format "tex"- = do- setEmptyLine False- return $ text str- | otherwise = do- report $ InlineNotRendered il- return empty+inlineToLaTeX il@(RawInline f str) = do+ beamer <- gets stBeamer+ if (f == Format "latex" || f == Format "tex" ||+ (f == Format "beamer" && beamer))+ then do+ setEmptyLine False+ return $ text str+ else do+ report $ InlineNotRendered il+ return empty inlineToLaTeX LineBreak = do emptyLine <- gets stEmptyLine setEmptyLine True
@@ -212,7 +212,8 @@ Nothing -> empty let headerBlocks = filter isHeaderBlock blocks toc <- if writerTableOfContents opts- then render' <$> tableOfContents opts headerBlocks+ then render' <$> blockToMarkdown opts+ ( toTableOfContents opts headerBlocks ) else return "" -- Strip off final 'references' header if markdown citations enabled let blocks' = if isEnabled Ext_citations opts@@ -319,26 +320,6 @@ _ -> '.':go cs _ -> c : go cs --- | Construct table of contents from list of header blocks.-tableOfContents :: PandocMonad m => WriterOptions -> [Block] -> MD m Doc-tableOfContents opts headers = do- contents <- BulletList <$> mapM (elementToListItem opts) (hierarchicalize headers)- blockToMarkdown opts contents---- | Converts an Element to a list item for a table of contents,-elementToListItem :: PandocMonad m => WriterOptions -> Element -> MD m [Block]-elementToListItem opts (Sec lev _nums (ident,_,_) headerText subsecs)- = do isPlain <- asks envPlain- let headerLink = if null ident || isPlain- then walk deNote headerText- else [Link nullAttr (walk deNote headerText)- ('#':ident, "")]- listContents <- if null subsecs || lev >= writerTOCDepth opts- then return []- else mapM (elementToListItem opts) subsecs- return [Plain headerLink, BulletList listContents]-elementToListItem _ (Blk _) = return []- attrsToMarkdown :: Attr -> Doc attrsToMarkdown attribs = braces $ hsep [attribId, attribClasses, attribKeys] where attribId = case attribs of@@ -463,7 +444,7 @@ | isEnabled Ext_raw_html opts && not (isEnabled Ext_link_attributes opts) && attr /= nullAttr = -- use raw HTML- (text . T.unpack . T.strip) <$>+ ((<> blankline) . text . T.unpack . T.strip) <$> writeHtml5String opts{ writerTemplate = Nothing } (Pandoc nullMeta [Para [Image attr alt (src,"fig:" ++ tit)]]) | otherwise = blockToMarkdown opts (Para [Image attr alt (src,tit)])@@ -491,6 +472,11 @@ return $ if plain then empty else text str <> text "\n"+ | f == "plain" = do+ plain <- asks envPlain+ return $ if plain+ then text str <> text "\n"+ else empty | otherwise = do report $ BlockNotRendered b return empty@@ -765,7 +751,8 @@ -- | Convert bullet list item (list of blocks) to markdown. bulletListItemToMarkdown :: PandocMonad m => WriterOptions -> [Block] -> MD m Doc bulletListItemToMarkdown opts bs = do- contents <- blockListToMarkdown opts bs+ let exts = writerExtensions opts+ contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs let sps = replicate (writerTabStop opts - 2) ' ' let start = text ('-' : ' ' : sps) -- remove trailing blank line if item ends with a tight list@@ -781,7 +768,8 @@ -> [Block] -- ^ list item (list of blocks) -> MD m Doc orderedListItemToMarkdown opts marker bs = do- contents <- blockListToMarkdown opts bs+ let exts = writerExtensions opts+ contents <- blockListToMarkdown opts $ taskListItemToAscii exts bs let sps = case length marker - writerTabStop opts of n | n > 0 -> text $ replicate n ' ' _ -> text " "
@@ -109,14 +109,24 @@ -- title beginning with fig: indicates that the image is a figure blockToMediaWiki (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do- capt <- if null txt- then return ""- else ("|caption " ++) `fmap` inlineListToMediaWiki txt+ capt <- inlineListToMediaWiki txt img <- imageToMediaWiki attr- let opt = if null txt- then ""- else "|alt=" ++ if null tit then capt else tit ++ capt- return $ "[[File:" ++ src ++ "|frame|none" ++ img ++ opt ++ "]]\n"+ let opt = if null tit+ then+ if null capt+ then ""+ else "alt=" ++ capt+ else "alt=" ++ tit+ return $ "[[" +++ intercalate "|"+ (filter (not . null) ["File:" ++ src+ , "thumb"+ , "none"+ , img+ , opt+ , capt+ ]) +++ "]]\n" blockToMediaWiki (Para inlines) = do tags <- asks useTags@@ -331,15 +341,15 @@ toPx = fmap (showInPixel opts) . checkPct checkPct (Just (Percent _)) = Nothing checkPct maybeDim = maybeDim- go (Just w) Nothing = '|':w ++ "px"- go (Just w) (Just h) = '|':w ++ "x" ++ h ++ "px"- go Nothing (Just h) = "|x" ++ h ++ "px"+ go (Just w) Nothing = w ++ "px"+ go (Just w) (Just h) = w ++ "x" ++ h ++ "px"+ go Nothing (Just h) = "x" ++ h ++ "px" go Nothing Nothing = "" dims = go (toPx $ dimension Width attr) (toPx $ dimension Height attr) classes = if null cls then ""- else "|class=" ++ unwords cls- return $ dims ++ classes+ else "class=" ++ unwords cls+ return $ intercalate "|" $ filter (not . null) [dims, classes] -- | Convert list of Pandoc block elements to MediaWiki. blockListToMediaWiki :: PandocMonad m@@ -436,12 +446,18 @@ inlineToMediaWiki (Image attr alt (source, tit)) = do img <- imageToMediaWiki attr alt' <- inlineListToMediaWiki alt- let txt = if null tit- then if null alt+ let txt = if null alt'+ then if null tit then ""- else '|' : alt'- else '|' : tit- return $ "[[File:" ++ source ++ img ++ txt ++ "]]"+ else tit+ else alt'+ return $ "[[" +++ intercalate "|"+ (filter (not . null)+ [ "File:" ++ source+ , img+ , txt+ ]) ++ "]]" inlineToMediaWiki (Note contents) = do contents' <- blockListToMediaWiki contents
@@ -418,7 +418,7 @@ contents <- inlineToMs opts il return $ cr <> text ".RS" $$ contents $$ text ".RE" Right r -> return $- cr <> text ".EQ" $$ text r $$ text ".EN"+ cr <> text ".EQ" $$ text r $$ text ".EN" <> cr inlineToMs _ il@(RawInline f str) | f == Format "ms" = return $ text str | otherwise = do
@@ -40,6 +40,7 @@ import Data.Maybe (fromMaybe) import qualified Data.Map as Map import qualified Data.Text.Lazy as TL+import Data.Time import System.FilePath (takeDirectory, takeExtension, (<.>)) import Text.Pandoc.BCP47 (Lang (..), getLang, renderLang) import Text.Pandoc.Class (PandocMonad, report, toLang)@@ -50,8 +51,9 @@ import Text.Pandoc.MIME (extensionFromMimeType, getMimeType) import Text.Pandoc.Options (WrapOption (..), WriterOptions (..)) import Text.Pandoc.Pretty-import Text.Pandoc.Shared (stringify, normalizeDate)-import Text.Pandoc.Writers.Shared (lookupMetaString, fixDisplayMath)+import Text.Pandoc.Shared (stringify, pandocVersion)+import Text.Pandoc.Writers.Shared (lookupMetaString, lookupMetaBlocks,+ fixDisplayMath) import Text.Pandoc.UTF8 (fromStringLazy, fromTextLazy, toStringLazy) import Text.Pandoc.Walk import Text.Pandoc.Writers.OpenDocument (writeOpenDocument)@@ -83,6 +85,7 @@ pandocToODT opts doc@(Pandoc meta _) = do let title = docTitle meta let authors = docAuthors meta+ utctime <- P.getCurrentTime lang <- toLang (getLang opts meta) refArchive <- case writerReferenceDoc opts of@@ -125,13 +128,18 @@ ) ) let archive' = addEntryToArchive manifestEntry archive+ -- create meta.xml let userDefinedMetaFields = [k | k <- Map.keys (unMeta meta)- , k `notElem` ["title", "lang", "author", "date"]]+ , k `notElem` ["title", "lang", "author"+ , "description", "subject", "keywords"]] let escapedText = text . escapeStringForXML+ let keywords = case lookupMeta "keywords" meta of+ Just (MetaList xs) -> map stringify xs+ _ -> [] let userDefinedMeta = map (\k -> inTags False "meta:user-defined"- [ ("meta_name", escapeStringForXML k)- ,("meta-value-type", "string")+ [ ("meta:name", escapeStringForXML k)+ ,("meta:value-type", "string") ] (escapedText $ lookupMetaString k meta)) userDefinedMetaFields let metaTag metafield = inTagsSimple metafield . escapedText let metaEntry = toEntry "meta.xml" epochtime@@ -146,18 +154,28 @@ ,("xmlns:ooo","http://openoffice.org/2004/office") ,("xmlns:grddl","http://www.w3.org/2003/g/data-view#") ,("office:version","1.2")] ( inTags True "office:meta" [] $- ( metaTag "dc:title" (stringify title)+ ( metaTag "meta:generator" ("Pandoc/" ++ pandocVersion) $$+ metaTag "dc:title" (stringify title)+ $$+ metaTag "dc:description"+ (intercalate "\n" (map stringify $+ lookupMetaBlocks "description" meta))+ $$+ metaTag "dc:subject" (lookupMetaString "subject" meta)+ $$+ metaTag "meta:keyword" (intercalate ", " keywords)+ $$ case lang of Just l -> metaTag "dc:language" (renderLang l) Nothing -> empty $$- metaTag "dc:creator"+ (\d a -> metaTag "meta:initial-creator" a+ $$ metaTag "dc:creator" a+ $$ metaTag "meta:creation-date" d+ $$ metaTag "dc:date" d+ ) (formatTime defaultTimeLocale "%FT%XZ" utctime) (intercalate "; " (map stringify authors))- $$- maybe mempty- (metaTag "dc:date")- (normalizeDate (lookupMetaString "date" meta)) $$ vcat userDefinedMeta )
@@ -188,13 +188,19 @@ then empty else cr <> nest (level + 1) (propertiesDrawer attr) return $ headerStr <> " " <> contents <> drawerStr <> blankline-blockToOrg (CodeBlock (_,classes,_) str) = do+blockToOrg (CodeBlock (_,classes,kvs) str) = do opts <- gets stOptions let tabstop = writerTabStop opts+ let startnum = maybe "" (\x -> ' ' : trimr x) $ lookup "startFrom" kvs+ let numberlines = if "numberLines" `elem` classes+ then if "continuedSourceBlock" `elem` classes+ then " +n" ++ startnum+ else " -n" ++ startnum+ else "" let at = map pandocLangToOrg classes `intersect` orgLangIdentifiers let (beg, end) = case at of- [] -> ("#+BEGIN_EXAMPLE", "#+END_EXAMPLE")- (x:_) -> ("#+BEGIN_SRC " ++ x, "#+END_SRC")+ [] -> ("#+BEGIN_EXAMPLE" ++ numberlines, "#+END_EXAMPLE")+ (x:_) -> ("#+BEGIN_SRC " ++ x ++ numberlines, "#+END_SRC") return $ text beg $$ nest tabstop (text str) $$ text end $$ blankline blockToOrg (BlockQuote blocks) = do contents <- blockListToOrg blocks
@@ -58,7 +58,7 @@ import qualified Data.ByteString.Lazy as BL import Text.Pandoc.Writers.OOXML import qualified Data.Map as M-import Data.Maybe (mapMaybe, listToMaybe, fromMaybe, maybeToList, catMaybes)+import Data.Maybe (mapMaybe, listToMaybe, fromMaybe, maybeToList, catMaybes, isNothing) import Text.Pandoc.ImageSize import Control.Applicative ((<|>)) import System.FilePath.Glob@@ -252,6 +252,8 @@ newArch' <- foldM copyFileToArchive emptyArchive filePaths -- we make a docProps/core.xml entry out of the presentation docprops docPropsEntry <- docPropsToEntry docProps+ -- we make a docProps/custom.xml entry out of the custom properties+ docCustomPropsEntry <- docCustomPropsToEntry docProps -- we make this ourself in case there's something unexpected in the -- one in the reference doc. relsEntry <- topLevelRelsEntry@@ -274,7 +276,8 @@ spkNotesEntries ++ spkNotesRelEntries ++ mediaEntries ++- [contentTypesEntry, docPropsEntry, relsEntry, presEntry, presRelsEntry]+ [contentTypesEntry, docPropsEntry, docCustomPropsEntry, relsEntry,+ presEntry, presRelsEntry] makeSlideIdMap :: Presentation -> M.Map SlideId Int makeSlideIdMap (Presentation _ slides) =@@ -1425,6 +1428,10 @@ , relType = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/extended-properties" , relTarget = "docProps/app.xml" }+ , Relationship { relId = 4+ , relType = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties"+ , relTarget = "docProps/custom.xml"+ } ] topLevelRelsEntry :: PandocMonad m => P m Entry@@ -1657,7 +1664,7 @@ docPropsElement docProps = do utctime <- asks envUTCTime let keywords = case dcKeywords docProps of- Just xs -> intercalate "," xs+ Just xs -> intercalate ", " xs Nothing -> "" return $ mknode "cp:coreProperties"@@ -1669,7 +1676,13 @@ $ (mknode "dc:title" [] $ fromMaybe "" $ dcTitle docProps) : (mknode "dc:creator" [] $ fromMaybe "" $ dcCreator docProps) : (mknode "cp:keywords" [] keywords)- : (\x -> [ mknode "dcterms:created" [("xsi:type","dcterms:W3CDTF")] x+ : (if isNothing (dcSubject docProps) then [] else+ [mknode "dc:subject" [] $ fromMaybe "" $ dcSubject docProps])+ ++ (if isNothing (dcDescription docProps) then [] else+ [mknode "dc:description" [] $ fromMaybe "" $ dcDescription docProps])+ ++ (if isNothing (cpCategory docProps) then [] else+ [mknode "cp:category" [] $ fromMaybe "" $ cpCategory docProps])+ ++ (\x -> [ mknode "dcterms:created" [("xsi:type","dcterms:W3CDTF")] x , mknode "dcterms:modified" [("xsi:type","dcterms:W3CDTF")] x ]) (formatTime defaultTimeLocale "%FT%XZ" utctime) @@ -1677,7 +1690,22 @@ docPropsToEntry docProps = docPropsElement docProps >>= elemToEntry "docProps/core.xml" +-- adapted from the Docx writer+docCustomPropsElement :: PandocMonad m => DocProps -> P m Element+docCustomPropsElement docProps = do+ let mkCustomProp (k, v) pid = mknode "property"+ [("fmtid","{D5CDD505-2E9C-101B-9397-08002B2CF9AE}")+ ,("pid", show pid)+ ,("name", k)] $ mknode "vt:lpwstr" [] v+ return $ mknode "Properties"+ [("xmlns","http://schemas.openxmlformats.org/officeDocument/2006/custom-properties")+ ,("xmlns:vt","http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes")+ ] $ zipWith mkCustomProp (fromMaybe [] $ customProperties docProps) [(2 :: Int)..] +docCustomPropsToEntry :: PandocMonad m => DocProps -> P m Entry+docCustomPropsToEntry docProps = docCustomPropsElement docProps >>=+ elemToEntry "docProps/custom.xml"+ defaultContentTypeToElem :: DefaultContentType -> Element defaultContentTypeToElem dct = mknode "Default"@@ -1765,6 +1793,7 @@ inheritedOverrides = mapMaybe pathToOverride filePaths docPropsOverride = mapMaybe pathToOverride ["docProps/core.xml"]+ docCustomPropsOverride = mapMaybe pathToOverride ["docProps/custom.xml"] presOverride = mapMaybe pathToOverride ["ppt/presentation.xml"] relativePaths <- mapM slideToFilePath slides let slideOverrides = mapMaybe@@ -1773,7 +1802,8 @@ speakerNotesOverrides <- (mapMaybe pathToOverride) <$> getSpeakerNotesFilePaths return $ ContentTypes (defaults ++ mediaDefaults)- (inheritedOverrides ++ docPropsOverride ++ presOverride ++ slideOverrides ++ speakerNotesOverrides)+ (inheritedOverrides ++ docPropsOverride ++ docCustomPropsOverride +++ presOverride ++ slideOverrides ++ speakerNotesOverrides) presML :: String presML = "application/vnd.openxmlformats-officedocument.presentationml"@@ -1788,6 +1818,7 @@ | fp == "ppt/viewProps.xml" = Just $ presML ++ ".viewProps+xml" | fp == "ppt/tableStyles.xml" = Just $ presML ++ ".tableStyles+xml" | fp == "docProps/core.xml" = Just $ "application/vnd.openxmlformats-package.core-properties+xml"+ | fp == "docProps/custom.xml" = Just $ "application/vnd.openxmlformats-officedocument.custom-properties+xml" | fp == "docProps/app.xml" = Just $ noPresML ++ ".extended-properties+xml" | "ppt" : "slideMasters" : f : [] <- splitDirectories fp , (_, ".xml") <- splitExtension f =
@@ -72,7 +72,8 @@ import Text.Pandoc.Walk import Data.Time (UTCTime) import qualified Text.Pandoc.Shared as Shared -- so we don't overlap "Element"-import Text.Pandoc.Writers.Shared (lookupMetaInlines)+import Text.Pandoc.Writers.Shared (lookupMetaInlines, lookupMetaBlocks+ , lookupMetaString, toTableOfContents) import qualified Data.Map as M import qualified Data.Set as S import Data.Maybe (maybeToList, fromMaybe)@@ -180,7 +181,10 @@ , dcSubject :: Maybe String , dcCreator :: Maybe String , dcKeywords :: Maybe [String]+ , dcDescription :: Maybe String+ , cpCategory :: Maybe String , dcCreated :: Maybe UTCTime+ , customProperties :: Maybe [(String, String)] } deriving (Show, Eq) @@ -770,23 +774,10 @@ } mempty --- adapted from the markdown writer-elementToListItem :: Shared.Element -> Pres [Block]-elementToListItem (Shared.Sec lev _nums (ident,_,_) headerText subsecs) = do- opts <- asks envOpts- let headerLink = if null ident- then walk Shared.deNote headerText- else [Link nullAttr (walk Shared.deNote headerText)- ('#':ident, "")]- listContents <- if null subsecs || lev >= writerTOCDepth opts- then return []- else mapM elementToListItem subsecs- return [Plain headerLink, BulletList listContents]-elementToListItem (Shared.Blk _) = return []- makeTOCSlide :: [Block] -> Pres Slide makeTOCSlide blks = local (\env -> env{envCurSlideId = tocSlideId}) $ do- contents <- BulletList <$> mapM elementToListItem (Shared.hierarchicalize blks)+ opts <- asks envOpts+ let contents = toTableOfContents opts blks meta <- asks envMetadata slideLevel <- asks envSlideLevel let tocTitle = case lookupMetaInlines "toc-title" meta of@@ -943,13 +934,26 @@ authors = case map Shared.stringify $ docAuthors meta of [] -> Nothing- ss -> Just $ intercalate ";" ss+ ss -> Just $ intercalate "; " ss++ description = case map Shared.stringify $ lookupMetaBlocks "description" meta of+ [] -> Nothing+ ss -> Just $ intercalate "_x000d_\n" ss++ customProperties' = case [(k, lookupMetaString k meta) | k <- M.keys (unMeta meta)+ , k `notElem` (["title", "author", "keywords", "description"+ , "subject","lang","category"])] of+ [] -> Nothing+ ss -> Just ss in DocProps{ dcTitle = Shared.stringify <$> lookupMeta "title" meta , dcSubject = Shared.stringify <$> lookupMeta "subject" meta , dcCreator = authors , dcKeywords = keywords+ , dcDescription = description+ , cpCategory = Shared.stringify <$> lookupMeta "category" meta , dcCreated = Nothing+ , customProperties = customProperties' } documentToPresentation :: WriterOptions
@@ -718,7 +718,7 @@ numChars xs = maximum . map offset $ xs let colWidths = map numChars $ transpose (headerDocs : rowDocs) let toRow = hsep . zipWith lblock colWidths- let hline = hsep (map (\n -> text (replicate n '=')) colWidths)+ let hline = nowrap $ hsep (map (\n -> text (replicate n '=')) colWidths) let hdr = if all null headers then mempty else hline $$ toRow headerDocs
@@ -119,9 +119,8 @@ inlinesToRTF meta' body <- blocksToRTF 0 AlignDefault blocks- let isTOCHeader (Header lev _ _) = lev <= writerTOCDepth options- isTOCHeader _ = False- toc <- tableOfContents $ filter isTOCHeader blocks+ toc <- blocksToRTF 0 AlignDefault+ [toTableOfContents options $ filter isHeaderBlock blocks] let context = defField "body" body $ defField "spacer" spacer $(if writerTableOfContents options@@ -138,20 +137,6 @@ case reverse body of ('\n':_) -> body _ -> body ++ "\n"---- | Construct table of contents from list of header blocks.-tableOfContents :: PandocMonad m => [Block] -> m String-tableOfContents headers = do- let contents = map elementToListItem $ hierarchicalize headers- blocksToRTF 0 AlignDefault- [Header 1 nullAttr [Str "Contents"], BulletList contents]--elementToListItem :: Element -> [Block]-elementToListItem (Blk _) = []-elementToListItem (Sec _ _ _ sectext subsecs) = Plain sectext :- if null subsecs- then []- else [BulletList (map elementToListItem subsecs)] -- | Convert unicode characters (> 127) into rich text format representation. handleUnicode :: String -> String
@@ -49,6 +49,7 @@ , stripLeadingTrailingSpace , toSubscript , toSuperscript+ , toTableOfContents ) where import Prelude@@ -66,7 +67,8 @@ import Text.Pandoc.Definition import Text.Pandoc.Options import Text.Pandoc.Pretty-import Text.Pandoc.Shared (stringify)+import Text.Pandoc.Shared (stringify, hierarchicalize, Element(..), deNote)+import Text.Pandoc.Walk (walk) import Text.Pandoc.UTF8 (toStringLazy) import Text.Pandoc.XML (escapeStringForXML) @@ -412,3 +414,23 @@ Just $ chr (0x2080 + (ord c - 48)) | isSpace c = Just c | otherwise = Nothing++-- | Construct table of contents (as a bullet list) from document body.+toTableOfContents :: WriterOptions+ -> [Block]+ -> Block+toTableOfContents opts bs =+ BulletList $ map (elementToListItem opts) (hierarchicalize bs)++-- | Converts an Element to a list item for a table of contents,+elementToListItem :: WriterOptions -> Element -> [Block]+elementToListItem opts (Sec lev _nums (ident,_,_) headerText subsecs)+ = Plain headerLink : [BulletList listContents | not (null subsecs)+ , lev < writerTOCDepth opts]+ where+ headerText' = walk deNote headerText+ headerLink = if null ident+ then headerText'+ else [Link nullAttr headerText' ('#':ident, "")]+ listContents = map (elementToListItem opts) subsecs+elementToListItem _ (Blk _) = []
@@ -225,14 +225,16 @@ return $ text "@node Top" $$ text "@top " <> txt <> blankline -blockToTexinfo (Header level _ lst)+blockToTexinfo (Header level (ident,_,_) lst) | level < 1 || level > 4 = blockToTexinfo (Para lst) | otherwise = do node <- inlineListForNode lst txt <- inlineListToTexinfo lst idsUsed <- gets stIdentifiers opts <- gets stOptions- let id' = uniqueIdent (writerExtensions opts) lst idsUsed+ let id' = if null ident+ then uniqueIdent (writerExtensions opts) lst idsUsed+ else ident modify $ \st -> st{ stIdentifiers = Set.insert id' idsUsed } sec <- seccmd level return $ if (level > 0) && (level <= 4)
@@ -109,9 +109,7 @@ let opt = if null txt then "" else "|" ++ if null tit then capt else tit ++ capt- -- Relative links fail isURI and receive a colon- prefix = if isURI src then "" else ":"- return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"+ return $ "{{" ++ src ++ imageDims opts attr ++ opt ++ "}}\n" blockToZimWiki opts (Para inlines) = do indent <- gets stIndent@@ -383,9 +381,7 @@ ("", _, False ) -> "|" ++ alt' (_ , _, False ) -> "|" ++ tit (_ , _, True ) -> ""- -- Relative links fail isURI and receive a colon- prefix = if isURI source then "" else ":"- return $ "{{" ++ prefix ++ source ++ imageDims opts attr ++ txt ++ "}}"+ return $ "{{" ++ source ++ imageDims opts attr ++ txt ++ "}}" inlineToZimWiki opts (Note contents) = do -- no concept of notes in zim wiki, use a text block
@@ -57,7 +57,12 @@ -- | Escape string as needed for XML. Entity references are not preserved. escapeStringForXML :: String -> String-escapeStringForXML = concatMap escapeCharForXML+escapeStringForXML = concatMap escapeCharForXML . filter isLegalXMLChar+ where isLegalXMLChar c = c == '\t' || c == '\n' || c == '\r' ||+ (c >= '\x20' && c <= '\xD7FF') ||+ (c >= '\xE000' && c <= '\xFFFD') ||+ (c >= '\x10000' && c <= '\x10FFFF')+ -- see https://www.w3.org/TR/xml/#charsets -- | Escape newline characters as escapeNls :: String -> String
@@ -19,16 +19,9 @@ - foundation extra-dep: true extra-deps:-- github: jgm/pandoc-citeproc- commit: c2c7c43f1c37a6e5f571c500b9e6dd36011c493f-- haddock-library-1.7.0-- HsYAML-0.1.1.2-- yaml-0.11.0.0-- libyaml-0.1.0.0-- hslua-1.0.1-- hslua-module-text-0.2.0-- skylighting-0.7.4-- skylighting-core-0.7.4+- pandoc-citeproc-0.16+- ipynb-0.1+- texmath-0.11.2 ghc-options: "$locals": -fhide-source-paths -XNoImplicitPrelude-resolver: lts-12.18+resolver: lts-13.5
@@ -1,3 +1,4 @@+{-# LANGUAGE CPP #-} {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE TypeSynonymInstances #-}@@ -78,19 +79,32 @@ showDiff (l+1,r+1) ds -- | Find pandoc executable relative to test-pandoc--- First, try in same directory (e.g. if both in ~/.cabal/bin)--- Second, try ../pandoc (e.g. if in dist/XXX/build/test-pandoc) findPandoc :: IO FilePath findPandoc = do testExePath <- getExecutablePath- let testExeDir = takeDirectory testExePath- found <- doesFileExist (testExeDir </> "pandoc")- return $ if found- then testExeDir </> "pandoc"- else case splitDirectories testExeDir of- [] -> error "test-pandoc: empty testExeDir"- xs -> joinPath (init xs) </> "pandoc" </> "pandoc"-+ let pandocDir =+ case reverse (splitDirectories (takeDirectory testExePath)) of+ -- cabalv2 with --disable-optimization+ "test-pandoc" : "build" : "noopt" : "test-pandoc" : "t" : ps+ -> joinPath (reverse ps) </>+ "x" </> "pandoc" </> "noopt" </> "build" </> "pandoc"+ -- cabalv2 without --disable-optimization+ "test-pandoc" : "build" : "test-pandoc" : "t" : ps+ -> joinPath (reverse ps) </>+ "x" </> "pandoc" </> "build" </> "pandoc"+ -- cabalv1+ "test-pandoc" : "build" : ps+ -> joinPath (reverse ps) </> "build" </> "pandoc"+ _ -> error $ "findPandoc: could not find pandoc executable"+ let pandocPath = pandocDir </> "pandoc"+#ifdef _WINDOWS+ <.> "exe"+#endif+ found <- doesFileExist pandocPath+ if found+ then return pandocPath+ else error $ "findPandoc: could not find pandoc executable at "+ ++ pandocPath vividize :: Diff String -> String vividize (Both s _) = " " ++ s
@@ -10,10 +10,10 @@ import Test.Tasty.HUnit (Assertion, assertEqual, testCase) import Test.Tasty.QuickCheck (QuickCheckTests (..), ioProperty, testProperty) import Text.Pandoc.Arbitrary ()-import Text.Pandoc.Builder (bulletList, divWith, doc, doubleQuoted, emph,- header, linebreak, para, plain, rawBlock,- singleQuoted, space, str, strong,- math, displayMath)+import Text.Pandoc.Builder (bulletList, definitionList, displayMath, divWith,+ doc, doubleQuoted, emph, header, lineBlock,+ linebreak, math, orderedList, para, plain, rawBlock,+ singleQuoted, space, str, strong) import Text.Pandoc.Class (runIOorExplode, setUserDataDir) import Text.Pandoc.Definition (Block (BlockQuote, Div, Para), Inline (Emph, Str), Attr, Meta, Pandoc, pandocTypesVersion)@@ -91,6 +91,17 @@ "block-count.lua" (doc $ para "one" <> para "two") (doc $ para "2")++ , testCase "Smart constructors" $+ assertFilterConversion "smart constructors returned a wrong result"+ "smart-constructors.lua"+ (doc $ para "")+ (doc $ mconcat+ [ bulletList [para "Hello", para "World"]+ , definitionList [("foo", [para "placeholder"])]+ , lineBlock ["Moin", "Welt"]+ , orderedList [plain "one", plain "two"]+ ]) , testCase "Convert header upper case" $ assertFilterConversion "converting header to upper case failed"
@@ -175,6 +175,10 @@ [ test "reader" ["-r", "man", "-w", "native", "-s"] "man-reader.man" "man-reader.native" ]+ , testGroup "org"+ [ test "reader" ["-r", "org", "-w", "native", "-s"]+ "org-select-tags.org" "org-select-tags.native"+ ] ] -- makes sure file is fully closed after reading
@@ -231,6 +231,10 @@ "docx/lists.docx" "docx/lists.native" , testCompare+ "lists with level overrides"+ "docx/lists_level_override.docx"+ "docx/lists_level_override.native"+ , testCompare "lists continuing after interruption" "docx/lists_continuing.docx" "docx/lists_continuing.native"
@@ -0,0 +1,315 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+module Tests.Readers.DokuWiki (tests) where++import Prelude+import Data.Text (Text)+import qualified Data.Text as T+import Test.Tasty+import Tests.Helpers+import Text.Pandoc+import Text.Pandoc.Arbitrary ()+import Text.Pandoc.Builder+import Text.Pandoc.Shared (underlineSpan)++dokuwiki :: Text -> Pandoc+dokuwiki = purely $ readDokuWiki def{ readerStandalone = True }++infix 4 =:+(=:) :: ToString c+ => String -> (Text, c) -> TestTree+(=:) = test dokuwiki++tests :: [TestTree]+tests = [ testGroup "inlines"+ [ "Bold" =:+ "**bold**" =?>+ para (strong "bold")+ , "Italic" =:+ "//italic//" =?>+ para (emph "italic")+ , "Underlined" =:+ "__underlined__" =?>+ para (underlineSpan "underlined")+ , "Monospaced" =:+ "''monospaced''" =?>+ para (code "monospaced")+ , "Combined" =:+ "**__//''combine''//__**" =?>+ para (strong $ underlineSpan $ emph $ code "combine")+ , "Nowiki" =:+ T.unlines [ "<nowiki>"+ , "This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it."+ , "</nowiki>"+ ] =?>+ para "This is some text which contains addresses like this: http://www.splitbrain.org and **formatting**, but nothing is done with it."+ , "Percent" =:+ "The same is true for %%//__this__ text// with a smiley ;-)%%." =?>+ para "The same is true for //__this__ text// with a smiley ;-)."+ , "Subscript" =:+ "<sub>subscript</sub>" =?>+ para (subscript "subscript")+ , "Superscript" =:+ "<sup>superscript</sup>" =?>+ para (superscript "superscript")+ , "Deleted" =:+ "<del>deleted</del>" =?>+ para (strikeout "deleted")+ , "Inline code" =:+ "foo <code java>public static void main</code> bar" =?>+ para (text "foo " <> codeWith ("", ["java"], []) "public static void main" <> text " bar")+ , "Inline file" =:+ "foo <file></code></file> bar" =?>+ para (text "foo " <> code "</code>" <> text " bar")+ , "Inline HTML" =:+ "<html>\nThis is some <span style=\"color:red;font-size:150%;\">inline HTML</span>\n</html>" =?>+ para (rawInline "html" "\nThis is some <span style=\"color:red;font-size:150%;\">inline HTML</span>\n")+ , "Inline PHP" =:+ "<php>echo '<p>Hello World</p>';</php>" =?>+ para (codeWith ("", ["php"], []) "echo '<p>Hello World</p>';")+ , "Linebreak" =:+ T.unlines [ "This is some text with some linebreaks\\\\ Note that the"+ , "two backslashes are only recognized at the end of a line\\\\"+ , "or followed by\\\\ a whitespace \\\\this happens without it."+ ] =?>+ para ("This is some text with some linebreaks" <> linebreak <> "Note that the\n" <>+ "two backslashes are only recognized at the end of a line" <> linebreak <>+ "or followed by" <> linebreak <> "a whitespace \\\\this happens without it.")+ , testGroup "External links"+ [ "Autolink" =:+ "http://www.google.com" =?>+ para (link "http://www.google.com" "" (str "http://www.google.com"))+ , "Link without description" =:+ "[[https://example.com]]" =?>+ para (link "https://example.com" "" (str "https://example.com"))+ , "Link with description" =:+ "[[http://www.google.com|This Link points to google]]" =?>+ para (link "http://www.google.com" "" (text "This Link points to google"))+ , "Trim whitespace around link and description" =:+ "[[ http://www.google.com | This Link points to google ]]" =?>+ para (link "http://www.google.com" "" (text "This Link points to google"))+ , "Email address" =:+ "<andi@splitbrain.org>" =?>+ para (link "mailto:andi@splitbrain.org" "" (str "andi@splitbrain.org"))+ ]+ , testGroup "Internal links"+ [ "Current namespace" =:+ "[[example]]" =?>+ para (link "example" "" (str "example"))+ , "Current namespace starting with dot" =:+ "[[.example]]" =?>+ para (link "example" "" (str ".example"))+ , "Current namespace starting with dot and colon" =:+ "[[.:example]]" =?>+ para (link "example" "" (str "example"))+ , "Root namespace" =:+ "[[:example]]" =?>+ para (link "/example" "" (str "example"))+ , "Parent namespace" =:+ "[[..example]]" =?>+ para (link "../example" "" (str "..example"))+ , "Parent namespace with colon" =:+ "[[..:example]]" =?>+ para (link "../example" "" (str "example"))+ , "Beneath the root namespace" =:+ "[[wiki:example]]" =?>+ para (link "/wiki/example" "" (str "example"))+ , "Explicitly beneath the root namespace" =:+ "[[:wiki:example]]" =?>+ para (link "/wiki/example" "" (str "example"))+ ]+ , testGroup "Interwiki links"+ [ "Interwiki without description" =:+ "[[doku>DokuWiki]]" =?>+ para (link "https://www.dokuwiki.org/DokuWiki" "" (str "DokuWiki"))+ , "Interwiki link with description" =:+ "[[doku>toolbar|quickbuttons]]" =?>+ para (link "https://www.dokuwiki.org/toolbar" "" (str "quickbuttons"))+ ]+ , "Footnote" =:+ "((This is a footnote))" =?>+ para (note (para "This is a footnote"))+ , testGroup "Images"+ [ "Image" =:+ "{{image.jpg}}" =?>+ para (image "image.jpg" "" (str "image.jpg"))+ , "Image with caption" =:+ "{{image.png|This is the caption}}" =?>+ para (image "image.png" "" "This is the caption")+ , "Image with } in caption" =:+ "{{image.png|There is an } in the caption}}" =?>+ para (image "image.png" "" "There is an } in the caption")+ , "Wiki namespace starting with dot" =:+ "{{.wiki:image.jpg}}" =?>+ para (image "wiki/image.jpg" "" (str "image.jpg"))+ , "Left aligned image" =:+ "{{wiki:dokuwiki-128.png }}" =?>+ para (imageWith ("", ["align-left"], []) "/wiki/dokuwiki-128.png" "" (str "dokuwiki-128.png"))+ , "Right aligned image" =:+ "{{ wiki:dokuwiki-128.png}}" =?>+ para (imageWith ("", ["align-right"], []) "/wiki/dokuwiki-128.png" "" (str "dokuwiki-128.png"))+ , "Centered image" =:+ "{{ wiki:dokuwiki-128.png }}" =?>+ para (imageWith ("", ["align-center"], []) "/wiki/dokuwiki-128.png" "" (str "dokuwiki-128.png"))+ , "Image with width" =:+ "{{wiki:dokuwiki-128.png?50}}" =?>+ para (imageWith ("", [], [("width", "50")]) "/wiki/dokuwiki-128.png" "" (str "dokuwiki-128.png"))+ , "Image with width and height" =:+ "{{wiki:dokuwiki-128.png?nocache&50x100}}" =?>+ para (imageWith ("", [], [("width", "50"), ("height", "100")]) "/wiki/dokuwiki-128.png" "" (str "dokuwiki-128.png"))+ , "Linkonly" =:+ "{{wiki:dokuwiki-128.png?linkonly}}" =?>+ para (link "/wiki/dokuwiki-128.png" "" (str "dokuwiki-128.png"))+ ]+ , "Ignore ~~NOTOC~~" =:+ "Here is a ~~NOTOC~~ macro" =?>+ para "Here is a macro"+ , "Ignore ~~NOCACHE~~" =:+ "Here is a ~~NOCACHE~~ macro" =?>+ para "Here is a macro"+ ]+ , testGroup "Sectioning"+ [ "Headline level 1" =:+ "====== Headline Level 1 ======" =?>+ header 1 "Headline Level 1"+ , "Headline level 2" =:+ "===== Headline Level 2 =====" =?>+ header 2 "Headline Level 2"+ , "Headline level 3" =:+ "==== Headline Level 3 ====" =?>+ header 3 "Headline Level 3"+ , "Headline level 4" =:+ "=== Headline Level 4 ===" =?>+ header 4 "Headline Level 4"+ , "Headline level 5" =:+ "== Headline Level 5 ==" =?>+ header 5 "Headline Level 5"+ , "Only two closing = are required" =:+ "====== Headline Level 1 ==" =?>+ header 1 "Headline Level 1"+ , "One closing = is not enough" =:+ "====== Headline Level 1 =" =?>+ para "====== Headline Level 1 ="+ , "One closing = is not enough" =:+ "== Headline with = sign ==" =?>+ header 5 "Headline with = sign"+ ]+ , "Horizontal line" =:+ "----" =?>+ horizontalRule+ , testGroup "Lists"+ [ "Unordered list" =:+ T.unlines [ " * This is a list"+ , " * The second item"+ , " * You may have different levels"+ , " * Another item"+ ] =?>+ bulletList [ plain "This is a list"+ , plain "The second item" <>+ bulletList [ plain "You may have different levels" ]+ , plain "Another item"+ ]+ , "Ordered list" =:+ T.unlines [ " - The same list but ordered"+ , " - Another item"+ , " - Just use indention for deeper levels"+ , " - That's it"+ ] =?>+ orderedList [ plain "The same list but ordered"+ , plain "Another item" <>+ orderedList [ plain "Just use indention for deeper levels" ]+ , plain "That's it"+ ]+ , "Multiline list items" =: -- https://www.dokuwiki.org/faq:lists+ T.unlines [ " - first item"+ , " - second item with linebreak\\\\ second line"+ , " - third item with code: <code>"+ , "some code"+ , "comes here"+ , "</code>"+ , " - fourth item"+ ] =?>+ orderedList [ plain "first item"+ , plain ("second item with linebreak" <> linebreak <> " second line")+ , plain ("third item with code: " <> code "some code\ncomes here\n")+ , plain "fourth item"+ ]+ ]+ , "Block HTML" =:+ T.unlines [ "<HTML>"+ , "<p style=\"border:2px dashed red;\">And this is some block HTML</p>"+ , "</HTML>"+ ] =?>+ rawBlock "html" "<p style=\"border:2px dashed red;\">And this is some block HTML</p>\n"+ , "Block PHP" =:+ T.unlines [ "<PHP>"+ , "echo '<p>Hello World</p>';"+ , "</PHP>"+ ] =?>+ codeBlockWith ("", ["php"], []) "echo '<p>Hello World</p>';\n"+ , "Quote" =:+ T.unlines [ "> foo"+ , ">no space is required after >"+ , "> bar"+ , ">> baz"+ , "> bat"+ ] =?>+ blockQuote (plain "foo" <>+ plain "no space is required after >" <>+ plain "bar" <>+ blockQuote (plain "baz") <>+ plain "bat")+ , "Code block" =:+ T.unlines [ "<code>"+ , "foo bar baz"+ , "</code>"+ ] =?>+ codeBlock "foo bar baz\n"+ , "Java code block" =:+ T.unlines [ "<code java>"+ , "public static void main"+ , "</code>"+ ] =?>+ codeBlockWith ("", ["java"], []) "public static void main\n"+ , "File with filename and no language" =:+ T.unlines [ "<file - foo.bar>"+ , "file contents"+ , "</file>"+ ] =?>+ codeBlock "file contents\n"+ , "Table" =:+ T.unlines [ "| foo | bar |"+ , "| bat | baz |"+ ] =?>+ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0)]+ []+ [[plain "foo", plain "bar"]+ ,[plain "bat", plain "baz"]]+ , "Table with header" =:+ T.unlines [ "^ foo ^ bar ^"+ , "| bat | baz |"+ ] =?>+ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0)]+ [plain "foo", plain "bar"]+ [[plain "bat", plain "baz"]]+ , "Table with colspan" =:+ T.unlines [ "^ 0,0 ^ 0,1 ^ 0,2 ^"+ , "| 1,0 | 1,1 ||"+ , "| 2,0 | 2,1 | 2,2 |"+ ] =?>+ table mempty [(AlignDefault, 0.0), (AlignDefault, 0.0), (AlignDefault, 0.0)]+ [plain "0,0", plain "0,1", plain "0,2"]+ [[plain "1,0", plain "1,1", mempty]+ ,[plain "2,0", plain "2,1", plain "2,2"]+ ]+ , "Indented code block" =:+ T.unlines [ "foo"+ , " bar"+ , " bat"+ , "baz"+ ] =?>+ para "foo" <>+ codeBlock "bar\n bat\n" <>+ para "baz"+ ]
@@ -319,9 +319,9 @@ Ext_literate_haskell pandocExtensions }) "inverse bird tracks and html" $ "> a\n\n< b\n\n<div>\n"- =?> codeBlockWith ("",["sourceCode","literate","haskell"],[]) "a"+ =?> codeBlockWith ("",["haskell","literate"],[]) "a" <>- codeBlockWith ("",["sourceCode","haskell"],[]) "b"+ codeBlockWith ("",["haskell"],[]) "b" <> rawBlock "html" "<div>\n\n" ]
@@ -726,6 +726,11 @@ Pandoc (setMeta "title" (MetaInlines $ toList "Document title") $ setMeta "notes" (MetaInlines $ toList "First line\nand second line") $ setMeta "author" (MetaInlines $ toList "Name") nullMeta) mempty+ , "Amusewiki's #cover is translated to pandoc's #cover-image" =:+ "#cover cover.png" =?>+ let titleInline = toList "cover.png"+ meta = setMeta "cover-image" (MetaInlines titleInline) nullMeta+ in Pandoc meta mempty ] , testGroup "Anchors" [ "Anchor" =:
@@ -192,9 +192,14 @@ headerWith ("level3", [], []) 3 "Level3") , testWithFiles [("./level3.org", "*** Level3\n\n")]- "Minlevel shifts level"+ "Minlevel shifts level leftward" (T.unlines [ "#+include: \"level3.org\" :minlevel 1" ] =?> headerWith ("level3", [], []) 1 "Level3")++ , testWithFiles [("./level1.org", "* Level1\n\n")]+ "Minlevel shifts level rightward"+ (T.unlines [ "#+include: \"level1.org\" :minlevel 3" ] =?>+ headerWith ("level1", [], []) 3 "Level1") , testWithFiles [("./src.hs", "putStrLn outString\n")] "Include file as source code snippet"
@@ -184,26 +184,26 @@ , testGroup "Images" [ "Image" =:- "[[./sunset.jpg]]" =?>- para (image "./sunset.jpg" "" "")+ "[[./sunset.jpg]]" =?>+ para (image "./sunset.jpg" "" "") , "Image with explicit file: prefix" =:- "[[file:sunrise.jpg]]" =?>- para (image "sunrise.jpg" "" "")+ "[[file:sunrise.jpg]]" =?>+ para (image "sunrise.jpg" "" "") , "Multiple images within a paragraph" =:- T.unlines [ "[[file:sunrise.jpg]]"- , "[[file:sunset.jpg]]"- ] =?>- para ((image "sunrise.jpg" "" "")+ T.unlines [ "[[file:sunrise.jpg]]"+ , "[[file:sunset.jpg]]"+ ] =?>+ para (image "sunrise.jpg" "" "" <> softbreak- <> (image "sunset.jpg" "" ""))+ <> image "sunset.jpg" "" "") , "Image with html attributes" =:- T.unlines [ "#+ATTR_HTML: :width 50%"- , "[[file:guinea-pig.gif]]"- ] =?>- para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "")+ T.unlines [ "#+ATTR_HTML: :width 50%"+ , "[[file:guinea-pig.gif]]"+ ] =?>+ para (imageWith ("", [], [("width", "50%")]) "guinea-pig.gif" "" "") ] , "Explicit link" =:@@ -215,6 +215,10 @@ "[[http://zeitlens.com/]]" =?> para (link "http://zeitlens.com/" "" "http://zeitlens.com/") + , "Internal self-link (reference)" =:+ "[[#rabbit]]" =?>+ para (link "#rabbit" "" "#rabbit")+ , "Absolute file link" =: "[[/url][hi]]" =?> para (link "file:///url" "" "hi")@@ -234,6 +238,10 @@ , "Image link with non-image target" =: "[[http://example.com][./logo.png]]" =?> para (link "http://example.com" "" (image "./logo.png" "" ""))++ , "Link to image" =:+ "[[https://example.com/image.jpg][Look!]]" =?>+ para (link "https://example.com/image.jpg" "" (str "Look!")) , "Plain link" =: "Posts on http://zeitlens.com/ can be funny at times." =?>
@@ -106,21 +106,21 @@ ] =?> doc (codeBlockWith ( ""- , ["sourceCode", "python", "numberLines", "class1", "class2", "class3"]+ , ["python", "numberLines", "class1", "class2", "class3"] , [ ("startFrom", "34") ] ) "def func(x):\n return y") , "Code directive with number-lines, no line specified" =: T.unlines [ ".. code::python"- , " :number-lines: "+ , " :number-lines:" , "" , " def func(x):" , " return y" ] =?> doc (codeBlockWith ( ""- , ["sourceCode", "python", "numberLines"]- , [ ("startFrom", "") ]+ , ["python", "numberLines"]+ , [] ) "def func(x):\n return y") , testGroup "literal / line / code blocks"@@ -164,18 +164,18 @@ [ "literal role prefix" =: ":literal:`a`" =?> para (code "a") , "literal role postfix" =: "`a`:literal:" =?> para (code "a") , "literal text" =: "``text``" =?> para (code "text")- , "code role" =: ":code:`a`" =?> para (codeWith ("", ["sourceCode"], []) "a")+ , "code role" =: ":code:`a`" =?> para (codeWith ("", [], []) "a") , "inherited code role" =: ".. role:: codeLike(code)\n\n:codeLike:`a`"- =?> para (codeWith ("", ["codeLike", "sourceCode"], []) "a")+ =?> para (codeWith ("", ["codeLike"], []) "a") , "custom code role with language field" =: ".. role:: lhs(code)\n :language: haskell\n\n:lhs:`a`"- =?> para (codeWith ("", ["lhs", "haskell","sourceCode"], []) "a")+ =?> para (codeWith ("", ["lhs", "haskell"], []) "a") , "custom role with unspecified parent role" =: ".. role:: classy\n\n:classy:`text`" =?> para (spanWith ("", ["classy"], []) "text") , "role with recursive inheritance" =: ".. role:: haskell(code)\n.. role:: lhs(haskell)\n\n:lhs:`text`"- =?> para (codeWith ("", ["lhs", "haskell", "sourceCode"], []) "text")+ =?> para (codeWith ("", ["lhs", "haskell"], []) "text") , "unknown role" =: ":unknown:`text`" =?> para (codeWith ("",["interpreted-text"],[("role","unknown")]) "text") ]
@@ -37,22 +37,22 @@ [ test asciidoc "empty cells" $ simpleTable [] [[mempty],[mempty]] =?> unlines [ "[cols=\"\",]"- , "|===="+ , "|===" , "|" , "|"- , "|===="+ , "|===" ] , test asciidoc "multiblock cells" $ simpleTable [] [[para (text "Para 1") <> para (text "Para 2")]] =?> unlines [ "[cols=\"\",]"- , "|====="+ , "|===" , "a|" , "Para 1" , "" , "Para 2" , ""- , "|====="+ , "|===" ] ] ]
@@ -156,4 +156,14 @@ "docx/custom_style.native" "docx/golden/custom_style_reference.docx" ]+ , testGroup "metadata"+ [ docxTest "document properties (core, custom)"+ def+ "docx/document-properties.native"+ "docx/golden/document-properties.docx"+ , docxTest "document properties (short description)"+ def+ "docx/document-properties-short-desc.native"+ "docx/golden/document-properties-short-desc.docx"+ ] ]
@@ -99,4 +99,12 @@ def "pptx/raw_ooxml.native" "pptx/raw_ooxml.pptx"+ , pptxTests "metadata, custom properties"+ def+ "pptx/document-properties.native"+ "pptx/document-properties.pptx"+ , pptxTests "metadata, short description"+ def+ "pptx/document-properties-short-desc.native"+ "pptx/document-properties-short-desc.pptx" ]
@@ -19,7 +19,7 @@ `hi\ there`:code: ^D [Para [Superscript [Str "hithere"]]-,Para [Code ("",["sourceCode"],[]) "hi\\ there"]]+,Para [Code ("",[],[]) "hi\\ there"]] ``` Backtick followed by alphanumeric doesn't end the span:
@@ -0,0 +1,9 @@+```+% pandoc -t docbook+hi+^D+<para>+ hi+</para>+```+
@@ -0,0 +1,13 @@+```+% pandoc -f markdown -t markdown_strict+{width=500px}++## Header 2+^D+<figure>+<img src="./my-figure.jpg" alt="My caption" width="500" /><figcaption>My caption</figcaption>+</figure>++Header 2+--------+```
@@ -0,0 +1,18 @@+```+pandoc -f org -t rst+| Option | Meaning |+|--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|+| =<= | Left alignment, additional characters are added to the right (default for string). |+| =>= | Right alignment, additional characters are added to the left. |+| =^= | Centered , the same amount of characters is added to the left and the right. |+| === | Padding. If a numeric value is printed with a sign, then additional characters are added after the sign. Otherwise it behaves like "=>=". This option is only available for numbers (default for numbers). |+^D+====== ============================================================================================================================================================================================================+Option Meaning+====== ============================================================================================================================================================================================================+``<`` Left alignment, additional characters are added to the right (default for string).+``>`` Right alignment, additional characters are added to the left.+``^`` Centered , the same amount of characters is added to the left and the right.+``=`` Padding. If a numeric value is printed with a sign, then additional characters are added after the sign. Otherwise it behaves like "``>``". This option is only available for numbers (default for numbers).+====== ============================================================================================================================================================================================================+```
@@ -0,0 +1,12 @@+This should not give a "Prelude.read: no parse" error:++```+% pandoc -M foo=1e -s -t markdown+hi+^D+---+foo: 1e+---++hi+```
@@ -0,0 +1,41 @@+```+% pandoc -f rst -t org+.. code:: haskell+ :number-lines: 42++ main = putStrLn "Hello World!"+ unsafePerformIO main+^D+#+BEGIN_SRC haskell -n 42+ main = putStrLn "Hello World!"+ unsafePerformIO main+#+END_SRC+```++```+% pandoc -f org -t native+#+BEGIN_SRC lisp -n 20+ (+ 1 1)+#+END_SRC++#+BEGIN_SRC lisp +n 10+ (+ 2 2)+#+END_SRC+^D+[CodeBlock ("",["commonlisp","numberLines"],[("org-language","lisp"),("startFrom","20")]) "(+ 1 1)\n"+,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]+```++```+% pandoc -f native -t org+[CodeBlock ("",["commonlisp","numberLines"],[("org-language","lisp"),("startFrom","20")]) "(+ 1 1)\n"+,CodeBlock ("",["commonlisp","numberLines","continuedSourceBlock"],[("org-language","lisp"),("startFrom","10")]) "(+ 2 2)\n"]+^D+#+BEGIN_SRC lisp -n 20+ (+ 1 1)+#+END_SRC++#+BEGIN_SRC lisp +n 10+ (+ 2 2)+#+END_SRC+```
@@ -0,0 +1,6 @@+```+pandoc -f rst -t native+.. include:: command/5182.txt+^D+[CodeBlock ("",["python","numberLines"],[]) "def func(x):\n return y"]+```
@@ -0,0 +1,5 @@+.. code::python+ :number-lines:++ def func(x):+ return y
@@ -0,0 +1,7 @@+```+% pandoc -f markdown_strict -t gfm+hard_line_breaks+Hello+there+^D+Hello there+```
@@ -0,0 +1,9 @@+```+% pandoc -f latex -t plain+foo+\endinput+bar+^D+foo+```+
@@ -0,0 +1,12 @@+```+% pandoc -f markdown -t html5+<textarea>+ one+ *two*+</textarea>+^D+<textarea>+ one+ *two*+</textarea>+```
@@ -101,3 +101,32 @@ ^D [Para [Str "hi",LineBreak,Str "hi"]] ```++```+% pandoc -f gfm -t native+- [ ] foo+- [x] bar+^D+[BulletList+ [[Plain [Str "\9744",Space,Str "foo"]]+ ,[Plain [Str "\9746",Space,Str "bar"]]]]+```++```+% pandoc -f gfm-task_lists -t native+- [ ] foo+- [x] bar+^D+[BulletList+ [[Plain [Str "[",Space,Str "]",Space,Str "foo"]]+ ,[Plain [Str "[x]",Space,Str "bar"]]]]+```++```+% pandoc -f gfm -t gfm+- [ ] foo+- [x] bar+^D+ - [ ] foo+ - [x] bar+```
@@ -0,0 +1,113 @@+tests adapted from <https://github.github.com/gfm/#task-list-items-extension->++```+% pandoc+- [ ] foo+- [x] bar+^D+<ul>+<li><input type="checkbox" disabled="" />+foo</li>+<li><input type="checkbox" disabled="" checked="" />+bar</li>+</ul>+```+++```+% pandoc+- [x] foo+ - [ ] bar+ - [x] baz+- [ ] bim+^D+<ul>+<li><input type="checkbox" disabled="" checked="" />+foo<ul>+<li><input type="checkbox" disabled="" />+bar</li>+<li><input type="checkbox" disabled="" checked="" />+baz</li>+</ul></li>+<li><input type="checkbox" disabled="" />+bim</li>+</ul>+```+++custom html task list test:++```+% pandoc+- [ ] unchecked+- plain item+- [x] checked++paragraph++1. [ ] ordered unchecked+2. [] plain item+3. [x] ordered checked++paragraph++- [ ] list item with a++ second paragraph++- [x] checked+^D+<ul>+<li><input type="checkbox" disabled="" />+unchecked</li>+<li>plain item</li>+<li><input type="checkbox" disabled="" checked="" />+checked</li>+</ul>+<p>paragraph</p>+<ol type="1">+<li><input type="checkbox" disabled="" />+ordered unchecked</li>+<li>[] plain item</li>+<li><input type="checkbox" disabled="" checked="" />+ordered checked</li>+</ol>+<p>paragraph</p>+<ul>+<li><p><input type="checkbox" disabled="" />+list item with a</p><p>second paragraph</p></li>+<li><p><input type="checkbox" disabled="" checked="" />+checked</p></li>+</ul>+```++latex task list test:++```+% pandoc -t latex+- [ ] foo bar++ baz++- [x] ok+^D+\begin{itemize}+\item[$\square$]+ foo bar++ baz+\item[$\boxtimes$]+ ok+\end{itemize}+```++round trip:++```+% pandoc -f markdown -t markdown+- [ ] foo+- [x] bar+^D+- [ ] foo+- [x] bar+```
@@ -0,0 +1,2 @@+Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("description",MetaInlines [Str "Short",Space,RawInline (Format "html") "<i>",Str "description",RawInline (Format "html") "</i>",Space,Str "&."]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]}) +[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
@@ -0,0 +1,2 @@+Pandoc (Meta {unMeta = fromList [("Company",MetaInlines [Str "My",Space,Str "Company"]),("Second Custom Property",MetaInlines [Str "Second",Space,Str "custom",Space,Str "property",Space,Str "value"]),("abstract",MetaBlocks [Plain [Str "Quite",Space,Str "a",Space,Str "long",Space,Str "description",SoftBreak,Str "spanning",Space,Str "several",Space,Str "lines"]]),("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("category",MetaInlines [Str "My",Space,Str "Category"]),("custom1",MetaInlines [Str "First",Space,Str "custom",Space,Str "property",Space,Str "value"]),("custom3",MetaInlines [Str "Escaping",Space,Str "amp",Space,Str "&",Space,Str "."]),("custom4",MetaInlines [Str "Escaping",Space,Str "LT,GT",Space,Str "<",Space,Str "asdf",Space,Str ">",Space,Str "<"]),("custom5",MetaInlines [Str "Escaping",Space,Str "html",Space,RawInline (Format "html") "<i>",Str "asdf",RawInline (Format "html") "</i>"]),("custom6",MetaInlines [Str "Escaping",Space,Emph [Str "MD"],Space,Str "\225",Space,Str "a"]),("custom9",MetaInlines [Str "Extended",Space,Str "chars:",Space,Str "\8364",Space,Str "\225",Space,Str "\233",Space,Str "\237",Space,Str "\243",Space,Str "\250",Space,Str "$"]),("description",MetaBlocks [Para [Str "Long",Space,Str "description",Space,Str "spanning",SoftBreak,Str "several",Space,Str "lines."],Plain [Str "This",Space,Str "is",Space,Str "\225",Space,Str "second",Space,RawInline (Format "html") "<i>",Str "line",RawInline (Format "html") "</i>",Str "."]]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("lang",MetaInlines [Str "en-US"]),("nested-custom",MetaList [MetaMap (fromList [("custom 7",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "7"])]),MetaMap (fromList [("custom 8",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "8"])])]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("subtitle",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "subtitle"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]}) +[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
binary file changed (absent → 9902 bytes)
binary file changed (absent → 10388 bytes)
binary file changed (absent → 16735 bytes)
@@ -0,0 +1,37 @@+[Para [Str "For",Space,Str "each",Space,Str "initiative",Space,Str "below",Space,Str "is",Space,Str "outlined",Space,Str "the",Space,Str "goals,",Space,Str "an",Space,Str "approximate",Space,Str "roadmap",Space,Str "which",Space,Str "will",Space,Str "likely",Space,Str "change",Space,Str "as",Space,Str "we",Space,Str "iterate,",Space,Str "signals/metrics",Space,Str "to",Space,Str "measure",Space,Str "success,",Space,Str "and",Space,Str "initial",Space,Str "workitems",Space,Str "with",Space,Str "a",Space,Str "rough",Space,Strong [Str "schedule"],Space,Str "and",Space,Str "contacts",Space,Str "where",Space,Str "available:"]+,Para [Str "\160"]+,OrderedList (1,Decimal,Period)+ [[BlockQuote+ [Para [Str "State",Space,Str "of",Space,Str "Documentation"]]]]+,BlockQuote+ [Para [Strong [Str "Goal:",Space,Str "Baseline",Space,Str "and",Space,Str "ongoing",Space,Str "metrics",Space,Str "tracking",Space,Str "doc",Space,Str "usefulness",Space,Str "and",Space,Str "completeness."]]+ ,Para [Str "\160"]]+,OrderedList (2,Decimal,Period)+ [[BlockQuote+ [Para [Str "Content",Space,Str "Migration"]]]]+,BlockQuote+ [Para [Str "Goal:",Space,Str "Content",Space,Str "is",Space,Str "accessible",Space,Str "to",Space,Str "new",Space,Str "employees",Space,Str "and",Space,Str "is",Space,Str "better",Space,Str "organized/archived."]+ ,Para [Str "\160"]]+,OrderedList (3,Decimal,Period)+ [[BlockQuote+ [Para [Str "Wiki",Space,Str "(xl)"]]]]+,BlockQuote+ [Para [Strong [Str "Goal:",Space,Str "Useful",Space,Str "documentation",Space,Str "that",Space,Str "is",Space,Str "archived,",Space,Str "searchable",Space,Str "and",Space,Str "easy",Space,Str "to",Space,Str "create"]]+ ,Para [Str "\160\160"]]+,OrderedList (4,Decimal,Period)+ [[BlockQuote+ [Para [Str "XL",Space,Str "Code",Space,Str "Autoreview",Space,Str "Bot",Space,Str "(XLCRBot)."]]]]+,BlockQuote+ [Para [Strong [Str "Goal:",Space,Str "Feedback",Space,Str "on",Space,Str "basic",Space,Str "violations",Space,Str "in",Space,Str "seconds",Space,Str "or",Space,Str "minutes",Space,Str "at",Space,Str "most",Space,Str "in",Space,Str "either",Space,Str "VS",Space,Str "or",Space,Str "Codeflow."]]]+,OrderedList (5,Decimal,Period)+ [[BlockQuote+ [Para [Str "Code",Space,Str "documentation"]]]]+,BlockQuote+ [Para [Strong [Str "Goal:",Space,Str "Useful,",Space,Str "consistent,",Space,Str "tool",Space,Str "supported",Space,Str "comments",Space]]]+,Para [Strong [Str "\160"],Str "\160"]+,OrderedList (6,Decimal,Period)+ [[BlockQuote+ [Para [Str "Education",Space,Str "efforts"]]]]+,BlockQuote+ [Para [Strong [Str "Goal:",Space,Str "Broad,",Space,Str "discoverable",Space,Str "channels",Space,Str "for",Space,Str "updates",Space,Str "and",Space,Str "news"]]]+,Para [Strong [Str "\160"]]]
@@ -1,1 +1,1 @@-{{https://cooluri.com/image.png|HTTPS image}} {{http://cooluri.com/image.png|HTTP image}} {{ftp://ftp.cooluri.com/image.png|FTP image}} {{file:///tmp/coolimage.png|Filesystem image}} {{:/image.jpg|Relative image 1}} {{:image.jpg|Relative image 2}}+{{https://cooluri.com/image.png|HTTPS image}} {{http://cooluri.com/image.png|HTTP image}} {{ftp://ftp.cooluri.com/image.png|FTP image}} {{file:///tmp/coolimage.png|Filesystem image}} {{/image.jpg|Relative image 1}} {{image.jpg|Relative image 2}}
@@ -1,6 +1,6 @@ [Header 1 ("lhs-test",[],[]) [Str "lhs",Space,Str "test"] ,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",SoftBreak,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]-,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n -- arr (\\op (x,y) -> x `op` y)"+,CodeBlock ("",["haskell","literate"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n -- arr (\\op (x,y) -> x `op` y)" ,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",SoftBreak,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",SoftBreak,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."] ,CodeBlock ("",[],[]) "f *** g = first f >>> second g" ,Para [Str "Block",Space,Str "quote:"]
@@ -5,13 +5,13 @@ <meta name="generator" content="pandoc" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> <title>lhs-test</title>- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} </style>- <style type="text/css">+ <style> a.sourceLine { display: inline-block; line-height: 1.25; } a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; } a.sourceLine:empty { height: 1.2em; }@@ -82,7 +82,7 @@ <h1 id="lhs-test">lhs test</h1> <p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>-<div class="sourceCode" id="cb1"><pre class="sourceCode literate haskell"><code class="sourceCode haskell"><a class="sourceLine" id="cb1-1" title="1"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d</a>+<div class="sourceCode" id="cb1"><pre class="sourceCode haskell literate"><code class="sourceCode haskell"><a class="sourceLine" id="cb1-1" title="1"><span class="ot">unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d</a> <a class="sourceLine" id="cb1-2" title="2">unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span></a> <a class="sourceLine" id="cb1-3" title="3"> <span class="co">-- arr (\op (x,y) -> x `op` y)</span></a></code></pre></div> <p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a
@@ -5,13 +5,13 @@ <meta name="generator" content="pandoc" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> <title>lhs-test</title>- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;} div.column{display: inline-block; vertical-align: top; width: 50%;} </style>- <style type="text/css">+ <style> a.sourceLine { display: inline-block; line-height: 1.25; } a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; } a.sourceLine:empty { height: 1.2em; }@@ -82,7 +82,7 @@ <h1 id="lhs-test">lhs test</h1> <p><code>unsplit</code> is an arrow that takes a pair of values and combines them to return a single value:</p>-<div class="sourceCode" id="cb1"><pre class="sourceCode literate literatehaskell"><code class="sourceCode literatehaskell"><a class="sourceLine" id="cb1-1" title="1"><span class="ot">> unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d</a>+<div class="sourceCode" id="cb1"><pre class="sourceCode literatehaskell literate"><code class="sourceCode literatehaskell"><a class="sourceLine" id="cb1-1" title="1"><span class="ot">> unsplit ::</span> (<span class="dt">Arrow</span> a) <span class="ot">=></span> (b <span class="ot">-></span> c <span class="ot">-></span> d) <span class="ot">-></span> a (b, c) d</a> <a class="sourceLine" id="cb1-2" title="2"><span class="ot">></span> unsplit <span class="fu">=</span> arr <span class="fu">.</span> <span class="fu">uncurry</span></a> <a class="sourceLine" id="cb1-3" title="3"><span class="ot">></span> <span class="co">-- arr (\op (x,y) -> x `op` y)</span></a></code></pre></div> <p><code>(***)</code> combines two arrows into a new arrow by running the two arrows on a
@@ -1,36 +1,42 @@ \PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere \PassOptionsToPackage{hyphens}{url} %-\documentclass[]{article}+\documentclass[+]{article} \usepackage{lmodern} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex}-\usepackage{fixltx2e} % provides \textsubscript \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols \else % if luatex or xelatex \usepackage{unicode-math}- \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}+ \defaultfontfeatures{Scale=MatchLowercase}+ \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi % use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{}-% use microtype if available-\IfFileExists{microtype.sty}{%-\usepackage[]{microtype}-\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts+\IfFileExists{microtype.sty}{% use microtype if available+ \usepackage[]{microtype}+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{}-\IfFileExists{parskip.sty}{%-\usepackage{parskip}-}{% else-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt}-}-\usepackage{hyperref}+\makeatletter+\@ifundefined{KOMAClassName}{% if non-KOMA class+ \IfFileExists{parskip.sty}{%+ \usepackage{parskip}+ }{% else+ \setlength{\parindent}{0pt}+ \setlength{\parskip}{6pt plus 2pt minus 1pt}}+}{% if KOMA class+ \KOMAoptions{parskip=half}}+\makeatother+\usepackage{xcolor}+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \hypersetup{- pdfborder={0 0 0},- breaklinks=true}+ pdfborder={0 0 0},+ breaklinks=true} \urlstyle{same} % don't use monospace font for urls \usepackage{color} \usepackage{fancyvrb}@@ -73,15 +79,15 @@ \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{0}+\setcounter{secnumdepth}{-2} % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else-\let\oldparagraph\paragraph-\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}+ \let\oldparagraph\paragraph+ \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else-\let\oldsubparagraph\subparagraph-\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}+ \let\oldsubparagraph\subparagraph+ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi % set default figure placement to htbp
@@ -1,52 +1,60 @@ \PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere \PassOptionsToPackage{hyphens}{url} %-\documentclass[]{article}+\documentclass[+]{article} \usepackage{lmodern} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex}-\usepackage{fixltx2e} % provides \textsubscript \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols \else % if luatex or xelatex \usepackage{unicode-math}- \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}+ \defaultfontfeatures{Scale=MatchLowercase}+ \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi % use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{}-% use microtype if available-\IfFileExists{microtype.sty}{%-\usepackage[]{microtype}-\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts+\IfFileExists{microtype.sty}{% use microtype if available+ \usepackage[]{microtype}+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{}-\IfFileExists{parskip.sty}{%-\usepackage{parskip}-}{% else-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt}-}-\usepackage{hyperref}+\makeatletter+\@ifundefined{KOMAClassName}{% if non-KOMA class+ \IfFileExists{parskip.sty}{%+ \usepackage{parskip}+ }{% else+ \setlength{\parindent}{0pt}+ \setlength{\parskip}{6pt plus 2pt minus 1pt}}+}{% if KOMA class+ \KOMAoptions{parskip=half}}+\makeatother+\usepackage{xcolor}+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \hypersetup{- pdfborder={0 0 0},- breaklinks=true}+ pdfborder={0 0 0},+ breaklinks=true} \urlstyle{same} % don't use monospace font for urls \usepackage{listings} \newcommand{\passthrough}[1]{#1}+\lstset{defaultdialect=[5.3]Lua}+\lstset{defaultdialect=[x86masm]Assembler} \lstnewenvironment{code}{\lstset{language=Haskell,basicstyle=\small\ttfamily}}{} \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{0}+\setcounter{secnumdepth}{-2} % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else-\let\oldparagraph\paragraph-\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}+ \let\oldparagraph\paragraph+ \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else-\let\oldsubparagraph\subparagraph-\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}+ \let\oldsubparagraph\subparagraph+ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi % set default figure placement to htbp
@@ -4,7 +4,7 @@ `unsplit` is an arrow that takes a pair of values and combines them to return a single value: -``` {.sourceCode .literate .haskell}+``` {.haskell .literate} unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d unsplit = arr . uncurry -- arr (\op (x,y) -> x `op` y)
@@ -1,6 +1,6 @@ [Header 1 ("lhs-test",[],[]) [Str "lhs",Space,Str "test"] ,Para [Code ("",[],[]) "unsplit",Space,Str "is",Space,Str "an",Space,Str "arrow",Space,Str "that",Space,Str "takes",Space,Str "a",Space,Str "pair",Space,Str "of",Space,Str "values",Space,Str "and",Space,Str "combines",Space,Str "them",Space,Str "to",SoftBreak,Str "return",Space,Str "a",Space,Str "single",Space,Str "value:"]-,CodeBlock ("",["sourceCode","literate","haskell"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n -- arr (\\op (x,y) -> x `op` y)"+,CodeBlock ("",["haskell","literate"],[]) "unsplit :: (Arrow a) => (b -> c -> d) -> a (b, c) d\nunsplit = arr . uncurry\n -- arr (\\op (x,y) -> x `op` y)" ,Para [Code ("",[],[]) "(***)",Space,Str "combines",Space,Str "two",Space,Str "arrows",Space,Str "into",Space,Str "a",Space,Str "new",Space,Str "arrow",Space,Str "by",Space,Str "running",Space,Str "the",Space,Str "two",Space,Str "arrows",Space,Str "on",Space,Str "a",SoftBreak,Str "pair",Space,Str "of",Space,Str "values",Space,Str "(one",Space,Str "arrow",Space,Str "on",Space,Str "the",Space,Str "first",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair",Space,Str "and",Space,Str "one",Space,Str "arrow",Space,Str "on",Space,Str "the",SoftBreak,Str "second",Space,Str "item",Space,Str "of",Space,Str "the",Space,Str "pair)."] ,CodeBlock ("",[],[]) "f *** g = first f >>> second g" ,Para [Str "Block",Space,Str "quote:"]
@@ -0,0 +1,10 @@+-- Test that constructors are "smart" in that they autoconvert+-- types where sensible.+function Para (_)+ return {+ pandoc.BulletList{pandoc.Para "Hello", pandoc.Para "World"},+ pandoc.DefinitionList{{"foo", pandoc.Para "placeholder"}},+ pandoc.LineBlock{"Moin", "Welt"},+ pandoc.OrderedList{pandoc.Plain{pandoc.Str "one"}, pandoc.Plain "two"}+ }+end
@@ -1,19 +1,19 @@ Pandoc (Meta {unMeta = fromList []}) [Header 1 ("header",[],[]) [Str "header"]-,Header 2 ("header-level-two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]-,Header 3 ("header-level-3",[],[]) [Str "header",Space,Str "level",Space,Str "3"]-,Header 4 ("header-level-four",[],[]) [Str "header",Space,Emph [Str "level"],Space,Str "four"]-,Header 5 ("header-level-5",[],[]) [Str "header",Space,Str "level",Space,Str "5"]-,Header 6 ("header-level-6",[],[]) [Str "header",Space,Str "level",Space,Str "6"]+,Header 2 ("header_level_two",[],[]) [Str "header",Space,Str "level",Space,Str "two"]+,Header 3 ("header_level_3",[],[]) [Str "header",Space,Str "level",Space,Str "3"]+,Header 4 ("header_level_four",[],[]) [Str "header",Space,Emph [Str "level"],Space,Str "four"]+,Header 5 ("header_level_5",[],[]) [Str "header",Space,Str "level",Space,Str "5"]+,Header 6 ("header_level_6",[],[]) [Str "header",Space,Str "level",Space,Str "6"] ,Para [Str "=======",Space,Str "not",Space,Str "a",Space,Str "header",Space,Str "========"] ,Para [Code ("",[],[]) "==\160not\160a\160header\160=="]-,Header 2 ("emph-and-strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"]+,Header 2 ("emph_and_strong",[],[]) [Str "emph",Space,Str "and",Space,Str "strong"] ,Para [Emph [Str "emph"],Space,Strong [Str "strong"]] ,Para [Strong [Emph [Str "strong",Space,Str "and",Space,Str "emph"]]] ,Para [Strong [Emph [Str "emph",Space,Str "inside"],Space,Str "strong"]] ,Para [Strong [Str "strong",Space,Str "with",Space,Emph [Str "emph"]]] ,Para [Emph [Strong [Str "strong",Space,Str "inside"],Space,Str "emph"]]-,Header 2 ("horizontal-rule",[],[]) [Str "horizontal",Space,Str "rule"]+,Header 2 ("horizontal_rule",[],[]) [Str "horizontal",Space,Str "rule"] ,Para [Str "top"] ,HorizontalRule ,Para [Str "bottom"]@@ -46,36 +46,36 @@ [([], [[Plain [Str "there"]]])]]])] ,Para [Str "bud"]-,Header 2 ("p-tags",[],[]) [Str "p",Space,Str "tags"]+,Header 2 ("p_tags",[],[]) [Str "p",Space,Str "tags"] ,Para [Str "hi",Space,Str "there"] ,Para [Str "bud"] ,Para [Str "another"]-,Header 2 ("raw-html",[],[]) [Str "raw",Space,Str "html"]+,Header 2 ("raw_html",[],[]) [Str "raw",Space,Str "html"] ,Para [Str "hi",Space,RawInline (Format "html") "<span style=\"color:red\">",Emph [Str "there"],RawInline (Format "html") "</span>",Str "."] ,Para [RawInline (Format "html") "<ins>",Str "inserted",RawInline (Format "html") "</ins>"] ,RawBlock (Format "html") "<div class=\"special\">" ,Para [Str "hi",Space,Emph [Str "there"]] ,RawBlock (Format "html") "</div>"-,Header 2 ("sup-sub-del",[],[]) [Str "sup,",Space,Str "sub,",Space,Str "del"]+,Header 2 ("sup_sub_del",[],[]) [Str "sup,",Space,Str "sub,",Space,Str "del"] ,Para [Str "H",Subscript [Str "2"],Str "O",Space,Str "base",Superscript [Emph [Str "exponent"]],SoftBreak,Strikeout [Str "hello"]]-,Header 2 ("inline-code",[],[]) [Str "inline",Space,Str "code"]+,Header 2 ("inline_code",[],[]) [Str "inline",Space,Str "code"] ,Para [Code ("",[],[]) "*\8594*",Space,Code ("",[],[]) "typed",Space,Code ("",["haskell"],[]) ">>="]-,Header 2 ("code-blocks",[],[]) [Str "code",Space,Str "blocks"]+,Header 2 ("code_blocks",[],[]) [Str "code",Space,Str "blocks"] ,CodeBlock ("",[],[]) "case xs of\n (_:_) -> reverse xs\n [] -> ['*']" ,CodeBlock ("",["haskell"],[]) "case xs of\n (_:_) -> reverse xs\n [] -> ['*']" ,CodeBlock ("",["ruby","numberLines"],[("startFrom","100")]) "widgets.each do |w|\n print w.price\nend"-,Header 2 ("block-quotes",[],[]) [Str "block",Space,Str "quotes"]+,Header 2 ("block_quotes",[],[]) [Str "block",Space,Str "quotes"] ,Para [Str "Regular",Space,Str "paragraph"] ,BlockQuote [Para [Str "This",Space,Str "is",Space,Str "a",Space,Str "block",Space,Str "quote."] ,Para [Str "With",Space,Str "two",Space,Str "paragraphs."]] ,Para [Str "Nother",Space,Str "paragraph."]-,Header 2 ("external-links",[],[]) [Str "external",Space,Str "links"]+,Header 2 ("external_links",[],[]) [Str "external",Space,Str "links"] ,Para [Link ("",[],[]) [Emph [Str "Google"],Space,Str "search",Space,Str "engine"] ("http://google.com","")] ,Para [Link ("",[],[]) [Str "http://pandoc.org"] ("http://pandoc.org","")] ,Para [Link ("",[],[]) [Str "1"] ("http://google.com",""),Space,Link ("",[],[]) [Str "2"] ("http://yahoo.com","")] ,Para [Link ("",[],[]) [Str "email",Space,Str "me"] ("mailto:info@example.org","")]-,Header 2 ("internal-links",[],[]) [Str "internal",Space,Str "links"]+,Header 2 ("internal_links",[],[]) [Str "internal",Space,Str "links"] ,Para [Link ("",[],[]) [Str "Help"] ("Help","wikilink")] ,Para [Link ("",[],[]) [Str "the",Space,Str "help",Space,Str "page"] ("Help","wikilink")] ,Para [Link ("",[],[]) [Str "Helpers"] ("Help","wikilink")]@@ -171,7 +171,7 @@ ,Header 2 ("math",[],[]) [Str "math"] ,Para [Str "Here",Space,Str "is",Space,Str "some",Space,Math InlineMath "x=\\frac{y^\\pi}{z}",Str "."] ,Para [Str "With",Space,Str "spaces:",Space,Math InlineMath "x=\\frac{y^\\pi}{z}",Str "."]-,Header 2 ("preformatted-blocks",[],[]) [Str "preformatted",Space,Str "blocks"]+,Header 2 ("preformatted_blocks",[],[]) [Str "preformatted",Space,Str "blocks"] ,Para [Code ("",[],[]) "Start\160each\160line\160with\160a\160space.",LineBreak,Code ("",[],[]) "Text\160is\160",Strong [Code ("",[],[]) "preformatted"],Code ("",[],[]) "\160and",LineBreak,Emph [Code ("",[],[]) "markups"],Code ("",[],[]) "\160",Strong [Emph [Code ("",[],[]) "can"]],Code ("",[],[]) "\160be\160done."] ,Para [Code ("",[],[]) "\160hell\160\160\160\160\160\160yeah"] ,Para [Code ("",[],[]) "Start\160with\160a\160space\160in\160the\160first\160column,",LineBreak,Code ("",[],[]) "(before\160the\160<nowiki>).",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "Then\160your\160block\160format\160will\160be",LineBreak,Code ("",[],[]) "\160\160\160\160maintained.",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "This\160is\160good\160for\160copying\160in\160code\160blocks:",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "def\160function():",LineBreak,Code ("",[],[]) "\160\160\160\160\"\"\"documentation\160string\"\"\"",LineBreak,Code ("",[],[]) "",LineBreak,Code ("",[],[]) "\160\160\160\160if\160True:",LineBreak,Code ("",[],[]) "\160\160\160\160\160\160\160\160print\160True",LineBreak,Code ("",[],[]) "\160\160\160\160else:",LineBreak,Code ("",[],[]) "\160\160\160\160\160\160\160\160print\160False"]
@@ -0,0 +1,7 @@+Pandoc (Meta {unMeta = fromList []})+[Header 1 ("will-appear-because-it-is-the-ancestor-of-something-tagged-yes",[],[]) [Str "Will",Space,Str "appear",Space,Str "because",Space,Str "it",Space,Str "is",Space,Str "the",Space,Str "ancestor",Space,Str "of",Space,Str "something",Space,Str "tagged",Space,Str "\"yes\""]+,Header 2 ("will-appear",[],[]) [Str "Will",Space,Str "appear",Space,Span ("",["tag"],[("tag-name","yes")]) [SmallCaps [Str "yes"]]]+,Header 3 ("will-appear-since-the-entire-subtree-of-something-selected-will-appear",[],[]) [Str "Will",Space,Str "appear",Space,Str "since",Space,Str "the",Space,Str "entire",Space,Str "subtree",Space,Str "of",Space,Str "something",Space,Str "selected",Space,Str "will",Space,Str "appear"]+,OrderedList (1,DefaultStyle,DefaultDelim)+ [[Para [Str "Will",Space,Str "appear"]]]+,Header 2 ("will-appear-because-it-is-the-ancestor-of-something-listed-in-select-tags",[],[]) [Str "Will",Space,Str "appear",Space,Str "because",Space,Str "it",Space,Str "is",Space,Str "the",Space,Str "ancestor",Space,Str "of",Space,Str "something",Space,Str "listed",Space,Str "in",Space,Str "SELECT-TAGS"]]
@@ -0,0 +1,17 @@+#+SELECT_TAGS: yes no+#+EXCLUDE_TAGS: no++In a document containing one or more trees containing a tag+listed in SELECT_TAGS, only those trees and their ancestor nodes will appear;+this text and any other text preceding the first headline+won't appear for such documents.++* Will appear because it is the ancestor of something tagged "yes"+** Will appear :yes:+*** Will appear since the entire subtree of something selected will appear+**** Will appear+*** Will not appear since this has tagged with something in EXCLUDE-TAGS :no:+** Will not appear since it's not an ancestor of listed in SELECT-TAGS+** Will appear because it is the ancestor of something listed in SELECT-TAGS+*** Will not appear because it has an EXCLUDE-TAG, but since "no" is also listed as a SELECT-TAG, it will force its parent to appear :no:+* Will not appear
@@ -0,0 +1,2 @@+Pandoc (Meta {unMeta = fromList [("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("description",MetaInlines [Str "Short",Space,RawInline (Format "html") "<i>",Str "description",RawInline (Format "html") "</i>",Space,Str "&."]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]}) +[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
binary file changed (absent → 27002 bytes)
binary file changed (absent → 394321 bytes)
@@ -0,0 +1,2 @@+Pandoc (Meta {unMeta = fromList [("Company",MetaInlines [Str "My",Space,Str "Company"]),("Second Custom Property",MetaInlines [Str "Second",Space,Str "custom",Space,Str "property",Space,Str "value"]),("abstract",MetaBlocks [Plain [Str "Quite",Space,Str "a",Space,Str "long",Space,Str "description",SoftBreak,Str "spanning",Space,Str "several",Space,Str "lines"]]),("author",MetaList [MetaInlines [Str "A.",Space,Str "M."]]),("category",MetaInlines [Str "My",Space,Str "Category"]),("custom1",MetaInlines [Str "First",Space,Str "custom",Space,Str "property",Space,Str "value"]),("custom3",MetaInlines [Str "Escaping",Space,Str "amp",Space,Str "&",Space,Str "."]),("custom4",MetaInlines [Str "Escaping",Space,Str "LT,GT",Space,Str "<",Space,Str "asdf",Space,Str ">",Space,Str "<"]),("custom5",MetaInlines [Str "Escaping",Space,Str "html",Space,RawInline (Format "html") "<i>",Str "asdf",RawInline (Format "html") "</i>"]),("custom6",MetaInlines [Str "Escaping",Space,Emph [Str "MD"],Space,Str "\225",Space,Str "a"]),("custom9",MetaInlines [Str "Extended",Space,Str "chars:",Space,Str "\8364",Space,Str "\225",Space,Str "\233",Space,Str "\237",Space,Str "\243",Space,Str "\250",Space,Str "$"]),("description",MetaBlocks [Para [Str "Long",Space,Str "description",Space,Str "spanning",SoftBreak,Str "several",Space,Str "lines."],Plain [Str "This",Space,Str "is",Space,Str "\225",Space,Str "second",Space,RawInline (Format "html") "<i>",Str "line",RawInline (Format "html") "</i>",Str "."]]),("keywords",MetaList [MetaInlines [Str "keyword",Space,Str "1"],MetaInlines [Str "keyword",Space,Str "2"]]),("lang",MetaInlines [Str "en-US"]),("nested-custom",MetaList [MetaMap (fromList [("custom 7",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "7"])]),MetaMap (fromList [("custom 8",MetaInlines [Str "Nested",Space,Str "Custom",Space,Str "value",Space,Str "8"])])]),("subject",MetaInlines [Str "This",Space,Str "is",Space,Str "the",Space,Str "subject"]),("subtitle",MetaInlines [Str "This",Space,Str "is",Space,Str "a",Space,Str "subtitle"]),("title",MetaInlines [Str "Testing",Space,Str "custom",Space,Str "properties"])]}) +[Para [Str "Testing",Space,Str "document",Space,Str "properties"]]
binary file changed (absent → 27408 bytes)
binary file changed (absent → 394725 bytes)
binary file changed (26678 → 26959 bytes)
binary file changed (394004 → 394284 bytes)
binary file changed (27602 → 27883 bytes)
binary file changed (394927 → 395207 bytes)
binary file changed (44338 → 44618 bytes)
binary file changed (411658 → 411938 bytes)
binary file changed (25842 → 26123 bytes)
binary file changed (393163 → 393444 bytes)
binary file changed (26765 → 27046 bytes)
binary file changed (394091 → 394371 bytes)
binary file changed (26656 → 26937 bytes)
binary file changed (393982 → 394263 bytes)
binary file changed (43784 → 44064 bytes)
binary file changed (411101 → 411382 bytes)
binary file changed (28290 → 28571 bytes)
binary file changed (27461 → 27742 bytes)
binary file changed (394786 → 395066 bytes)
binary file changed (395617 → 395896 bytes)
binary file changed (29248 → 29530 bytes)
binary file changed (396575 → 396855 bytes)
binary file changed (35156 → 35435 bytes)
binary file changed (51322 → 51604 bytes)
binary file changed (418642 → 418927 bytes)
binary file changed (402475 → 402759 bytes)
binary file changed (27282 → 27563 bytes)
binary file changed (394610 → 394890 bytes)
binary file changed (25785 → 26066 bytes)
binary file changed (393106 → 393387 bytes)
@@ -38,7 +38,7 @@ ,Para [Str "And:"] ,CodeBlock ("",[],[]) "this block is indented by two tabs\n\nThese should not be escaped: \\$ \\\\ \\> \\[ \\{" ,Para [Str "And:"]-,CodeBlock ("",["sourceCode","python"],[]) "def my_function(x):\n return x + 1"+,CodeBlock ("",["python"],[]) "def my_function(x):\n return x + 1" ,Header 1 ("lists",[],[]) [Str "Lists"] ,Header 2 ("unordered",[],[]) [Str "Unordered"] ,Para [Str "Asterisks",Space,Str "tight:"]@@ -328,8 +328,8 @@ ,Para [Str "Reset",Space,Str "default-role",Space,Str "to",Space,Str "the",Space,Str "default",Space,Str "default."] ,Para [Str "And",Space,Str "now",Space,Span ("",["title-ref"],[]) [Str "some-invalid-string-3231231"],Space,Str "is",Space,Str "nonsense."] ,Para [Str "And",Space,Str "now",Space,Str "with",Space,RawInline (Format "html") "<b>inline</b> <span id=\"test\">HTML</span>",Str "."]-,Para [Str "And",Space,Str "some",Space,Str "inline",Space,Str "haskell",Space,Code ("",["haskell","sourceCode"],[]) "fmap id [1,2..10]",Str "."]-,Para [Str "Indirect",Space,Str "python",Space,Str "role",Space,Code ("",["py","python","indirect","sourceCode"],[]) "[x*x for x in [1,2,3,4,5]]",Str "."]-,Para [Str "Different",Space,Str "indirect",Space,Str "C",Space,Code ("",["c","different-indirect","sourceCode"],[]) "int x = 15;",Str "."]+,Para [Str "And",Space,Str "some",Space,Str "inline",Space,Str "haskell",Space,Code ("",["haskell"],[]) "fmap id [1,2..10]",Str "."]+,Para [Str "Indirect",Space,Str "python",Space,Str "role",Space,Code ("",["py","python","indirect"],[]) "[x*x for x in [1,2,3,4,5]]",Str "."]+,Para [Str "Different",Space,Str "indirect",Space,Str "C",Space,Code ("",["c","different-indirect"],[]) "int x = 15;",Str "."] ,Header 2 ("literal-symbols",[],[]) [Str "Literal",Space,Str "symbols"] ,Para [Str "2*2",Space,Str "=",Space,Str "4*1"]]
@@ -2,66 +2,66 @@ .Demonstration of simple table syntax. [cols=">,<,^,",options="header",]-|============================+|=== |Right |Left |Center |Default |12 |12 |12 |12 |123 |123 |123 |123 |1 |1 |1 |1-|============================+|=== Simple table without caption: [cols=">,<,^,",options="header",]-|============================+|=== |Right |Left |Center |Default |12 |12 |12 |12 |123 |123 |123 |123 |1 |1 |1 |1-|============================+|=== Simple table indented two spaces: .Demonstration of simple table syntax. [cols=">,<,^,",options="header",]-|============================+|=== |Right |Left |Center |Default |12 |12 |12 |12 |123 |123 |123 |123 |1 |1 |1 |1-|============================+|=== Multiline table with caption: .Here’s the caption. It may span multiple lines. [width="80%",cols="^20%,<17%,>20%,<43%",options="header",]-|=======================================================================+|=== |Centered Header |Left Aligned |Right Aligned |Default aligned |First |row |12.0 |Example of a row that spans multiple lines. |Second |row |5.0 |Here’s another one. Note the blank line between rows.-|=======================================================================+|=== Multiline table without caption: [width="80%",cols="^20%,<17%,>20%,<43%",options="header",]-|=======================================================================+|=== |Centered Header |Left Aligned |Right Aligned |Default aligned |First |row |12.0 |Example of a row that spans multiple lines. |Second |row |5.0 |Here’s another one. Note the blank line between rows.-|=======================================================================+|=== Table without column headers: [cols=">,<,^,>",]-|==================+|=== |12 |12 |12 |12 |123 |123 |123 |123 |1 |1 |1 |1-|==================+|=== Multiline table without column headers: [width="80%",cols="^20%,<17%,>20%,43%",]-|=======================================================================+|=== |First |row |12.0 |Example of a row that spans multiple lines. |Second |row |5.0 |Here’s another one. Note the blank line between rows.-|=======================================================================+|===
@@ -26,7 +26,7 @@ <td align="center">1</td> <td align="left">1</td> </tr>-</table+</table> <p>Simple table without caption:</p> @@ -55,7 +55,7 @@ <td align="center">1</td> <td align="left">1</td> </tr>-</table+</table> <p>Simple table indented two spaces:</p> @@ -85,7 +85,7 @@ <td align="center">1</td> <td align="left">1</td> </tr>-</table+</table> <p>Multiline table with caption:</p> @@ -119,7 +119,7 @@ <td align="left">Here’s another one. Note the blank line between rows.</td> </tr>-</table+</table> <p>Multiline table without caption:</p> @@ -151,7 +151,7 @@ <td align="left">Here’s another one. Note the blank line between rows.</td> </tr>-</table+</table> <p>Table without column headers:</p> @@ -174,7 +174,7 @@ <td align="center">1</td> <td align="right">1</td> </tr>-</table+</table> <p>Multiline table without column headers:</p> @@ -197,5 +197,5 @@ <td align="left">Here’s another one. Note the blank line between rows.</td> </tr>-</table+</table>
@@ -11,6 +11,7 @@ import qualified Tests.Old import qualified Tests.Readers.Creole import qualified Tests.Readers.Docx+import qualified Tests.Readers.DokuWiki import qualified Tests.Readers.EPUB import qualified Tests.Readers.FB2 import qualified Tests.Readers.HTML@@ -40,6 +41,7 @@ import qualified Tests.Writers.Powerpoint import qualified Tests.Writers.RST import qualified Tests.Writers.TEI+import Tests.Helpers (findPandoc) import Text.Pandoc.Shared (inDirectory) tests :: TestTree@@ -79,6 +81,7 @@ , testGroup "Creole" Tests.Readers.Creole.tests , testGroup "Man" Tests.Readers.Man.tests , testGroup "FB2" Tests.Readers.FB2.tests+ , testGroup "DokuWiki" Tests.Readers.DokuWiki.tests ] , testGroup "Lua filters" Tests.Lua.tests ]@@ -86,4 +89,7 @@ main :: IO () main = do setLocaleEncoding utf8- inDirectory "test" $ defaultMain tests+ inDirectory "test" $ do+ fp <- findPandoc+ putStrLn $ "Using pandoc executable at " ++ fp+ defaultMain tests
@@ -50,11 +50,11 @@ E-mail style: -__________________________________________+____ This is a block quote. It is pretty short.-__________________________________________+____ -______________________+____ -- Code in a block quote: @@ -72,16 +72,16 @@ Nested block quotes: -______+____ nested-______+____ -______+____ nested-______+____ ---______________________+____ This should not be a block quote: 2 > 1. @@ -306,9 +306,9 @@ { orange code block } .... +- __________________+ ____ orange block quote- __________________+ ____ Multiple definitions, tight: @@ -602,9 +602,9 @@ An e-mail address: nobody@nowhere.net -________________________________+____ Blockquoted: http://example.com/-________________________________+____ Auto-links should not occur here: `<http://example.com/>` @@ -634,9 +634,9 @@ http://google.com[links] and `]` verbatim characters, as well as [bracketed text].] -___________________________________________+____ Notes can go in quotes.footnote:[In quote.]-___________________________________________+____ [arabic] . And in list items.footnote:[In list.]
@@ -550,17 +550,17 @@ <h1 id="smart-quotes-ellipses-dashes">Smart quotes, ellipses, dashes</h1> -<p> said the spider. </p>+<p>“Hello,” said the spider. “‘Shelob’ is my name.”</p> -<p>, , and are letters.</p>+<p>‘A’, ‘B’, and ‘C’ are letters.</p> -<p> and are names of trees.-So is </p>+<p>‘Oak,’ ‘elm,’ and ‘beech’ are names of trees.+So is ‘pine.’</p> -<p> Were you alive in the+<p>‘He said, “I want to go.”’ Were you alive in the 70’s?</p> -<p>Here is some quoted and a .</p>+<p>Here is some quoted ‘<code>code</code>’ and a “<a href='http://example.com/?foo=1&bar=2' title=''>quoted link</a>”.</p> <p>Some dashes: one—two — three—four — five.</p> @@ -589,7 +589,7 @@ <ul> <li>To get the famous equation, write <code>$e = mc^2$</code>.</li> <li>$22,000 is a <em>lot</em> of money. So is $34,000.-(It worked if is emphasized.)</li>+(It worked if “lot” is emphasized.)</li> <li>Shoes ($20) and socks ($5).</li> <li>Escaped <code>$</code>: $73 <em>this should be emphasized</em> 23$.</li> </ul>@@ -734,7 +734,7 @@ <h1 id="images">Images</h1> -<p>From by Georges Melies (1902):</p>+<p>From “Voyage dans la Lune” by Georges Melies (1902):</p> <div class="figure"> <img src="lalune.jpg" title="fig:Voyage dans la Lune"/>
@@ -609,9 +609,9 @@ From “Voyage dans la Lune” by Georges Melies (1902): -{{:lalune.jpg|Voyage dans la Lune lalune}}+{{lalune.jpg|Voyage dans la Lune lalune}} -Here is a movie {{:movie.jpg|movie}} icon.+Here is a movie {{movie.jpg|movie}} icon. ----
@@ -8,7 +8,7 @@ <meta name="author" content="Anonymous" /> <meta name="dcterms.date" content="2006-07-17" /> <title>Pandoc Test Suite</title>- <style type="text/css">+ <style> code{white-space: pre-wrap;} span.smallcaps{font-variant: small-caps;} span.underline{text-decoration: underline;}
@@ -1,39 +1,45 @@ \PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere \PassOptionsToPackage{hyphens}{url} %-\documentclass[]{article}+\documentclass[+]{article} \usepackage{lmodern} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex}-\usepackage{fixltx2e} % provides \textsubscript \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols \else % if luatex or xelatex \usepackage{unicode-math}- \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}+ \defaultfontfeatures{Scale=MatchLowercase}+ \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi % use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{}-% use microtype if available-\IfFileExists{microtype.sty}{%-\usepackage[]{microtype}-\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts+\IfFileExists{microtype.sty}{% use microtype if available+ \usepackage[]{microtype}+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{}-\IfFileExists{parskip.sty}{%-\usepackage{parskip}-}{% else-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt}-}+\makeatletter+\@ifundefined{KOMAClassName}{% if non-KOMA class+ \IfFileExists{parskip.sty}{%+ \usepackage{parskip}+ }{% else+ \setlength{\parindent}{0pt}+ \setlength{\parskip}{6pt plus 2pt minus 1pt}}+}{% if KOMA class+ \KOMAoptions{parskip=half}}+\makeatother \usepackage{fancyvrb}-\usepackage{hyperref}+\usepackage{xcolor}+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \hypersetup{- pdftitle={Pandoc Test Suite},- pdfauthor={John MacFarlane; Anonymous},- pdfborder={0 0 0},- breaklinks=true}+ pdftitle={Pandoc Test Suite},+ pdfauthor={John MacFarlane; Anonymous},+ pdfborder={0 0 0},+ breaklinks=true} \urlstyle{same} % don't use monospace font for urls \VerbatimFootnotes % allows verbatim text in footnotes \usepackage{graphicx,grffile}@@ -51,15 +57,15 @@ \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{0}+\setcounter{secnumdepth}{-2} % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else-\let\oldparagraph\paragraph-\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}+ \let\oldparagraph\paragraph+ \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else-\let\oldsubparagraph\subparagraph-\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}+ \let\oldsubparagraph\subparagraph+ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi % set default figure placement to htbp
@@ -27,7 +27,7 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.-Because a hard\-wrapped line in the middle of a paragraph looked like a list+Because a hard-wrapped line in the middle of a paragraph looked like a list item. .PP Here\[cq]s one with a bullet.@@ -42,7 +42,7 @@ * * * * * .SH Block Quotes .PP-E\-mail style:+E-mail style: .RS .PP This is a block quote.@@ -88,7 +88,7 @@ .IP .nf \f[C]-\-\-\-\- (should be four hyphens)+---- (should be four hyphens) sub status { print \[dq]working\[dq];@@ -454,7 +454,7 @@ .IP .nf \f[C]-<!\-\- Comment \-\->+<!-- Comment --> \f[R] .fi .PP@@ -533,11 +533,11 @@ .IP \[bu] 2 223 .IP \[bu] 2-\f[I]p\f[R]\-Tree+\f[I]p\f[R]-Tree .IP \[bu] 2 Here\[cq]s some display math: .RS-$$\[rs]frac{d}{dx}f(x)=\[rs]lim_{h\[rs]to 0}\[rs]frac{f(x+h)\-f(x)}{h}$$+$$\[rs]frac{d}{dx}f(x)=\[rs]lim_{h\[rs]to 0}\[rs]frac{f(x+h)-f(x)}{h}$$ .RE .IP \[bu] 2 Here\[cq]s one that has a line break in it:@@ -602,7 +602,7 @@ .PP Right paren: ) .PP-Greater\-than: >+Greater-than: > .PP Hash: # .PP@@ -612,7 +612,7 @@ .PP Plus: + .PP-Minus: \-+Minus: - .PP * * * * * .SH Links@@ -680,13 +680,13 @@ .IP \[bu] 2 It should. .PP-An e\-mail address: <nobody@nowhere.net>+An e-mail address: <nobody@nowhere.net> .RS .PP Blockquoted: <http://example.com/> .RE .PP-Auto\-links should not occur here: \f[C]<http://example.com/>\f[R]+Auto-links should not occur here: \f[C]<http://example.com/>\f[R] .IP .nf \f[C]
@@ -620,7 +620,7 @@ From “Voyage dans la Lune” by Georges Melies (1902): -[[File:lalune.jpg|frame|none|alt=Voyage dans la Lune|caption lalune]]+[[File:lalune.jpg|thumb|none|alt=Voyage dans la Lune|lalune]] Here is a movie [[File:movie.jpg|movie]] icon.
@@ -131,7 +131,7 @@ In Markdown 1.0.0 and earlier. Version 8. This line turns into a list item.-Because a hard\-wrapped line in the middle of a paragraph looked like a list+Because a hard-wrapped line in the middle of a paragraph looked like a list item. .PP Here\[cq]s one with a bullet.@@ -146,7 +146,7 @@ .pdfhref O 1 "Block Quotes" .pdfhref M "block-quotes" .LP-E\-mail style:+E-mail style: .RS .LP This is a block quote.@@ -194,7 +194,7 @@ .IP .nf \f[C]-\-\-\-\- (should be four hyphens)+---- (should be four hyphens) sub status { print \[dq]working\[dq];@@ -603,7 +603,7 @@ .IP .nf \f[C]-<!\-\- Comment \-\->+<!-- Comment --> \f[] .fi .LP@@ -693,7 +693,7 @@ .IP \[bu] 3 @223@ .IP \[bu] 3-@p@\-Tree+@p@-Tree .IP \[bu] 3 Here\[cq]s some display math: .EQ@@ -763,7 +763,7 @@ .PP Right paren: ) .PP-Greater\-than: >+Greater-than: > .PP Hash: # .PP@@ -773,7 +773,7 @@ .PP Plus: + .PP-Minus: \-+Minus: - .HLINE .SH 1 Links@@ -923,7 +923,7 @@ .IP \[bu] 3 It should. .LP-An e\-mail address: \c+An e-mail address: \c .pdfhref W -D "mailto:nobody%40nowhere.net" -A "\c" \ -- "nobody\[at]nowhere.net" \&@@ -935,7 +935,7 @@ \& .RE .LP-Auto\-links should not occur here: \f[C]<http://example.com/>\f[R]+Auto-links should not occur here: \f[C]<http://example.com/>\f[R] .IP .nf \f[C]
@@ -593,9 +593,9 @@ From “Voyage dans la Lune” by Georges Melies (1902): -{{:lalune.jpg|Voyage dans la Lune lalune}}+{{lalune.jpg|Voyage dans la Lune lalune}} -Here is a movie {{:movie.jpg|movie}} icon.+Here is a movie {{movie.jpg|movie}} icon. ----
@@ -1,49 +1,56 @@ \PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere \PassOptionsToPackage{hyphens}{url} %-\documentclass[english,]{article}+\documentclass[+ english,+]{article} \usepackage{lmodern} \usepackage{amssymb,amsmath} \usepackage{ifxetex,ifluatex}-\usepackage{fixltx2e} % provides \textsubscript \ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage{textcomp} % provides euro and other symbols \else % if luatex or xelatex \usepackage{unicode-math}- \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}+ \defaultfontfeatures{Scale=MatchLowercase}+ \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1} \fi % use upquote if available, for straight quotes in verbatim environments \IfFileExists{upquote.sty}{\usepackage{upquote}}{}-% use microtype if available-\IfFileExists{microtype.sty}{%-\usepackage[]{microtype}-\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts+\IfFileExists{microtype.sty}{% use microtype if available+ \usepackage[]{microtype}+ \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts }{}-\IfFileExists{parskip.sty}{%-\usepackage{parskip}-}{% else-\setlength{\parindent}{0pt}-\setlength{\parskip}{6pt plus 2pt minus 1pt}-}-\usepackage{hyperref}+\makeatletter+\@ifundefined{KOMAClassName}{% if non-KOMA class+ \IfFileExists{parskip.sty}{%+ \usepackage{parskip}+ }{% else+ \setlength{\parindent}{0pt}+ \setlength{\parskip}{6pt plus 2pt minus 1pt}}+}{% if KOMA class+ \KOMAoptions{parskip=half}}+\makeatother+\usepackage{xcolor}+\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available+\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}} \hypersetup{- pdfborder={0 0 0},- breaklinks=true}+ pdfborder={0 0 0},+ breaklinks=true} \urlstyle{same} % don't use monospace font for urls \setlength{\emergencystretch}{3em} % prevent overfull lines \providecommand{\tightlist}{% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}-\setcounter{secnumdepth}{0}+\setcounter{secnumdepth}{-2} % Redefines (sub)paragraphs to behave more like sections \ifx\paragraph\undefined\else-\let\oldparagraph\paragraph-\renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}}+ \let\oldparagraph\paragraph+ \renewcommand{\paragraph}[1]{\oldparagraph{#1}\mbox{}} \fi \ifx\subparagraph\undefined\else-\let\oldsubparagraph\subparagraph-\renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}}+ \let\oldsubparagraph\subparagraph+ \renewcommand{\subparagraph}[1]{\oldsubparagraph{#1}\mbox{}} \fi % set default figure placement to htbp@@ -51,7 +58,7 @@ \def\fps@figure{htbp} \makeatother -\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex+\ifnum 0\ifxetex 1\fi=0 % if pdftex or luatex \usepackage[shorthands=off,ngerman,british,nswissgerman,spanish,french,main=english]{babel} \newcommand{\textgerman}[2][]{\foreignlanguage{ngerman}{#2}} \newenvironment{german}[2][]{\begin{otherlanguage}{ngerman}}{\end{otherlanguage}}@@ -62,7 +69,7 @@ \AddBabelHook{spanish}{afterextras}{\renewcommand{\textspanish}[2][]{\foreignlanguage{spanish}{##2}}} \newcommand{\textfrench}[2][]{\foreignlanguage{french}{#2}} \newenvironment{french}[2][]{\begin{otherlanguage}{french}}{\end{otherlanguage}}-\else+\else % if xetex % load polyglossia as late as possible as it *could* call bidi if RTL lang (e.g. Hebrew or Arabic) \usepackage{polyglossia} \setmainlanguage[]{english}
@@ -3,9 +3,15 @@ <head> <meta charset="utf-8"> <title>Try pandoc!</title>- <script src="//code.jquery.com/jquery-1.11.0.min.js"></script>- <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>- <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">+ <meta name="viewport" content="width=device-width, initial-scale=1.0">+ <meta http-equiv="X-UA-Compatible" content="IE=edge">+ <!--[if lt IE 9]>+ <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>+ <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>+ <![endif]-->+ <script src="//code.jquery.com/jquery-1.11.1.min.js"></script>+ <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" rel="stylesheet">+ <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> <script type="text/javascript"> (function($) { // http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values $.QueryString = (function(a) {@@ -63,7 +69,7 @@ </style> </head> <body>-<div class="container">+<div class="container-fluid"> <div class="row"> <div class="col-md-6"> <h1>Try pandoc!</h1>