summaryrefslogtreecommitdiff
path: root/macros/generic/markdown
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/generic/markdown
Initial commit
Diffstat (limited to 'macros/generic/markdown')
-rw-r--r--macros/generic/markdown/LICENSE42
-rw-r--r--macros/generic/markdown/Makefile130
-rw-r--r--macros/generic/markdown/README.md100
-rw-r--r--macros/generic/markdown/docstrip.cfg105
-rw-r--r--macros/generic/markdown/examples/README.md7
-rw-r--r--macros/generic/markdown/examples/context-mkii.pdfbin0 -> 237090 bytes
-rw-r--r--macros/generic/markdown/examples/context-mkiv.pdfbin0 -> 67910 bytes
-rw-r--r--macros/generic/markdown/examples/context.tex31
-rw-r--r--macros/generic/markdown/examples/example.md131
-rw-r--r--macros/generic/markdown/examples/latex-luatex.pdfbin0 -> 63088 bytes
-rw-r--r--macros/generic/markdown/examples/latex-pdftex.pdfbin0 -> 265094 bytes
-rw-r--r--macros/generic/markdown/examples/latex-xetex.pdfbin0 -> 60564 bytes
-rw-r--r--macros/generic/markdown/examples/latex.tex42
-rw-r--r--macros/generic/markdown/examples/scientists.csv4
-rw-r--r--macros/generic/markdown/latexmkrc4
-rw-r--r--macros/generic/markdown/markdown.css351
-rw-r--r--macros/generic/markdown/markdown.dtx17226
-rw-r--r--macros/generic/markdown/markdown.html5344
-rw-r--r--macros/generic/markdown/markdown.ins15
-rw-r--r--macros/generic/markdown/markdown.md278
-rw-r--r--macros/generic/markdown/markdown.pdfbin0 -> 429871 bytes
-rw-r--r--macros/generic/markdown/tests/README.md17
-rw-r--r--macros/generic/markdown/tests/support/README.md4
-rw-r--r--macros/generic/markdown/tests/support/latex-setup.tex162
-rw-r--r--macros/generic/markdown/tests/support/plain-setup.tex142
-rw-r--r--macros/generic/markdown/tests/support/setup.tex79
-rw-r--r--macros/generic/markdown/tests/templates/README.md20
-rw-r--r--macros/generic/markdown/tests/templates/context/COMMANDS.m42
-rw-r--r--macros/generic/markdown/tests/templates/context/README.md2
-rw-r--r--macros/generic/markdown/tests/templates/context/input.tex.m411
-rw-r--r--macros/generic/markdown/tests/templates/context/verbatim.tex.m413
-rw-r--r--macros/generic/markdown/tests/templates/latex/COMMANDS.m43
-rw-r--r--macros/generic/markdown/tests/templates/latex/README.md1
-rw-r--r--macros/generic/markdown/tests/templates/latex/input.tex.m414
-rw-r--r--macros/generic/markdown/tests/templates/latex/verbatim-starred.tex.m417
-rw-r--r--macros/generic/markdown/tests/templates/latex/verbatim.tex.m417
-rw-r--r--macros/generic/markdown/tests/templates/plain/COMMANDS.m43
-rw-r--r--macros/generic/markdown/tests/templates/plain/README.md1
-rw-r--r--macros/generic/markdown/tests/templates/plain/input.tex.m410
-rw-r--r--macros/generic/markdown/tests/templates/plain/verbatim.tex.m412
-rwxr-xr-xmacros/generic/markdown/tests/test.sh58
-rw-r--r--macros/generic/markdown/tests/testfiles/CommonMark_0.26/README.md2
-rw-r--r--macros/generic/markdown/tests/testfiles/CommonMark_0.26/fenced-code.test315
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/README.md2
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/amps-encoding.test36
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/auto-links.test52
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/backslash-escapes.test192
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/blockquotes-with-code-blocks.test21
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-blocks.test18
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-spans.test4
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/hard-wrapped-paragraphs-with-list-like-lines.test12
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/horizontal-rules.test132
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-inline-style.test50
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-reference-style.test176
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-shortcut-references.test42
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/literal-quotes-in-titles.test21
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-basics.test436
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-syntax.test1518
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/nested-blockquotes.test14
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/ordered-and-unordered-lists.test323
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/strong-and-em-together.test17
-rw-r--r--macros/generic/markdown/tests/testfiles/Markdown_1.0.3/tabs.test39
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/README.md2
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/auto-links.test16
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/backslash-escapes.test19
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-in-a-list-item.test31
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-on-second-line.test6
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/email-auto-links.test16
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/emphasis.test272
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/empty-list-item.test97
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/headers.test18
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/horizontal-rules.test51
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/links-inline-style.test9
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/md5-hashes.test22
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/mixed-ols-and-uls.test47
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/nesting.test30
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/parens-in-url.test52
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/php-specific-bugs.test39
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/quotes-in-attributes.test29
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/tables.test327
-rw-r--r--macros/generic/markdown/tests/testfiles/PHP_Markdown/tight-blocks.test30
-rw-r--r--macros/generic/markdown/tests/testfiles/README.md21
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/README.md2
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/blank-before-code-fence.test57
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/breakable-blockquotes.test19
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/cache-dir.test12
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-escapes.test73
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-nbsps.test85
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-no-nbsps.test85
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-trailing-punctuation.test115
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks-language-map.test16
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks.test64
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/empty-code-spans.test24
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/fenced-code.test27
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/header-attributes.test37
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/html.test53
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/hybrid.test43
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/inline-footnotes.test17
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-blank-before-code-fence.test57
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-breakable-blockquotes.test15
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-citations.test31
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-code-spans.test9
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-content-blocks.test32
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-fenced-code.test22
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-header-attributes.test35
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-html.test53
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-hybrid.test65
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-inline-footnotes.test16
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-pipe-tables.test41
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-shift-headings.test35
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-slice.test251
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-start-number.test41
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-strip-percent-signs.test10
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-table-captions.test79
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-tight-lists.test19
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/no-underscores.test15
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-backwards.test37
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-forward.test37
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-conclusion.test155
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-existing-section.test182
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-nonexisting-section.test141
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-preface.test148
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-two-sections.test278
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/start-number.test39
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/table-captions.test76
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark-markdown/tight-lists.test18
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/README.md2
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/backticks-in-links.test8
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/case-insensitive-references.test10
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/consecutive-lists.test19
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/definition-lists.test200
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/hash-enumerators.test11
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/indented-code-in-list-item.test16
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/list-spacing.test42
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/lists-and-hrules.test18
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/notes.test27
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/reference-defined-in-blockquote.test12
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-blockquote.test5
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-header.test6
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/smart.test7
-rw-r--r--macros/generic/markdown/tests/testfiles/lunamark/unicode.test10
141 files changed, 32013 insertions, 0 deletions
diff --git a/macros/generic/markdown/LICENSE b/macros/generic/markdown/LICENSE
new file mode 100644
index 0000000000..72d52c06d9
--- /dev/null
+++ b/macros/generic/markdown/LICENSE
@@ -0,0 +1,42 @@
+Copyright (C) 2009-2016 John MacFarlane, Hans Hagen
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Copyright (C) 2016-2018 Vít Novotný
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status `maintained'.
+The Current Maintainer of this work is Vít Novotný.
+
+Send bug reports, requests for additions and questions
+either to the GitHub issue tracker at
+
+ https://github.com/witiko/markdown/issues
+
+or to the e-mail address <witiko@mail.muni.cz>.
diff --git a/macros/generic/markdown/Makefile b/macros/generic/markdown/Makefile
new file mode 100644
index 0000000000..5c210f83e4
--- /dev/null
+++ b/macros/generic/markdown/Makefile
@@ -0,0 +1,130 @@
+.PHONY: all clean implode dist test examples
+AUXFILES=markdown.bbl markdown.cb markdown.cb2 markdown.glo markdown.bbl \
+ markdown.run.xml markdown.bib markdown.markdown.in markdown.markdown.lua \
+ markdown.markdown.out
+AUXDIRS=_minted-markdown _markdown_markdown
+TDSARCHIVE=markdown.tds.zip
+CTANARCHIVE=markdown.ctan.zip
+DISTARCHIVE=markdown.zip
+ARCHIVES=$(TDSARCHIVE) $(CTANARCHIVE) $(DISTARCHIVE)
+EXAMPLES_RESOURCES=examples/example.md examples/scientists.csv
+EXAMPLES_SOURCES=examples/context.tex examples/latex.tex
+EXAMPLES=examples/context-mkii.pdf examples/context-mkiv.pdf \
+ examples/latex-pdftex.pdf examples/latex-luatex.pdf examples/latex-xetex.pdf
+TESTS=tests/test.sh tests/support/*.tex tests/templates/*/*.tex.m4 \
+ tests/templates/*/COMMANDS.m4 tests/testfiles/*/*.test
+MAKES=Makefile $(addsuffix /Makefile, $(SUBDIRECTORIES)) latexmkrc
+READMES=README.md LICENSE examples/README.md tests/README.md \
+ tests/support/README.md tests/templates/README.md tests/testfiles/README.md \
+ tests/templates/*/README.md tests/testfiles/*/README.md
+DTXARCHIVE=markdown.dtx
+VERSION=$(shell sed -rn '/^\\def\\markdownVersion\{/s/[^{]*\{(.*)\}.*/\1/p' <$(DTXARCHIVE))
+LASTMODIFIED=$(shell sed -rn '/^\\def\\markdownLastModified\{/s/[^{]*\{(.*)\}.*/\1/p' <$(DTXARCHIVE))
+INSTALLER=markdown.ins docstrip.cfg
+TECHNICAL_DOCUMENTATION=markdown.pdf
+MARKDOWN_USER_MANUAL=markdown.md markdown.css
+HTML_USER_MANUAL=markdown.html markdown.css
+USER_MANUAL=$(MARKDOWN_USER_MANUAL) $(HTML_USER_MANUAL)
+DOCUMENTATION=$(TECHNICAL_DOCUMENTATION) $(USER_MANUAL)
+INSTALLABLES=markdown.lua markdown-cli.lua markdown.tex markdown.sty t-markdown.tex
+MAKEABLES=$(TECHNICAL_DOCUMENTATION) $(USER_MANUAL) $(INSTALLABLES) $(EXAMPLES)
+RESOURCES=$(DOCUMENTATION) $(EXAMPLES_RESOURCES) $(EXAMPLES_SOURCES) $(EXAMPLES) \
+ $(MAKES) $(READMES) $(INSTALLER) $(DTXARCHIVE) $(TESTS)
+EVERYTHING=$(RESOURCES) $(INSTALLABLES)
+
+# This is the default pseudo-target. It typesets the manual,
+# the examples, and extracts the package files.
+all: $(MAKEABLES)
+ $(MAKE) clean
+
+# This target extracts the source files out of the DTX archive.
+$(INSTALLABLES) $(MARKDOWN_USER_MANUAL): $(INSTALLER) $(DTXARCHIVE)
+ xetex $<
+
+# This target typesets the manual.
+$(TECHNICAL_DOCUMENTATION): $(DTXARCHIVE) $(INSTALLABLES)
+ latexmk -interaction=nonstopmode $<
+
+# These targets typeset the examples.
+$(EXAMPLES): $(EXAMPLE_SOURCES) examples/example.tex $(INSTALLABLES)
+ $(MAKE) -C examples $(notdir $@)
+
+examples/example.tex: $(INSTALLABLES)
+ $(MAKE) -C examples $(notdir $@)
+
+# This target converts the markdown user manual to an HTML page.
+%.html: %.md %.css
+ awk '{ \
+ filename = gensub(/^\/(.*\.md)$$/, "\\1", "g"); \
+ if(filename != $$0) \
+ system("cat " filename); \
+ else \
+ print($$0); \
+ }' <$< | \
+ sed -e 's#\\markdownVersion{}#$(VERSION)#g' \
+ -e 's#\\markdownLastModified{}#$(LASTMODIFIED)#g' \
+ -e 's#\\TeX{}#<span class="tex">T<sub>e</sub>X</span>#g' \
+ -e 's#\\LaTeX{}#<span class="latex">L<sup>a</sup>T<sub>e</sub>X</span>#g' \
+ -e 's#\\Hologo{ConTeXt}#Con<span class="tex">T<sub>e</sub>X</span>t#g' \
+ -e 's#\\Opt{\([^}]*\)}#**`\1`**#g' -e 's#\\,# #g' \
+ -e 's#\\meta{\([^}]*\)}#\&LeftAngleBracket;*\1*\&RightAngleBracket;#g' \
+ -e 's#\\acro{\([^}]*\)}#<abbr>\1</abbr>#g' \
+ -e 's#;-)#<i class="em em-wink"></i>#g' \
+ -e 's#\\envm{\([^}]*\)}#`\1`#g' -e 's#\\envmdef{\([^}]*\)}#`\1`#g' \
+ -e 's#\\m{\([^}]*\)}#`\\\1`#g' -e 's#\\mdef{\([^}]*\)}#`\\\1`#g' | \
+ pandoc -f markdown -t html -N -s --toc --toc-depth=3 --css=$(word 2, $^) >$@
+
+# This pseudo-target runs all the tests in the `tests/` directory.
+test:
+ $(MAKE) -C tests
+
+# This pseudo-target produces the distribution archives.
+dist: implode
+ $(MAKE) $(ARCHIVES)
+ $(MAKE) clean
+
+# This target produces the TeX directory structure archive.
+$(TDSARCHIVE): $(DTXARCHIVE) $(INSTALLABLES) $(DOCUMENTATION)
+ @# Installing the macro package.
+ mkdir -p tex/generic/markdown tex/luatex/markdown tex/latex/markdown \
+ tex/context/third/markdown scripts/markdown
+ cp markdown.lua tex/luatex/markdown/
+ cp markdown-cli.lua scripts/markdown/
+ cp markdown.sty tex/latex/markdown/
+ cp markdown.tex tex/generic/markdown/
+ cp t-markdown.tex tex/context/third/markdown/
+ @# Installing the documentation.
+ mkdir -p doc/generic/markdown doc/latex/markdown/examples \
+ doc/context/third/markdown/examples
+ cp $(DOCUMENTATION) doc/generic/markdown/
+ cp examples/context.tex $(EXAMPLES_RESOURCES) doc/context/third/markdown/examples/
+ cp examples/latex.tex $(EXAMPLES_RESOURCES) doc/latex/markdown/examples/
+ @# Installing the sources.
+ mkdir -p source/generic/markdown
+ cp $(DTXARCHIVE) $(INSTALLER) source/generic/markdown
+ zip -r -v -nw $@ doc scripts source tex
+ rm -rf doc scripts source tex
+
+# This target produces the distribution archive.
+$(DISTARCHIVE): $(EVERYTHING) $(TDSARCHIVE)
+ -ln -s . markdown
+ zip -MM -r -v -nw $@ $(addprefix markdown/,$(EVERYTHING)) $(TDSARCHIVE)
+ rm -f markdown
+
+# This target produces the CTAN archive.
+$(CTANARCHIVE): $(RESOURCES) $(TDSARCHIVE)
+ -ln -s . markdown
+ zip -MM -r -v -nw $@ $(addprefix markdown/,$(RESOURCES)) $(TDSARCHIVE)
+ rm -f markdown
+
+# This pseudo-target removes any existing auxiliary files and directories.
+clean:
+ latexmk -c $(DTXARCHIVE)
+ rm -f $(AUXFILES)
+ rm -rf ${AUXDIRS}
+ $(MAKE) -C examples clean
+
+# This pseudo-target removes any makeable files.
+implode: clean
+ rm -f $(MAKEABLES) $(ARCHIVES)
+ $(MAKE) -C examples implode
diff --git a/macros/generic/markdown/README.md b/macros/generic/markdown/README.md
new file mode 100644
index 0000000000..44c963a2da
--- /dev/null
+++ b/macros/generic/markdown/README.md
@@ -0,0 +1,100 @@
+Markdown
+========
+[![release](https://img.shields.io/github/release/witiko/markdown.svg)][release]
+[![CircleCI](https://circleci.com/gh/Witiko/markdown/tree/master.svg?style=shield)][CircleCI]
+
+ [CircleCI]: https://circleci.com/gh/Witiko/markdown/tree/master "CircleCI"
+ [release]: https://github.com/Witiko/markdown/releases/latest "Releases · Witiko/markdown"
+
+The Markdown package converts [markdown][] markup to TeX commands. The
+functionality is provided both as a Lua module, and as plain TeX, LaTeX, and
+ConTeXt macro packages that can be used to directly typeset TeX documents
+containing markdown markup. Unlike other convertors, the Markdown package
+makes it easy to redefine how each and every markdown element is rendered.
+Creative abuse of the markdown syntax is encouraged. 😉
+
+ [markdown]: https://daringfireball.net/projects/markdown/basics/ "Daring Fireball: Markdown Basics"
+
+Further information
+-------------------
+For further information, consult one of the following:
+
+1. The [user manual][manual], which can be produced by interpreting the
+ `markdown.ins` file using a Unicode-aware TeX engine, such as XeTeX
+ (`xetex markdown.ins`) or LuaTeX (`luatex markdown.ins`). The manual will
+ reside in the file `markdown.md` and the CSS stylesheet `markdown.css`.
+2. The [technical documentation][techdoc], which can be typeset by running the
+ [LaTeXMK][] tool on the `markdown.dtx` file
+ (`latexmk markdown.dtx`) after [installing the Markdown package][install].
+ [LaTeXMK][] should be included in your TeX distribution. The typeset
+ documentation will reside in the file `markdown.pdf`.
+3. Tutorials and example documents by [Lian Tze Lim][liantze] at [Overleaf][]:
+ - [How to write in Markdown on Overleaf][overleaf-1],
+ - [Markdown into LaTeX with Style][overleaf-2],
+ - [Writing Markdown in LaTeX Documents][overleaf-3],
+ - [Writing Beamer Slides with Markdown][overleaf-4],
+ - [Writing Posters with Markdown][overleaf-5], and
+ - [Using Markdown in LaTeX documents][overleaf-6].
+4. My journal articles published by [TUGboat][]:
+ - [Using Markdown inside TeX documents][tb119], and
+ - [Markdown 2.7.0: Towards lightweight markup in TeX][tb124].
+
+ [overleaf-1]: https://www.overleaf.com/learn/latex/Articles/How_to_write_in_Markdown_on_Overleaf "How to write in Markdown on Overleaf"
+ [overleaf-2]: https://www.overleaf.com/learn/latex/Articles/Markdown_into_LaTeX_with_Style "Markdown into LaTeX with Style"
+ [overleaf-3]: https://www.overleaf.com/learn/how-to/Writing_Markdown_in_LaTeX_Documents "Writing Markdown in LaTeX Documents"
+ [overleaf-4]: https://www.overleaf.com/latex/examples/writing-beamer-slides-with-markdown/dnrwnjrpjjhw "Writing Beamer Slides with Markdown"
+ [overleaf-5]: https://www.overleaf.com/latex/examples/writing-posters-with-markdown/jtbgmmgqrqmh "Writing Posters with Markdown"
+ [overleaf-6]: https://www.overleaf.com/latex/examples/using-markdown-in-latex-documents/whdrnpcpnwrm "Using Markdown in LaTeX documents"
+
+ [tb119]: https://www.tug.org/members/TUGboat/tb38-2/tb119novotny.pdf "Using Markdown inside TeX documents"
+ [tb124]: https://www.tug.org/TUGboat/production/40-1/tb124novotny-markdown.pdf "Markdown 2.7.0: Towards lightweight markup in TeX"
+
+ [install]: http://mirrors.ctan.org/macros/generic/markdown/markdown.html#installation "Markdown Package User Manual"
+ [liantze]: http://liantze.penguinattack.org/ "Rants from the Lab"
+ [manual]: http://mirrors.ctan.org/macros/generic/markdown/markdown.html "Markdown Package User Manual"
+ [overleaf]: https://www.overleaf.com/ "Overleaf: Real-time Collaborative Writing and Publishing Tools with Integrated PDF Preview"
+ [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf "A Markdown Interpreter for TeX"
+ [tugboat]: https://www.tug.org/tugboat/ "TUGboat - Communications of the TeX Users Group"
+
+Contributing
+------------
+Apart from the example markdown documents and tests, which are placed in the
+`examples/` and `tests/` directories, the complete source code and
+documentation of the package are placed in the `markdown.dtx` document
+following the literate programming paradigm.
+
+When the file `markdown.ins` is interpreted using a Unicode-aware TeX engine,
+such as XeTeX (`xetex markdown.ins`) or LuaTeX (`luatex markdown.ins`), several
+files are produced from the `markdown.dtx` document. In `markdown.dtx`, the
+boundaries between the produced files are marked up using a XML-like syntax
+provided by the [DocStrip][] plain TeX package.
+
+Running the [LaTeXMK][] tool on the `markdown.dtx` file
+(`latexmk markdown.dtx`) after the Markdown package has been
+[installed][install] typesets the documentation. In `markdown.dtx`, the
+documentation is placed inside TeX comments and marked up using the
+[ltxdockit][] LaTeX document class. Support for typesetting the documentation
+is provided by the [doc][] LaTeX package.
+
+ [doc]: https://ctan.org/pkg/doc "doc – Format LaTeX documentation"
+ [DocStrip]: https://ctan.org/pkg/docstrip "docstrip – Remove comments from file"
+ [LaTeXMK]: https://ctan.org/pkg/latexmk "latexmk – Fully automated LaTeX document generation"
+ [ltxdockit]: https://ctan.org/pkg/ltxdockit "ltxdockit – Documentation support"
+
+Acknowledgements
+----------------
+I gratefully acknowledge the funding from the [Faculty of Informatics][fimu]
+at the [Masaryk University][mu] in Brno, Czech Republic, for the development of
+the Markdown package.
+
+Support for content slicing (Lua options `shiftHeadings` and `slice`) and pipe
+tables (Lua options `pipeTables` and `tableCaptions`) was graciously sponsored
+by [David Vins][dvins] and [Omedym][].
+
+Extensive user documentation of the Markdown package was kindly written by
+[Lian Tze Lim][liantze] and published by [Overleaf][].
+
+ [dvins]: https://github.com/dvins "David Vins"
+ [fimu]: https://www.fi.muni.cz/index.html.en "Faculty of Informatics, Masaryk University"
+ [mu]: https://www.muni.cz/en "Masaryk University"
+ [Omedym]: https://www.omedym.com/ "Omedym"
diff --git a/macros/generic/markdown/docstrip.cfg b/macros/generic/markdown/docstrip.cfg
new file mode 100644
index 0000000000..a03b51c87b
--- /dev/null
+++ b/macros/generic/markdown/docstrip.cfg
@@ -0,0 +1,105 @@
+\askforoverwritefalse
+\def\luapreamble{%
+-- ^^J%
+-- Copyright (C) 2009-2016 John MacFarlane, Hans Hagen^^J%
+-- ^^J%
+-- Permission is hereby granted, free of charge, to any person obtaining^^J%
+-- a copy of this software and associated documentation files (the^^J%
+-- "Software"), to deal in the Software without restriction, including^^J%
+-- without limitation the rights to use, copy, modify, merge, publish,^^J%
+-- distribute, sublicense, and/or sell copies of the Software, and to^^J%
+-- permit persons to whom the Software is furnished to do so, subject to^^J%
+-- the following conditions:^^J%
+-- ^^J%
+-- The above copyright notice and this permission notice shall be included^^J%
+-- in all copies or substantial portions of the Software.^^J%
+-- ^^J%
+-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,^^J%
+-- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF^^J%
+-- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.^^J%
+-- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY^^J%
+-- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,^^J%
+-- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE^^J%
+-- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.^^J%
+-- ^^J%
+-- Copyright (C) 2016-2019 Vít Novotný^^J%
+-- ^^J%
+-- This work may be distributed and/or modified under the^^J%
+-- conditions of the LaTeX Project Public License, either version 1.3^^J%
+-- of this license or (at your option) any later version.^^J%
+-- The latest version of this license is in^^J%
+-- ^^J%
+-- \space\space\space\space http://www.latex-project.org/lppl.txt^^J%
+-- ^^J%
+-- and version 1.3 or later is part of all distributions of LaTeX^^J%
+-- version 2005/12/01 or later.^^J%
+-- ^^J%
+-- This work has the LPPL maintenance status `maintained'.^^J%
+-- The Current Maintainer of this work is Vít Novotný.^^J%
+-- ^^J%
+-- Send bug reports, requests for additions and questions^^J%
+-- either to the GitHub issue tracker at^^J%
+-- ^^J%
+-- \space\space\space\space https://github.com/witiko/markdown/issues^^J%
+-- ^^J%
+-- or to the e-mail address <witiko@mail.muni.cz>.^^J%
+-- ^^J%
+-- MODIFICATION ADVICE:^^J%
+-- ^^J%
+-- If you want to customize this file, it is best to make a copy of^^J%
+-- the source file(s) from which it was produced. Use a different^^J%
+-- name for your copy(ies) and modify the copy(ies); this will ensure^^J%
+-- that your modifications do not get overwritten when you install a^^J%
+-- new release of the standard system. You should also ensure that^^J%
+-- your modified source file does not generate any modified file with^^J%
+-- the same name as a standard file.^^J%
+-- ^^J%
+-- You will also need to produce your own, suitably named, .ins file to^^J%
+-- control the generation of files from your source file; this file^^J%
+-- should contain your own preambles for the files it generates, not^^J%
+-- those in the standard .ins files.^^J%
+-- }
+\let\luapostamble\empty
+\declarepreamble\texpreamble
+
+Copyright (C) 2016-2019 Vít Novotný
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+
+ http://www.latex-project.org/lppl.txt
+
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status `maintained'.
+The Current Maintainer of this work is Vít Novotný.
+
+Send bug reports, requests for additions and questions
+either to the GitHub issue tracker at
+
+ https://github.com/Witiko/markdown/issues
+
+or to the e-mail address <witiko@mail.muni.cz>.
+
+MODIFICATION ADVICE:
+
+If you want to customize this file, it is best to make a copy of
+the source file(s) from which it was produced. Use a different
+name for your copy(ies) and modify the copy(ies); this will ensure
+that your modifications do not get overwritten when you install a
+new release of the standard system. You should also ensure that
+your modified source file does not generate any modified file with
+the same name as a standard file.
+
+You will also need to produce your own, suitably named, .ins file to
+control the generation of files from your source file; this file
+should contain your own preambles for the files it generates, not
+those in the standard .ins files.
+
+The names of the source files used are shown above.
+
+\endpreamble
+\let\texpostamble\defaultpostamble
diff --git a/macros/generic/markdown/examples/README.md b/macros/generic/markdown/examples/README.md
new file mode 100644
index 0000000000..0d32d16ec4
--- /dev/null
+++ b/macros/generic/markdown/examples/README.md
@@ -0,0 +1,7 @@
+This directory contains example LaTeX and ConTeXt documents. These documents
+can be typeset by running the GNU `make` program in this directory. It is
+expected that your TeX installation contains the `pdflatex`, `xelatex`,
+`lualatex`, `texexec`, and `context` executables.
+
+The `markdown.dtx` file in the root directory contains documentation in the
+markdown language and can also serve as an example LaTeX document.
diff --git a/macros/generic/markdown/examples/context-mkii.pdf b/macros/generic/markdown/examples/context-mkii.pdf
new file mode 100644
index 0000000000..a17e5fc469
--- /dev/null
+++ b/macros/generic/markdown/examples/context-mkii.pdf
Binary files differ
diff --git a/macros/generic/markdown/examples/context-mkiv.pdf b/macros/generic/markdown/examples/context-mkiv.pdf
new file mode 100644
index 0000000000..ad965f37fe
--- /dev/null
+++ b/macros/generic/markdown/examples/context-mkiv.pdf
Binary files differ
diff --git a/macros/generic/markdown/examples/context.tex b/macros/generic/markdown/examples/context.tex
new file mode 100644
index 0000000000..7ed432344a
--- /dev/null
+++ b/macros/generic/markdown/examples/context.tex
@@ -0,0 +1,31 @@
+\enableregime[utf]
+\usetypescript[modern][ec]
+\setupbodyfont[10pt,rm]
+\setupexternalfigures[location={local,global,default}]
+\usemodule[t][markdown]
+\def\markdownOptionHashEnumerators{true}
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionSmartEllipses{true}
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionPipeTables{true}
+\def\markdownOptionTableCaptions{true}
+\definetyping [latex]
+\setuptyping [latex] [option=TEX]
+\starttext
+% Typeset the document `example.md` by letting the Markdown package handle
+% the conversion internally.
+\markdownInput{./example.md}
+
+% Typeset the document `example.tex` that we prepared separately using the
+% Lua command-line interface and that contains a plain TeX representation
+% of the document `example.md`.
+\doiffileelse{./example.tex}{\input example}{}
+
+\startmarkdown
+Here are some non-ASCII characters: *ěščřžýáíé*
+and ConTeXt special characters: *|*.
+\stopmarkdown
+\stoptext
diff --git a/macros/generic/markdown/examples/example.md b/macros/generic/markdown/examples/example.md
new file mode 100644
index 0000000000..8aeb423a20
--- /dev/null
+++ b/macros/generic/markdown/examples/example.md
@@ -0,0 +1,131 @@
+This is an H1
+=============
+
+This is an H2
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is a table:
+
+| Right | Left | Default | Center |
+|------:|:-----|---------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
diff --git a/macros/generic/markdown/examples/latex-luatex.pdf b/macros/generic/markdown/examples/latex-luatex.pdf
new file mode 100644
index 0000000000..1ce6e43d49
--- /dev/null
+++ b/macros/generic/markdown/examples/latex-luatex.pdf
Binary files differ
diff --git a/macros/generic/markdown/examples/latex-pdftex.pdf b/macros/generic/markdown/examples/latex-pdftex.pdf
new file mode 100644
index 0000000000..f5eca2597a
--- /dev/null
+++ b/macros/generic/markdown/examples/latex-pdftex.pdf
Binary files differ
diff --git a/macros/generic/markdown/examples/latex-xetex.pdf b/macros/generic/markdown/examples/latex-xetex.pdf
new file mode 100644
index 0000000000..3c9f0ff75d
--- /dev/null
+++ b/macros/generic/markdown/examples/latex-xetex.pdf
Binary files differ
diff --git a/macros/generic/markdown/examples/latex.tex b/macros/generic/markdown/examples/latex.tex
new file mode 100644
index 0000000000..07ebe631f9
--- /dev/null
+++ b/macros/generic/markdown/examples/latex.tex
@@ -0,0 +1,42 @@
+\documentclass{book}
+\usepackage{ifxetex,ifluatex}
+\ifxetex
+ \usepackage{polyglossia}
+ \setmainlanguage{english}
+ \usepackage{fontspec}
+\else\ifluatex
+ \usepackage{polyglossia}
+ \setmainlanguage{english}
+ \usepackage{fontspec}
+\else
+ \usepackage[english]{babel}
+ \usepackage[utf8]{inputenc}
+ \usepackage[T1]{fontenc}
+ \usepackage{lmodern}
+\fi\fi
+\usepackage{booktabs}
+\usepackage[
+ hashEnumerators,
+ definitionLists,
+ footnotes,
+ inlineFootnotes,
+ smartEllipses,
+ fencedCode,
+ contentBlocks,
+ pipeTables,
+ tableCaptions,
+]{markdown}
+\begin{document}
+% Typeset the document `example.md` by letting the Markdown package handle
+% the conversion internally.
+\markdownInput{./example.md}
+
+% Typeset the document `example.tex` that we prepared separately using the
+% Lua command-line interface of the Markdown package and that contains a
+% plain TeX representation of the document `example.md`.
+\InputIfFileExists{./example.tex}{}{}
+
+\begin{markdown}
+Here are some non-ASCII characters: *ěščřžýáíé*.
+\end{markdown}
+\end{document}
diff --git a/macros/generic/markdown/examples/scientists.csv b/macros/generic/markdown/examples/scientists.csv
new file mode 100644
index 0000000000..dee7830edf
--- /dev/null
+++ b/macros/generic/markdown/examples/scientists.csv
@@ -0,0 +1,4 @@
+Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847
diff --git a/macros/generic/markdown/latexmkrc b/macros/generic/markdown/latexmkrc
new file mode 100644
index 0000000000..34d796211e
--- /dev/null
+++ b/macros/generic/markdown/latexmkrc
@@ -0,0 +1,4 @@
+$pdflatex = 'lualatex --shell-escape %O %S';
+$pdf_mode = 1;
+$postscript_mode = 0;
+$dvi_mode = 0;
diff --git a/macros/generic/markdown/markdown.css b/macros/generic/markdown/markdown.css
new file mode 100644
index 0000000000..f679065407
--- /dev/null
+++ b/macros/generic/markdown/markdown.css
@@ -0,0 +1,351 @@
+
+html {
+ font-size: 100%;
+ overflow-y: scroll;
+ -webkit-text-size-adjust: 100%;
+ -ms-text-size-adjust: 100%;
+}
+
+body {
+ color: #444;
+ font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
+ font-size: 12px;
+ line-height: 1.7;
+ padding: 1em;
+ margin: auto;
+ max-width: 42em;
+ background: #fefefe;
+}
+
+a {
+ color: #0645ad;
+}
+
+a:visited {
+ color: #0b0080;
+}
+
+a:hover {
+ color: #06e;
+}
+
+a:active {
+ color: #faa700;
+}
+
+a:focus {
+ outline: thin dotted;
+}
+
+*::-moz-selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #000;
+}
+
+*::selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #000;
+}
+
+a::-moz-selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #0645ad;
+}
+
+a::selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #0645ad;
+}
+
+p {
+ margin: 1em 0;
+}
+
+img {
+ max-width: 100%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #111;
+ line-height: 125%;
+ margin-top: 2em;
+ font-weight: normal;
+}
+
+h4, h5, h6 {
+ font-weight: bold;
+}
+
+h1 {
+ font-size: 2.5em;
+}
+
+h2 {
+ font-size: 2em;
+}
+
+h3 {
+ font-size: 1.5em;
+}
+
+h4 {
+ font-size: 1.2em;
+}
+
+h5 {
+ font-size: 1em;
+}
+
+h6 {
+ font-size: 0.9em;
+}
+
+blockquote {
+ color: #666666;
+ margin: 0;
+ padding-left: 3em;
+ border-left: 0.5em #EEE solid;
+}
+
+hr {
+ display: block;
+ height: 2px;
+ border: 0;
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #eee;
+ margin: 1em 0;
+ padding: 0;
+}
+
+pre, code, kbd, samp {
+ color: #000;
+ font-family: monospace, monospace;
+ _font-family: 'courier new', monospace;
+ font-size: 0.98em;
+}
+
+pre {
+ white-space: pre;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+b, strong {
+ font-weight: bold;
+}
+
+dfn {
+ font-style: italic;
+}
+
+ins {
+ background: #ff9;
+ color: #000;
+ text-decoration: none;
+}
+
+mark {
+ background: #ff0;
+ color: #000;
+ font-style: italic;
+ font-weight: bold;
+}
+
+sub, sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sup {
+ top: -0.5em;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+ul, ol {
+ margin: 1em 0;
+ padding: 0 0 0 2em;
+}
+
+li p:last-child {
+ margin-bottom: 0;
+}
+
+ul ul, ol ol {
+ margin: .3em 0;
+}
+
+dl {
+ margin-bottom: 1em;
+}
+
+dt {
+ font-weight: bold;
+ margin-bottom: .8em;
+}
+
+dd {
+ margin: 0 0 .8em 2em;
+}
+
+dd:last-child {
+ margin-bottom: 0;
+}
+
+img {
+ border: 0;
+ -ms-interpolation-mode: bicubic;
+ vertical-align: middle;
+}
+
+figure {
+ display: block;
+ text-align: center;
+ margin: 1em 0;
+}
+
+figure img {
+ border: none;
+ margin: 0 auto;
+}
+
+figcaption {
+ font-size: 0.8em;
+ font-style: italic;
+ margin: 0 0 .8em;
+}
+
+table {
+ margin-bottom: 2em;
+ border-bottom: 1px solid #ddd;
+ border-right: 1px solid #ddd;
+ border-spacing: 0;
+ border-collapse: collapse;
+}
+
+table th {
+ padding: .2em 1em;
+ background-color: #eee;
+ border-top: 1px solid #ddd;
+ border-left: 1px solid #ddd;
+}
+
+table td {
+ padding: .2em 1em;
+ border-top: 1px solid #ddd;
+ border-left: 1px solid #ddd;
+ vertical-align: top;
+}
+
+.author {
+ font-size: 1.2em;
+ text-align: center;
+}
+
+@media only screen and (min-width: 480px) {
+ body {
+ font-size: 14px;
+ }
+}
+@media only screen and (min-width: 768px) {
+ body {
+ font-size: 16px;
+ }
+}
+@media print {
+ * {
+ background: transparent !important;
+ color: black !important;
+ filter: none !important;
+ -ms-filter: none !important;
+ }
+
+ body {
+ font-size: 12pt;
+ max-width: 100%;
+ }
+
+ a, a:visited {
+ text-decoration: underline;
+ }
+
+ hr {
+ height: 1px;
+ border: 0;
+ border-bottom: 1px solid black;
+ }
+
+ a[href]:after {
+ content: " (" attr(href) ")";
+ }
+
+ abbr[title]:after {
+ content: " (" attr(title) ")";
+ }
+
+ .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after {
+ content: "";
+ }
+
+ pre, blockquote {
+ border: 1px solid #999;
+ padding-right: 1em;
+ page-break-inside: avoid;
+ }
+
+ tr, img {
+ page-break-inside: avoid;
+ }
+
+ img {
+ max-width: 100% !important;
+ }
+
+ @page :left {
+ margin: 15mm 20mm 15mm 10mm;
+}
+
+ @page :right {
+ margin: 15mm 10mm 15mm 20mm;
+}
+
+ p, h2, h3 {
+ orphans: 3;
+ widows: 3;
+ }
+
+ h2, h3 {
+ page-break-after: avoid;
+ }
+}
+
+.tex sub, .latex sub, .latex sup {
+ text-transform: uppercase;
+}
+
+.tex sub, .latex sub {
+ vertical-align: -0.1ex;
+ margin-left: -0.1667em;
+ margin-right: -0.125em;
+}
+
+.tex, .latex, .tex sub, .latex sub {
+ font-size: 1em;
+}
+
+.latex sup {
+ font-size: 0.85em;
+ vertical-align: -0.35em;
+ margin-left: -0.36em;
+ margin-right: -0.15em;
+}
+
+abbr {
+ text-transform: lowercase;
+ font-variant: small-caps;
+}
+
diff --git a/macros/generic/markdown/markdown.dtx b/macros/generic/markdown/markdown.dtx
new file mode 100644
index 0000000000..71c06b8154
--- /dev/null
+++ b/macros/generic/markdown/markdown.dtx
@@ -0,0 +1,17226 @@
+% \iffalse
+%<*driver>
+\documentclass{ltxdockit}
+\usepackage[american]{babel}
+\usepackage{amsmath,btxdockit,doc,fancyvrb,hologo,microtype,minted,xcolor}
+\usepackage{fontspec}
+\defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{}
+
+% Set up the style.
+\emergencystretch=1em
+\fvset{gobble=0,frame=single}
+\setcounter{secnumdepth}{4}
+\addtokomafont{title}{\sffamily}
+\addtokomafont{paragraph}{\spotcolor}
+\addtokomafont{section}{\spotcolor}
+\addtokomafont{subsection}{\spotcolor}
+\addtokomafont{subsubsection}{\spotcolor}
+\addtokomafont{descriptionlabel}{\spotcolor}
+\setkomafont{caption}{\bfseries\sffamily\spotcolor}
+\setkomafont{captionlabel}{\bfseries\sffamily\spotcolor}
+\hypersetup{citecolor=spot}
+\let\oldCodelineNo\theCodelineNo
+\def\theCodelineNo{\textcolor{gray}{\oldCodelineNo}}
+
+% Define some markup.
+\let\pkg\relax % A package name
+\newcommand\mdef[1]{% A TeX macro definition
+ \phantomsection\label{macro:#1}\textcolor{spot}{\cs{#1}}}
+\newcommand\m[1]{% A TeX macro reference
+ \hyperref[macro:#1]{\textcolor{spot}{\cs{#1}}}}
+\newcommand\envmdef[1]{% A TeX macro definition
+ \phantomsection\label{environment:#1}\t`#1`}
+\newcommand\envm[1]{% A LaTeX environment reference
+ \hyperref[environment:#1]{\t`#1`}}
+\newcommand\luamdef[1]{% A Lua object / method definition
+ \phantomsection\label{lua:#1}\t`#1`}
+\newcommand\luam[1]{% A Lua object / method reference
+ \hyperref[lua:#1]{\t`#1`}}
+\def\inline#1{% Inline code
+ \textcolor{spot}{\text{\texttt{#1}}}}
+\def\t`#1`{\inline{#1}}
+\newcommand\Optitem[2][]{\penalty -1000\relax % An option item definition
+ \phantomsection\label{opt:#2}\optitem[#1]{#2}}
+\newcommand\Valitem[2][]{\penalty -1000\relax % A value item definition
+ \phantomsection\label{opt:#2}\valitem[#1]{#2}}
+\newcommand\Opt[1]{% An option / value item reference
+ \hyperref[opt:#1]{\t`#1`}}
+\newcommand\acro[1]{% An acronym
+ \textsc{\MakeLowercase{#1}}}
+
+% Set up markdown.
+\usepackage[
+ citations,
+ definitionLists,
+ fencedCode,
+ headerAttributes,
+ hybrid,
+ html,
+ stripPercentSigns,
+ underscores=false,
+]{markdown}
+\markdownSetup{
+ renderers = {
+ codeSpan = {\inline{#1}},
+ link = {#1\footnote{See \url{#3}.}},
+ headingFour = {%
+ \paragraph{#1}\leavevmode
+ \def\markdownRendererInterblockSeparator{%
+ \let\markdownRendererInterblockSeparator\par
+ }%
+ \noindent
+ },
+ },
+}
+
+% Set up the catcodes.
+\catcode`\_=12 % We won't be typesetting much math and Lua contains lots of `_`.
+\catcode`\^^B=8 % When we occasionally need subscripts , we will use `^^B` (STX).
+
+% Set up the title page.
+\titlepage{%
+ title={A Markdown Interpreter for \TeX{}},
+ subtitle={},
+ url={https://github.com/witiko/markdown},
+ author={Vít Novotný},
+ email={witiko@mail.muni.cz},
+ revision=\markdownVersion,
+ date={\today}}
+\hypersetup{%
+ pdftitle={A Markdown Interpreter for \TeX{}},
+ pdfauthor={Vít Novotný}}
+\CodelineIndex
+
+% Set up the bibliography.
+\usepackage{filecontents}
+\begin{filecontents}{markdown.bib}
+@online{sotkov17,
+ author = {Sotkov, Anton},
+ title = {File transclusion syntax for Markdown},
+ date = {2017-01-19},
+ url = {https://github.com/iainc/Markdown-Content-Blocks},
+ urldate = {2018-01-08}}
+@book{luatex17,
+ author = {{Lua\TeX{} development team}},
+ title = {Lua\TeX{} reference manual},
+ year = {2017},
+ month = {2},
+ url = {http://www.luatex.org/svn/trunk/manual/luatex.pdf},
+ urldate = {2018-01-08}}
+@book{latex17,
+ author = {Braams, Johannes and Carlisle, David and Jeffrey, Alan and
+ Lamport, Leslie and Mittelbach, Frank and Rowley, Chris and
+ Schöpf, Rainer},
+ title = {The \Hologo{LaTeX2e} Sources},
+ date = {2017-04-15},
+ url = {http://mirrors.ctan.org/macros/latex/base/source2e.pdf},
+ urldate = {2018-01-08}}
+@book{mittelbach17,
+ author = {Mittelbach, Frank},
+ title = {The \texttt{doc} and \texttt{shortvrb} Packages},
+ date = {2017-04-15},
+ url = {http://mirrors.ctan.org/macros/latex/base/doc.pdf},
+ urldate = {2018-02-19}}
+@online{novotny15,
+ author = {Novotný, Vít},
+ year = {2015},
+ title = {TeXový interpret jazyka Markdown (markdown.sty)},
+ location = {Brno, Czech Republic},
+ publisher = {Masaryk University},
+ url = {https://www.muni.cz/en/research/projects/32984},
+ urldate = {2018-02-19}}
+@book{ierusalimschy13,
+ author = {Ierusalimschy, Roberto},
+ year = {2013},
+ title = {Programming in Lua},
+ edition = {3},
+ isbn = {978-85-903798-5-0},
+ pagetotal = {xviii, 347},
+ location = {Rio de Janeiro},
+ publisher = {PUC-Rio}}
+@book{knuth86,
+ author = {Knuth, Donald Ervin},
+ year = {1986},
+ title = {The \TeX{}book},
+ edition = {3},
+ isbn = {0-201-13447-0},
+ pagetotal = {ix, 479},
+ publisher = {Addison-Wesley}}
+\end{filecontents}
+\usepackage[
+ backend=biber,
+ style=numeric,
+ sorting=none,
+ autolang=other,
+ sortlocale=auto]{biblatex}
+\addbibresource{markdown.bib}
+
+\begin{document}
+\printtitlepage
+\tableofcontents
+\DocInput{markdown.dtx}
+\printbibliography
+\end{document}
+%</driver>
+%<*manual-css>
+
+html {
+ font-size: 100%;
+ overflow-y: scroll;
+ -webkit-text-size-adjust: 100%;
+ -ms-text-size-adjust: 100%;
+}
+
+body {
+ color: #444;
+ font-family: Georgia, Palatino, 'Palatino Linotype', Times, 'Times New Roman', serif;
+ font-size: 12px;
+ line-height: 1.7;
+ padding: 1em;
+ margin: auto;
+ max-width: 42em;
+ background: #fefefe;
+}
+
+a {
+ color: #0645ad;
+}
+
+a:visited {
+ color: #0b0080;
+}
+
+a:hover {
+ color: #06e;
+}
+
+a:active {
+ color: #faa700;
+}
+
+a:focus {
+ outline: thin dotted;
+}
+
+*::-moz-selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #000;
+}
+
+*::selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #000;
+}
+
+a::-moz-selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #0645ad;
+}
+
+a::selection {
+ background: rgba(255, 255, 0, 0.3);
+ color: #0645ad;
+}
+
+p {
+ margin: 1em 0;
+}
+
+img {
+ max-width: 100%;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ color: #111;
+ line-height: 125%;
+ margin-top: 2em;
+ font-weight: normal;
+}
+
+h4, h5, h6 {
+ font-weight: bold;
+}
+
+h1 {
+ font-size: 2.5em;
+}
+
+h2 {
+ font-size: 2em;
+}
+
+h3 {
+ font-size: 1.5em;
+}
+
+h4 {
+ font-size: 1.2em;
+}
+
+h5 {
+ font-size: 1em;
+}
+
+h6 {
+ font-size: 0.9em;
+}
+
+blockquote {
+ color: #666666;
+ margin: 0;
+ padding-left: 3em;
+ border-left: 0.5em #EEE solid;
+}
+
+hr {
+ display: block;
+ height: 2px;
+ border: 0;
+ border-top: 1px solid #aaa;
+ border-bottom: 1px solid #eee;
+ margin: 1em 0;
+ padding: 0;
+}
+
+pre, code, kbd, samp {
+ color: #000;
+ font-family: monospace, monospace;
+ _font-family: 'courier new', monospace;
+ font-size: 0.98em;
+}
+
+pre {
+ white-space: pre;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+}
+
+b, strong {
+ font-weight: bold;
+}
+
+dfn {
+ font-style: italic;
+}
+
+ins {
+ background: #ff9;
+ color: #000;
+ text-decoration: none;
+}
+
+mark {
+ background: #ff0;
+ color: #000;
+ font-style: italic;
+ font-weight: bold;
+}
+
+sub, sup {
+ font-size: 75%;
+ line-height: 0;
+ position: relative;
+ vertical-align: baseline;
+}
+
+sup {
+ top: -0.5em;
+}
+
+sub {
+ bottom: -0.25em;
+}
+
+ul, ol {
+ margin: 1em 0;
+ padding: 0 0 0 2em;
+}
+
+li p:last-child {
+ margin-bottom: 0;
+}
+
+ul ul, ol ol {
+ margin: .3em 0;
+}
+
+dl {
+ margin-bottom: 1em;
+}
+
+dt {
+ font-weight: bold;
+ margin-bottom: .8em;
+}
+
+dd {
+ margin: 0 0 .8em 2em;
+}
+
+dd:last-child {
+ margin-bottom: 0;
+}
+
+img {
+ border: 0;
+ -ms-interpolation-mode: bicubic;
+ vertical-align: middle;
+}
+
+figure {
+ display: block;
+ text-align: center;
+ margin: 1em 0;
+}
+
+figure img {
+ border: none;
+ margin: 0 auto;
+}
+
+figcaption {
+ font-size: 0.8em;
+ font-style: italic;
+ margin: 0 0 .8em;
+}
+
+table {
+ margin-bottom: 2em;
+ border-bottom: 1px solid #ddd;
+ border-right: 1px solid #ddd;
+ border-spacing: 0;
+ border-collapse: collapse;
+}
+
+table th {
+ padding: .2em 1em;
+ background-color: #eee;
+ border-top: 1px solid #ddd;
+ border-left: 1px solid #ddd;
+}
+
+table td {
+ padding: .2em 1em;
+ border-top: 1px solid #ddd;
+ border-left: 1px solid #ddd;
+ vertical-align: top;
+}
+
+.author {
+ font-size: 1.2em;
+ text-align: center;
+}
+
+@media only screen and (min-width: 480px) {
+ body {
+ font-size: 14px;
+ }
+}
+@media only screen and (min-width: 768px) {
+ body {
+ font-size: 16px;
+ }
+}
+@media print {
+ * {
+ background: transparent !important;
+ color: black !important;
+ filter: none !important;
+ -ms-filter: none !important;
+ }
+
+ body {
+ font-size: 12pt;
+ max-width: 100%;
+ }
+
+ a, a:visited {
+ text-decoration: underline;
+ }
+
+ hr {
+ height: 1px;
+ border: 0;
+ border-bottom: 1px solid black;
+ }
+
+ a[href]:after {
+ content: " (" attr(href) ")";
+ }
+
+ abbr[title]:after {
+ content: " (" attr(title) ")";
+ }
+
+ .ir a:after, a[href^="javascript:"]:after, a[href^="#"]:after {
+ content: "";
+ }
+
+ pre, blockquote {
+ border: 1px solid #999;
+ padding-right: 1em;
+ page-break-inside: avoid;
+ }
+
+ tr, img {
+ page-break-inside: avoid;
+ }
+
+ img {
+ max-width: 100% !important;
+ }
+
+ @page :left {
+ margin: 15mm 20mm 15mm 10mm;
+}
+
+ @page :right {
+ margin: 15mm 10mm 15mm 20mm;
+}
+
+ p, h2, h3 {
+ orphans: 3;
+ widows: 3;
+ }
+
+ h2, h3 {
+ page-break-after: avoid;
+ }
+}
+
+.tex sub, .latex sub, .latex sup {
+ text-transform: uppercase;
+}
+
+.tex sub, .latex sub {
+ vertical-align: -0.1ex;
+ margin-left: -0.1667em;
+ margin-right: -0.125em;
+}
+
+.tex, .latex, .tex sub, .latex sub {
+ font-size: 1em;
+}
+
+.latex sup {
+ font-size: 0.85em;
+ vertical-align: -0.35em;
+ margin-left: -0.36em;
+ margin-right: -0.15em;
+}
+
+abbr {
+ text-transform: lowercase;
+ font-variant: small-caps;
+}
+
+%</manual-css>
+%<*manual>
+
+---
+title: Markdown Package User Manual
+author: Vít Novotný
+date: v\markdownVersion{} (\markdownLastModified{})
+---
+
+% \fi
+% \par
+% \begin{markdown}
+
+<link href="https://afeld.github.io/emoji-css/emoji.css" rel="stylesheet" />
+
+Introduction
+============
+The [Markdown package][pkg] converts [markdown][] markup to \TeX{} commands. The
+functionality is provided both as a Lua module and as plain \TeX{}, \LaTeX{}, and
+\Hologo{ConTeXt} macro packages that can be used to directly typeset \TeX documents
+containing markdown markup. Unlike other convertors, the Markdown package
+makes it easy to redefine how each and every markdown element is rendered.
+Creative abuse of the markdown syntax is encouraged. ;-)
+
+ [markdown]: https://daringfireball.net/projects/markdown/basics/
+ (Daring Fireball: Markdown Basics)
+ [pkg]: https://ctan.org/pkg/markdown
+ (CTAN: Package markdown)
+
+% This document is a technical documentation for the \pkg{Markdown} package. It
+% consists of three sections. This section introduces the package and outlines
+% its prerequisites. Section \ref{sec:interfaces} describes the interfaces
+% exposed by the package. Section \ref{sec:implementation} describes the
+% implementation of the package. The technical documentation contains only a
+% limited number of tutorials and code examples. You can find more of these in
+% the [user manual.][manual]
+%
+% [manual]: http://mirrors.ctan.org/macros/generic/markdown/markdown.html
+%
+% \end{markdown}
+% \iffalse
+
+This document is a user manual for the [Markdown package][pkg]. It provides
+tutorials and code examples. For an in-depth description of the package
+requirements, interfaces, and implementation, please refer to the [technical
+documentation][techdoc].
+
+ [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf
+ (A Markdown Interpreter for TeX)
+
+%</manual>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+local metadata = {
+ version = "2.8.1",
+ comment = "A module for the conversion from markdown to plain TeX",
+ author = "John MacFarlane, Hans Hagen, Vít Novotný",
+ copyright = {"2009-2016 John MacFarlane, Hans Hagen",
+ "2016-2019 Vít Novotný"},
+ license = "LPPL 1.3"
+}
+
+% \end{macrocode}
+% \iffalse
+%</lua,lua-cli>
+%<*lua>
+% \fi
+% \begin{macrocode}
+if not modules then modules = { } end
+modules['markdown'] = metadata
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Feedback
+%---------
+% Please use the \pkg{Markdown} project page on
+% [GitHub](https://github.com/witiko/markdown/issues) to report bugs and submit
+% feature requests. If you do not want to report a bug or request a feature but
+% are simply in need of assistance, you might want to consider posting your
+% question on the [\TeX-\LaTeX{} Stack Exchange.](https://tex.stackexchange.com)
+%
+% Acknowledgements
+%-----------------
+% The Lunamark Lua module provides speedy markdown parsing for the package. I
+% would like to thank John Macfarlane, the creator of Lunamark, for releasing
+% Lunamark under a permissive license.
+%
+% Funding by the the Faculty of Informatics at the Masaryk~University
+% in~Brno~[@novotny15] is gratefully acknowledged.
+%
+% The \TeX{} implementation of the package draws inspiration from several
+% sources including the source code of \Hologo{LaTeX2e}, the \pkg{minted}
+% package by Geoffrey M. Poore, which likewise tackles the issue of
+% interfacing with an external interpreter from \TeX{}, the \pkg{filecontents}
+% package by Scott Pakin and others.
+%
+% \end{markdown}
+% \iffalse
+%</lua>
+%<*manual>
+
+Requirements
+------------
+
+The package requires a working \TeX{} distribution. [\TeX{} Live][tl] ≥ 2013 is
+known to work and so are recent installation of [Mik\TeX{}][mik]. If you are
+using a minimal installation of a \TeX{} distribution, please consult the
+[technical documentation][techdoc] for a detailed list of required packages.
+
+ [tl]: https://www.tug.org/texlive/ (TeX Live - TeX Users Group)
+ [mik]: https://miktex.org/ (Home - MiKTeXorg)
+
+Installation
+------------
+
+The package comes pre-installed with [\TeX{} Live][tl] ≥ 2016 and with recent
+installations of [MikTeX][mik]. Unless you explicitly wish to use the latest
+version of the package, you are encouraged to skip this step.
+
+To install the package, first download the package from the repository
+using Git:
+``` sh
+git clone https://github.com/witiko/markdown
+``````
+Next, enter the directory named `markdown` and interpret the file named
+`markdown.ins` file using a Unicode-aware \TeX{} engine, such as XeTeX or
+LuaTeX:
+``` sh
+cd markdown
+luatex markdown.ins
+``````
+This should produce the following files:
+
+ * `markdown.lua`, the Lua module,
+ * `markdown-cli.lua`, the Lua command-line interface,
+ * `markdown.tex`, the plain \TeX{} macro package,
+ * `markdown.sty`, the \LaTeX{} package, and
+ * `t-markdown.tex`, the \Hologo{ConTeXt} module.
+
+### Local Installation
+
+To perform a local installation, place the above files into your \TeX{}
+directory structure. This is generally where the individual files should be
+placed:
+
+ * `<TEXMF>/tex/luatex/markdown/markdown.lua`
+ * `<TEXMF>/scripts/markdown/markdown-cli.lua`
+ * `<TEXMF>/tex/generic/markdown/markdown.tex`
+ * `<TEXMF>/tex/latex/markdown/markdown.sty`
+ * `<TEXMF>/tex/context/third/markdown/t-markdown.tex`
+
+where `<TEXMF>` corresponds to a root of your \TeX{} distribution, such as
+`/usr/share/texmf` and `~/texmf` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf` on Windows systems. When in doubt,
+consult the manual of your \TeX{} distribution.
+
+### Portable Installation
+
+Alternatively, you can also store the above files in the same folder as your
+\TeX{} document and distribute them together. This way your document can be
+portably typeset on legacy \TeX{} distributions.
+
+%</manual>
+%<*lua>
+% \fi
+% \par
+% \begin{markdown}
+%
+% Requirements
+%-------------
+%
+% This section gives an overview of all resources required by the package.
+%
+%### Lua Requirements
+% \label{sec:luaprerequisites}
+% The Lua part of the package requires that the following Lua modules are
+% available from within the Lua\TeX{} engine:
+%
+% \pkg{LPeg${}\geq{}$0.10}
+%
+%: A pattern-matching library for the writing of recursive descent parsers
+% via the Parsing Expression Grammars (\acro{peg}s). It is used by the
+% \pkg{Lunamark} library to parse the markdown input.
+% \pkg{LPeg${}\geq{}$0.10} is included in Lua\TeX${}\geq{}$0.72.0 (\TeX
+% Live${}\geq{}2013$).
+%
+% \end{markdown}
+% \begin{macrocode}
+local lpeg = require("lpeg")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{Selene Unicode}
+%
+%: A library that provides support for the processing of wide strings. It is
+% used by the \pkg{Lunamark} library to cast image, link, and footnote tags
+% to the lower case. \pkg{Selene Unicode} is included in all releases of
+% Lua\TeX{} (\TeX Live${}\geq{}2008$).
+%
+% \end{markdown}
+% \begin{macrocode}
+local unicode = require("unicode")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{MD5}
+%
+%: A library that provides \acro{md5} crypto functions. It is used by the
+% \pkg{Lunamark} library to compute the digest of the input for caching
+% purposes. \pkg{MD5} is included in all releases of Lua\TeX{} (\TeX
+% Live${}\geq{}2008$).
+%
+% \end{markdown}
+% \begin{macrocode}
+local md5 = require("md5")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% All the abovelisted modules are statically linked into the current version of
+% the Lua\TeX{} engine~[@luatex17, Section 3.3].
+%
+% \end{markdown}
+% \iffalse
+%</lua>
+%<*tex>
+% \fi
+% \par
+% \begin{markdown}
+%
+%### Plain \TeX{} Requirements
+% \label{sec:texprerequisites}
+% The plain \TeX{} part of the package requires that the plain \TeX{}
+% format (or its superset) is loaded, all the Lua prerequisites (see
+% Section \ref{sec:luaprerequisites}), and the following Lua module:
+%
+% \pkg{Lua File System}
+%
+%: A library that provides access to the filesystem via \acro{os}-specific
+% syscalls. It is used by the plain \TeX{} code to create the cache
+% directory specified by the \m{markdownOptionCacheDir} macro before
+% interfacing with the \pkg{Lunamark} library. \pkg{Lua File System} is
+% included in all releases of Lua\TeX{} (\TeX Live${}\geq{}2008$).
+%
+% The plain \TeX{} code makes use of the \luam{isdir} method that was added
+% to the \pkg{Lua File System} library by the Lua\TeX{} engine
+% developers~[@luatex17, Section 3.2].
+%
+% The \pkg{Lua File System} module is statically linked into the Lua\TeX{}
+% engine~[@luatex17, Section~3.3].
+%
+% Unless you convert markdown documents to \TeX{} manually using the Lua
+% command-line interface (see Section~\ref{sec:lua-cli-interface}), the plain
+% \TeX{} part of the package will require that either the Lua\TeX{}
+% \m{directlua} primitive or the shell access file stream 18 is available in
+% your \TeX{} engine. If only the shell access file stream is available in your
+% \TeX{} engine (as is the case with \hologo{pdfTeX} and \Hologo{XeTeX}) or if
+% you enforce the use of shell using the \m{markdownMode} macro, then unless
+% your \TeX{} engine is globally configured to enable shell access, you will
+% need to provide the `-shell-escape` parameter to your engine when typesetting
+% a document.
+%
+% \end{markdown}
+% \iffalse
+%</tex>
+%<*latex>
+% \fi
+% \par
+% \begin{markdown}
+%
+%### \LaTeX{} Requirements
+% \label{sec:latexprerequisites}
+% The \LaTeX{} part of the package requires that the \Hologo{LaTeX2e} format is
+% loaded,
+% \end{markdown}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}%
+% \end{macrocode}
+% \begin{markdown}
+% all the plain \TeX{} prerequisites (see Section \ref{sec:texprerequisites}),
+% and the following \Hologo{LaTeX2e} packages:
+%
+% \pkg{keyval}
+%
+%: A package that enables the creation of parameter sets. This package is
+% used to provide the \m{markdownSetup} macro, the package options
+% processing, as well as the parameters of the \envm{markdown*} \LaTeX{}
+% environment.
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{keyval}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{url}
+%
+%: A package that provides the \m{url} macro for the typesetting of
+% \acro{url}s. It is used to provide the default token renderer prototype
+% (see Section \ref{sec:texrendererprototypes}) for links.
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{url}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{graphicx}
+%
+%: A package that provides the \m{includegraphics} macro for the typesetting
+% of images. It is used to provide the corresponding default token renderer
+% prototype (see Section \ref{sec:texrendererprototypes}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{graphicx}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{paralist}
+%
+%: A package that provides the \envm{compactitem}, \envm{compactenum}, and
+% \envm{compactdesc} macros for the typesetting of tight bulleted lists,
+% ordered lists, and definition lists. It is used to provide the
+% corresponding default token renderer prototypes (see Section
+% \ref{sec:texrendererprototypes}).
+%
+% \pkg{ifthen}
+%
+%: A package that provides a concise syntax for the inspection of macro
+% values. It is used to determine whether or not the \pkg{paralist} package
+% should be loaded based on the user options.
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{ifthen}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{fancyvrb}
+%
+%: A package that provides the \m{VerbatimInput} macros for the verbatim
+% inclusion of files containing code. It is used to provide the
+% corresponding default token renderer prototype (see Section
+% \ref{sec:texrendererprototypes}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{fancyvrb}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{csvsimple}
+%
+%: A package that provides the default token renderer prototype for
+% iA\,Writer content blocks with the \acro{csv} filename extension (see
+% Section \ref{sec:texrendererprototypes}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{csvsimple}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% \pkg{gobble}
+%
+%: A package that provides the \m{\@gobblethree} \TeX{} command.
+%
+% \end{markdown}
+% \begin{macrocode}
+\RequirePackage{gobble}
+% \end{macrocode}
+% \iffalse
+%</latex>
+%<*context>
+% \fi
+% \par
+% \begin{markdown}
+%
+%### \Hologo{ConTeXt} Prerequisites
+% The \Hologo{ConTeXt} part of the package requires that either the Mark II or
+% the Mark IV format is loaded, all the plain \TeX{} prerequisites (see
+% Section \ref{sec:texprerequisites}), and the following \Hologo{ConTeXt}
+% modules:
+%
+% \pkg{m-database}
+%
+%: A module that provides the default token renderer prototype for
+% iA\,Writer content blocks with the \acro{csv} filename extension (see
+% Section \ref{sec:texrendererprototypes}).
+%
+% Interfaces
+%===========
+% \label{sec:interfaces}
+% This part of the documentation describes the interfaces exposed by the package
+% along with usage notes and examples. It is aimed at the user of the package.
+%
+% Since neither \TeX{} nor Lua provide interfaces as a language construct, the
+% separation to interfaces and implementations is purely abstract. It serves as
+% a means of structuring this documentation and as a promise to the user that
+% if they only access the package through the interface, the future minor
+% versions of the package should remain backwards compatible.
+%
+% \end{markdown}
+% \iffalse
+%</context>
+%<*manual>
+
+First Document
+--------------
+
+In this section, we will take the necessary steps to typeset our first markdown
+document in \TeX{}. This will serve as our first hands-on experience with the
+package and also as a reassurance that the package has been correctly installed.
+
+### Using Lua
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input hello
+\bye
+```````
+
+#### Using the Lua Module
+
+Using a text editor, create a text document named `hello.lua` with the
+following content:
+``` lua
+#!/usr/bin/env texlua
+local kpse = require("kpse")
+kpse.set_program_name("luatex")
+local markdown = require("markdown")
+local convert = markdown.new()
+print(convert("Hello *world*!"))
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua hello.lua > hello.tex
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!” Invoking pdfTeX should have the same effect:
+``` sh
+texlua hello.lua > hello.tex
+pdftex document.tex
+``````
+
+#### Using the Lua Command-Line Interface
+
+Using a text editor, create a text document named `hello.md` with the
+following content:
+``` md
+Hello *world*!
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- hello.md hello.tex
+luatex document.tex
+``````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+ [Kpathsea]: https://tug.org/kpathsea/ (Kpathsea - TeX Users Group)
+
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” Invoking pdfTeX should have the same effect:
+``` sh
+texlua ⟨CLI pathname⟩ -- hello.md hello.tex
+pdftex document.tex
+``````
+
+### Using Plain \TeX{}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!” Invoking pdfTeX should have the same effect:
+``` sh
+pdftex --shell-escape document.tex
+```````
+
+### Using \LaTeX{}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+Hello *world*!
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” Invoking pdfTeX should have the same effect:
+``` sh
+pdflatex --shell-escape document.tex
+``````
+
+***
+
+As the next step, try typesetting the example documents distributed along with
+the Markdown package:
+``` sh
+git clone https://github.com/witiko/markdown
+cd markdown/examples
+lualatex latex.tex
+``````
+A PDF document named `latex.pdf` should be produced. Open the text documents
+`latex.tex` and `example.md` in a text editor to see how the example documents
+are structured. Try changing the documents and typesetting them as follows:
+``` sh
+lualatex latex.tex
+``````
+to see the effect of your changes.
+
+### Using \Hologo{ConTeXt}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+\startmarkdown
+Hello *world*!
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” Invoking pdfTeX should have the same effect:
+``` sh
+texexec --passon=--shell-escape document.tex
+``````
+
+***
+
+As the next step, try typesetting the example documents distributed along with
+the Markdown package:
+``` sh
+git clone https://github.com/witiko/markdown
+cd markdown/examples
+context context.tex
+``````
+A PDF document named `context.pdf` should be produced. Open the text documents
+`context.tex` and `example.md` in a text editor to see how the example documents
+are structured. Try changing the documents and typesetting them as follows:
+``` sh
+context context.tex
+``````
+to see the effect of your changes.
+
+Examples
+========
+
+In this section, I will describe the individual parts of the Markdown package.
+Each part will be shown by example, leaving the implementation details to the
+[technical documentation][techdoc].
+
+ [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf
+ (A Markdown Interpreter for \TeX{})
+
+/markdown-interfaces.md
+/markdown-options.md
+/markdown-tokens.md
+
+%</manual>
+%<*lua>
+% \fi
+% \par
+% \begin{markdown}
+%
+% Lua Interface
+%--------------
+% \label{sec:luainterface}
+%
+% \iffalse
+%</lua>
+%<*manual-interfaces>
+
+Interfaces
+----------
+
+In this section, I will describe the individual interfaces exposed by the
+Markdown package starting with the low-level Lua interfaces and all the way up
+to the \LaTeX{} and \Hologo{ConTeXt} interfaces intended for the ordinary
+user.
+
+### Lua
+
+The Lua programming language is what drives the conversion from markdown to
+\TeX{} in the Markdown package. Based on the [Lunamark][] Lua library by John
+MacFarlane, the Lua implementation is largely independent on \TeX{}, and can be
+used separately from typesetting a document. Lua provides two interfaces: a Lua
+module and a command-line interface (CLI).
+
+ [Lunamark]: https://github.com/jgm/lunamark
+ (Lua library for conversion between markup formats)
+
+%</manual-interfaces>
+%<*lua>
+% \fi
+%
+% The Lua interface provides the conversion from \acro{utf}-\oldstylenums8
+% encoded markdown to plain \TeX{}. This interface is used by the plain \TeX{}
+% implementation (see Section \ref{sec:teximplementation}) and will be of
+% interest to the developers of other packages and Lua modules.
+%
+% The Lua interface is implemented by the `markdown` Lua module.
+%
+% \end{markdown}
+% \begin{macrocode}
+local M = {metadata = metadata}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Conversion from Markdown to Plain \TeX{}
+% \label{sec:luaconversion}
+% The Lua interface exposes the \luamdef{new}`(options)` method. This
+% method creates converter functions that perform the conversion from markdown
+% to plain \TeX{} according to the table `options` that contains options
+% recognized by the Lua interface. (see Section \ref{sec:luaoptions}). The
+% `options` parameter is optional; when unspecified, the behaviour will be
+% the same as if `options` were an empty table.
+%
+% The following example Lua code converts the markdown string `Hello
+% *world*!` to a \TeX{} output using the default options and prints the \TeX{}
+% output:
+% ``` lua
+% local md = require("markdown")
+% local convert = md.new()
+% print(convert("Hello *world*!"))
+% ```````
+%
+% \end{markdown}
+% \iffalse
+%</lua>
+%<*manual-interfaces>
+
+#### Lua Module
+
+A Lua module is a software library that can be used from in other programs.
+The `markdown` Lua module makes it possible to convert markdown to \TeX{} from
+within Lua\TeX{} documents and Lua scripts.
+
+The `markdown` Lua module exposes the `new(`\meta{options}`)` method, which
+creates a converter function from markdown to \TeX{}. The properties of the
+converter function are specified by the Lua table `options`. The parameter is
+optional; when unspecified, the behaviour will be the same as if \meta{options}
+were an empty table.
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input example
+\bye
+```````
+Using a text editor, create a text document named `example.lua` with the
+following content:
+``` lua
+#!/usr/bin/env texlua
+local kpse = require("kpse")
+kpse.set_program_name("luatex")
+local markdown = require("markdown")
+local input, convert_safe, convert_unsafe, paragraph
+
+input = [[$\sqrt{-1}$ *equals* $i$.]]
+convert_safe = markdown.new()
+convert_unsafe = markdown.new({hybrid = true})
+paragraph = [[\par]]
+
+print(
+ convert_safe(input) .. paragraph ..
+ convert_unsafe(input)
+)
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua example.lua > example.tex
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+Invoking pdfTeX should have the same effect:
+``` sh
+texlua example.lua > example.tex
+pdftex document.tex
+``````
+
+***
+
+Rather than use the `texlua` interpreter, we can also access the `markdown` Lua
+module directly from our document. Using a text editor, create a text document
+named `document.tex` with the following content:
+``` tex
+\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local input, convert_safe, convert_unsafe, paragraph
+
+ input = [[$\string\sqrt{-1}$ *equals* $i$.]]
+ convert_safe = markdown.new()
+ convert_unsafe = markdown.new({hybrid = true})
+ paragraph = [[\par]]
+
+ tex.sprint(
+ convert_safe(input) .. paragraph ..
+ convert_unsafe(input)
+ )
+}
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+In this case, we cannot use pdfTeX, because pdfTeX does not define the
+`\directlua` \TeX{} command.
+
+#### Lua Command-Line Interface
+
+The Lua command-line interface (CLI) of the Markdown package makes the
+functionality of the Lua module accessible from the command line. This makes
+it possible to convert documents from markdown to \TeX{} manually without any
+knowledge of the Lua programming language.
+
+The Lua command-line interface accepts the same options as the `markdown` Lua
+module, but now the options are specified as command-line parameters.
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input safe
+
+\input unsafe
+\bye
+```````
+Using a text editor, create a text document named `example.md` with the
+following content:
+``` md
+$\sqrt{-1}$ *equals* $i$.
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- example.md safe.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
+luatex document.tex
+``````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+Invoking pdfTeX should have the same effect:
+``` sh
+texlua ⟨CLI pathname⟩ -- example.md safe.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
+pdftex document.tex
+``````
+
+%</manual-interfaces>
+%<*lua>
+% \fi
+% \begin{markdown}
+%
+%### Options
+% \label{sec:luaoptions}
+% The Lua interface recognizes the following options. When unspecified, the
+% value of a key is taken from the \luamdef{defaultOptions} table.
+%
+% \end{markdown}
+% \iffalse
+%</lua>
+%<*manual-options>
+
+## Options
+
+In this section, I will describe all the options recognized by the Markdown
+package.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+local defaultOptions = {}
+% \end{macrocode}
+% \begingroup
+% \markdownSetup{
+% renderers = {
+% dlBegin = {\begin{optionlist}},
+% dlItem = {
+% #1
+% \begingroup
+% \markdownSetup{
+% renderers = {
+% dlBegin = {
+% \begingroup
+% \markdownSetup{
+% renderers = {
+% dlItem = {\item[####1]},
+% dlItemEnd = {}}}
+% \begin{valuelist}},
+% dlEnd = {
+% \end{valuelist}
+% \endgroup}}}},
+% dlItemEnd = {\endgroup},
+% dlEnd = {\end{optionlist}}}}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+### Lua
+
+Lua options control the conversion from markdown to \TeX{}. They are supported
+by all interfaces of the Markdown package starting with the low-level Lua
+interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces.
+
+% \fi
+% \begin{markdown}
+%
+%### File and Directory Names
+%
+% \end{markdown}
+% \par
+% \iffalse
+
+#### Option `cacheDir`
+
+`cacheDir` (default value: `"."`)
+
+% \fi
+% \begin{markdown}
+%
+% \Valitem[.]{cacheDir}{path}
+%
+: A path to the directory containing auxiliary cache files. If the last
+ segment of the path does not exist, it will be created by the Lua
+ command-line and plain \TeX{} implementations. The Lua implementation
+ expects that the entire path already exists.
+
+ When iteratively writing and typesetting a markdown document, the cache
+ files are going to accumulate over time. You are advised to clean the
+ cache directory every now and then, or to set it to a temporary filesystem
+ (such as `/tmp` on UN*X systems), which gets periodically emptied.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new({cacheDir = "cache"})
+ local input = "Hello *world*!"
+ tex.sprint(convert(input)) }
+\bye
+```````
+Create an empty directory named `cache` next to our text document. Then, invoke
+LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!” Several cache files of the Markdown package will also be
+produced in the `cache` directory as we requested using the `cacheDir` option.
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input hello
+\bye
+```````
+Using a text editor, create a text document named `hello.md` with the
+following content:
+``` md
+Hello *world*!
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!” A directory named `cache` containing several cache files of
+the Markdown package will also be produced as we requested using the `cacheDir`
+option.
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionCacheDir{cache}
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” A directory named `cache` containing several cache files of the
+Markdown package will also be produced as we requested using the `cacheDir`
+option.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[cacheDir=cache]{markdown}
+\begin{document}
+\begin{markdown}
+Hello *world*!
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” A directory named `cache` containing several cache files of the
+Markdown package will also be produced as we requested using the `cacheDir`
+option.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionCacheDir{cache}
+\starttext
+\startmarkdown
+Hello *world*!
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” A directory named `cache` containing several cache files of the
+Markdown package will also be produced as we requested using the `cacheDir`
+option.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.cacheDir = "."
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+% \fi
+% \begin{markdown}
+%
+%### Parser Options
+%
+% \end{markdown}
+% \par
+% \iffalse
+
+#### Option `blankBeforeBlockquote`
+
+`blankBeforeBlockquote` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+% \Optitem[false]{blankBeforeBlockquote}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Require a blank line between a paragraph and the following blockquote.
+
+ false
+
+ : Do not require a blank line between a paragraph and the following
+ blockquote.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local newline = [[^^J^^J]]
+ local convert, input
+
+ convert = markdown.new()
+ input = "A paragraph." .. newline ..
+ "> A quote." .. newline
+ tex.sprint(convert(input))
+
+ convert = markdown.new({blankBeforeBlockquote = true})
+ input = "A paragraph." .. newline ..
+ "> Not a quote." .. newline
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> > A quote.
+>
+> A paragraph > Not a quote.
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` md
+A paragraph.
+> A quote?
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> > A quote?
+>
+> A paragraph. > A quote?
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+
+\markdownBegin
+A paragraph.
+> A quote.
+\markdownEnd
+
+\def\markdownOptionBlankBeforeBlockquote{true}
+\markdownBegin
+A paragraph.
+> Not a quote.
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> > A quote.
+>
+> A paragraph > Not a quote.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+A paragraph.
+> A quote.
+\end{markdown}
+
+\begin{markdown*}{blankBeforeBlockquote}
+A paragraph.
+> Not a quote.
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> > A quote.
+>
+> A paragraph > Not a quote.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+A paragraph.
+> A quote.
+\stopmarkdown
+
+\def\markdownOptionBlankBeforeBlockquote{true}
+\startmarkdown
+A paragraph.
+> Not a quote.
+\stopmarkdown
+
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> > A quote.
+>
+> A paragraph > Not a quote.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.blankBeforeBlockquote = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `blankBeforeCodeFence`
+
+`blankBeforeCodeFence` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{blankBeforeCodeFence}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Require a blank line between a paragraph and the following fenced code
+ block.
+
+ false
+
+ : Do not require a blank line between a paragraph and the following
+ fenced code block.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local newline = [[^^J^^J]]
+ local convert, input
+
+ convert = markdown.new({fencedCode = true})
+ input = "A paragraph." .. newline ..
+ "```" .. newline ..
+ "A code fence." .. newline ..
+ "```" .. newline
+ tex.sprint(convert(input))
+
+ convert = markdown.new({
+ fencedCode = true, blankBeforeCodeFence = true})
+ input = "A paragraph." .. newline ..
+ "```" .. newline ..
+ "Not a code fence." .. newline ..
+ "```" .. newline
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> ```
+> A code fence.
+> ```
+>
+> A paragraph. ``` Not a code fence. ```
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+```` md
+A paragraph.
+```
+A code fence?
+```
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> ```
+> A code fence?
+> ```
+>
+> A paragraph. ``` A code fence? ```
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\input markdown
+\def\markdownOptionFencedCode{true}
+
+\markdownBegin
+A paragraph.
+```
+A code fence.
+```
+\markdownEnd
+
+\def\markdownOptionBlankBeforeCodeFence{true}
+\markdownBegin
+A paragraph.
+```
+Not a code fence.
+```
+\markdownEnd
+
+\bye
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> ```
+> A code fence.
+> ```
+>
+> A paragraph. ``` Not a code fence. ```
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\documentclass{article}
+\usepackage[fencedCode]{markdown}
+\begin{document}
+
+\begin{markdown}
+A paragraph.
+```
+A code fence.
+```
+\end{markdown}
+
+\begin{markdown*}{blankBeforeCodeFence}
+A paragraph.
+```
+Not a code fence.
+```
+\end{markdown*}
+
+\end{document}
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> ```
+> A code fence.
+> ```
+>
+> A paragraph. ``` Not a code fence. ```
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\usemodule[t][markdown]
+\def\markdownOptionFencedCode{true}
+\starttext
+
+\startmarkdown
+A paragraph.
+```
+A code fence.
+```
+\stopmarkdown
+
+\def\markdownOptionBlankBeforeCodeFence{true}
+\startmarkdown
+A paragraph.
+```
+Not a code fence.
+```
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> ```
+> A code fence.
+> ```
+>
+> A paragraph. ``` Not a code fence. ```
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.blankBeforeCodeFence = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `blankBeforeHeading`
+
+`blankBeforeHeading` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{blankBeforeHeading}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Require a blank line between a paragraph and the following header.
+
+ false
+
+ : Do not require a blank line between a paragraph and the following
+ header.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\def\markdownRendererHeadingOne#1{{\bf #1}\par}
+\directlua{
+ local markdown = require("markdown")
+ local newline = [[^^J^^J]]
+ local convert, input
+
+ convert = markdown.new()
+ input = "A paragraph." .. newline ..
+ "A heading." .. newline ..
+ "==========" .. newline
+ tex.sprint(convert(input))
+
+ convert = markdown.new({blankBeforeHeading = true})
+ input = "A paragraph." .. newline ..
+ "Not a heading." .. newline ..
+ "==============" .. newline
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> A heading.
+> ==========
+>
+> A paragraph. Not a heading. ==============
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` md
+A paragraph.
+A heading?
+==========
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> A heading?
+> ==========
+>
+> A paragraph. A heading? ==========
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+
+\markdownBegin
+A paragraph.
+A heading.
+==========
+\markdownEnd
+
+\def\markdownOptionBlankBeforeHeading{true}
+\markdownBegin
+A paragraph.
+Not a heading.
+==============
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> A heading.
+> ==========
+>
+> A paragraph. Not a heading. ==============
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+A paragraph.
+A heading.
+==========
+\end{markdown}
+
+\begin{markdown*}{blankBeforeHeading}
+A paragraph.
+Not a heading.
+==============
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> A heading.
+> ==========
+>
+> A paragraph. Not a heading. ==============
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+A paragraph.
+A heading.
+==========
+\stopmarkdown
+
+\def\markdownOptionBlankBeforeHeading{true}
+\startmarkdown
+A paragraph.
+Not a heading.
+==============
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> A heading.
+> ==========
+>
+> A paragraph. Not a heading. ==============
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.blankBeforeHeading = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `breakableBlockquotes`
+
+`breakableBlockquotes` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{breakableBlockquotes}{\opt{true}, \opt{false}}
+%
+: true
+
+ : A blank line separates block quotes.
+
+ false
+
+ : Blank lines in the middle of a block quote are ignored.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\def\markdownRendererHeadingOne#1{{\bf #1}\par}
+\directlua{
+ local markdown = require("markdown")
+ local newline = [[^^J^^J]]
+ local convert, input
+
+ convert = markdown.new()
+ input = "> A single" .. newline .. newline ..
+ "> block quote." .. newline
+ tex.sprint(convert(input))
+
+ convert = markdown.new({breakableBlockquotes = true})
+ input = "> A block quote." .. newline .. newline ..
+ "> Another block quote." .. newline
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> > A single block quote.
+>
+> > A block quote.
+>
+> > Another block quote.
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` md
+> A single block quote
+
+> or two block quotes?
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> > A single block quote or two block quotes?
+>
+> > A single block quote
+>
+> > or two block quotes?
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+
+\markdownBegin
+> A single
+
+> block quote.
+\markdownEnd
+
+\def\markdownOptionBreakableBlockquotes{true}
+\markdownBegin
+> A block quote.
+
+> Another block quote.
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> > A single block quote.
+>
+> > A block quote.
+>
+> > Another block quote.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+> A single
+
+> block quote.
+\end{markdown}
+
+\begin{markdown*}{breakableBlockquotes}
+> A block quote.
+
+> Another block quote.
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> > A single block quote.
+>
+> > A block quote.
+>
+> > Another block quote.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+> A single
+
+> block quote.
+\stopmarkdown
+
+\def\markdownOptionBreakableBlockquotes{true}
+\startmarkdown
+> A block quote.
+
+> Another block quote.
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> > A single block quote.
+>
+> > A block quote.
+>
+> > Another block quote.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.breakableBlockquotes = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `citationNbsps`
+
+`citationNbsps` (default value: `true`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{citationNbsps}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Replace regular spaces with non-breakable spaces inside the prenotes
+ and postnotes of citations produced via the pandoc citation syntax
+ extension.
+
+ false
+
+ : Do not replace regular spaces with non-breakable spaces inside the
+ prenotes and postnotes of citations produced via the pandoc citation
+ syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.bib` with the
+following content:
+``` bib
+@book{knuth:tex,
+ author = "Knuth, Donald Ervin",
+ title = "The \TeX book, volume A of Computers and typesetting",
+ publisher = "Addison-Wesley",
+ year = "1984"
+}
+```````
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[citations]{markdown}
+\begin{document}
+
+\begin{markdown}
+The TeXbook [@knuth:tex, p. 123 and 130] is good.
+\end{markdown}
+
+\begin{markdown*}{citationNbsps = false}
+The TeXbook [@knuth:tex, p. 123 and 130] is good.
+\end{markdown*}
+
+\bibliographystyle{plain}
+\bibliography{document.bib}
+\end{document}
+```````
+Next, invoke LuaTeX and BibTeX from the terminal:
+``` sh
+lualatex document.tex
+bibtex document.aux
+lualatex document.tex
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text, where the middot (`·`) denotes a non-breakable space:
+
+> The TeXbook [1, p.·123·and·130] is good.
+>
+> The TeXbook [1, p. 123 and 130] is good.
+>
+> ### References
+> [1] Donald·Ervin Knuth. _The TeXbook, volume A of Computers and typesetting._
+> Addison-Wesley, 1984.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.citationNbsps = true
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `citations`
+
+`citations` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{citations}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the pandoc citation syntax extension:
+
+ ``` md
+ Here is a simple parenthetical citation [@doe99] and here
+ is a string of several [see @doe99, pp. 33-35; also
+ @smith04, chap. 1].
+
+ A parenthetical citation can have a [prenote @doe99] and
+ a [@smith04 postnote]. The name of the author can be
+ suppressed by inserting a dash before the name of an
+ author as follows [-@smith04].
+
+ Here is a simple text citation @doe99 and here is
+ a string of several @doe99 [pp. 33-35; also @smith04,
+ chap. 1]. Here is one with the name of the author
+ suppressed -@doe99.
+ ``````
+
+: false
+
+ : Disable the pandoc citation syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.bib` with the
+following content:
+``` bib
+@book{knuth:tex,
+ author = "Knuth, Donald Ervin",
+ title = "The \TeX book, volume A of Computers and typesetting",
+ publisher = "Addison-Wesley",
+ year = "1984"
+}
+```````
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[backend=biber]{biblatex}
+\addbibresource{document.bib}
+\usepackage[citations]{markdown}
+\begin{document}
+
+\begin{markdown}
+The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.
+\end{markdown}
+
+\printbibliography
+\end{document}
+```````
+Next, invoke LuaTeX and Biber from the terminal:
+``` sh
+lualatex document.tex
+biber document.bcf
+lualatex document.tex
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The TeXbook [1, p.·123 and 130] was written by Knuth [1].
+>
+> ### References
+> [1] Donald Ervin Knuth. _The \TeX{}book, volume A of Computers and typesetting._
+> Addison-Wesley, 1984.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.citations = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `codeSpans`
+
+`codeSpans` (default value: `true`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[true]{codeSpans}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the code span syntax:
+
+ ~~~ md
+ Use the `printf()` function.
+ ``There is a literal backtick (`) here.``
+ ~~~
+
+: false
+
+ : Disable the code span syntax. This allows you to easily
+ use the quotation mark ligatures in texts that do not contain code
+ spans:
+
+ ~~~
+ ``This is a quote.''
+ ~~~~~~
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new()
+ local input =
+ "``This is a code span.'' " ..
+ "``This is no longer a code span.''"
+ tex.sprint(convert(input)) }
+\par
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new({codeSpans = false})
+ local input =
+ "``This is a quote.'' " ..
+ "``This is another quote.''"
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ``This is a code span.'' ``This is no longer a code span.''
+>
+> “This is a quote.” “This is another quote.”
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+\par
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` md
+``Is this a code span?'' ``Or a quote?''
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> “Is this a code span?” “Or a quote?”
+>
+> ``Is this a code span?'' ``Or a quote?''
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+
+\markdownBegin
+``This is a code span.''
+``This is no longer a code span.''
+\markdownEnd
+
+\def\markdownOptionCodeSpans{false}
+\markdownBegin
+``This is a quote.''
+``This is another quote.''
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ``This is a code span.'' ``This is no longer a code span.''
+>
+> “This is a quote.” “This is another quote.”
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+``This is a code span.''
+``This is no longer a code span.''
+\end{markdown}
+
+\begin{markdown*}{codeSpans=false}
+``This is a quote.''
+``This is another quote.''
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ``This is a code span.'' ``This is no longer a code span.''
+>
+> “This is a quote.” “This is another quote.”
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+``This is a code span.''
+``This is no longer a code span.''
+\stopmarkdown
+
+\def\markdownOptionCodeSpans{false}
+\startmarkdown
+``This is a quote.''
+``This is another quote.''
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ``This is a code span.'' ``This is no longer a code span.''
+>
+> “This is a quote.” “This is another quote.”
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.codeSpans = true
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `contentBlocks`
+
+`contentBlocks` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{contentBlocks}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the
+% iA\,Writer content blocks syntax extension~[@sotkov17]:
+% \iffalse
+ iA\,Writer content blocks syntax extension:
+% \fi
+
+ ``` md
+ http://example.com/minard.jpg (Napoleon's
+ disastrous Russian campaign of 1812)
+ /Flowchart.png "Engineering Flowchart"
+ /Savings Account.csv 'Recent Transactions'
+ /Example.swift
+ /Lorem Ipsum.txt
+ ``````
+
+: false
+
+ : Disable the
+ iA\,Writer content blocks syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `table.csv` with the
+following content:
+``` csv
+Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847
+```````
+Create also a text document named `markdown-languages.json` with the following
+content:
+``` js
+{
+ "tex": "LaTeX"
+}
+``````
+Create also a text document named `code.tex` with the following content:
+``` tex
+This is an example code listing in \LaTeX.
+```````
+Create also a text document named `part.md` with the following content:
+``` md
+This is a *transcluded markdown document*.
+``````
+Create also a text document named `document.tex` with the following content:
+``` tex
+\documentclass{article}
+\usepackage{minted}
+\usepackage[contentBlocks]{markdown}
+\begin{document}
+\begin{markdown}
+/table.csv (An example table)
+/code.tex (An example code listing)
+/part.md (A file transclusion example)
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Name | Surname | Born |
+> | ------ | ---------| ---- |
+> | Albert | Einstein | 1879 |
+> | Marie | Curie | 1867 |
+> | Thomas | Edison | 1847 |
+>
+> Table 1: An example table
+>
+> ``` tex
+> This is an example code listing in \LaTeX.
+> ```````
+>
+> This is a *transcluded markdown document*.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `table.csv` with the
+following content:
+``` csv
+Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847
+```````
+Create also a text document named `markdown-languages.json` with the following
+content:
+``` js
+{
+ "tex": "ConTeXt"
+}
+``````
+Create also a text document named `code.tex` with the following content:
+``` tex
+This is an example code listing in \ConTeXt.
+```````
+Create also a text document named `part.md` with the following content:
+``` md
+This is a *transcluded markdown document*.
+``````
+Create also a text document named `document.tex` with the following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionContentBlocks{true}
+\definetyping [ConTeXt]
+\setuptyping [ConTeXt] [option=TEX]
+\starttext
+\startmarkdown
+/table.csv (An example table)
+/code.tex (An example code listing)
+/part.md (A file transclusion example)
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Name | Surname | Born |
+> | ------ | ---------| ---- |
+> | Albert | Einstein | 1879 |
+> | Marie | Curie | 1867 |
+> | Thomas | Edison | 1847 |
+>
+> Table 1: An example table
+>
+> ``` tex
+> This is an example code listing in \ConTeXt.
+> ```````
+>
+> This is a *transcluded markdown document*.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.contentBlocks = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `contentBlocksLanguageMap`
+
+`contentBlocksLanguageMap` (default value: `"markdown-languages.json"`)
+
+% \fi
+% \begin{markdown}
+%
+% \Valitem[markdown-languages.json]{contentBlocksLanguageMap}{filename}
+%
+: The filename of the JSON file that maps filename extensions to
+ programming language names in the iA\,Writer content blocks.
+% See Section~\ref{sec:texcontentblockrenderers} for more information.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `table.csv` with the
+following content:
+``` csv
+Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847
+```````
+Create also a text document named `language-map.json` with the following
+content:
+``` js
+{
+ "tex": "LaTeX"
+}
+``````
+Create also a text document named `code.tex` with the following content:
+``` tex
+This is an example code listing in \LaTeX.
+```````
+Create also a text document named `part.md` with the following content:
+``` md
+This is a *transcluded markdown document*.
+``````
+Create also a text document named `document.tex` with the following content:
+``` tex
+\documentclass{article}
+\usepackage{minted}
+\usepackage[contentBlocks]{markdown}
+\markdownSetup{
+ contentBlocksLanguageMap = {language-map.json},
+}
+\begin{document}
+\begin{markdown}
+/table.csv (An example table)
+/code.tex (An example code listing)
+/part.md (A file transclusion example)
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Name | Surname | Born |
+> | ------ | ---------| ---- |
+> | Albert | Einstein | 1879 |
+> | Marie | Curie | 1867 |
+> | Thomas | Edison | 1847 |
+>
+> Table 1: An example table
+>
+> ``` tex
+> This is an example code listing in \LaTeX.
+> ```````
+>
+> This is a *transcluded markdown document*.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `table.csv` with the
+following content:
+``` csv
+Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847
+```````
+Create also a text document named `language-map.json` with the following
+content:
+``` js
+{
+ "tex": "ConTeXt"
+}
+``````
+Create also a text document named `code.tex` with the following content:
+``` tex
+This is an example code listing in \ConTeXt.
+```````
+Create also a text document named `part.md` with the following content:
+``` md
+This is a *transcluded markdown document*.
+``````
+Create also a text document named `document.tex` with the following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionContentBlocksLanguageMap{language-map.json}
+\definetyping [ConTeXt]
+\setuptyping [ConTeXt] [option=TEX]
+\starttext
+\startmarkdown
+/table.csv (An example table)
+/code.tex (An example code listing)
+/part.md (A file transclusion example)
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Name | Surname | Born |
+> | ------ | ---------| ---- |
+> | Albert | Einstein | 1879 |
+> | Marie | Curie | 1867 |
+> | Thomas | Edison | 1847 |
+>
+> Table 1: An example table
+>
+> ``` tex
+> This is an example code listing in \ConTeXt.
+> ```````
+>
+> This is a *transcluded markdown document*.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.contentBlocksLanguageMap = "markdown-languages.json"
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `definitionLists`
+
+`definitionLists` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{definitionLists}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the pandoc definition list syntax extension:
+
+ ``` md
+ Term 1
+
+ : Definition 1
+
+ Term 2 with *inline markup*
+
+ : Definition 2
+
+ { some code, part of Definition 2 }
+
+ Third paragraph of definition 2.
+ `````
+
+: false
+
+ : Disable the pandoc definition list syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[definitionLists]{markdown}
+\begin{document}
+\begin{markdown}
+Term 1
+
+: Definition 1
+
+Term 2 with *inline markup*
+
+: Definition 2
+
+ { some code, part of Definition 2 }
+
+ Third paragraph of definition 2.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Term 1
+>
+> : Definition 1
+>
+> Term 2 with *inline markup*
+>
+> : Definition 2
+>
+> { some code, part of Definition 2 }
+>
+> Third paragraph of definition 2.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionDefinitionLists{true}
+\starttext
+\startmarkdown
+Term 1
+
+: Definition 1
+
+Term 2 with *inline markup*
+
+: Definition 2
+
+ { some code, part of Definition 2 }
+
+ Third paragraph of definition 2.
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Term 1
+>
+> : Definition 1
+>
+> Term 2 with *inline markup*
+>
+> : Definition 2
+>
+> { some code, part of Definition 2 }
+>
+> Third paragraph of definition 2.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.definitionLists = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `fencedCode`
+
+`fencedCode` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{fencedCode}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the commonmark fenced code block extension:
+
+ ~~~~~~~~ md
+ ~~~ js
+ if (a > 3) {
+ moveShip(5 * gravity, DOWN);
+ }
+ ~~~~~~
+
+ ``` html
+ <pre>
+ <code>
+ // Some comments
+ line 1 of code
+ line 2 of code
+ line 3 of code
+ </code>
+ </pre>
+ ```
+ ~~~~~~~~~~~
+
+: false
+
+ : Disable the commonmark fenced code block extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\documentclass{article}
+\usepackage{minted}
+\usepackage[fencedCode]{markdown}
+\begin{document}
+\begin{markdown}
+~~~ js
+if (a > 3) {
+ moveShip(5 * gravity, DOWN);
+}
+~~~~~~
+
+ ``` html
+ <pre>
+ <code>
+ // Some comments
+ line 1 of code
+ line 2 of code
+ line 3 of code
+ </code>
+ </pre>
+ ```
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ~~~ js
+> if (a > 3) {
+> moveShip(5 * gravity, DOWN);
+> }
+> ~~~~~~
+>
+> ``` html
+> <pre>
+> <code>
+> // Some comments
+> line 1 of code
+> line 2 of code
+> line 3 of code
+> </code>
+> </pre>
+> ```
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\usemodule[t][markdown]
+\def\markdownOptionFencedCode{true}
+\definetyping [js]
+\definetyping [html]
+\setuptyping [html] [option=XML]
+\starttext
+\startmarkdown
+~~~ js
+if (a > 3) {
+ moveShip(5 * gravity, DOWN);
+}
+~~~~~~
+
+ ``` html
+ <pre>
+ <code>
+ // Some comments
+ line 1 of code
+ line 2 of code
+ line 3 of code
+ </code>
+ </pre>
+ ```
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ~~~ js
+> if (a > 3) {
+> moveShip(5 * gravity, DOWN);
+> }
+> ~~~~~~
+>
+> ``` html
+> <pre>
+> <code>
+> // Some comments
+> line 1 of code
+> line 2 of code
+> line 3 of code
+> </code>
+> </pre>
+> ```
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.fencedCode = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `footnotes`
+
+`footnotes` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{footnotes}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the pandoc footnote syntax extension:
+
+ ``` md
+ Here is a footnote reference,[^1] and another.[^longnote]
+
+ [^1]: Here is the footnote.
+
+ [^longnote]: Here'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't be part of the note, because it
+ isn't indented.
+ ``````
+
+: false
+
+ : Disable the pandoc footnote syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[footnotes]{markdown}
+\begin{document}
+\begin{markdown}
+Here is a footnote reference,[^1] and another.[^longnote]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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't be part of the note, because it
+isn't indented.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is a footnote reference,[^1] and another.[^longnote]
+>
+> [^1]: Here is the footnote.
+>
+> [^longnote]: Here'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't be part of the note, because it
+> isn't indented.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionFootnotes{true}
+\starttext
+\startmarkdown
+Here is a footnote reference,[^1] and another.[^longnote]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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't be part of the note, because it
+isn't indented.
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is a footnote reference,[^1] and another.[^longnote]
+>
+> [^1]: Here is the footnote.
+>
+> [^longnote]: Here'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't be part of the note, because it
+> isn't indented.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.footnotes = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `hashEnumerators`
+
+`hashEnumerators` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{hashEnumerators}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the use of hash symbols (`#`) as ordered item list
+ markers:
+
+ ``` md
+ #. Bird
+ #. McHale
+ #. Parish
+ ``````
+
+: false
+
+ : Disable the use of hash symbols (`#`) as ordered item list
+ markers.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+. Bird
+. McHale
+. Parish
+\end{markdown}
+
+\begin{markdown*}{hashEnumerators}
+. Bird
+. McHale
+. Parish
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> . Bird
+> ========
+> . McHale
+> ========
+> . Parish
+> ========
+>
+> #. Bird
+> #. McHale
+> #. Parish
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+. Bird
+. McHale
+. Parish
+\stopmarkdown
+
+\def\markdownOptionHashEnumerators{true}
+\startmarkdown
+. Bird
+. McHale
+. Parish
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> . Bird
+> ========
+> . McHale
+> ========
+> . Parish
+> ========
+>
+> #. Bird
+> #. McHale
+> #. Parish
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.hashEnumerators = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `headerAttributes` {#header-attributes}
+
+`headerAttributes` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{headerAttributes}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the assignment of HTML attributes to headings:
+
+ ``` md
+ # My first heading {#foo}
+
+ ## My second heading ## {#bar .baz}
+
+ Yet another heading {key=value}
+ ===================
+ ``````
+
+ These HTML attributes have currently no effect other than enabling
+% content slicing, see the \Opt{slice} option.
+% \iffalse
+ [content slicing](#slice).
+% \fi
+
+: false
+
+ : Disable the assignment of HTML attributes to headings.
+
+% \end{markdown}
+% \iffalse
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.headerAttributes = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `html`
+
+`html` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{html}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the recognition of HTML tags, block elements, comments, HTML
+ instructions, and entities in the input. Tags, block elements (along
+ with contents), HTML instructions, and comments will be ignored and
+ HTML entities will be replaced with the corresponding Unicode
+ codepoints.
+
+: false
+
+ : Disable the recognition of HTML markup. Any HTML markup in the input
+ will be rendered as plain text.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new()
+ local newline = [[^^J^^J]]
+ local input =
+ "<div>*There is no block tag support.*</div>" .. newline ..
+ "*There is no <inline tag="tag"></inline> support.*" .. newline ..
+ "_There is no <!-- comment --> support._" .. newline ..
+ "_There is no <? HTML instruction ?> support._"
+ tex.sprint(convert(input)) }
+\par
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new({html = true})
+ local input =
+ "<div>*There is block tag support.*</div>" .. newline ..
+ "*There is <inline tag="tag"></inline> support.*" .. newline ..
+ "_There is <!-- comment --> support._" .. newline ..
+ "_There is <? HTML instruction ?> support._"
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \<div>There is no block tag support.\</div>
+> There is no \<inline tag=”tag”>\</inline> support.
+> There is no \<!-- comment --> support.
+> There is no <? HTML instruction ?> support.
+>
+> There is support. There is support. There is support.
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+\par
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` html
+<div>
+*Is there block tag support?*
+</div>
+*Is there <inline tag="tag"></inline> support?*
+_Is there <!-- comment --> support?_
+_Is there <? HTML instruction ?> support?_
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \<div>Is there block tag support?\</div>
+> Is there \<inline tag=”tag”>\</inline> support?
+> Is there \<!-- comment --> support?
+> Is there <? HTML instruction ?> support?
+>
+> Is there support? Is there support? Is there support?
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+
+\markdownBegin
+<div>
+*There is no block tag support.*
+</div>
+*There is no <inline tag="tag"></inline> support.*
+_There is no <!-- comment --> support._
+_There is no <? HTML instruction ?> support._
+\markdownEnd
+
+\def\markdownOptionHtml{true}
+\markdownBegin
+<div>
+*There is block tag support.*
+</div>
+*There is <inline tag="tag"></inline> support.*
+_There is <!-- comment --> support._
+_There is <? HTML instruction ?> support._
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \<div>There is no block tag support.\</div>
+> There is no \<inline tag=”tag”>\</inline> support.
+> There is no \<!-- comment --> support.
+> There is no <? HTML instruction ?> support.
+>
+> There is support. There is support. There is support.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+<div>
+*There is no block tag support.*
+</div>
+*There is no <inline tag="tag"></inline> support.*
+_There is no <!-- comment --> support._
+_There is no <? HTML instruction ?> support._
+\end{markdown}
+
+\begin{markdown*}{html}
+<div>
+*There is block tag support.*
+</div>
+*There is <inline tag="tag"></inline> support.*
+_There is <!-- comment --> support._
+_There is <? HTML instruction ?> support._
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \<div>There is no block tag support.\</div>
+> There is no \<inline tag=”tag”>\</inline> support.
+> There is no \<!-- comment --> support.
+> There is no <? HTML instruction ?> support.
+>
+> There is support. There is support. There is support.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+<div>
+*There is no block tag support.*
+</div>
+*There is no <inline tag="tag"></inline> support.*
+_There is no <!-- comment --> support._
+_There is no <? HTML instruction ?> support._
+\stopmarkdown
+
+\def\markdownOptionHtml{true}
+\startmarkdown
+<div>
+*There is block tag support.*
+</div>
+*There is <inline tag="tag"></inline> support.*
+_There is <!-- comment --> support._
+_There is <? HTML instruction ?> support._
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \<div>There is no block tag support.\</div>
+> There is no \<inline tag=”tag”>\</inline> support.
+> There is no \<!-- comment --> support.
+> There is no <? HTML instruction ?> support.
+>
+> There is support. There is support. There is support.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.html = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `hybrid`
+
+`hybrid` (default value: `true`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{hybrid}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Disable the escaping of special plain \TeX{} characters, which makes it
+ possible to intersperse your markdown markup with \TeX{} code. The
+ intended usage is in documents prepared manually by a human author.
+ In such documents, it can often be desirable to mix \TeX{} and markdown
+ markup freely.
+
+: false
+
+ : Enable the escaping of special plain \TeX{} characters outside verbatim
+ environments, so that they are not interpretted by \TeX{}. This is
+ encouraged when typesetting automatically generated content or
+ markdown documents that were not prepared with this package in mind.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local input, convert_safe, convert_unsafe, paragraph
+
+ input = [[$\string\sqrt{-1}$ *equals* $i$.]]
+ convert_safe = markdown.new()
+ convert_unsafe = markdown.new({hybrid = true})
+ paragraph = [[\par]]
+
+ tex.sprint(
+ convert_safe(input) .. paragraph ..
+ convert_unsafe(input)
+ )
+}
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt {-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+\input optionfalse
+
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` md
+$\sqrt{-1}$ *equals* $i$.
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt {-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt {-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+$\sqrt{-1}$ *equals* $i$.
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$.
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt {-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\def\markdownOptionHybrid{true}
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt {-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.hybrid = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `inlineFootnotes`
+
+`inlineFootnotes` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{inlineFootnotes}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the pandoc inline footnote syntax extension:
+
+ ``` md
+ Here is an inline note.^[Inlines notes are easier to
+ write, since you don't have to pick an identifier and
+ move down to type the note.]
+ ``````
+
+: false
+
+ : Disable the pandoc inline footnote syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[footnotes, inlineFootnotes]{markdown}
+\begin{document}
+\begin{markdown}
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is an inline note.^[Inlines notes are easier to
+> write, since you don't have to pick an identifier and
+> move down to type the note.]
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\starttext
+\startmarkdown
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is an inline note.^[Inlines notes are easier to
+> write, since you don't have to pick an identifier and
+> move down to type the note.]
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.inlineFootnotes = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `pipeTables` {#pipe-tables}
+
+`pipeTables` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{pipeTables}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the \acro{PHP} Markdown table syntax extension:
+
+ ``` md
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |
+ ``````
+
+: false
+
+ : Disable the \acro{PHP} Markdown table syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[pipeTables]{markdown}
+\begin{document}
+\begin{markdown}
+| Right | Left | Default | Center |
+|------:|:-----|---------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Right | Left | Default | Center |
+> |------:|:-----|---------|:------:|
+> | 12 | 12 | 12 | 12 |
+> | 123 | 123 | 123 | 123 |
+> | 1 | 1 | 1 | 1 |
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionPipeTables{true}
+\starttext
+\startmarkdown
+| Right | Left | Default | Center |
+|------:|:-----|---------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Right | Left | Default | Center |
+> |------:|:-----|---------|:------:|
+> | 12 | 12 | 12 | 12 |
+> | 123 | 123 | 123 | 123 |
+> | 1 | 1 | 1 | 1 |
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.pipeTables = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `preserveTabs`
+
+`preserveTabs` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{preserveTabs}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Preserve tabs in code block and fenced code blocks.
+
+: false
+
+ : Convert any tabs in the input to spaces.
+
+% \end{markdown}
+% \iffalse
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.preserveTabs = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `shiftHeadings`
+
+`shiftHeadings` (default value: `0`)
+
+% \fi
+% \begin{markdown}
+%
+% \Valitem[0]{shiftHeadings}{shift amount}
+%
+: All headings will be shifted by \meta{shift amount}, which can be both
+ positive and negative. Headings will not be shifted beyond level 6 or
+ below level 1. Instead, those headings will be shifted to level 6, when
+ \meta{shift amount} is positive, and to level 1, when \meta{shift amount}
+ is negative.
+
+% \end{markdown}
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `example.md` with the
+following content:
+
+``` md
+## A section
+```
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+
+\font\normal=cmr10\normal
+\font\big=cmr10 at 12pt
+\def\markdownRendererHeadingTwo#1{{\big #1\par}}
+\font\bigger=cmr10 scaled 1440
+\def\markdownRendererHeadingOne#1{{\bigger #1\par}}
+
+\def\markdownOptionShiftHeadings{-1}
+\markdownInput{example.md}
+
+\def\markdownOptionShiftHeadings{0}
+\markdownInput{example.md}
+
+\def\markdownOptionShiftHeadings{+1}
+\markdownInput{example.md}
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # A section
+> ## A section
+> ### A section
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\usepackage{filecontents}
+\begin{filecontents*}{example.md}
+## A section
+\end{filecontents*}
+\begin{document}
+\markdownInput[shiftHeadings=-1]{example.md}
+\markdownInput{example.md}
+\markdownInput[shiftHeadings=+1]{example.md}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # A section
+> ## A section
+> ### A section
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `example.md` with the
+following content:
+
+``` md
+## A section
+```
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\def\markdownOptionShiftHeadings{-1}
+\markdownInput{example.md}
+
+\def\markdownOptionShiftHeadings{0}
+\markdownInput{example.md}
+
+\def\markdownOptionShiftHeadings{+1}
+\markdownInput{example.md}
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # A section
+> ## A section
+> ### A section
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.shiftHeadings = 0
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `slice` {#slice}
+
+`slice` (default value: `^ $`)
+
+% \fi
+% \begin{markdown}
+%
+% \Valitem[\textasciicircum{} \$]{slice}{the beginning and the end of a slice}
+%
+: Two space-separated selectors that specify the slice of a document that
+ will be processed, whereas the remainder of the document will be ignored.
+ The following selectors are recognized:
+
+ - The circumflex (`^`) selects the beginning of a document.
+ - The dollar sign (`$`) selects the end of a document.
+ - `^`\meta{identifier} selects the beginning of a section with the
+% \acro{HTML} attribute `#`\meta{identifier} (see the
+% \Opt{headerAttributes} option).
+% \iffalse
+ [\acro{HTML} attribute](#header-attributes) `#`\meta{identifier}.
+% \fi
+ - `$`\meta{identifier} selects the end of a section with the \acro{HTML}
+ attribute `#`\meta{identifier}.
+ - \meta{identifier} corresponds to `^`\meta{identifier} for the first
+ selector and to `$`\meta{identifier} for the second selector.
+
+ Specifying only a single selector, \meta{identifier}, is equivalent
+ to specifying the two selectors \meta{identifier} \meta{identifier},
+ which is equivalent to `^`\meta{identifier} `$`\meta{identifier}, i.e.
+ the entire section with the \acro{HTML} attribute `#`\meta{identifier} will be
+ selected.
+
+% \end{markdown}
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `hamlet.md` with the
+following content:
+
+``` md
+# The Tragedy of Hamlet
+Shakespeare's longest play.
+
+## Act III {#act-3}
+Hamlet kills Polonius.
+
+## Act V {#act-5}
+Hamlet dies.
+
+## Act I {#act-1}
+Hamlet talks to ghost.
+```
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionHeaderAttributes{true}
+
+\font\normal=cmr10\normal
+\font\big=cmr10 at 12pt
+\def\markdownRendererHeadingTwo#1{{\big #1\par}}
+\font\bigger=cmr10 scaled 1440
+\def\markdownRendererHeadingOne#1{{\bigger #1\par}}
+
+\def\markdownOptionSlice{^ ^act-3}
+\markdownInput{hamlet.md}
+
+\def\markdownOptionSlice{act-1}
+\markdownInput{hamlet.md}
+
+\def\markdownOptionSlice{act-3 act-5}
+\markdownInput{hamlet.md}
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # The Tragedy of Hamlet
+> Shakespeare's longest play.
+>
+> ## Act I
+> Hamlet talks to ghost.
+>
+> ## Act III
+> Hamlet kills Polonius.
+>
+> ## Act V
+> Hamlet dies.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[headerAttributes]{markdown}
+\usepackage{filecontents}
+\begin{filecontents*}{hamlet.md}
+# The Tragedy of Hamlet
+Shakespeare's longest play.
+
+## Act III {#act-3}
+Hamlet kills Polonius.
+
+## Act V {#act-5}
+Hamlet dies.
+
+## Act I {#act-1}
+Hamlet talks to ghost.
+\end{filecontents*}
+\begin{document}
+\markdownInput[slice=^ ^act-3]{hamlet.md}
+\markdownInput[slice=act-1]{hamlet.md}
+\markdownInput[slice=act-3 act-5]{hamlet.md}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # The Tragedy of Hamlet
+> Shakespeare's longest play.
+>
+> ## Act I
+> Hamlet talks to ghost.
+>
+> ## Act III
+> Hamlet kills Polonius.
+>
+> ## Act V
+> Hamlet dies.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `hamlet.md` with the
+following content:
+
+``` md
+# The Tragedy of Hamlet
+Shakespeare's longest play.
+
+## Act III {#act-3}
+Hamlet kills Polonius.
+
+## Act V {#act-5}
+Hamlet dies.
+
+## Act I {#act-1}
+Hamlet talks to ghost.
+```
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionHeaderAttributes{true}
+\starttext
+
+\def\markdownOptionSlice{^ ^act-3}
+\markdownInput{hamlet.md}
+
+\def\markdownOptionSlice{act-1}
+\markdownInput{hamlet.md}
+
+\def\markdownOptionSlice{act-3 act-5}
+\markdownInput{hamlet.md}
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # The Tragedy of Hamlet
+> Shakespeare's longest play.
+>
+> ## Act I
+> Hamlet talks to ghost.
+>
+> ## Act III
+> Hamlet kills Polonius.
+>
+> ## Act V
+> Hamlet dies.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.slice = "^ $"
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+
+#### Option `smartEllipses`
+
+`smartEllipses` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{smartEllipses}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Convert any ellipses in the input to the
+ \m{markdownRendererEllipsis} \TeX{} macro.
+
+: false
+
+ : Preserve all ellipses in the input.
+
+% \end{markdown}
+% \iffalse
+
+##### Lua Module Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererEllipsis{. . .}
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new()
+ local input = "These are just three regular dots ..."
+ tex.sprint(convert(input)) }
+\par
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new({smartEllipses = true})
+ local input = "... and this is a victorian ellipsis."
+ tex.sprint(convert(input)) }
+\bye
+```````
+Then, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+```````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> These are just three regular dots ...
+>
+> . . . and this is a victorian ellipsis.
+
+##### Lua CLI Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererEllipsis{. . .}
+\input lmfonts
+\input optionfalse
+\par
+\input optiontrue
+\bye
+```````
+Using a text editor, create a text document named `content.md` with the
+following content:
+``` md
+Are these just three regular dots, a victorian ellipsis, or ... ?
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex
+luatex document.tex
+```````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Are these just three regular dots, a victorian ellipsis, or ... ?
+>
+> Are these just three regular dots, a victorian ellipsis, or . . . ?
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererEllipsis{. . .}
+
+\markdownBegin
+These are just three regular dots ...
+\markdownEnd
+
+\def\markdownOptionSmartEllipses{true}
+\markdownBegin
+... and this is a victorian ellipsis.
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> These are just three regular dots ...
+>
+> . . . and this is a victorian ellipsis.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ ellipsis = {. . .} }}
+\begin{document}
+
+\begin{markdown}
+These are just three regular dots ...
+\end{markdown}
+
+\begin{markdown*}{smartEllipses}
+... and this is a victorian ellipsis.
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> These are just three regular dots ...
+>
+> . . . and this is a victorian ellipsis.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererEllipsis{. . .}
+\starttext
+
+\startmarkdown
+These are just three regular dots ...
+\stopmarkdown
+
+\def\markdownOptionSmartEllipses{true}
+\startmarkdown
+... and this is a victorian ellipsis.
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> These are just three regular dots ...
+>
+> . . . and this is a victorian ellipsis.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.smartEllipses = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `startNumber`
+
+`startNumber` (default value: `true`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[true]{startNumber}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Make the number in the first item of an ordered lists significant. The
+ item numbers will be passed to the
+ \m{markdownRendererOlItemWithNumber} \TeX{} macro.
+
+: false
+
+ : Ignore the numbers in the ordered list items. Each item will only
+ produce a \m{markdownRendererOlItem} \TeX{} macro.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+The following list respects the numbers specified in the markup:
+
+3. third item
+4. fourth item
+5. fifth item
+\end{markdown}
+
+\begin{markdown*}{startNumber=false}
+The following list does not respect the numbers specified in the
+markup:
+
+3. third item
+4. fourth item
+5. fifth item
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The following list respects the numbers specified in the markup:
+>
+> 3. third item
+> 4. fourth item
+> 5. fifth item
+>
+> The following list does not respect the numbers specified in the markup:
+>
+> 1. third item
+> 2. fourth item
+> 3. fifth item
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+The following list respects the numbers specified in the markup:
+
+3. third item
+4. fourth item
+5. fifth item
+\stopmarkdown
+
+\def\markdownOptionStartNumber{false}
+\startmarkdown
+The following list respects the numbers specified in the markup:
+
+3. third item
+4. fourth item
+5. fifth item
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The following list respects the numbers specified in the markup:
+>
+> 3. third item
+> 4. fourth item
+> 5. fifth item
+>
+> The following list does not respect the numbers specified in the markup:
+>
+> 1. third item
+> 2. fourth item
+> 3. fifth item
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.startNumber = true
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `tableCaptions`
+
+`tableCaptions` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{tableCaptions}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the Pandoc `table_captions` syntax extension for
+% pipe tables (see the \Opt{pipeTables} option).
+% \iffalse
+ [pipe tables](#pipe-tables).
+% \fi
+
+ ``` md
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.
+ ``````
+
+: false
+
+ : Enable the Pandoc `table_captions` syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[pipeTables, tableCaptions]{markdown}
+\begin{document}
+\begin{markdown}
+| Right | Left | Default | Center |
+|------:|:-----|---------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Right | Left | Default | Center |
+> |------:|:-----|---------|:------:|
+> | 12 | 12 | 12 | 12 |
+> | 123 | 123 | 123 | 123 |
+> | 1 | 1 | 1 | 1 |
+>
+> : Demonstration of pipe table syntax.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionPipeTables{true}
+\def\markdownOptionTableCaptions{true}
+\starttext
+\startmarkdown
+| Right | Left | Default | Center |
+|------:|:-----|---------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> | Right | Left | Default | Center |
+> |------:|:-----|---------|:------:|
+> | 12 | 12 | 12 | 12 |
+> | 123 | 123 | 123 | 123 |
+> | 1 | 1 | 1 | 1 |
+>
+> : Demonstration of pipe table syntax.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.tableCaptions = false
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+
+#### Option `tightLists`
+
+`tightLists` (default value: `true`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[true]{tightLists}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Lists whose bullets do not consist of multiple paragraphs will be
+ passed to the
+ \m{markdownRendererOlBeginTight}, \m{markdownRendererOlEndTight},
+ \m{markdownRendererUlBeginTight}, \m{markdownRendererUlEndTight},
+ \m{markdownRendererDlBeginTight}, and
+ \m{markdownRendererDlEndTight} \TeX{} macros.
+
+: false
+
+ : Lists whose bullets do not consist of multiple paragraphs will be
+ treated the same way as lists that do consist of multiple paragraphs.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+The following list is tight:
+
+ - first item
+ - second item
+ - third item
+
+The following list is loose:
+
+ - first item
+ - second item that spans
+
+ multiple paragraphs
+ - third item
+\end{markdown}
+
+\begin{markdown*}{tightLists=false}
+The following list is now also loose:
+
+ - first item
+ - second item
+ - third item
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The following list is tight:
+>
+> - first item
+> - second item
+> - third item
+>
+> The following list is loose:
+>
+> - first item
+> - second item that spans
+>
+> multiple paragraphs
+> - third item
+>
+> The following list is now also loose:
+>
+> - first item
+>
+> - second item
+>
+> - third item
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.tightLists = true
+% \end{macrocode}
+% \par
+% \iffalse
+%</lua,lua-cli>
+%<*manual-options>
+
+#### Option `underscores`
+
+`underscores` (default value: `true`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[true]{underscores}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Both underscores and asterisks can be used to denote emphasis and
+ strong emphasis:
+
+ ``` md
+ *single asterisks*
+ _single underscores_
+ **double asterisks**
+ __double underscores__
+ ``````
+
+: false
+
+ : Only asterisks can be used to denote emphasis and strong emphasis.
+ This makes it easy to write math with the \Opt{hybrid} option
+ without the need to constantly escape subscripts.
+
+% \end{markdown}
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionHybrid{true}
+
+\markdownBegin
+This is _emphasized text_ and this is a math subscript: $m\_n$.
+\markdownEnd
+
+\def\markdownOptionUnderscores{false}
+\markdownBegin
+This is *emphasized text* and this is a math subscript: $m_n$.
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is _emphasized text_ and this is a math subscript: *mₙ*.
+>
+> This is _emphasized text_ and this is a math subscript: *mₙ*.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[hybrid]{markdown}
+\begin{document}
+
+\begin{markdown}
+This is _emphasized text_ and this is a math subscript: $m\_n$.
+\end{markdown}
+
+\begin{markdown*}{underscores=false}
+This is *emphasized text* and this is a math subscript: $m_n$.
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is _emphasized text_ and this is a math subscript: *mₙ*.
+>
+> This is _emphasized text_ and this is a math subscript: *mₙ*.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionHybrid{true}
+\starttext
+
+\startmarkdown
+This is _emphasized text_ and this is a math subscript: $m\_n$.
+\stopmarkdown
+
+\def\markdownOptionUnderscores{false}
+\startmarkdown
+This is *emphasized text* and this is a math subscript: $m_n$.
+\stopmarkdown
+
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is _emphasized text_ and this is a math subscript: *mₙ*.
+>
+> This is _emphasized text_ and this is a math subscript: *mₙ*.
+
+%</manual-options>
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.underscores = true
+% \end{macrocode}
+% \endgroup
+% \iffalse
+%</lua,lua-cli>
+%<*lua-cli>
+% \fi
+% \par
+% \begin{markdown}
+%
+%### Command-Line Interface
+% \label{sec:lua-cli-interface}
+% To provide finer control over the conversion and to simplify debugging, a
+% command-line Lua interface for converting a Markdown document to \TeX{} is
+% also provided.
+%
+% \end{markdown}
+% \begin{macrocode}
+
+HELP_STRING = [[
+Usage: texlua ]] .. arg[0] .. [[ [OPTIONS] -- [INPUT_FILE] [OUTPUT_FILE]
+where OPTIONS are documented in the Lua interface section of the
+technical Markdown package documentation.
+
+When OUTPUT_FILE is unspecified, the result of the conversion will be
+written to the standard output. When INPUT_FILE is also unspecified, the
+result of the conversion will be read from the standard input.
+
+Report bugs to: witiko@mail.muni.cz
+Markdown package home page: <https://github.com/witiko/markdown>]]
+
+VERSION_STRING = [[
+markdown-cli.lua (Markdown) ]] .. metadata.version .. [[
+
+Copyright (C) ]] .. table.concat(metadata.copyright,
+ "\nCopyright (C) ") .. [[
+
+License: ]] .. metadata.license
+
+local function warn(s)
+ io.stderr:write("Warning: " .. s .. "\n") end
+
+local function error(s)
+ io.stderr:write("Error: " .. s .. "\n")
+ os.exit(1) end
+
+local process_options = true
+local options = {}
+local input_filename
+local output_filename
+for i = 1, #arg do
+ if process_options then
+% \end{macrocode}
+% \begin{markdown}
+% After the optional `-`{}`-` argument has been specified, the remaining
+% arguments are assumed to be input and output filenames. This argument is
+% optional, but encouraged, because it helps resolve ambiguities when
+% deciding whether an option or a filename has been specified.
+% \end{markdown}
+% \begin{macrocode}
+ if arg[i] == "--" then
+ process_options = false
+ goto continue
+% \end{macrocode}
+% \begin{markdown}
+% Unless the `-`{}`-` argument has been specified before, an argument
+% containing the equals sign (`=`) is assumed to be an option specification in
+% a \meta{key}`=`\meta{value} format. The available options are listed in
+% Section~\ref{sec:luaoptions}.
+% \end{markdown}
+% \begin{macrocode}
+ elseif arg[i]:match("=") then
+ key, value = arg[i]:match("(.-)=(.*)")
+% \end{macrocode}
+% \begin{markdown}
+% The \luam{defaultOptions} table is consulted to identify whether \meta{value}
+% should be parsed as a string or as a boolean.
+% \end{markdown}
+% \begin{macrocode}
+ default_type = type(defaultOptions[key])
+ if default_type == "boolean" then
+ options[key] = (value == "true")
+ else
+ if default_type ~= "string" then
+ if default_type == "nil" then
+ warn('Option "' .. key .. '" not recognized.')
+ else
+ warn('Option "' .. key .. '" type not recognized, please file ' ..
+ 'a report to the package maintainer.')
+ end
+ warn('Parsing the ' .. 'value "' .. value ..'" of option "' ..
+ key .. '" as a string.')
+ end
+ options[key] = value
+ end
+ goto continue
+% \end{macrocode}
+% \begin{markdown}
+% Unless the `-`{}`-` argument has been specified before, an argument
+% `-`{}`-help`, or `-h` causes a brief documentation for how to invoke the
+% program to be printed to the standard output.
+% \end{markdown}
+% \begin{macrocode}
+ elseif arg[i] == "--help" or arg[i] == "-h" then
+ print(HELP_STRING)
+ os.exit()
+% \end{macrocode}
+% \begin{markdown}
+% Unless the `-`{}`-` argument has been specified before, an argument
+% `-`{}`-version`, or `-v` causes the program to print information about its
+% name, version, origin and legal status, all on standard output.
+% \end{markdown}
+% \begin{macrocode}
+ elseif arg[i] == "--version" or arg[i] == "-v" then
+ print(VERSION_STRING)
+ os.exit()
+ end
+ end
+% \end{macrocode}
+% \begin{markdown}
+% The first argument that matches none of the above patters is assumed to be
+% the input filename. The input filename should correspond to the Markdown
+% document that is going to be converted to a \TeX{} document.
+% \end{markdown}
+% \begin{macrocode}
+ if input_filename == nil then
+ input_filename = arg[i]
+% \end{macrocode}
+% \begin{markdown}
+% The first argument that matches none of the above patters is assumed to be
+% the output filename. The output filename should correspond to the \TeX{}
+% document that will result from the conversion.
+% \end{markdown}
+% \begin{macrocode}
+ elseif output_filename == nil then
+ output_filename = arg[i]
+ else
+ error('Unexpected argument: "' .. arg[i] .. '".')
+ end
+ ::continue::
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The command-line Lua interface is implemented by the `markdown-cli.lua`
+% file that can be invoked from the command line as follows:
+% ``` sh
+% texlua /path/to/markdown-cli.lua cacheDir=. -- hello.md hello.tex
+% ``````
+% \noindent to convert the Markdown document `hello.md` to a \TeX{} document
+% `hello.tex`. After the Markdown package for our \TeX{} format has been
+% loaded, the converted document can be typeset as follows:
+% ``` tex
+% \input hello
+% ```````
+%
+% This shows another advantage of using the command-line interface compared to
+% using a higher-level \TeX{} interface: it is unnecessary to provide shell
+% access for the \TeX{} engine.
+%
+% \end{markdown}
+% \iffalse
+%</lua-cli>
+%<*tex>
+% \fi
+% \par
+% \begin{markdown}
+%
+% Plain \TeX{} Interface
+%-----------------------
+% \label{sec:texinterface}
+%
+% \iffalse
+%</tex>
+%<*manual-interfaces>
+
+### Plain \TeX{}
+
+The plain \TeX{} interface provides \TeX{} commands that typeset markdown
+documents by using the Lua interface behind the scenes. Unlike the Lua
+interface, the plain TeX interface does not provide low-level tools for
+converting markdown to \TeX{}. Instead, its goal is to provide high-level
+typesetting capabilities.
+
+The plain \TeX{} interface accepts the same options as the `markdown` Lua
+module, in addition to its own options, but now the options are specified as
+\TeX{} commands.
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+Invoking pdfTeX should have the same effect:
+``` sh
+pdftex --shell-escape document.tex
+``````
+
+%</manual-interfaces>
+%<*tex>
+% \fi
+%
+% The plain \TeX{} interface provides macros for the typesetting of markdown
+% input from within plain \TeX{}, for setting the Lua interface options (see
+% Section \ref{sec:luaoptions}) used during the conversion from markdown to
+% plain \TeX{} and for changing the way markdown the tokens are rendered.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownLastModified{2019/04/30}%
+\def\markdownVersion{2.8.1}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The plain \TeX{} interface is implemented by the `markdown.tex` file that can
+% be loaded as follows:
+% ``` tex
+% \input markdown
+% ```````
+% \noindent It is expected that the special plain \TeX{} characters have the
+% expected category codes, when \m{input}ting the file.
+%
+%### Typesetting Markdown
+% \label{sec:textypesetting}
+% The interface exposes the \mdef{markdownBegin}, \mdef{markdownEnd}, and
+% \mdef{markdownInput} macros.
+%
+% The \m{markdownBegin} macro marks the beginning of a markdown document
+% fragment and the \m{markdownEnd} macro marks its end.
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\markdownBegin\relax
+\let\markdownEnd\relax
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% You may prepend your own code to the \m{markdownBegin} macro and redefine the
+% \m{markdownEnd} macro to produce special effects before and after the
+% markdown block.
+%
+% There are several limitations to the macros you need to be aware of.
+% The first limitation concerns the \m{markdownEnd} macro, which must be
+% visible directly from the input line buffer (it may not be produced as a
+% result of input expansion). Otherwise, it will not be recognized as the end
+% of the markdown string. As a corrolary, the \m{markdownEnd} string
+% may not appear anywhere inside the markdown input.
+%
+% Another limitation concerns spaces at the right end of an input line. In
+% markdown, these are used to produce a forced line break. However, any such
+% spaces are removed before the lines enter the input buffer of
+% \TeX{}~[@knuth86, p. 46]. As a corrolary, the \m{markdownBegin} macro also
+% ignores them.
+%
+% The \m{markdownBegin} and \m{markdownEnd} macros will also consume the rest
+% of the lines at which they appear. In the following example plain \TeX{}
+% code, the characters `c`, `e`, and `f` will not appear in the output.
+%
+% ``` tex
+% \input markdown
+% a
+% b \markdownBegin c
+% d
+% e \markdownEnd f
+% g
+% \bye
+% ```````
+%
+% Note that you may also not nest the \m{markdownBegin} and \m{markdownEnd}
+% macros.
+%
+% The following example plain \TeX{} code showcases the usage of the
+% \m{markdownBegin} and \m{markdownEnd} macros:
+%
+% ``` tex
+% \input markdown
+% \markdownBegin
+% _Hello_ **world** ...
+% \markdownEnd
+% \bye
+% ```````
+%
+% The \m{markdownInput} macro accepts a single parameter containing the
+% filename of a markdown document and expands to the result of the conversion
+% of the input markdown document to plain \TeX{}.
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\markdownInput\relax
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% This macro is not subject to the abovelisted limitations of the
+% \m{markdownBegin} and \m{markdownEnd} macros.
+%
+% The following example plain \TeX{} code showcases the usage of the
+% \m{markdownInput} macro:
+%
+% ``` tex
+% \input markdown
+% \markdownInput{hello.md}
+% \bye
+% ```````
+%
+%### Options
+% \label{sec:texoptions}
+%
+% The plain \TeX{} options are represented by \TeX{} commands. Some of them map
+% directly to the options recognized by the Lua interface (see
+% Section~\ref{sec:luaoptions}), while some of them are specific to the plain
+% \TeX{} interface.
+%
+% \end{markdown}
+% \iffalse
+%</tex>
+%<*manual-options>
+
+### Plain \TeX{}
+
+Plain \TeX{} options control the communication between the \TeX{} interface and
+the `markdown` Lua module. They are supported by all higher-level interfaces of
+the Markdown package, i.e. the plain \TeX{}, \LaTeX{} and \Hologo{ConTeXt}
+interfaces.
+
+% \fi
+% \begin{markdown}
+
+#### File and Directory Names
+
+% \end{markdown}
+% \iffalse
+%</manual-options>
+%<*tex>
+% \fi
+% \begin{markdown}
+%
+% The \mdef{markdownOptionHelperScriptFileName} macro sets the filename of the
+% helper Lua script file that is created during the conversion from markdown to
+% plain \TeX{} in \TeX{} engines without the \m{directlua} primitive. It
+% defaults to \m{jobname}`.markdown.lua`, where \m{jobname} is the base name
+% of the document being typeset.
+%
+% The expansion of this macro must not contain quotation marks (`"`) or
+% backslash symbols (`extbackslash`). Mind that \TeX{} engines tend to
+% put quotation marks around \m{jobname}, when it contains spaces.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionHelperScriptFileName{\jobname.markdown.lua}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownOptionInputTempFileName} macro sets the filename of the
+% temporary input file that is created during the conversion from markdown to
+% plain \TeX{} in \m{markdownMode} other than `2`. It defaults to
+% \m{jobname}`.markdown.out`. The same limitations as in the case of the
+% \m{markdownOptionHelperScriptFileName} macro apply here.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionInputTempFileName{\jobname.markdown.in}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownOptionOutputTempFileName} macro sets the filename of the
+% temporary output file that is created during the conversion from markdown to
+% plain \TeX{} in \m{markdownMode} other than `2`. It defaults to
+% \m{jobname}`.markdown.out`. The same limitations apply here as in the case
+% of the \m{markdownOptionHelperScriptFileName} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionOutputTempFileName{\jobname.markdown.out}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownOptionErrorTempFileName} macro sets the filename of the
+% temporary output file that is created when a Lua error is encountered during
+% the conversion from markdown to plain \TeX{} in \m{markdownMode} other than
+% `2`. It defaults to \m{jobname}`.markdown.err`. The same limitations
+% apply here as in the case of the \m{markdownOptionHelperScriptFileName}
+% macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionErrorTempFileName{\jobname.markdown.err}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownOptionOutputDir} macro sets the path to the directory that
+% will contain the cache files produced by the Lua implementation and also the
+% auxiliary files produced by the plain \TeX{} implementation. The option
+% defaults to `.`.
+%
+% The path must be set to the same value as the `-output-directory` option of
+% your \TeX{} engine for the package to function correctly. We need this macro
+% to make the Lua implementation aware where it should store the helper files.
+% The same limitations apply here as in the case of the
+% \m{markdownOptionHelperScriptFileName} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionOutputDir{.}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownOptionCacheDir} macro corresponds to the Lua interface
+% \Opt{cacheDir} option that sets the path to the directory that will contain
+% the produced cache files. The option defaults to `_markdown_`\m{jobname},
+% which is a similar naming scheme to the one used by the \pkg{minted} \LaTeX{}
+% package. The same limitations apply here as in the case of the
+% \m{markdownOptionHelperScriptFileName} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionCacheDir{\markdownOptionOutputDir/_markdown_\jobname}%
+% \end{macrocode}
+%
+% \iffalse
+%</tex>
+%<*manual-options>
+
+The plain \TeX{} interface provides the following commands that you can use to
+specify the location of temporary files produced during the conversion from
+Markdown to \TeX{}:
+
+- `\markdownOptionHelperScriptFileName`,
+- `\markdownOptionInputTempFileName`,
+- `\markdownOptionOutputTempFileName`,
+- `\markdownOptionErrorTempFileName`,
+- `\markdownOptionOutputDir`, and
+- `\markdownOptionCacheDir`.
+
+Using a text editor, create a folder named `output-directory` and a text
+document named `document.tex` with the following content:
+``` tex
+\input lmfonts
+\input markdown
+\def\markdownOptionHelperScriptFileName{helper-script.lua}
+\def\markdownOptionInputTempFileName{temporary-input.md}
+\def\markdownOptionOutputTempFileName{temporary-output.tex}
+\def\markdownOptionErrorTempFileName{error-output.txt}
+\def\markdownOptionOutputDir{output-directory}
+\def\markdownOptionCacheDir{output-directory/cache-directory}
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex --output-directory output-directory document.tex
+``````
+A text document named `temporary-input.md` should be produced in the folder
+named `output-directory` and contain the following text:
+
+> Hello \*world\*!
+
+A folder named `output-directory/cache-directory` should also be produced and
+contain fragments of the converted markdown document. LuaTeX does not need
+other temporary files to perform the conversion from markdown to \TeX{}. To
+produce the remaining temporary files, invoke pdfTeX from the terminal:
+``` sh
+pdftex --output-directory output-directory --shell-escape document.tex
+``````
+Text documents named `helper-script.lua`, and `temporary-output.md` should be
+produced in the folder named `output-directory`. The document named
+`helper-script.lua` will contain Lua code that was executed to convert markdown
+to plain \TeX{}. The document named `temporary-output.tex` will contain the
+input markdown document converted to \TeX{}.
+
+No document named `error-output.txt` should be produced in the folder named
+`output-directory`. This document would only be produced if an error had occured
+while executing the Lua code. If this happens, please [file a
+bug](https://github.com/witiko/markdown/issues).
+
+%</manual-options>
+%<*tex>
+% \fi
+% \par
+% \begin{markdown}
+%
+%#### Lua Interface Options
+% The following macros map directly to the options recognized by the Lua
+% interface (see Section \ref{sec:luaoptions}) and are not processed by the
+% plain \TeX{} implementation, only passed along to Lua. They are undefined, which
+% makes them fall back to the default values provided by the Lua interface.
+%
+% For the macros that correspond to the non-boolean options recognized by the
+% Lua interface, the same limitations apply here in the case of the
+% \m{markdownOptionHelperScriptFileName} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\markdownOptionBlankBeforeBlockquote\undefined
+\let\markdownOptionBlankBeforeCodeFence\undefined
+\let\markdownOptionBlankBeforeHeading\undefined
+\let\markdownOptionBreakableBlockquotes\undefined
+\let\markdownOptionCitations\undefined
+\let\markdownOptionCitationNbsps\undefined
+\let\markdownOptionContentBlocks\undefined
+\let\markdownOptionContentBlocksLanguageMap\undefined
+\let\markdownOptionDefinitionLists\undefined
+\let\markdownOptionFootnotes\undefined
+\let\markdownOptionFencedCode\undefined
+\let\markdownOptionHashEnumerators\undefined
+\let\markdownOptionHeaderAttributes\undefined
+\let\markdownOptionHtml\undefined
+\let\markdownOptionHybrid\undefined
+\let\markdownOptionInlineFootnotes\undefined
+\let\markdownOptionPipeTables\undefined
+\let\markdownOptionPreserveTabs\undefined
+\let\markdownOptionShiftHeadings\undefined
+\let\markdownOptionSlice\undefined
+\let\markdownOptionSmartEllipses\undefined
+\let\markdownOptionStartNumber\undefined
+\let\markdownOptionTableCaptions\undefined
+\let\markdownOptionTightLists\undefined
+% \end{macrocode}
+% \par
+% \iffalse
+%</tex>
+%<*manual-options>
+
+#### Package Documentation
+
+The \mdef{markdownOptionStripPercentSigns} macro controls whether a percent
+sign (`%`) at the beginning of a line will be discarded when reading Markdown
+input from a \TeX{} document. This enables the use of markdown when writing
+\TeX{} package documentation using the [Doc \LaTeX{} package][doc] by Frank
+Mittelbach.
+
+ [doc]: https://ctan.org/pkg/doc (doc – Format LaTeX documentation)
+
+Using a text editor, create a text document named `document.dtx` with the
+following content:
+
+ ``` tex
+ % \iffalse
+ \documentclass{ltxdoc}
+ \usepackage[stripPercentSigns]{markdown}
+ \begin{document}
+ \DocInput{document.dtx}
+ \end{document}
+ % \fi
+ %
+ % \begin{markdown}
+ % Hello *world*!
+ % \end{markdown}
+ ```````
+
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.dtx
+``````
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!”
+
+%</manual-options>
+%<*tex>
+% \fi
+% \begin{markdown}
+%
+%#### Miscellaneous Options
+%
+% The \mdef{markdownOptionStripPercentSigns} macro controls whether a percent
+% sign (`%`) at the beginning of a line will be discarded when buffering
+% Markdown input (see Section~\ref{sec:buffering}) or not. Notably, this
+% enables the use of markdown when writing \TeX{} package documentation using
+% the \pkg{Doc} \LaTeX{}~package~[@mittelbach17] or similar. The recognized
+% values of the macro are `true` (discard) and `false` (retain).
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownOptionStripPercentSigns{false}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownIfOption}`{`\meta{name}`}` macro is provided for testing,
+% whether the value of `\markdownOption`\meta{name} is `true` or `false`.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownIfOption#1{%
+ \def\next##1##2##3##4##5{%
+ \expandafter\def\expandafter\next\expandafter{%
+ \csname iffalse\endcsname}%
+ \if##1t\if##2r\if##3u\if##4e
+ \expandafter\def\expandafter\next\expandafter{%
+ \csname iftrue\endcsname}%
+ \fi\fi\fi\fi
+ \next}%
+ \expandafter\expandafter\expandafter\next
+ \csname markdownOption#1\endcsname\relax\relax\relax\relax\relax}
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+
+## Markdown Tokens
+
+A key feature of the Markdown package is the support for manipulating markdown
+tokens, such as headings, emphasized text, links, and lists, in \TeX{}. Instead
+of reducing \TeX{} to a PDF document producer, the Markdown package allows the
+user to specify how every markdown token should be processed and rendered.
+
+% \fi
+% \begin{markdown}
+
+### Token Renderers
+
+% \label{sec:texrenderersuser}
+% \end{markdown}
+% \iffalse
+
+Token renderers are user-defined \TeX{} macros, which render markdown tokens.
+In this section, I will describe the individual token renderers.
+
+% \fi
+% \begin{markdown}
+%
+% The following \TeX{} macros may occur inside the output of the
+% converter functions exposed by the Lua interface (see Section
+% \ref{sec:luaconversion}) and represent the parsed markdown tokens. These
+% macros are intended to be redefined by the user who is typesetting a
+% document. By default, they point to the corresponding prototypes (see Section
+% \ref{sec:texrendererprototypes}).
+
+#### Interblock Separator Renderer
+The \mdef{markdownRendererInterblockSeparator} macro represents a separator
+between two markdown block elements. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererInterblockSeparator{%
+ \par
+ {\it(The end of a block)}%
+ \par
+}
+\markdownBegin
+Hello *world*!
+
+_Foo_ bar!
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ interblockSeparator = {%
+ \par
+ \emph{(The end of a block)}%
+ \par
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+Hello *world*!
+
+_Foo_ bar!
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererInterblockSeparator{%
+ \par
+ \emph{(The end of a block)}%
+ \par
+}
+\starttext
+\startmarkdown
+Hello *world*!
+
+_Foo_ bar!
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererInterblockSeparator{%
+ \markdownRendererInterblockSeparatorPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Line Break Renderer
+The \mdef{markdownRendererLineBreak} macro represents a forced line break.
+The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererLineBreak{%
+ \par
+ {\it(A forced linebreak)}%
+ \par
+}
+\markdownInput{example.md}
+\bye
+```````
+Using a text editor, create a text document named `example.md` with the
+following content. Note the two spaces at the end of the first line, which
+specify a hard linebreak. Due to the limitations of the \TeX{} input
+processor, hard linebreaks would be ignored if we typed them directly into the
+`document.tex` document.
+
+<pre><code>Hello world! <br/>_Foo_ bar!</code></pre>
+
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(A forced linebreak)*
+>
+> _Foo_ bar!
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ lineBreak = {%
+ \par
+ \emph{(A forced linebreak)}%
+ \par
+ },
+ },
+}
+\begin{document}
+\markdownInput{example.md}
+\end{document}
+```````
+Using a text editor, create a text document named `example.md` with the
+following content. Note the two spaces at the end of the first line, which
+specify a hard linebreak. Due to the limitations of the \TeX{} input
+processor, hard linebreaks would be ignored if we typed them directly into the
+`document.tex` document.
+
+<pre><code>Hello world! <br/>_Foo_ bar!</code></pre>
+
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(A forced linebreak)*
+>
+> _Foo_ bar!
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererLineBreak{%
+ \par
+ \emph{(A forced linebreak)}%
+ \par
+}
+\starttext
+\markdownInput{example.md}
+\stoptext
+```````
+Using a text editor, create a text document named `example.md` with the
+following content. Note the two spaces at the end of the first line, which
+specify a hard linebreak. Due to the limitations of the \TeX{} input
+processor, hard linebreaks would be ignored if we typed them directly into the
+`document.tex` document.
+
+<pre><code>Hello world! <br/>_Foo_ bar!</code></pre>
+
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(A forced linebreak)*
+>
+> _Foo_ bar!
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererLineBreak{%
+ \markdownRendererLineBreakPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Ellipsis Renderer
+ The \mdef{markdownRendererEllipsis} macro replaces any occurance of ASCII
+ ellipses in the input text. This macro will only be produced, when the
+ \Opt{smartEllipses} option is `true`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionSmartEllipses{true}
+\def\markdownRendererEllipsis{{\it SHAZAM}!}
+\markdownBegin
+The secret word is ...
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The secret word is *SHAZAM*!
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[smartEllipses]{markdown}
+\markdownSetup{
+ renderers = {
+ ellipsis = \emph{SHAZAM}!,
+ },
+}
+\begin{document}
+\begin{markdown}
+The secret word is ...
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The secret word is *SHAZAM*!
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionSmartEllipses{true}
+\def\markdownRendererEllipsis{\emph{SHAZAM}!}
+\starttext
+\startmarkdown
+The secret word is ...
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererEllipsis{%
+ \markdownRendererEllipsisPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Non-Breaking Space Renderer
+The \mdef{markdownRendererNbsp} macro represents a non-breaking space.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.bib` with the
+following content:
+``` bib
+@book{knuth:tex,
+ author = "Knuth, Donald Ervin",
+ title = "The \TeX book, volume A of Computers and typesetting",
+ publisher = "Addison-Wesley",
+ year = "1984"
+}
+```````
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[
+ citations,
+ citationNbsps,
+]{markdown}
+\markdownSetup{
+ renderers = {
+ nbsp = {$\cdot$},
+ },
+}
+\begin{document}
+
+\begin{markdown}
+The TeXbook [@knuth:tex, p. 123 and 130] is good.
+\end{markdown}
+
+\bibliographystyle{plain}
+\bibliography{document.bib}
+
+\end{document}
+```````
+Next, invoke LuaTeX and BibTeX from the terminal:
+``` sh
+lualatex document.tex
+bibtex document.aux
+lualatex document.tex
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The TeXbook [1, p.·123·and·130] is good.
+>
+> ### References
+> [1] Donald Ervin Knuth. _The TeXbook, volume A of Computers and typesetting._
+> Addison-Wesley, 1984.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererNbsp{%
+ \markdownRendererNbspPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Special Character Renderers
+The following macros replace any special plain \TeX{} characters, including
+% \iffalse
+the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text:
+
+- \mdef{markdownRendererAmpersand} replaces the ampersand (`&`).
+- \mdef{markdownRendererBackslash} replaces the backslash (`\`).
+- \mdef{markdownRendererCircumflex} replaces the circumflex (`^`).
+- \mdef{markdownRendererDollarSign} replaces the dollar sign (`$`).
+- \mdef{markdownRendererHash} replaces the hash sign (`#`).
+- \mdef{markdownRendererLeftBrace} replaces the left brace (`{`).
+- \mdef{markdownRendererPercentSign} replaces the percent sign (`%`).
+- \mdef{markdownRendererPipe} replaces the pipe character (`|`).
+- \mdef{markdownRendererRightBrace} replaces the right brace (`}`).
+- \mdef{markdownRendererTilde} replaces the tilde (`~`).
+- \mdef{markdownRendererUnderscore} replaces the underscore (`_`).
+
+% \fi
+% the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text.
+% These macros will only be produced, when the \Opt{hybrid} option is
+% `false`.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content. We will make the tilde behave as if it were written in
+\TeX{}, where it represents a non-breaking space.
+``` tex
+\input markdown
+\def\markdownRendererTilde{~}
+\markdownBegin
+Bartel~Leendert van~der~Waerden
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text, where the middot (`·`) denotes a non-breakable space:
+
+> Bartel·Leendert van·der·Waerden
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content. We will make the tilde behave as if it were written in
+\TeX{}, where it represents a non-breaking space.
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ tilde = ~,
+ },
+}
+\begin{document}
+\begin{markdown}
+Bartel~Leendert van~der~Waerden
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text, where the middot (`·`) denotes a non-breakable space:
+
+> Bartel·Leendert van·der·Waerden
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content. We will make the tilde behave as if it were written in
+\TeX{}, where it represents a non-breaking space.
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererTilde{~}
+\starttext
+\startmarkdown
+Bartel~Leendert van~der~Waerden
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text, where the middot (`·`) denotes a non-breakable space:
+
+> Bartel·Leendert van·der·Waerden
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererLeftBrace{%
+ \markdownRendererLeftBracePrototype}%
+\def\markdownRendererRightBrace{%
+ \markdownRendererRightBracePrototype}%
+\def\markdownRendererDollarSign{%
+ \markdownRendererDollarSignPrototype}%
+\def\markdownRendererPercentSign{%
+ \markdownRendererPercentSignPrototype}%
+\def\markdownRendererAmpersand{%
+ \markdownRendererAmpersandPrototype}%
+\def\markdownRendererUnderscore{%
+ \markdownRendererUnderscorePrototype}%
+\def\markdownRendererHash{%
+ \markdownRendererHashPrototype}%
+\def\markdownRendererCircumflex{%
+ \markdownRendererCircumflexPrototype}%
+\def\markdownRendererBackslash{%
+ \markdownRendererBackslashPrototype}%
+\def\markdownRendererTilde{%
+ \markdownRendererTildePrototype}%
+\def\markdownRendererPipe{%
+ \markdownRendererPipePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Code Span Renderer
+The \mdef{markdownRendererCodeSpan} macro represents inlined code span in the
+input text. It receives a single argument that corresponds to the inlined
+code span.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input lmfonts
+
+\def\markdownRendererCodeSpan#1{#1}
+
+\markdownBegin
+`$\sqrt{-1}$ *equals* $i$`
+
+$\sqrt{-1}$ *equals* $i$
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ \*equals\* \$i\$.
+>
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[smartEllipses]{markdown}
+\markdownSetup{
+ renderers = {
+ codeSpan = {#1},
+ },
+}
+\begin{document}
+
+\begin{markdown}
+`$\sqrt{-1}$ *equals* $i$`
+
+$\sqrt{-1}$ *equals* $i$
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ \*equals\* \$i\$.
+>
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererCodeSpan#1{#1}
+\starttext
+
+\startmarkdown
+`$\sqrt{-1}$ *equals* $i$`
+
+$\sqrt{-1}$ *equals* $i$
+\stopmarkdown
+
+\def\markdownOptionHybrid{true}
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$
+\stopmarkdown
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ \*equals\* \$i\$.
+>
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererCodeSpan{%
+ \markdownRendererCodeSpanPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Link Renderer
+The \mdef{markdownRendererLink} macro represents a hyperlink. It receives
+four arguments: the label, the fully escaped \acro{uri} that can be directly
+typeset, the raw \acro{uri} that can be used outside typesetting, and the
+title of the link.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererLink#1#2#3#4{%
+ #1 {\tt#2} titled {\it#4}%
+}
+\markdownBegin
+Please visit [the link][ctan].
+
+ [ctan]: https://ctan.org/
+ (the Comprehensive TeX Archive Network)
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Please visit the link <https://ctan.org/> titled *the Comprehensive TeX
+> Archive Network*.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ link = {%
+ #1 \texttt{#2} titled \emph{#4}%
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+Please visit [the link][ctan].
+
+ [ctan]: https://ctan.org/
+ (the Comprehensive TeX Archive Network)
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Please visit the link <https://ctan.org/> titled *the Comprehensive TeX
+> Archive Network*.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererLink#1#2#3#4{%
+ #1 {\tt#2} titled \emph{#4}%
+}
+\starttext
+\startmarkdown
+Please visit [the link][ctan].
+
+ [ctan]: https://ctan.org/
+ (the Comprehensive TeX Archive Network)
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Please visit the link <https://ctan.org/> titled *the Comprehensive TeX
+> Archive Network*.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererLink{%
+ \markdownRendererLinkPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Image Renderer
+The \mdef{markdownRendererImage} macro represents an image. It receives
+four arguments: the label, the fully escaped \acro{uri} that can be directly
+typeset, the raw \acro{uri} that can be used outside typesetting, and the
+title of the link.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begingroup
+\catcode`\@=11
+\catcode`\%=12
+\catcode`\^^A=14
+\global\def\markdownRendererImage#1#2#3#4{^^A
+ \immediate\write18{^^A
+ if printf '%s' "#3" | grep -q ^http; then
+ OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A
+ $(printf '%s' "#3" | sed 's/.*[.]//')";
+ if ! [ -e "$OUTPUT" ]; then
+ wget -O "$OUTPUT" '#3' || rm "$OUTPUT";
+ convert "$OUTPUT" png:"$OUTPUT";
+ fi;
+ printf '%s%%' "$OUTPUT" > \jobname.fetched;
+ else
+ printf '%s%%' "#3" > \jobname.fetched;
+ fi^^A
+ }^^A
+ {^^A
+ \everyeof={\noexpand}^^A
+ \edef\filename{\@@input"\jobname.fetched" }^^A
+ \includegraphics[width=\textwidth]{\filename}^^A
+ }^^A
+}
+\endgroup
+\begin{document}
+\begin{markdown}
+![TUGboat](https://tug.org/tugboat/noword.jpg)
+\end{markdown}
+\end{document}
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following content. This assumes that you use a Unix-like operating system with
+Bourne or Bourne again shell as the default shell of the current user. It also
+assumes that the `md5sum`, `wget`, and `convert` binaries are installed and
+that the \TeX{} engine has shell access.
+
+> ![](https://tug.org/tugboat/noword.jpg "The Communications of the TeX Users Group")
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererImage{%
+ \markdownRendererImagePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Content Block Renderers
+\label{sec:texcontentblockrenderers}
+The \mdef{markdownRendererContentBlock} macro represents an iA\,Writer content
+block. It receives four arguments: the local file or online image filename
+extension cast to the lower case, the fully escaped \acro{uri} that can be
+directly typeset, the raw \acro{uri} that can be used outside typesetting,
+and the title of the content block.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererContentBlock{%
+ \markdownRendererContentBlockPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererContentBlockOnlineImage} macro represents an
+iA\,Writer online image content block. The macro receives the same arguments
+as \m{markdownRendererContentBlock}.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererContentBlockOnlineImage{%
+ \markdownRendererContentBlockOnlineImagePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererContentBlockCode} macro represents an iA\,Writer
+content block that was recognized as a file in a known programming language
+by its filename extension $s$. If any `markdown-languages.json` file found
+by \pkg{kpathsea}\footnote{Local files take precedence. Filenames other
+than `markdown-languages.json` may be specified using the
+`contentBlocksLanguageMap` Lua option.} contains a record $(k, v)$, then a
+non-online-image content block with the filename extension $s,
+s$`:lower()`${}=k$ is considered to be in a known programming language $v$.
+The macro receives five arguments: the local file name extension $s$ cast to
+the lower case, the language $v$, the fully escaped \acro{uri} that can be
+directly typeset, the raw \acro{uri} that can be used outside typesetting,
+and the title of the content block.
+
+Note that you will need to place place a `markdown-languages.json` file
+inside your working directory or inside your local \TeX{} directory
+structure. In this file, you will define a mapping between filename
+extensions and the language names recognized by your favorite syntax
+highlighter; there may exist other creative uses beside syntax highlighting.
+% The `Languages.json` file provided by @sotkov17 is a good starting point.
+% \end{markdown}
+%
+% \iffalse
+[The `Languages.json` file provided by Anton Sotkov][sotkov17] is a good
+starting point.
+
+ [sotkov17]: https://github.com/iainc/Markdown-Content-Blocks
+ (File transclusion syntax for Markdown)
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionContentBlocks{true}
+\def\markdownRendererContentBlock#1#2#3#4{%
+ This is {\tt #2}, #4.
+}
+\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
+ This is the image {\tt #2}, #4.
+}
+\def\markdownRendererContentBlockCode#1#2#3#4#5{%
+ This is the #2 (\uppercase{#1}) document {\tt #3}, #5.
+}
+\markdownBegin
+/document.tex (the document that we are currently typesetting)
+/markdown-languages.json (the mapping between filename extensions
+ and programming language names)
+https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
+\markdownEnd
+\bye
+```````
+Create also a text document named `markdown-languages.json` with the following
+content:
+``` js
+{
+ "json": "JavaScript Object Notation",
+}
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is `document.tex`, the document that we are currently typesetting.
+>
+> This is the JavaScript Object Notation (JSON) document
+> `markdown-languages.json`, the mapping between filename extensions and
+> programming language names.
+>
+> This is the image `https://tug.org/tugboat/noword.jpg`, the logotype of
+> TUGboat.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{filecontents}
+\begin{filecontents*}{markdown-languages.json}
+{
+ "json": "JavaScript Object Notation",
+}
+\end{filecontents*}
+\usepackage[contentBlocks]{markdown}
+\markdownSetup{
+ renderers = {
+ contentBlock = {This is \texttt{#2}, #4.},
+ contentBlockOnlineImage = {This is the image \texttt{#2}, #4.},
+ contentBlockCode = {%
+ This is the #2 (\MakeUppercase{#1}) document \texttt{#3}, #5.
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+/document.tex (the document that we are currently typesetting)
+/markdown-languages.json (the mapping between filename extensions
+ and programming language names)
+https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is `document.tex`, the document that we are currently typesetting.
+>
+> This is the JavaScript Object Notation (JSON) document
+> `markdown-languages.json`, the mapping between filename extensions and
+> programming language names.
+>
+> This is the image `https://tug.org/tugboat/noword.jpg`, the logotype of
+> TUGboat.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionContentBlocks{true}
+\def\markdownRendererContentBlock#1#2#3#4{%
+ This is {\tt #2}, #4.
+}
+\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
+ This is the image {\tt #2}, #4.
+}
+\def\markdownRendererContentBlockCode#1#2#3#4#5{%
+ This is the #2 (\uppercase{#1}) document {\tt #3}, #5.
+}
+\starttext
+\startmarkdown
+/document.tex (the document that we are currently typesetting)
+/markdown-languages.json (the mapping between filename extensions
+ and programming language names)
+https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
+\stopmarkdown
+\stoptext
+```````
+Create also a text document named `markdown-languages.json` with the following
+content:
+``` js
+{
+ "json": "JavaScript Object Notation",
+}
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is `document.tex`, the document that we are currently typesetting.
+>
+> This is the JavaScript Object Notation (JSON) document
+> `markdown-languages.json`, the mapping between filename extensions and
+> programming language names.
+>
+> This is the image `https://tug.org/tugboat/noword.jpg`, the logotype of
+> TUGboat.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererContentBlockCode{%
+ \markdownRendererContentBlockCodePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Bullet List Renderers
+The \mdef{markdownRendererUlBegin} macro represents the beginning of a
+bulleted list that contains an item with several paragraphs of text (the
+list is not tight). The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlBegin{%
+ \markdownRendererUlBeginPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererUlBeginTight} macro represents the beginning of a
+bulleted list that contains no item with several paragraphs of text (the list
+is tight). This macro will only be produced, when the \Opt{tightLists} option
+is `false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlBeginTight{%
+ \markdownRendererUlBeginTightPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererUlItem} macro represents an item in a bulleted
+list. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlItem{%
+ \markdownRendererUlItemPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererUlItemEnd} macro represents the end of an item in a
+bulleted list. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlItemEnd{%
+ \markdownRendererUlItemEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererUlEnd} macro represents the end of a bulleted list
+that contains an item with several paragraphs of text (the list is not
+tight). The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlEnd{%
+ \markdownRendererUlEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererUlEndTight} macro represents the end of a bulleted
+list that contains no item with several paragraphs of text (the list is
+tight). This macro will only be produced, when the \Opt{tightLists} option is
+`false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionTightLists{true}
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererUlBeginTight{ (}
+\def\markdownRendererUlItem{%
+ \def\markdownRendererUlItem{%
+ ,
+ \def\markdownRendererUlItem{, and }%
+ }%
+}
+\def\markdownRendererUlItemEnd{}
+\def\markdownRendererUlEndTight{).}
+
+\markdownBegin
+This is a tight list
+
+- the first item
+- the second item
+- the third item
+\markdownEnd
+
+\def\markdownRendererInterblockSeparator{%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererUlBegin{}
+\def\markdownRendererUlItem{--\kern 0.5em}
+\def\markdownRendererUlItemEnd{.\par}
+\def\markdownRendererUlEnd{}
+
+\markdownBegin
+This is a loose list
+
+- This is the first item
+
+- This is the second item
+
+- This is the third item
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> - This is the first item.
+>
+> - This is the second item.
+>
+> - This is the third item.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[tightLists]{markdown}
+\begin{document}
+
+\begin{markdown*}{
+ renderers = {
+ interblockSeparator = {},
+ ulBeginTight = { (},
+ ulItem = {%
+ \def\markdownRendererUlItem{%
+ ,
+ \def\markdownRendererUlItem{, and }%
+ }%
+ },
+ ulItemEnd = {},
+ ulEndTight = {).},
+ },
+}
+This is a tight list
+
+- the first item
+- the second item
+- the third item
+\end{markdown*}
+
+\begin{markdown*}{
+ renderers = {
+ interblockSeparator = {%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+ },
+ ulBeginTight = {\begin{itemize}},
+ ulItem = {\item},
+ ulItemEnd = {.},
+ ulEnd = {\end{itemize}},
+ },
+}
+This is a loose list
+
+- This is the first item
+
+- This is the second item
+
+- This is the third item
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> - This is the first item.
+>
+> - This is the second item.
+>
+> - This is the third item.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionTightLists{true}
+\starttext
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererUlBeginTight{ (}
+\def\markdownRendererUlItem{%
+ \def\markdownRendererUlItem{%
+ ,
+ \def\markdownRendererUlItem{, and }%
+ }%
+}
+\def\markdownRendererUlItemEnd{}
+\def\markdownRendererUlEndTight{).}
+
+\startmarkdown
+This is a tight list
+
+- the first item
+- the second item
+- the third item
+\stopmarkdown
+
+\def\markdownRendererInterblockSeparator{%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererUlBegin{\startitemize}
+\def\markdownRendererUlItem{\item}
+\def\markdownRendererUlItemEnd{.}
+\def\markdownRendererUlEnd{\stopitemize}
+
+\startmarkdown
+This is a loose list
+
+- This is the first item
+
+- This is the second item
+
+- This is the third item
+\stopmarkdown
+
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> - This is the first item.
+>
+> - This is the second item.
+>
+> - This is the third item.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlEndTight{%
+ \markdownRendererUlEndTightPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Ordered List Renderers
+The \mdef{markdownRendererOlBegin} macro represents the beginning of an
+ordered list that contains an item with several paragraphs of text (the
+list is not tight). The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlBegin{%
+ \markdownRendererOlBeginPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererOlBeginTight} macro represents the beginning of an
+ordered list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the \Opt{tightLists}
+option is `false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlBeginTight{%
+ \markdownRendererOlBeginTightPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererOlItem} macro represents an item in an ordered list.
+This macro will only be produced, when the \Opt{startNumber} option is
+`false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlItem{%
+ \markdownRendererOlItemPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererOlItemEnd} macro represents the end of an item in
+an ordered list. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlItemEnd{%
+ \markdownRendererOlItemEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererOlItemWithNumber} macro represents an item in an
+ordered list. This macro will only be produced, when the \Opt{startNumber}
+option is `true`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlItemWithNumber{%
+ \markdownRendererOlItemWithNumberPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererOlEnd} macro represents the end of an ordered list
+that contains an item with several paragraphs of text (the list is not
+tight). The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlEnd{%
+ \markdownRendererOlEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererOlEndTight} macro represents the end of an ordered
+list that contains no item with several paragraphs of text (the list is
+tight). This macro will only be produced, when the \Opt{tightLists} option is
+`false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionTightLists{true}
+\def\markdownOptionStartNumber{true}
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererOlBeginTight{ (}
+\def\markdownRendererOlItemWithNumber#1{%
+ \ifnum #1=1\relax
+ the first
+ \else
+ \ifnum #1=2\relax
+ , the second
+ \else
+ , and the third
+ \fi
+ \fi
+}
+\def\markdownRendererOlItemEnd{}
+\def\markdownRendererOlEndTight{).}
+
+\markdownBegin
+This is a tight list
+
+1. item
+2. item
+3. item
+\markdownEnd
+
+\def\markdownRendererInterblockSeparator{%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererOlBegin{}
+\def\markdownRendererOlItemWithNumber#1{%
+ #1.\kern 0.5em%
+ This is the
+ \ifnum #1=1\relax
+ first
+ \else
+ \ifnum #1=2\relax
+ second
+ \else
+ third
+ \fi
+ \fi
+}
+\def\markdownRendererOlItemEnd{.\par}
+\def\markdownRendererOlEnd{}
+
+\markdownBegin
+This is a loose list
+
+1. item
+
+2. item
+
+3. item
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> 1. This is the first item.
+>
+> 2. This is the second item.
+>
+> 3. This is the third item.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[tightLists, startNumber]{markdown}
+\begin{document}
+
+\begin{markdown*}{
+ renderers = {
+ interblockSeparator = {},
+ olBeginTight = { (},
+ olItemWithNumber = {%
+ \ifnum #1=1\relax
+ the first
+ \else
+ \ifnum #1=2\relax
+ , the second
+ \else
+ , and the third
+ \fi
+ \fi
+ },
+ olItemEnd = {},
+ olEndTight = {).},
+ },
+}
+This is a tight list
+
+1. item
+2. item
+3. item
+\end{markdown*}
+
+\begin{markdown*}{
+ renderers = {
+ interblockSeparator = {%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+ },
+ olBeginTight = {\begin{enumerate}},
+ olItemWithNumber = {%
+ \item This is the
+ \ifnum #1=1\relax
+ first
+ \else
+ \ifnum #1=2\relax
+ second
+ \else
+ third
+ \fi
+ \fi
+ },
+ olItemEnd = {.},
+ olEnd = {\end{enumerate}},
+ },
+}
+This is a loose list
+
+1. item
+
+2. item
+
+3. item
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> 1. This is the first item.
+>
+> 2. This is the second item.
+>
+> 3. This is the third item.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionTightLists{true}
+\def\markdownOptionStartNumber{true}
+\starttext
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererOlBeginTight{ (}
+\def\markdownRendererOlItemWithNumber#1{%
+ \ifnum #1=1\relax
+ the first
+ \else
+ \ifnum #1=2\relax
+ , the second
+ \else
+ , and the third
+ \fi
+ \fi
+}
+\def\markdownRendererOlItemEnd{}
+\def\markdownRendererOlEndTight{).}
+
+\startmarkdown
+This is a tight list
+
+1. item
+2. item
+3. item
+\stopmarkdown
+
+\def\markdownRendererInterblockSeparator{%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererOlBegin{\startitemize}
+\def\markdownRendererOlItemWithNumber#1{%
+ \sym{#1.}
+ This is the
+ \ifnum #1=1\relax
+ first
+ \else
+ \ifnum #1=2\relax
+ second
+ \else
+ third
+ \fi
+ \fi
+}
+\def\markdownRendererOlItemEnd{.\par}
+\def\markdownRendererOlEnd{\stopitemize}
+
+\startmarkdown
+This is a loose list
+
+1. item
+
+2. item
+
+3. item
+\stopmarkdown
+
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> 1. This is the first item.
+>
+> 2. This is the second item.
+>
+> 3. This is the third item.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlEndTight{%
+ \markdownRendererOlEndTightPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Definition List Renderers
+The following macros are only produced, when the \Opt{definitionLists} option
+is `true`.
+
+The \mdef{markdownRendererDlBegin} macro represents the beginning of a
+definition list that contains an item with several paragraphs of text (the
+list is not tight). The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlBegin{%
+ \markdownRendererDlBeginPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlBeginTight} macro represents the beginning of a
+definition list that contains an item with several paragraphs of text (the
+list is not tight). This macro will only be produced, when the
+\Opt{tightLists} option is `false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlBeginTight{%
+ \markdownRendererDlBeginTightPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlItem} macro represents a term in a definition
+list. The macro receives a single argument that corresponds to the term
+being defined.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlItem{%
+ \markdownRendererDlItemPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlItemEnd} macro represents the end of a list of
+definitions for a single term.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlItemEnd{%
+ \markdownRendererDlItemEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlDefinitionBegin} macro represents the beginning
+of a definition in a definition list. There can be several definitions for
+a single term.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlDefinitionBegin{%
+ \markdownRendererDlDefinitionBeginPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlDefinitionEnd} macro represents the end of a
+definition in a definition list. There can be several definitions for a
+single term.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlDefinitionEnd{%
+ \markdownRendererDlDefinitionEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlEnd} macro represents the end of a definition
+list that contains an item with several paragraphs of text (the list is not
+tight). The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlEnd{%
+ \markdownRendererDlEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlEndTight} macro represents the end of a
+definition list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the \Opt{tightLists}
+option is `false`. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionTightLists{true}
+
+\def\markdownRendererInterblockSeparator{%
+ :%
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererDlBeginTight{%
+ \begingroup
+ \parindent=0pt
+}
+\def\markdownRendererDlItem#1{%
+ \par{\bf#1}%
+ \def\markdownRendererDlDefinitionEnd{%
+ ,
+ \def\markdownRendererDlDefinitionEnd{%
+ , and
+ \def\markdownRendererDlDefinitionEnd{.}%
+ }%
+ }%
+}
+\def\markdownRendererDlItemEnd{}
+\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em}
+\def\markdownRendererDlEndTight{\endgroup}
+
+\markdownBegin
+This is a tight definition list
+
+Coffee
+: black hot drink
+: prepared from roasted coffee beans
+: one of the most traded agricultural commodities in the world
+
+Milk
+: white cold drink
+: nutrient-rich
+: produced on an industrial scale
+\markdownEnd
+
+\def\markdownRendererInterblockSeparator{%
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererDlBegin{}
+\def\markdownRendererDlItem#1{%
+ . #1 is a
+ \def\markdownRendererDlDefinitionBegin{%
+ \def\markdownRendererDlDefinitionBegin{%
+ ,
+ \def\markdownRendererDlDefinitionBegin{, and }%
+ }%
+ }%
+}
+\def\markdownRendererDlItemEnd{}
+\def\markdownRendererDlDefinitionEnd{}
+\def\markdownRendererDlEnd{.}
+
+\markdownBegin
+This is a loose definition list
+
+Coffee
+
+: black hot drink
+
+: prepared from roasted coffee beans
+
+: one of the most traded agricultural commodities in the world
+
+Milk
+
+: white cold drink
+
+: nutrient-rich
+
+: produced on an industrial scale
+\markdownEnd
+
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight definition list:
+>
+> **Coffee**
+>
+> - black hot drink,
+> - prepared from roasted coffee beans, and
+> - one of the most traded agricultural commodities in the world.
+>
+> **Milk**
+>
+> - white cold drink,
+> - nutrient-rich, and
+> - produced on an industrial scale.
+>
+> This is a loose definition list. Coffee is a black hot drink, prepared from
+> roasted coffee beans, and one of the most traded agricultural commodities in
+> the world. Milk is a white cold drink, nutrient-rich, and produced on an
+> industrial scale.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[definitionLists, tightLists]{markdown}
+\begin{document}
+
+\begin{markdown*}{
+ renderers = {
+ interblockSeparator = {%
+ :%
+ \def\markdownRendererInterblockSeparator{\par}%
+ },
+ dlBeginTight = {\begin{description}},
+ dlItem = {%
+ \item[#1]
+ \begin{itemize}
+ \def\markdownRendererDlDefinitionEnd{%
+ ,
+ \def\markdownRendererDlDefinitionEnd{%
+ , and
+ \def\markdownRendererDlDefinitionEnd{.}%
+ }%
+ }%
+ },
+ dlItemEnd = {\end{itemize}},
+ dlDefinitionBegin = \item,
+ dlEndTight = {\end{description}},
+ },
+}
+This is a tight definition list
+
+Coffee
+: black hot drink
+: prepared from roasted coffee beans
+: one of the most traded agricultural commodities in the world
+
+Milk
+: white cold drink
+: nutrient-rich
+: produced on an industrial scale
+\end{markdown*}
+
+\begin{markdown*}{
+ renderers = {
+ interblockSeparator = {%
+ \def\markdownRendererInterblockSeparator{\par}%
+ },
+ dlBegin = {},
+ dlItem = {%
+ . #1 is a
+ \def\markdownRendererDlDefinitionBegin{%
+ \def\markdownRendererDlDefinitionBegin{%
+ ,
+ \def\markdownRendererDlDefinitionBegin{, and }%
+ }%
+ }%
+ },
+ dlItemEnd = {},
+ dlDefinitionEnd = {},
+ dlEnd = {.},
+ },
+}
+This is a loose definition list
+
+Coffee
+
+: black hot drink
+
+: prepared from roasted coffee beans
+
+: one of the most traded agricultural commodities in the world
+
+Milk
+
+: white cold drink
+
+: nutrient-rich
+
+: produced on an industrial scale
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight definition list:
+>
+> **Coffee**
+>
+> - black hot drink,
+> - prepared from roasted coffee beans, and
+> - one of the most traded agricultural commodities in the world.
+>
+> **Milk**
+>
+> - white cold drink,
+> - nutrient-rich, and
+> - produced on an industrial scale.
+>
+> This is a loose definition list. Coffee is a black hot drink, prepared from
+> roasted coffee beans, and one of the most traded agricultural commodities in
+> the world. Milk is a white cold drink, nutrient-rich, and produced on an
+> industrial scale.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionTightLists{true}
+\starttext
+
+\def\markdownRendererInterblockSeparator{%
+ :%
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererDlBeginTight{}
+\def\markdownRendererDlItem#1{%
+ \par{\bf#1}%
+ \startitemize
+ \def\markdownRendererDlDefinitionEnd{%
+ ,
+ \def\markdownRendererDlDefinitionEnd{%
+ , and
+ \def\markdownRendererDlDefinitionEnd{.}%
+ }%
+ }%
+}
+\def\markdownRendererDlItemEnd{\stopitemize}
+\def\markdownRendererDlDefinitionBegin{\item}
+\def\markdownRendererDlEndTight{}
+
+\startmarkdown
+This is a tight definition list
+
+Coffee
+: black hot drink
+: prepared from roasted coffee beans
+: one of the most traded agricultural commodities in the world
+
+Milk
+: white cold drink
+: nutrient-rich
+: produced on an industrial scale
+\stopmarkdown
+
+\def\markdownRendererInterblockSeparator{%
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererDlBegin{}
+\def\markdownRendererDlItem#1{%
+ . #1 is a
+ \def\markdownRendererDlDefinitionBegin{%
+ \def\markdownRendererDlDefinitionBegin{%
+ ,
+ \def\markdownRendererDlDefinitionBegin{, and }%
+ }%
+ }%
+}
+\def\markdownRendererDlItemEnd{}
+\def\markdownRendererDlDefinitionEnd{}
+\def\markdownRendererDlEnd{.}
+
+\startmarkdown
+This is a loose definition list
+
+Coffee
+
+: black hot drink
+
+: prepared from roasted coffee beans
+
+: one of the most traded agricultural commodities in the world
+
+Milk
+
+: white cold drink
+
+: nutrient-rich
+
+: produced on an industrial scale
+\stopmarkdown
+
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a tight definition list:
+>
+> **Coffee**
+>
+> - black hot drink,
+> - prepared from roasted coffee beans, and
+> - one of the most traded agricultural commodities in the world.
+>
+> **Milk**
+>
+> - white cold drink,
+> - nutrient-rich, and
+> - produced on an industrial scale.
+>
+> This is a loose definition list. Coffee is a black hot drink, prepared from
+> roasted coffee beans, and one of the most traded agricultural commodities in
+> the world. Milk is a white cold drink, nutrient-rich, and produced on an
+> industrial scale.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlEndTight{%
+ \markdownRendererDlEndTightPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Emphasis Renderers
+The \mdef{markdownRendererEmphasis} macro represents an emphasized span of
+text. The macro receives a single argument that corresponds to the emphasized
+span of text.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererEmphasis#1{{\it#1}}
+\def\markdownRendererStrongEmphasis#1{{\bf#1}}
+\markdownBegin
+This is *emphasis*.
+
+This is **strong emphasis**.
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is *emphasis*.
+>
+> This is **strong emphasis**.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ emphasis = {\emph{#1}},
+ strongEmphasis = {\textbf{#1}},
+ },
+}
+\begin{document}
+\begin{markdown}
+This is *emphasis*.
+
+This is **strong emphasis**.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is *emphasis*.
+>
+> This is **strong emphasis**.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererEmphasis#1{\emph{#1}}
+\def\markdownRendererStrongEmphasis#1{\bold{#1}}
+\starttext
+\startmarkdown
+This is *emphasis*.
+
+This is **strong emphasis**.
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is *emphasis*.
+>
+> This is **strong emphasis**.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererEmphasis{%
+ \markdownRendererEmphasisPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererStrongEmphasis} macro represents a strongly
+emphasized span of text. The macro receives a single argument that
+corresponds to the emphasized span of text.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererStrongEmphasis{%
+ \markdownRendererStrongEmphasisPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Block Quote Renderers
+The \mdef{markdownRendererBlockQuoteBegin} macro represents the beginning of
+a block quote. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererBlockQuoteBegin{%
+ \begingroup
+ \vskip\parindent
+ \leftskip=2\parindent
+ \parindent=0pt
+}
+\def\markdownRendererBlockQuoteEnd{%
+ \par
+ \vskip\parindent
+ \endgroup
+}
+\markdownBegin
+A quote from William Shakespeare's King Lear:
+
+> This is the excellent foppery of the world that when we are
+> sick in fortune---often the surfeit of our own behavior---we
+> make guilty of our disasters the sun, the moon, and the
+> stars [...]
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A quote from William Shakespeare's King Lear:
+>
+> > This is the excellent foppery of the world that when we are
+> > sick in fortune—often the surfeit of our own behavior—we
+> > make guilty of our disasters the sun, the moon, and the
+> > stars [...]
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ blockQuoteBegin = {\begin{quote}},
+ blockQuoteEnd = {\end{quote}},
+ },
+}
+\begin{document}
+\begin{markdown}
+A quote from William Shakespeare's King Lear:
+
+> This is the excellent foppery of the world that when we are
+> sick in fortune---often the surfeit of our own behavior---we
+> make guilty of our disasters the sun, the moon, and the
+> stars [...]
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A quote from William Shakespeare's King Lear:
+>
+> > This is the excellent foppery of the world that when we are
+> > sick in fortune—often the surfeit of our own behavior—we
+> > make guilty of our disasters the sun, the moon, and the
+> > stars [...]
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererBlockQuoteBegin{\startquotation}
+\def\markdownRendererBlockQuoteEnd{\stopquotation}
+\starttext
+\startmarkdown
+A quote from William Shakespeare's King Lear:
+
+> This is the excellent foppery of the world that when we are
+> sick in fortune---often the surfeit of our own behavior---we
+> make guilty of our disasters the sun, the moon, and the
+> stars [...]
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A quote from William Shakespeare's King Lear:
+>
+> > This is the excellent foppery of the world that when we are
+> > sick in fortune—often the surfeit of our own behavior—we
+> > make guilty of our disasters the sun, the moon, and the
+> > stars [...]
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererBlockQuoteBegin{%
+ \markdownRendererBlockQuoteBeginPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererBlockQuoteEnd} macro represents the end of a block
+quote. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererBlockQuoteEnd{%
+ \markdownRendererBlockQuoteEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Code Block Renderers
+The \mdef{markdownRendererInputVerbatim} macro represents a code
+block. The macro receives a single argument that corresponds to the
+filename of a file contaning the code block contents.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererInputVerbatim{%
+ \markdownRendererInputVerbatimPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererInputFencedCode} macro represents a fenced code
+block. This macro will only be produced, when the \Opt{fencedCode} option is
+`true`. The macro receives two arguments that correspond to the filename of
+a file contaning the code block contents and to the code fence infostring.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{verbatim}
+\usepackage[hyphens]{url}
+\usepackage[fencedCode]{markdown}
+\markdownSetup{
+ renderers = {
+ interblockSeparator = {
+ \def\markdownRendererInterblockSeparator{%
+ \par
+ \def\markdownRendererInterblockSeparator{%
+ \def\markdownRendererInterblockSeparator{%
+ \par
+ }%
+ }%
+ }%
+ },
+ inputVerbatim = {
+ is contained in file \url{#1}:%
+ \verbatiminput{#1}%
+ },
+ inputFencedCode = {
+ in #2 \markdownRendererInputVerbatim{#1}%
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+The following code
+
+ def foo(bar):
+ if len(bar) <= 1:
+ return bar[0]
+ elif len(bar) == 2:
+ return sorted(bar)
+ else:
+ baz = len(bar) // 2
+ return foo(bar[baz:], bar[:baz])
+
+The following code
+
+~~~ Python
+>>> foo([4, 2, 1, 3])
+[1, 2, 3, 4]
+~~~~~~~~~~
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text except for the filename, which may differ:
+
+> The following code is contained in file
+> `./_markdown_document/882453149edcf288976647f6fe147ada.verbatim`:
+> ``` py
+> def foo(bar):
+> if len(bar) <= 1:
+> return bar[:1]
+> elif len(bar) == 2:
+> return sorted(bar)
+> else:
+> baz = bar[len(bar) // 2]
+> return (
+> foo([qux for qux in bar if qux < baz]) + [baz] +
+> foo([qux for qux in bar if qux > baz])
+> )
+> ``````
+> The following code in Python contained in file
+> `./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim`:
+> ``` py
+> >>> foo([4, 2, 1, 3])
+> [1, 2, 3, 4]
+> ``````
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererInputFencedCode{%
+ \markdownRendererInputFencedCodePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Heading Renderers
+The \mdef{markdownRendererHeadingOne} macro represents a first level heading.
+The macro receives a single argument that corresponds to the heading text.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHeadingOne{%
+ \markdownRendererHeadingOnePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererHeadingTwo} macro represents a second level
+heading. The macro receives a single argument that corresponds to the heading
+text.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHeadingTwo{%
+ \markdownRendererHeadingTwoPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererHeadingThree} macro represents a third level
+heading. The macro receives a single argument that corresponds to the heading
+text.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHeadingThree{%
+ \markdownRendererHeadingThreePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererHeadingFour} macro represents a fourth level
+heading. The macro receives a single argument that corresponds to the heading
+text.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHeadingFour{%
+ \markdownRendererHeadingFourPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererHeadingFive} macro represents a fifth level
+heading. The macro receives a single argument that corresponds to the heading
+text.
+
+% \end{markdown}
+%
+% \iffalse
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHeadingFive{%
+ \markdownRendererHeadingFivePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererHeadingSix} macro represents a sixth level
+heading. The macro receives a single argument that corresponds to the heading
+text.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererHeadingOne{1}
+\def\markdownRendererHeadingTwo{2}
+\def\markdownRendererHeadingThree{3}
+\def\markdownRendererHeadingFour{4}
+\def\markdownRendererHeadingFive{5}
+\def\markdownRendererHeadingSix{6}
+\markdownBegin
+######
+#####
+#####
+###
+######
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> 65536
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ interblockSeparator = {},
+ headingOne = 1,
+ headingTwo = 2,
+ headingThree = 3,
+ headingFour = 4,
+ headingFive = 5,
+ headingSix = 6,
+ },
+}
+\begin{document}
+\begin{markdown}
+######
+#####
+#####
+###
+######
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> 65536
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererHeadingOne{1}
+\def\markdownRendererHeadingTwo{2}
+\def\markdownRendererHeadingThree{3}
+\def\markdownRendererHeadingFour{4}
+\def\markdownRendererHeadingFive{5}
+\def\markdownRendererHeadingSix{6}
+\starttext
+\startmarkdown
+######
+#####
+#####
+###
+######
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> 65536
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHeadingSix{%
+ \markdownRendererHeadingSixPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Horizontal Rule Renderer
+The \mdef{markdownRendererHorizontalRule} macro represents a horizontal rule.
+The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererHorizontalRule{\vfil\break}
+\markdownBegin
+This is the first page.
+
+***
+
+This is the second page.
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is the first page.
+>
+> ***
+>
+> This is the second page.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ horizontalRule = \newpage,
+ },
+}
+\begin{document}
+\begin{markdown}
+This is the first page.
+
+***
+
+This is the second page.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is the first page.
+>
+> ***
+>
+> This is the second page.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererHorizontalRule{\page[yes]}
+\starttext
+\startmarkdown
+This is the first page.
+
+***
+
+This is the second page.
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is the first page.
+>
+> ***
+>
+> This is the second page.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererHorizontalRule{%
+ \markdownRendererHorizontalRulePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Footnote Renderer
+The \mdef{markdownRendererFootnote} macro represents a footnote. This macro
+will only be produced, when the \Opt{footnotes} option is `true`. The
+macro receives a single argument that corresponds to the footnote text.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionFootnotes{true}
+\def\markdownRendererFootnote#1{ (and \lowercase{#1})}
+\markdownBegin
+This is some text[^1] and this is some other text[^2].
+
+ [^1]: this is a footnote
+
+ [^2]: this is some other footnote
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is some text (and this is a footnote) and this is some other
+> text (and this is some other footnote).
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[footnotes]{markdown}
+\markdownSetup{
+ renderers = {
+ footnote = { (and \MakeLowercase{#1})},
+ },
+}
+\begin{document}
+\begin{markdown}
+This is some text[^1] and this is some other text[^2].
+
+ [^1]: this is a footnote
+
+ [^2]: this is some other footnote
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is some text (and this is a footnote) and this is some other
+> text (and this is some other footnote).
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownOptionFootnotes{true}
+\def\markdownRendererFootnote#1{ (and \lowercase{#1})}
+\starttext
+\startmarkdown
+This is some text[^1] and this is some other text[^2].
+
+ [^1]: this is a footnote
+
+ [^2]: this is some other footnote
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is some text (and this is a footnote) and this is some other
+> text (and this is some other footnote).
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererFootnote{%
+ \markdownRendererFootnotePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Parenthesized Citations Renderer
+The \mdef{markdownRendererCite} macro represents a string of one or more
+parenthetical citations. This macro will only be produced, when the
+\Opt{citations} option is `true`. The macro receives the parameter
+`{`\meta{number of citations}`}` followed by \meta{suppress
+author}`{`\meta{prenote}`}{`\meta{postnote}`}{`\meta{name}`}` repeated
+\meta{number of citations} times. The \meta{suppress author} parameter is
+either the token `-`, when the author's name is to be suppressed, or `+`
+otherwise.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[citations]{markdown}
+\newcount\citationsCounter
+\newcount\citationsTotal
+\makeatletter
+\def\citations#1#2#3#4{%
+ a parenthesized citation \emph{#4}
+ \advance\citationsCounter by 1\relax
+ \ifx\relax#2\relax
+ \ifx\relax#3\relax\else
+ with a postfix \emph{#3}%
+ \fi
+ \else
+ with a prefix \emph{#2}%
+ \ifx\relax#3\relax\else
+ \ and a postfix \emph{#3}%
+ \fi
+ \fi
+ \ifnum\citationsCounter>\citationsTotal\relax
+ .%
+ \expandafter\@gobble
+ \else
+ , and
+ \fi\citations}
+\makeatother
+\markdownSetup{
+ renderers = {
+ cite = {%
+ \citationsCounter=1%
+ \citationsTotal=#1%
+ This is
+ \expandafter\citations
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+[see @abrahams90, pp. 12; @eijkhout91, pp. 34]
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a parenthesized citation *abrahams90* with a prefix see
+> and a postfix *pp. > 12*, and a citation *eijkhout91* with a
+> postfix *pp. 34*.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererCite{%
+ \markdownRendererCitePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Text Citations Renderer
+The \mdef{markdownRendererTextCite} macro represents a string of one or more
+text citations. This macro will only be produced, when the
+\Opt{citations} option is `true`. The macro receives parameters in the same
+format as the \m{markdownRendererCite} macro.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[citations]{markdown}
+\newcount\citationsCounter
+\newcount\citationsTotal
+\makeatletter
+\def\citations#1#2#3#4{%
+ a text citation \emph{#4}
+ \advance\citationsCounter by 1\relax
+ \ifx\relax#2\relax
+ \ifx\relax#3\relax\else
+ with a postfix \emph{#3}%
+ \fi
+ \else
+ with a prefix \emph{#2}%
+ \ifx\relax#3\relax\else
+ \ and a postfix \emph{#3}%
+ \fi
+ \fi
+ \ifnum\citationsCounter>\citationsTotal\relax
+ .%
+ \expandafter\@gobble
+ \else
+ , and
+ \fi\citations}
+\makeatother
+\markdownSetup{
+ renderers = {
+ textCite = {%
+ \citationsCounter=1%
+ \citationsTotal=#1%
+ This is
+ \expandafter\citations
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+@abrahams90 [pp. 12; also @eijkhout91]
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a text citation *abrahams90* with a postfix *pp. 12*,
+> and a citation *eijkhout91* with a prefix *also*.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererTextCite{%
+ \markdownRendererTextCitePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Table Renderer
+The \mdef{markdownRendererTable} macro represents a table. This macro will only
+be produced, when the \Opt{pipeTables} option is `true`. The macro receives the
+parameters `{`\meta{caption}`}{`\meta{number of rows}`}{`\meta{number of columns}`}`
+followed by `{`\meta{alignments}`}` and then by `{`\meta{row}`}` repeated
+\meta{number of rows} times, where \meta{row} is `{`\meta{column}`}` repeated
+\meta{number of columns} times, \meta{alignments} is \meta{alignment} repeated
+\meta{number of columns} times, and \meta{alignment} is one of the following:
+
+- `d` -- The corresponding column has an unspecified (default) alignment.
+- `l` -- The corresponding column is left-aligned.
+- `c` -- The corresponding column is centered.
+- `r` -- The corresponding column is right-aligned.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[pipeTables, tableCaptions]{markdown}
+\newcount\rowCounter
+\newcount\columnCounter
+\makeatletter
+\def\processRow#1{%
+ \columnCounter=1%
+ \ifnum\rowCounter=0\relax
+ As for the alignment,
+ \else
+ In row \the\rowCounter,
+ \fi
+ \processColumn#1
+ \advance\rowCounter by 1\relax
+ \ifnum\rowCounter>\rowTotal\relax
+ \expandafter\@gobble
+ \fi\processRow}%
+\def\processColumn#1{%
+ column number \the\columnCounter{}
+ \ifnum\rowCounter=0\relax
+ \if#1d{}has default alignment\fi
+ \if#1l{}is left-aligned\fi
+ \if#1c{}is centered\fi
+ \if#1r{}is right-aligned\fi
+ \else
+ says \emph{#1}%
+ \fi
+ \advance\columnCounter by 1\relax
+ \ifnum\columnCounter<\columnTotal\relax, \fi
+ \ifnum\columnCounter=\columnTotal\relax, and \fi
+ \ifnum\columnCounter>\columnTotal\relax
+ .\expandafter\@gobble
+ \fi\processColumn}%
+\makeatother
+\markdownSetup{
+ renderers = {
+ table = {%
+ This is a table with caption \emph{#1} that is #3 colums wide
+ and #2 rows long.
+ \rowCounter=0%
+ \def\rowTotal{#2}%
+ \def\columnTotal{#3}%
+ \processRow
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+| Right | Left | Default | Center |
+|------:|:-----|---------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | 123 | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax
+\end{markdown}
+\end{document}
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a table with caption *Demonstration of pipe table syntax* that is 4
+> colums wide and 4 rows long. As for the alignment, column number 1 is
+> right-aligned, column number 2 is left-aligned, column number 3 has default
+> alignment, and column number 4 is centered. In row 1, column number 1 says
+> *Right*, column number 2 says *Left*, column number 3 says *Default*, and
+> column number 4 says *Center*. In row 2, column number 1 says *12*, column
+> number 2 says *12*, column number 3 says *12*, and column number 4 says *12*.
+> In row 3, column number 1 says *123*, column number 2 says *123*, column
+> number 3 says *123*, and column number 4 says *123*. In row 4, column number
+> 1 says *1*, column number 2 says *1*, column number 3 says *1*, and column
+> number 4 says *1*.
+
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererTable{%
+ \markdownRendererTablePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%</tex>
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+### Token Renderer Prototypes
+
+% \label{sec:texrendererprototypes}
+%
+% \end{markdown}
+% \iffalse
+
+By default, token renderers point to package-defined \TeX{} macros, further
+referred to as *prototypes*, which provide useful default definitions.
+
+% \fi
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererTildePrototype{%
+ Packages can specify token renderer prototypes.%
+}
+\markdownBegin
+~
+\markdownEnd
+
+\def\markdownRendererTilde{%
+ User-defined token renderers take precedence.%
+}
+\markdownBegin
+~
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Packages can specify token renderer prototypes.
+>
+> User-defined token renderers take precedence.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ rendererPrototypes = {
+ tilde = {Packages can specify token renderer prototypes.},
+ },
+}
+\begin{document}
+\begin{markdown}
+~
+\end{markdown}
+
+\begin{markdown*}{
+ renderers = {
+ tilde = {User-defined token renderers take precedence.},
+ },
+}
+~
+\end{markdown*}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Packages can specify token renderer prototypes.
+>
+> User-defined token renderers take precedence.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererTildePrototype{%
+ Packages can specify token renderer prototypes.%
+}
+\starttext
+\startmarkdown
+~
+\stopmarkdown
+
+\def\markdownRendererTilde{%
+ User-defined token renderers take precedence.%
+}
+\startmarkdown
+~
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Packages can specify token renderer prototypes.
+>
+> User-defined token renderers take precedence.
+
+%</manual-tokens>
+%<*tex>
+% \fi
+%
+% \begin{markdown}
+%
+% The following \TeX{} macros provide definitions for the token renderers (see
+% Section \ref{sec:texrenderersuser}) that have not been redefined by the
+% user. These macros are intended to be redefined by macro package authors
+% who wish to provide sensible default token renderers. They are also redefined
+% by the \LaTeX{} and \Hologo{ConTeXt} implementations (see sections
+% \ref{sec:lateximplementation} and \ref{sec:contextimplementation}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownRendererInterblockSeparatorPrototype{}%
+\def\markdownRendererLineBreakPrototype{}%
+\def\markdownRendererEllipsisPrototype{}%
+\def\markdownRendererNbspPrototype{}%
+\def\markdownRendererLeftBracePrototype{}%
+\def\markdownRendererRightBracePrototype{}%
+\def\markdownRendererDollarSignPrototype{}%
+\def\markdownRendererPercentSignPrototype{}%
+\def\markdownRendererAmpersandPrototype{}%
+\def\markdownRendererUnderscorePrototype{}%
+\def\markdownRendererHashPrototype{}%
+\def\markdownRendererCircumflexPrototype{}%
+\def\markdownRendererBackslashPrototype{}%
+\def\markdownRendererTildePrototype{}%
+\def\markdownRendererPipePrototype{}%
+\def\markdownRendererCodeSpanPrototype#1{}%
+\def\markdownRendererLinkPrototype#1#2#3#4{}%
+\def\markdownRendererImagePrototype#1#2#3#4{}%
+\def\markdownRendererContentBlockPrototype#1#2#3#4{}%
+\def\markdownRendererContentBlockOnlineImagePrototype#1#2#3#4{}%
+\def\markdownRendererContentBlockCodePrototype#1#2#3#4#5{}%
+\def\markdownRendererUlBeginPrototype{}%
+\def\markdownRendererUlBeginTightPrototype{}%
+\def\markdownRendererUlItemPrototype{}%
+\def\markdownRendererUlItemEndPrototype{}%
+\def\markdownRendererUlEndPrototype{}%
+\def\markdownRendererUlEndTightPrototype{}%
+\def\markdownRendererOlBeginPrototype{}%
+\def\markdownRendererOlBeginTightPrototype{}%
+\def\markdownRendererOlItemPrototype{}%
+\def\markdownRendererOlItemWithNumberPrototype#1{}%
+\def\markdownRendererOlItemEndPrototype{}%
+\def\markdownRendererOlEndPrototype{}%
+\def\markdownRendererOlEndTightPrototype{}%
+\def\markdownRendererDlBeginPrototype{}%
+\def\markdownRendererDlBeginTightPrototype{}%
+\def\markdownRendererDlItemPrototype#1{}%
+\def\markdownRendererDlItemEndPrototype{}%
+\def\markdownRendererDlDefinitionBeginPrototype{}%
+\def\markdownRendererDlDefinitionEndPrototype{}%
+\def\markdownRendererDlEndPrototype{}%
+\def\markdownRendererDlEndTightPrototype{}%
+\def\markdownRendererEmphasisPrototype#1{}%
+\def\markdownRendererStrongEmphasisPrototype#1{}%
+\def\markdownRendererBlockQuoteBeginPrototype{}%
+\def\markdownRendererBlockQuoteEndPrototype{}%
+\def\markdownRendererInputVerbatimPrototype#1{}%
+\def\markdownRendererInputFencedCodePrototype#1#2{}%
+\def\markdownRendererHeadingOnePrototype#1{}%
+\def\markdownRendererHeadingTwoPrototype#1{}%
+\def\markdownRendererHeadingThreePrototype#1{}%
+\def\markdownRendererHeadingFourPrototype#1{}%
+\def\markdownRendererHeadingFivePrototype#1{}%
+\def\markdownRendererHeadingSixPrototype#1{}%
+\def\markdownRendererHorizontalRulePrototype{}%
+\def\markdownRendererFootnotePrototype#1{}%
+\def\markdownRendererCitePrototype#1{}%
+\def\markdownRendererTextCitePrototype#1{}%
+\def\markdownRendererTablePrototype#1#2#3{}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Logging Facilities
+% The \mdef{markdownInfo}, \mdef{markdownWarning}, and \mdef{markdownError}
+% macros perform logging for the Markdown package. Their first argument
+% specifies the text of the info, warning, or error message.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownInfo#1{}%
+\def\markdownWarning#1{}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \m{markdownError} macro receives a second argument that provides a help
+% text.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownError#1#2{}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% You may redefine these macros to redirect and process the info, warning, and
+% error messages.
+%
+%### Miscellanea
+% The \mdef{markdownMakeOther} macro is used by the package, when a \TeX{}
+% engine that does not support direct Lua access is starting to buffer a text.
+% The plain \TeX{} implementation changes the category code of plain \TeX{}
+% special characters to other, but there may be other active characters that
+% may break the output. This macro should temporarily change the category of
+% these to *other*.
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\markdownMakeOther\relax
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownReadAndConvert} macro implements the \m{markdownBegin}
+% macro. The first argument specifies the token sequence that will terminate
+% the markdown input (\m{markdownEnd} in the instance of the \m{markdownBegin}
+% macro) when the plain \TeX{} special characters have had their category
+% changed to *other*. The second argument specifies the token sequence
+% that will actually be inserted into the document, when the ending token
+% sequence has been found.
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\markdownReadAndConvert\relax
+\begingroup
+% \end{macrocode}
+% \begin{markdown}
+% Locally swap the category code of the backslash symbol (`\`) with the pipe
+% symbol (`|`). This is required in order that all the special symbols in the
+% first argument of the `markdownReadAndConvert` macro have the category code
+% *other*.
+%
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`\|=0\catcode`\\=12%
+ |gdef|markdownBegin{%
+ |markdownReadAndConvert{\markdownEnd}%
+ {|markdownEnd}}%
+|endgroup
+% \end{macrocode}
+% \begin{markdown}
+% The macro is exposed in the interface, so that the user can create their own
+% markdown environments. Due to the way the arguments are passed to Lua (see
+% Section \ref{sec:directlua}), the first argument may not contain the
+% string `]]` (regardless of the category code of the bracket symbol (`]`)).
+%
+% The \mdef{markdownMode} macro specifies how the plain \TeX{} implementation
+% interfaces with the Lua interface. The valid values and their meaning are
+% as follows:
+%
+% - `0` – Shell escape via the 18 output file stream
+% - `1` – Shell escape via the Lua \luam{os.execute} method
+% - `2` – Direct Lua access
+%
+% By defining the macro, the user can coerce the package to use a specific mode.
+% If the user does not define the macro prior to loading the plain \TeX{}
+% implementation, the correct value will be automatically detected. The outcome
+% of changing the value of \m{markdownMode} after the implementation has been
+% loaded is undefined.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ifx\markdownMode\undefined
+ \ifx\directlua\undefined
+ \def\markdownMode{0}%
+ \else
+ \def\markdownMode{2}%
+ \fi
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The following macros are no longer a part of the plain \TeX{} interface and
+% are only defined for backwards compatibility:
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownLuaRegisterIBCallback#1{\relax}%
+\def\markdownLuaUnregisterIBCallback#1{\relax}%
+% \end{macrocode}
+% \iffalse
+%</tex>
+% \fi
+% \par
+% \begin{markdown}
+%
+% \LaTeX{} Interface
+%-------------------
+% \label{sec:latexinterface}
+%
+% \end{markdown}
+% \iffalse
+%<*manual-interfaces>
+
+### \LaTeX{}
+
+The \LaTeX{} interface provides the same level of functionality as the plain
+\TeX{} interface by using the plain \TeX{} interface behind the scenes. Unlike
+the plain \TeX{} interface, the \LaTeX{} interface uses familiar \LaTeX{}
+idioms, such as package options and environments.
+
+The \LaTeX{} interface accepts the same options as the plain \TeX{} interface,
+but now the options are specified as \meta{key}${}={}$\meta{value} pairs and
+they are passed either as package options, in the \m{markdownSetup} command, or
+as parameters for the \envm{markdown*} \LaTeX{} environment.
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown*}
+
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+Invoking pdfTeX should have the same effect:
+``` sh
+pdflatex --shell-escape document.tex
+``````
+
+%</manual-interfaces>
+%<*latex>
+% \fi
+% \begin{markdown}
+%
+% The \LaTeX{} interface provides \LaTeX{} environments for the typesetting of
+% markdown input from within \LaTeX{}, facilities for setting Lua interface
+% options (see Section \ref{sec:luaoptions}) used during the conversion from
+% markdown to plain \TeX{}, and facilities for changing the way markdown tokens
+% are rendered. The rest of the interface is inherited from the plain \TeX{}
+% interface (see Section \ref{sec:texinterface}).
+%
+% The \LaTeX{} interface is implemented by the `markdown.sty` file, which
+% can be loaded from the \LaTeX{} document preamble as follows:
+% \end{markdown}
+% \begin{Verbatim}[commandchars=\\\{\},gobble=2]
+% \textbackslash{}usepackage[\textrm{\meta{options}}]\{markdown\}
+% \end{Verbatim}
+% \begin{markdown}
+% where \meta{options} are the \LaTeX{} interface options (see Section
+% \ref{sec:latexoptions}). Note that \meta{options} inside the \m{usepackage}
+% macro may not set the `markdownRenderers` (see Section
+% \ref{sec:latexrenderers}) and `markdownRendererPrototypes` (see Section
+% \ref{sec:latexrendererprototypes}) keys. This limitation is due to the way
+% \Hologo{LaTeX2e} parses package options.
+%
+% \end{markdown}
+% \par
+% \begin{markdown}
+%
+%### Typesetting Markdown
+% The interface exposes the \envmdef{markdown} and \envmdef{markdown*}
+% \LaTeX{} environments, and redefines the \m{markdownInput} command.
+%
+% The \envm{markdown} and \envm{markdown*} \LaTeX{} environments are used to
+% typeset markdown document fragments. The starred version of the
+% \envm{markdown} environment accepts \LaTeX{} interface options (see
+% Section \ref{sec:latexoptions}) as its only argument. These options will
+% only influence this markdown document fragment.
+%
+% \end{markdown}
+% \begin{macrocode}
+\newenvironment{markdown}\relax\relax
+\newenvironment{markdown*}[1]\relax\relax
+% \end{macrocode}
+% \markdownBegin
+%
+% You may prepend your own code to the \m{markdown} macro and append your own
+% code to the \m{endmarkdown} macro to produce special effects before and after
+% the \envm{markdown} \LaTeX{} environment (and likewise for the starred
+% version).
+%
+% Note that the \envm{markdown} and \envm{markdown*} \LaTeX{} environments are
+% subject to the same limitations as the \m{markdownBegin} and \m{markdownEnd}
+% macros exposed by the plain \TeX{} interface.
+%
+% The following example \LaTeX{} code showcases the usage of the
+% \envm{markdown} and \envm{markdown*} environments:
+% ``` tex
+% \documentclass{article} \documentclass{article}
+% \usepackage{markdown} \usepackage{markdown}
+% \begin{document} \begin{document}
+% % ... % ...
+% \begin{markdown} \begin{markdown*}{smartEllipses}
+% _Hello_ **world** ... _Hello_ **world** ...
+% \end{markdown} \end{markdown*}
+% % ... % ...
+% \end{document} \end{document}
+% ```````
+%
+% The \m{markdownInput} macro accepts a single mandatory parameter containing
+% the filename of a markdown document and expands to the result of the
+% conversion of the input markdown document to plain \TeX{}. Unlike the
+% \m{markdownInput} macro provided by the plain \TeX{} interface, this macro
+% also accepts \LaTeX{} interface options (see Section \ref{sec:latexoptions})
+% as its optional argument. These options will only influnce this markdown
+% document.
+%
+% The following example \LaTeX{} code showcases the usage of the
+% \m{markdownInput} macro:
+% ``` tex
+% \documentclass{article}
+% \usepackage{markdown}
+% \begin{document}
+% % ...
+% \markdownInput[smartEllipses]{hello.md}
+% % ...
+% \end{document}
+% ```````
+%
+%### Options
+% \label{sec:latexoptions}
+%
+% The \LaTeX{} options are represented by a comma-delimited list of
+% \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value}
+% part is optional, and \meta{key} will be interpreted as \meta{key}`=true`.
+%
+% The \LaTeX{} options map directly to the options recognized by the plain
+% \TeX{} interface (see Section \ref{sec:texoptions}) and to the markdown token
+% renderers and their prototypes recognized by the plain \TeX{} interface (see
+% Sections \ref{sec:texrenderersuser} and \ref{sec:texrendererprototypes}).
+%
+% The \LaTeX{} options may be specified when loading the \LaTeX{} package (see
+% Section \ref{sec:latexinterface}), when using the \envm{markdown*} \LaTeX{}
+% environment, or via the \mdef{markdownSetup} macro. The \m{markdownSetup}
+% macro receives the options to set up as its only argument.
+%
+% \markdownEnd
+% \begin{macrocode}
+\newcommand\markdownSetup[1]{%
+ \setkeys{markdownOptions}{#1}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Plain \TeX{} Interface Options
+% The following options map directly to the option macros exposed by the plain
+% \TeX{} interface (see Section \ref{sec:texoptions}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\define@key{markdownOptions}{helperScriptFileName}{%
+ \def\markdownOptionHelperScriptFileName{#1}}%
+\define@key{markdownOptions}{inputTempFileName}{%
+ \def\markdownOptionInputTempFileName{#1}}%
+\define@key{markdownOptions}{outputTempFileName}{%
+ \def\markdownOptionOutputTempFileName{#1}}%
+\define@key{markdownOptions}{errorTempFileName}{%
+ \def\markdownOptionErrorTempFileName{#1}}%
+\define@key{markdownOptions}{cacheDir}{%
+ \def\markdownOptionCacheDir{#1}}%
+\define@key{markdownOptions}{outputDir}{%
+ \def\markdownOptionOutputDir{#1}}%
+\define@key{markdownOptions}{blankBeforeBlockquote}[true]{%
+ \def\markdownOptionBlankBeforeBlockquote{#1}}%
+\define@key{markdownOptions}{blankBeforeCodeFence}[true]{%
+ \def\markdownOptionBlankBeforeCodeFence{#1}}%
+\define@key{markdownOptions}{blankBeforeHeading}[true]{%
+ \def\markdownOptionBlankBeforeHeading{#1}}%
+\define@key{markdownOptions}{breakableBlockquotes}[true]{%
+ \def\markdownOptionBreakableBlockquotes{#1}}%
+\define@key{markdownOptions}{citations}[true]{%
+ \def\markdownOptionCitations{#1}}%
+\define@key{markdownOptions}{citationNbsps}[true]{%
+ \def\markdownOptionCitationNbsps{#1}}%
+\define@key{markdownOptions}{contentBlocks}[true]{%
+ \def\markdownOptionContentBlocks{#1}}%
+\define@key{markdownOptions}{codeSpans}[true]{%
+ \def\markdownOptionCodeSpans{#1}}%
+\define@key{markdownOptions}{contentBlocksLanguageMap}{%
+ \def\markdownOptionContentBlocksLanguageMap{#1}}%
+\define@key{markdownOptions}{definitionLists}[true]{%
+ \def\markdownOptionDefinitionLists{#1}}%
+\define@key{markdownOptions}{footnotes}[true]{%
+ \def\markdownOptionFootnotes{#1}}%
+\define@key{markdownOptions}{fencedCode}[true]{%
+ \def\markdownOptionFencedCode{#1}}%
+\define@key{markdownOptions}{hashEnumerators}[true]{%
+ \def\markdownOptionHashEnumerators{#1}}%
+\define@key{markdownOptions}{headerAttributes}[true]{%
+ \def\markdownOptionHeaderAttributes{#1}}%
+\define@key{markdownOptions}{html}[true]{%
+ \def\markdownOptionHtml{#1}}%
+\define@key{markdownOptions}{hybrid}[true]{%
+ \def\markdownOptionHybrid{#1}}%
+\define@key{markdownOptions}{inlineFootnotes}[true]{%
+ \def\markdownOptionInlineFootnotes{#1}}%
+\define@key{markdownOptions}{pipeTables}[true]{%
+ \def\markdownOptionPipeTables{#1}}%
+\define@key{markdownOptions}{preserveTabs}[true]{%
+ \def\markdownOptionPreserveTabs{#1}}%
+\define@key{markdownOptions}{smartEllipses}[true]{%
+ \def\markdownOptionSmartEllipses{#1}}%
+\define@key{markdownOptions}{shiftHeadings}{%
+ \def\markdownOptionShiftHeadings{#1}}%
+\define@key{markdownOptions}{slice}{%
+ \def\markdownOptionSlice{#1}}%
+\define@key{markdownOptions}{startNumber}[true]{%
+ \def\markdownOptionStartNumber{#1}}%
+\define@key{markdownOptions}{tableCaptions}[true]{%
+ \def\markdownOptionTableCaptions{#1}}%
+\define@key{markdownOptions}{tightLists}[true]{%
+ \def\markdownOptionTightLists{#1}}%
+\define@key{markdownOptions}{underscores}[true]{%
+ \def\markdownOptionUnderscores{#1}}%
+\define@key{markdownOptions}{stripPercentSigns}[true]{%
+ \def\markdownOptionStripPercentSigns{#1}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The following example \LaTeX{} code showcases a possible configuration of
+% plain \TeX{} interface options \m{markdownOptionHybrid},
+% \m{markdownOptionSmartEllipses}, and \m{markdownOptionCacheDir}.
+% ``` tex
+% \markdownSetup{
+% hybrid,
+% smartEllipses,
+% cacheDir = /tmp,
+% }
+% ```````
+%
+%#### Plain \TeX{} Markdown Token Renderers
+% \label{sec:latexrenderers}
+%
+% The \LaTeX{} interface recognizes an option with the `renderers` key,
+% whose value must be a list of options that map directly to the markdown token
+% renderer macros exposed by the plain \TeX{} interface (see Section
+% \ref{sec:texrenderersuser}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\define@key{markdownRenderers}{interblockSeparator}{%
+ \renewcommand\markdownRendererInterblockSeparator{#1}}%
+\define@key{markdownRenderers}{lineBreak}{%
+ \renewcommand\markdownRendererLineBreak{#1}}%
+\define@key{markdownRenderers}{ellipsis}{%
+ \renewcommand\markdownRendererEllipsis{#1}}%
+\define@key{markdownRenderers}{nbsp}{%
+ \renewcommand\markdownRendererNbsp{#1}}%
+\define@key{markdownRenderers}{leftBrace}{%
+ \renewcommand\markdownRendererLeftBrace{#1}}%
+\define@key{markdownRenderers}{rightBrace}{%
+ \renewcommand\markdownRendererRightBrace{#1}}%
+\define@key{markdownRenderers}{dollarSign}{%
+ \renewcommand\markdownRendererDollarSign{#1}}%
+\define@key{markdownRenderers}{percentSign}{%
+ \renewcommand\markdownRendererPercentSign{#1}}%
+\define@key{markdownRenderers}{ampersand}{%
+ \renewcommand\markdownRendererAmpersand{#1}}%
+\define@key{markdownRenderers}{underscore}{%
+ \renewcommand\markdownRendererUnderscore{#1}}%
+\define@key{markdownRenderers}{hash}{%
+ \renewcommand\markdownRendererHash{#1}}%
+\define@key{markdownRenderers}{circumflex}{%
+ \renewcommand\markdownRendererCircumflex{#1}}%
+\define@key{markdownRenderers}{backslash}{%
+ \renewcommand\markdownRendererBackslash{#1}}%
+\define@key{markdownRenderers}{tilde}{%
+ \renewcommand\markdownRendererTilde{#1}}%
+\define@key{markdownRenderers}{pipe}{%
+ \renewcommand\markdownRendererPipe{#1}}%
+\define@key{markdownRenderers}{codeSpan}{%
+ \renewcommand\markdownRendererCodeSpan[1]{#1}}%
+\define@key{markdownRenderers}{link}{%
+ \renewcommand\markdownRendererLink[4]{#1}}%
+\define@key{markdownRenderers}{contentBlock}{%
+ \renewcommand\markdownRendererContentBlock[4]{#1}}%
+\define@key{markdownRenderers}{contentBlockOnlineImage}{%
+ \renewcommand\markdownRendererContentBlockOnlineImage[4]{#1}}%
+\define@key{markdownRenderers}{contentBlockCode}{%
+ \renewcommand\markdownRendererContentBlockCode[5]{#1}}%
+\define@key{markdownRenderers}{image}{%
+ \renewcommand\markdownRendererImage[4]{#1}}%
+\define@key{markdownRenderers}{ulBegin}{%
+ \renewcommand\markdownRendererUlBegin{#1}}%
+\define@key{markdownRenderers}{ulBeginTight}{%
+ \renewcommand\markdownRendererUlBeginTight{#1}}%
+\define@key{markdownRenderers}{ulItem}{%
+ \renewcommand\markdownRendererUlItem{#1}}%
+\define@key{markdownRenderers}{ulItemEnd}{%
+ \renewcommand\markdownRendererUlItemEnd{#1}}%
+\define@key{markdownRenderers}{ulEnd}{%
+ \renewcommand\markdownRendererUlEnd{#1}}%
+\define@key{markdownRenderers}{ulEndTight}{%
+ \renewcommand\markdownRendererUlEndTight{#1}}%
+\define@key{markdownRenderers}{olBegin}{%
+ \renewcommand\markdownRendererOlBegin{#1}}%
+\define@key{markdownRenderers}{olBeginTight}{%
+ \renewcommand\markdownRendererOlBeginTight{#1}}%
+\define@key{markdownRenderers}{olItem}{%
+ \renewcommand\markdownRendererOlItem{#1}}%
+\define@key{markdownRenderers}{olItemWithNumber}{%
+ \renewcommand\markdownRendererOlItemWithNumber[1]{#1}}%
+\define@key{markdownRenderers}{olItemEnd}{%
+ \renewcommand\markdownRendererOlItemEnd{#1}}%
+\define@key{markdownRenderers}{olEnd}{%
+ \renewcommand\markdownRendererOlEnd{#1}}%
+\define@key{markdownRenderers}{olEndTight}{%
+ \renewcommand\markdownRendererOlEndTight{#1}}%
+\define@key{markdownRenderers}{dlBegin}{%
+ \renewcommand\markdownRendererDlBegin{#1}}%
+\define@key{markdownRenderers}{dlBeginTight}{%
+ \renewcommand\markdownRendererDlBeginTight{#1}}%
+\define@key{markdownRenderers}{dlItem}{%
+ \renewcommand\markdownRendererDlItem[1]{#1}}%
+\define@key{markdownRenderers}{dlItemEnd}{%
+ \renewcommand\markdownRendererDlItemEnd{#1}}%
+\define@key{markdownRenderers}{dlDefinitionBegin}{%
+ \renewcommand\markdownRendererDlDefinitionBegin{#1}}%
+\define@key{markdownRenderers}{dlDefinitionEnd}{%
+ \renewcommand\markdownRendererDlDefinitionEnd{#1}}%
+\define@key{markdownRenderers}{dlEnd}{%
+ \renewcommand\markdownRendererDlEnd{#1}}%
+\define@key{markdownRenderers}{dlEndTight}{%
+ \renewcommand\markdownRendererDlEndTight{#1}}%
+\define@key{markdownRenderers}{emphasis}{%
+ \renewcommand\markdownRendererEmphasis[1]{#1}}%
+\define@key{markdownRenderers}{strongEmphasis}{%
+ \renewcommand\markdownRendererStrongEmphasis[1]{#1}}%
+\define@key{markdownRenderers}{blockQuoteBegin}{%
+ \renewcommand\markdownRendererBlockQuoteBegin{#1}}%
+\define@key{markdownRenderers}{blockQuoteEnd}{%
+ \renewcommand\markdownRendererBlockQuoteEnd{#1}}%
+\define@key{markdownRenderers}{inputVerbatim}{%
+ \renewcommand\markdownRendererInputVerbatim[1]{#1}}%
+\define@key{markdownRenderers}{inputFencedCode}{%
+ \renewcommand\markdownRendererInputFencedCode[2]{#1}}%
+\define@key{markdownRenderers}{headingOne}{%
+ \renewcommand\markdownRendererHeadingOne[1]{#1}}%
+\define@key{markdownRenderers}{headingTwo}{%
+ \renewcommand\markdownRendererHeadingTwo[1]{#1}}%
+\define@key{markdownRenderers}{headingThree}{%
+ \renewcommand\markdownRendererHeadingThree[1]{#1}}%
+\define@key{markdownRenderers}{headingFour}{%
+ \renewcommand\markdownRendererHeadingFour[1]{#1}}%
+\define@key{markdownRenderers}{headingFive}{%
+ \renewcommand\markdownRendererHeadingFive[1]{#1}}%
+\define@key{markdownRenderers}{headingSix}{%
+ \renewcommand\markdownRendererHeadingSix[1]{#1}}%
+\define@key{markdownRenderers}{horizontalRule}{%
+ \renewcommand\markdownRendererHorizontalRule{#1}}%
+\define@key{markdownRenderers}{footnote}{%
+ \renewcommand\markdownRendererFootnote[1]{#1}}%
+\define@key{markdownRenderers}{cite}{%
+ \renewcommand\markdownRendererCite[1]{#1}}%
+\define@key{markdownRenderers}{textCite}{%
+ \renewcommand\markdownRendererTextCite[1]{#1}}%
+\define@key{markdownRenderers}{table}{%
+ \renewcommand\markdownRendererTable[3]{#1}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The following example \LaTeX{} code showcases a possible configuration of the
+% \m{markdownRendererLink} and \m{markdownRendererEmphasis} markdown token
+% renderers.
+% ``` tex
+% \markdownSetup{
+% renderers = {
+% link = {#4}, % Render links as the link title.
+% emphasis = {\emph{#1}}, % Render emphasized text via `\emph`.
+% }
+% }
+% ```````
+%
+%#### Plain \TeX{} Markdown Token Renderer Prototypes
+% \label{sec:latexrendererprototypes}
+% The \LaTeX{} interface recognizes an option with the `rendererPrototypes`
+% key, whose value must be a list of options that map directly to the markdown
+% token renderer prototype macros exposed by the plain \TeX{} interface (see
+% Section \ref{sec:texrendererprototypes}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\define@key{markdownRendererPrototypes}{interblockSeparator}{%
+ \renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{lineBreak}{%
+ \renewcommand\markdownRendererLineBreakPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ellipsis}{%
+ \renewcommand\markdownRendererEllipsisPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{nbsp}{%
+ \renewcommand\markdownRendererNbspPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{leftBrace}{%
+ \renewcommand\markdownRendererLeftBracePrototype{#1}}%
+\define@key{markdownRendererPrototypes}{rightBrace}{%
+ \renewcommand\markdownRendererRightBracePrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dollarSign}{%
+ \renewcommand\markdownRendererDollarSignPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{percentSign}{%
+ \renewcommand\markdownRendererPercentSignPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ampersand}{%
+ \renewcommand\markdownRendererAmpersandPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{underscore}{%
+ \renewcommand\markdownRendererUnderscorePrototype{#1}}%
+\define@key{markdownRendererPrototypes}{hash}{%
+ \renewcommand\markdownRendererHashPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{circumflex}{%
+ \renewcommand\markdownRendererCircumflexPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{backslash}{%
+ \renewcommand\markdownRendererBackslashPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{tilde}{%
+ \renewcommand\markdownRendererTildePrototype{#1}}%
+\define@key{markdownRendererPrototypes}{pipe}{%
+ \renewcommand\markdownRendererPipePrototype{#1}}%
+\define@key{markdownRendererPrototypes}{codeSpan}{%
+ \renewcommand\markdownRendererCodeSpanPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{link}{%
+ \renewcommand\markdownRendererLinkPrototype[4]{#1}}%
+\define@key{markdownRendererPrototypes}{contentBlock}{%
+ \renewcommand\markdownRendererContentBlockPrototype[4]{#1}}%
+\define@key{markdownRendererPrototypes}{contentBlockOnlineImage}{%
+ \renewcommand\markdownRendererContentBlockOnlineImagePrototype[4]{#1}}%
+\define@key{markdownRendererPrototypes}{contentBlockCode}{%
+ \renewcommand\markdownRendererContentBlockCodePrototype[5]{#1}}%
+\define@key{markdownRendererPrototypes}{image}{%
+ \renewcommand\markdownRendererImagePrototype[4]{#1}}%
+\define@key{markdownRendererPrototypes}{ulBegin}{%
+ \renewcommand\markdownRendererUlBeginPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ulBeginTight}{%
+ \renewcommand\markdownRendererUlBeginTightPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ulItem}{%
+ \renewcommand\markdownRendererUlItemPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ulItemEnd}{%
+ \renewcommand\markdownRendererUlItemEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ulEnd}{%
+ \renewcommand\markdownRendererUlEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{ulEndTight}{%
+ \renewcommand\markdownRendererUlEndTightPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{olBegin}{%
+ \renewcommand\markdownRendererOlBeginPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{olBeginTight}{%
+ \renewcommand\markdownRendererOlBeginTightPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{olItem}{%
+ \renewcommand\markdownRendererOlItemPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{olItemWithNumber}{%
+ \renewcommand\markdownRendererOlItemWithNumberPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{olItemEnd}{%
+ \renewcommand\markdownRendererOlItemEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{olEnd}{%
+ \renewcommand\markdownRendererOlEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{olEndTight}{%
+ \renewcommand\markdownRendererOlEndTightPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlBegin}{%
+ \renewcommand\markdownRendererDlBeginPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlBeginTight}{%
+ \renewcommand\markdownRendererDlBeginTightPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlItem}{%
+ \renewcommand\markdownRendererDlItemPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{dlItemEnd}{%
+ \renewcommand\markdownRendererDlItemEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlDefinitionBegin}{%
+ \renewcommand\markdownRendererDlDefinitionBeginPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlDefinitionEnd}{%
+ \renewcommand\markdownRendererDlDefinitionEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlEnd}{%
+ \renewcommand\markdownRendererDlEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{dlEndTight}{%
+ \renewcommand\markdownRendererDlEndTightPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{emphasis}{%
+ \renewcommand\markdownRendererEmphasisPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{strongEmphasis}{%
+ \renewcommand\markdownRendererStrongEmphasisPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{blockQuoteBegin}{%
+ \renewcommand\markdownRendererBlockQuoteBeginPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{blockQuoteEnd}{%
+ \renewcommand\markdownRendererBlockQuoteEndPrototype{#1}}%
+\define@key{markdownRendererPrototypes}{inputVerbatim}{%
+ \renewcommand\markdownRendererInputVerbatimPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{inputFencedCode}{%
+ \renewcommand\markdownRendererInputFencedCodePrototype[2]{#1}}%
+\define@key{markdownRendererPrototypes}{headingOne}{%
+ \renewcommand\markdownRendererHeadingOnePrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{headingTwo}{%
+ \renewcommand\markdownRendererHeadingTwoPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{headingThree}{%
+ \renewcommand\markdownRendererHeadingThreePrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{headingFour}{%
+ \renewcommand\markdownRendererHeadingFourPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{headingFive}{%
+ \renewcommand\markdownRendererHeadingFivePrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{headingSix}{%
+ \renewcommand\markdownRendererHeadingSixPrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{horizontalRule}{%
+ \renewcommand\markdownRendererHorizontalRulePrototype{#1}}%
+\define@key{markdownRendererPrototypes}{footnote}{%
+ \renewcommand\markdownRendererFootnotePrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{cite}{%
+ \renewcommand\markdownRendererCitePrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{textCite}{%
+ \renewcommand\markdownRendererTextCitePrototype[1]{#1}}%
+\define@key{markdownRendererPrototypes}{table}{%
+ \renewcommand\markdownRendererTablePrototype[3]{#1}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The following example \LaTeX{} code showcases a possible configuration of the
+% \m{markdownRendererImagePrototype} and \m{markdownRendererCodeSpanPrototype}
+% markdown token renderer prototypes.
+% ``` tex
+% \markdownSetup{
+% rendererPrototypes = {
+% image = {\includegraphics{#2}},
+% codeSpan = {\texttt{#1}}, % Render inline code via `\texttt`.
+% }
+% }
+% ```````
+%
+% \iffalse
+%</latex>
+%<*context>
+% \fi
+% \Hologo{ConTeXt} Interface
+%---------------------------
+% \label{sec:contextinterface}
+%
+% \iffalse
+%</context>
+%<*manual-interfaces>
+
+### \Hologo{ConTeXt}
+
+The \Hologo{ConTeXt} interface provides the same level of functionality as the
+plain \TeX{} interface by using the plain \TeX{} interface behind the scenes.
+Unlike the plain \TeX{} interface, the \Hologo{ConTeXt} interface uses familiar
+\Hologo{ConTeXt} idioms, such as environments.
+
+The \Hologo{ConTeXt} interface accepts the same options as the plain \TeX{}
+interface.
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\def\markdownOptionHybrid{true}
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
+
+Invoking pdfTeX should have the same effect:
+``` sh
+texexec --passon=--shell-escape document.tex
+``````
+
+%</manual-interfaces>
+%<*context>
+% \fi
+%
+% The \Hologo{ConTeXt} interface provides a start-stop macro pair for the
+% typesetting of markdown input from within \Hologo{ConTeXt}. The rest of the
+% interface is inherited from the plain \TeX{} interface (see Section
+% \ref{sec:texinterface}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\writestatus{loading}{ConTeXt User Module / markdown}%
+\unprotect
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \Hologo{ConTeXt} interface is implemented by the
+% `t-markdown.tex` \Hologo{ConTeXt} module file that can be loaded as follows:
+% ``` tex
+% \usemodule[t][markdown]
+% ```````
+% \noindent It is expected that the special plain \TeX{} characters have the
+% expected category codes, when \m{input}ting the file.
+%
+%### Typesetting Markdown
+% The interface exposes the \mdef{startmarkdown} and \mdef{stopmarkdown} macro
+% pair for the typesetting of a markdown document fragment.
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\startmarkdown\relax
+\let\stopmarkdown\relax
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% You may prepend your own code to the \m{startmarkdown} macro and redefine the
+% \m{stopmarkdown} macro to produce special effects before and after the
+% markdown block.
+%
+% Note that the \m{startmarkdown} and \m{stopmarkdown} macros
+% are subject to the same limitations as the \m{markdownBegin} and
+% \m{markdownEnd} macros exposed by the plain \TeX{} interface.
+%
+% The following example \Hologo{ConTeXt} code showcases the usage of the
+% \m{startmarkdown} and \m{stopmarkdown} macros:
+% ``` tex
+% \usemodule[t][markdown]
+% \starttext
+% \startmarkdown
+% _Hello_ **world** ...
+% \stopmarkdown
+% \stoptext
+% ```````
+%
+% Implementation
+%===============
+% \label{sec:implementation}
+% This part of the documentation describes the implementation of the interfaces
+% exposed by the package (see Section \ref{sec:interfaces}) and is aimed at the
+% developers of the package, as well as the curious users.
+%
+% \iffalse
+%</context>
+%<*lua>
+% \fi
+%
+% Lua Implementation
+%-------------------
+% \label{sec:luaimplementation}
+% The Lua implementation implements \luamdef{writer} and \luamdef{reader}
+% objects that provide the conversion from markdown to plain \TeX{}.
+%
+% The Lunamark Lua module implements writers for the conversion to various
+% other formats, such as DocBook, Groff, or \acro{HTML}. These were stripped
+% from the module and the remaining markdown reader and plain \TeX{} writer
+% were hidden behind the converter functions exposed by the Lua interface (see
+% Section \ref{sec:luainterface}).
+%
+% \end{markdown}
+% \begin{macrocode}
+local upper, gsub, format, length =
+ string.upper, string.gsub, string.format, string.len
+local concat = table.concat
+local P, R, S, V, C, Cg, Cb, Cmt, Cc, Ct, B, Cs, any =
+ lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cg, lpeg.Cb,
+ lpeg.Cmt, lpeg.Cc, lpeg.Ct, lpeg.B, lpeg.Cs, lpeg.P(1)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Utility Functions
+% This section documents the utility functions used by the plain \TeX{}
+% writer and the markdown reader. These functions are encapsulated in the
+% `util` object. The functions were originally located in the
+% `lunamark/util.lua` file in the Lunamark Lua module.
+%
+% \end{markdown}
+% \begin{macrocode}
+local util = {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.err} method prints an error message `msg` and exits.
+% If `exit_code` is provided, it specifies the exit code. Otherwise, the
+% exit code will be 1.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.err(msg, exit_code)
+ io.stderr:write("markdown.lua: " .. msg .. "\n")
+ os.exit(exit_code or 1)
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.cache} method computes the digest of `string` and
+% `salt`, adds the `suffix` and looks into the directory `dir`, whether a
+% file with such a name exists. If it does not, it gets created with
+% `transform(string)` as its content. The filename is then returned.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.cache(dir, string, salt, transform, suffix)
+ local digest = md5.sumhexa(string .. (salt or ""))
+ local name = util.pathname(dir, digest .. suffix)
+ local file = io.open(name, "r")
+ if file == nil then -- If no cache entry exists, then create a new one.
+ local file = assert(io.open(name, "w"))
+ local result = string
+ if transform ~= nil then
+ result = transform(result)
+ end
+ assert(file:write(result))
+ assert(file:close())
+ end
+ return name
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.table_copy} method creates a shallow copy of a table `t`
+% and its metatable.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.table_copy(t)
+ local u = { }
+ for k, v in pairs(t) do u[k] = v end
+ return setmetatable(u, getmetatable(t))
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.expand_tabs_in_line} expands tabs in string `s`. If
+% `tabstop` is specified, it is used as the tab stop width. Otherwise,
+% the tab stop width of 4 characters is used. The method is a copy of the tab
+% expansion algorithm from @ierusalimschy13 [Chapter 21].
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.expand_tabs_in_line(s, tabstop)
+ local tab = tabstop or 4
+ local corr = 0
+ return (s:gsub("()\t", function(p)
+ local sp = tab - (p - 1 + corr) % tab
+ corr = corr - 1 + sp
+ return string.rep(" ", sp)
+ end))
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.walk} method walks a rope `t`, applying a function `f`
+% to each leaf element in order. A rope is an array whose elements may be
+% ropes, strings, numbers, or functions. If a leaf element is a function, call
+% it and get the return value before proceeding.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.walk(t, f)
+ local typ = type(t)
+ if typ == "string" then
+ f(t)
+ elseif typ == "table" then
+ local i = 1
+ local n
+ n = t[i]
+ while n do
+ util.walk(n, f)
+ i = i + 1
+ n = t[i]
+ end
+ elseif typ == "function" then
+ local ok, val = pcall(t)
+ if ok then
+ util.walk(val,f)
+ end
+ else
+ f(tostring(t))
+ end
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.flatten} method flattens an array `ary` that does not
+% contain cycles and returns the result.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.flatten(ary)
+ local new = {}
+ for _,v in ipairs(ary) do
+ if type(v) == "table" then
+ for _,w in ipairs(util.flatten(v)) do
+ new[#new + 1] = w
+ end
+ else
+ new[#new + 1] = v
+ end
+ end
+ return new
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.rope_to_string} method converts a rope `rope` to a
+% string and returns it. For the definition of a rope, see the definition of
+% the \luam{util.walk} method.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.rope_to_string(rope)
+ local buffer = {}
+ util.walk(rope, function(x) buffer[#buffer + 1] = x end)
+ return table.concat(buffer)
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.rope_last} method retrieves the last item in a rope. For
+% the definition of a rope, see the definition of the \luam{util.walk} method.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.rope_last(rope)
+ if #rope == 0 then
+ return nil
+ else
+ local l = rope[#rope]
+ if type(l) == "table" then
+ return util.rope_last(l)
+ else
+ return l
+ end
+ end
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Given an array `ary` and a string `x`, the \luamdef{util.intersperse}
+% method returns an array `new`, such that `ary[i] == new[2*(i-1)+1]` and
+% `new[2*i] == x` for all $1\leq`i`\leq`#ary`$.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.intersperse(ary, x)
+ local new = {}
+ local l = #ary
+ for i,v in ipairs(ary) do
+ local n = #new
+ new[n + 1] = v
+ if i ~= l then
+ new[n + 2] = x
+ end
+ end
+ return new
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Given an array `ary` and a function `f`, the \luamdef{util.map} method
+% returns an array `new`, such that `new[i] == f(ary[i])` for all
+% $1\leq`i`\leq`#ary`$.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.map(ary, f)
+ local new = {}
+ for i,v in ipairs(ary) do
+ new[i] = f(v)
+ end
+ return new
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Given a table `char_escapes` mapping escapable characters to escaped
+% strings and optionally a table `string_escapes` mapping escapable strings
+% to escaped strings, the \luamdef{util.escaper} method returns an escaper
+% function that escapes all occurances of escapable strings and characters (in
+% this order).
+%
+% The method uses \pkg{LPeg}, which is faster than the Lua `string.gsub`
+% built-in method.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.escaper(char_escapes, string_escapes)
+% \end{macrocode}
+% \begin{markdown}
+% Build a string of escapable characters.
+% \end{markdown}
+% \begin{macrocode}
+ local char_escapes_list = ""
+ for i,_ in pairs(char_escapes) do
+ char_escapes_list = char_escapes_list .. i
+ end
+% \end{macrocode}
+% \begin{markdown}
+% Create an \pkg{LPeg} capture `escapable` that produces the escaped string
+% corresponding to the matched escapable character.
+% \end{markdown}
+% \begin{macrocode}
+ local escapable = S(char_escapes_list) / char_escapes
+% \end{macrocode}
+% \begin{markdown}
+% If `string_escapes` is provided, turn `escapable` into the
+% $$\sum^^B{(`k`, `v`)\in`string_escapes`}`P(k) / v` + `escapable`$$
+% capture that replaces any occurance of the string `k` with the string
+% `v` for each $(`k`, `v`)\in`string_escapes`$. Note that the pattern
+% summation is not commutative and its operands are inspected in the
+% summation order during the matching. As a corrolary, the strings always
+% take precedence over the characters.
+%
+% \end{markdown}
+% \begin{macrocode}
+ if string_escapes then
+ for k,v in pairs(string_escapes) do
+ escapable = P(k) / v + escapable
+ end
+ end
+% \end{macrocode}
+% \begin{markdown}
+% Create an \pkg{LPeg} capture `escape_string` that captures anything
+% `escapable` does and matches any other unmatched characters.
+% \end{markdown}
+% \begin{macrocode}
+ local escape_string = Cs((escapable + any)^0)
+% \end{macrocode}
+% \begin{markdown}
+% Return a function that matches the input string `s` against the
+% `escape_string` capture.
+% \end{markdown}
+% \begin{macrocode}
+ return function(s)
+ return lpeg.match(escape_string, s)
+ end
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{util.pathname} method produces a pathname out of a directory
+% name `dir` and a filename `file` and returns it.
+%
+% \end{markdown}
+% \begin{macrocode}
+function util.pathname(dir, file)
+ if #dir == 0 then
+ return file
+ else
+ return dir .. "/" .. file
+ end
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### HTML Entities
+% This section documents the \acro{HTML} entities recognized by the
+% markdown reader. These functions are encapsulated in the `entities`
+% object. The functions were originally located in the
+% `lunamark/entities.lua` file in the Lunamark Lua module.
+%
+% \end{markdown}
+% \begin{macrocode}
+local entities = {}
+
+local character_entities = {
+ ["Tab"] = 9,
+ ["NewLine"] = 10,
+ ["excl"] = 33,
+ ["quot"] = 34,
+ ["QUOT"] = 34,
+ ["num"] = 35,
+ ["dollar"] = 36,
+ ["percnt"] = 37,
+ ["amp"] = 38,
+ ["AMP"] = 38,
+ ["apos"] = 39,
+ ["lpar"] = 40,
+ ["rpar"] = 41,
+ ["ast"] = 42,
+ ["midast"] = 42,
+ ["plus"] = 43,
+ ["comma"] = 44,
+ ["period"] = 46,
+ ["sol"] = 47,
+ ["colon"] = 58,
+ ["semi"] = 59,
+ ["lt"] = 60,
+ ["LT"] = 60,
+ ["equals"] = 61,
+ ["gt"] = 62,
+ ["GT"] = 62,
+ ["quest"] = 63,
+ ["commat"] = 64,
+ ["lsqb"] = 91,
+ ["lbrack"] = 91,
+ ["bsol"] = 92,
+ ["rsqb"] = 93,
+ ["rbrack"] = 93,
+ ["Hat"] = 94,
+ ["lowbar"] = 95,
+ ["grave"] = 96,
+ ["DiacriticalGrave"] = 96,
+ ["lcub"] = 123,
+ ["lbrace"] = 123,
+ ["verbar"] = 124,
+ ["vert"] = 124,
+ ["VerticalLine"] = 124,
+ ["rcub"] = 125,
+ ["rbrace"] = 125,
+ ["nbsp"] = 160,
+ ["NonBreakingSpace"] = 160,
+ ["iexcl"] = 161,
+ ["cent"] = 162,
+ ["pound"] = 163,
+ ["curren"] = 164,
+ ["yen"] = 165,
+ ["brvbar"] = 166,
+ ["sect"] = 167,
+ ["Dot"] = 168,
+ ["die"] = 168,
+ ["DoubleDot"] = 168,
+ ["uml"] = 168,
+ ["copy"] = 169,
+ ["COPY"] = 169,
+ ["ordf"] = 170,
+ ["laquo"] = 171,
+ ["not"] = 172,
+ ["shy"] = 173,
+ ["reg"] = 174,
+ ["circledR"] = 174,
+ ["REG"] = 174,
+ ["macr"] = 175,
+ ["OverBar"] = 175,
+ ["strns"] = 175,
+ ["deg"] = 176,
+ ["plusmn"] = 177,
+ ["pm"] = 177,
+ ["PlusMinus"] = 177,
+ ["sup2"] = 178,
+ ["sup3"] = 179,
+ ["acute"] = 180,
+ ["DiacriticalAcute"] = 180,
+ ["micro"] = 181,
+ ["para"] = 182,
+ ["middot"] = 183,
+ ["centerdot"] = 183,
+ ["CenterDot"] = 183,
+ ["cedil"] = 184,
+ ["Cedilla"] = 184,
+ ["sup1"] = 185,
+ ["ordm"] = 186,
+ ["raquo"] = 187,
+ ["frac14"] = 188,
+ ["frac12"] = 189,
+ ["half"] = 189,
+ ["frac34"] = 190,
+ ["iquest"] = 191,
+ ["Agrave"] = 192,
+ ["Aacute"] = 193,
+ ["Acirc"] = 194,
+ ["Atilde"] = 195,
+ ["Auml"] = 196,
+ ["Aring"] = 197,
+ ["AElig"] = 198,
+ ["Ccedil"] = 199,
+ ["Egrave"] = 200,
+ ["Eacute"] = 201,
+ ["Ecirc"] = 202,
+ ["Euml"] = 203,
+ ["Igrave"] = 204,
+ ["Iacute"] = 205,
+ ["Icirc"] = 206,
+ ["Iuml"] = 207,
+ ["ETH"] = 208,
+ ["Ntilde"] = 209,
+ ["Ograve"] = 210,
+ ["Oacute"] = 211,
+ ["Ocirc"] = 212,
+ ["Otilde"] = 213,
+ ["Ouml"] = 214,
+ ["times"] = 215,
+ ["Oslash"] = 216,
+ ["Ugrave"] = 217,
+ ["Uacute"] = 218,
+ ["Ucirc"] = 219,
+ ["Uuml"] = 220,
+ ["Yacute"] = 221,
+ ["THORN"] = 222,
+ ["szlig"] = 223,
+ ["agrave"] = 224,
+ ["aacute"] = 225,
+ ["acirc"] = 226,
+ ["atilde"] = 227,
+ ["auml"] = 228,
+ ["aring"] = 229,
+ ["aelig"] = 230,
+ ["ccedil"] = 231,
+ ["egrave"] = 232,
+ ["eacute"] = 233,
+ ["ecirc"] = 234,
+ ["euml"] = 235,
+ ["igrave"] = 236,
+ ["iacute"] = 237,
+ ["icirc"] = 238,
+ ["iuml"] = 239,
+ ["eth"] = 240,
+ ["ntilde"] = 241,
+ ["ograve"] = 242,
+ ["oacute"] = 243,
+ ["ocirc"] = 244,
+ ["otilde"] = 245,
+ ["ouml"] = 246,
+ ["divide"] = 247,
+ ["div"] = 247,
+ ["oslash"] = 248,
+ ["ugrave"] = 249,
+ ["uacute"] = 250,
+ ["ucirc"] = 251,
+ ["uuml"] = 252,
+ ["yacute"] = 253,
+ ["thorn"] = 254,
+ ["yuml"] = 255,
+ ["Amacr"] = 256,
+ ["amacr"] = 257,
+ ["Abreve"] = 258,
+ ["abreve"] = 259,
+ ["Aogon"] = 260,
+ ["aogon"] = 261,
+ ["Cacute"] = 262,
+ ["cacute"] = 263,
+ ["Ccirc"] = 264,
+ ["ccirc"] = 265,
+ ["Cdot"] = 266,
+ ["cdot"] = 267,
+ ["Ccaron"] = 268,
+ ["ccaron"] = 269,
+ ["Dcaron"] = 270,
+ ["dcaron"] = 271,
+ ["Dstrok"] = 272,
+ ["dstrok"] = 273,
+ ["Emacr"] = 274,
+ ["emacr"] = 275,
+ ["Edot"] = 278,
+ ["edot"] = 279,
+ ["Eogon"] = 280,
+ ["eogon"] = 281,
+ ["Ecaron"] = 282,
+ ["ecaron"] = 283,
+ ["Gcirc"] = 284,
+ ["gcirc"] = 285,
+ ["Gbreve"] = 286,
+ ["gbreve"] = 287,
+ ["Gdot"] = 288,
+ ["gdot"] = 289,
+ ["Gcedil"] = 290,
+ ["Hcirc"] = 292,
+ ["hcirc"] = 293,
+ ["Hstrok"] = 294,
+ ["hstrok"] = 295,
+ ["Itilde"] = 296,
+ ["itilde"] = 297,
+ ["Imacr"] = 298,
+ ["imacr"] = 299,
+ ["Iogon"] = 302,
+ ["iogon"] = 303,
+ ["Idot"] = 304,
+ ["imath"] = 305,
+ ["inodot"] = 305,
+ ["IJlig"] = 306,
+ ["ijlig"] = 307,
+ ["Jcirc"] = 308,
+ ["jcirc"] = 309,
+ ["Kcedil"] = 310,
+ ["kcedil"] = 311,
+ ["kgreen"] = 312,
+ ["Lacute"] = 313,
+ ["lacute"] = 314,
+ ["Lcedil"] = 315,
+ ["lcedil"] = 316,
+ ["Lcaron"] = 317,
+ ["lcaron"] = 318,
+ ["Lmidot"] = 319,
+ ["lmidot"] = 320,
+ ["Lstrok"] = 321,
+ ["lstrok"] = 322,
+ ["Nacute"] = 323,
+ ["nacute"] = 324,
+ ["Ncedil"] = 325,
+ ["ncedil"] = 326,
+ ["Ncaron"] = 327,
+ ["ncaron"] = 328,
+ ["napos"] = 329,
+ ["ENG"] = 330,
+ ["eng"] = 331,
+ ["Omacr"] = 332,
+ ["omacr"] = 333,
+ ["Odblac"] = 336,
+ ["odblac"] = 337,
+ ["OElig"] = 338,
+ ["oelig"] = 339,
+ ["Racute"] = 340,
+ ["racute"] = 341,
+ ["Rcedil"] = 342,
+ ["rcedil"] = 343,
+ ["Rcaron"] = 344,
+ ["rcaron"] = 345,
+ ["Sacute"] = 346,
+ ["sacute"] = 347,
+ ["Scirc"] = 348,
+ ["scirc"] = 349,
+ ["Scedil"] = 350,
+ ["scedil"] = 351,
+ ["Scaron"] = 352,
+ ["scaron"] = 353,
+ ["Tcedil"] = 354,
+ ["tcedil"] = 355,
+ ["Tcaron"] = 356,
+ ["tcaron"] = 357,
+ ["Tstrok"] = 358,
+ ["tstrok"] = 359,
+ ["Utilde"] = 360,
+ ["utilde"] = 361,
+ ["Umacr"] = 362,
+ ["umacr"] = 363,
+ ["Ubreve"] = 364,
+ ["ubreve"] = 365,
+ ["Uring"] = 366,
+ ["uring"] = 367,
+ ["Udblac"] = 368,
+ ["udblac"] = 369,
+ ["Uogon"] = 370,
+ ["uogon"] = 371,
+ ["Wcirc"] = 372,
+ ["wcirc"] = 373,
+ ["Ycirc"] = 374,
+ ["ycirc"] = 375,
+ ["Yuml"] = 376,
+ ["Zacute"] = 377,
+ ["zacute"] = 378,
+ ["Zdot"] = 379,
+ ["zdot"] = 380,
+ ["Zcaron"] = 381,
+ ["zcaron"] = 382,
+ ["fnof"] = 402,
+ ["imped"] = 437,
+ ["gacute"] = 501,
+ ["jmath"] = 567,
+ ["circ"] = 710,
+ ["caron"] = 711,
+ ["Hacek"] = 711,
+ ["breve"] = 728,
+ ["Breve"] = 728,
+ ["dot"] = 729,
+ ["DiacriticalDot"] = 729,
+ ["ring"] = 730,
+ ["ogon"] = 731,
+ ["tilde"] = 732,
+ ["DiacriticalTilde"] = 732,
+ ["dblac"] = 733,
+ ["DiacriticalDoubleAcute"] = 733,
+ ["DownBreve"] = 785,
+ ["UnderBar"] = 818,
+ ["Alpha"] = 913,
+ ["Beta"] = 914,
+ ["Gamma"] = 915,
+ ["Delta"] = 916,
+ ["Epsilon"] = 917,
+ ["Zeta"] = 918,
+ ["Eta"] = 919,
+ ["Theta"] = 920,
+ ["Iota"] = 921,
+ ["Kappa"] = 922,
+ ["Lambda"] = 923,
+ ["Mu"] = 924,
+ ["Nu"] = 925,
+ ["Xi"] = 926,
+ ["Omicron"] = 927,
+ ["Pi"] = 928,
+ ["Rho"] = 929,
+ ["Sigma"] = 931,
+ ["Tau"] = 932,
+ ["Upsilon"] = 933,
+ ["Phi"] = 934,
+ ["Chi"] = 935,
+ ["Psi"] = 936,
+ ["Omega"] = 937,
+ ["alpha"] = 945,
+ ["beta"] = 946,
+ ["gamma"] = 947,
+ ["delta"] = 948,
+ ["epsiv"] = 949,
+ ["varepsilon"] = 949,
+ ["epsilon"] = 949,
+ ["zeta"] = 950,
+ ["eta"] = 951,
+ ["theta"] = 952,
+ ["iota"] = 953,
+ ["kappa"] = 954,
+ ["lambda"] = 955,
+ ["mu"] = 956,
+ ["nu"] = 957,
+ ["xi"] = 958,
+ ["omicron"] = 959,
+ ["pi"] = 960,
+ ["rho"] = 961,
+ ["sigmav"] = 962,
+ ["varsigma"] = 962,
+ ["sigmaf"] = 962,
+ ["sigma"] = 963,
+ ["tau"] = 964,
+ ["upsi"] = 965,
+ ["upsilon"] = 965,
+ ["phi"] = 966,
+ ["phiv"] = 966,
+ ["varphi"] = 966,
+ ["chi"] = 967,
+ ["psi"] = 968,
+ ["omega"] = 969,
+ ["thetav"] = 977,
+ ["vartheta"] = 977,
+ ["thetasym"] = 977,
+ ["Upsi"] = 978,
+ ["upsih"] = 978,
+ ["straightphi"] = 981,
+ ["piv"] = 982,
+ ["varpi"] = 982,
+ ["Gammad"] = 988,
+ ["gammad"] = 989,
+ ["digamma"] = 989,
+ ["kappav"] = 1008,
+ ["varkappa"] = 1008,
+ ["rhov"] = 1009,
+ ["varrho"] = 1009,
+ ["epsi"] = 1013,
+ ["straightepsilon"] = 1013,
+ ["bepsi"] = 1014,
+ ["backepsilon"] = 1014,
+ ["IOcy"] = 1025,
+ ["DJcy"] = 1026,
+ ["GJcy"] = 1027,
+ ["Jukcy"] = 1028,
+ ["DScy"] = 1029,
+ ["Iukcy"] = 1030,
+ ["YIcy"] = 1031,
+ ["Jsercy"] = 1032,
+ ["LJcy"] = 1033,
+ ["NJcy"] = 1034,
+ ["TSHcy"] = 1035,
+ ["KJcy"] = 1036,
+ ["Ubrcy"] = 1038,
+ ["DZcy"] = 1039,
+ ["Acy"] = 1040,
+ ["Bcy"] = 1041,
+ ["Vcy"] = 1042,
+ ["Gcy"] = 1043,
+ ["Dcy"] = 1044,
+ ["IEcy"] = 1045,
+ ["ZHcy"] = 1046,
+ ["Zcy"] = 1047,
+ ["Icy"] = 1048,
+ ["Jcy"] = 1049,
+ ["Kcy"] = 1050,
+ ["Lcy"] = 1051,
+ ["Mcy"] = 1052,
+ ["Ncy"] = 1053,
+ ["Ocy"] = 1054,
+ ["Pcy"] = 1055,
+ ["Rcy"] = 1056,
+ ["Scy"] = 1057,
+ ["Tcy"] = 1058,
+ ["Ucy"] = 1059,
+ ["Fcy"] = 1060,
+ ["KHcy"] = 1061,
+ ["TScy"] = 1062,
+ ["CHcy"] = 1063,
+ ["SHcy"] = 1064,
+ ["SHCHcy"] = 1065,
+ ["HARDcy"] = 1066,
+ ["Ycy"] = 1067,
+ ["SOFTcy"] = 1068,
+ ["Ecy"] = 1069,
+ ["YUcy"] = 1070,
+ ["YAcy"] = 1071,
+ ["acy"] = 1072,
+ ["bcy"] = 1073,
+ ["vcy"] = 1074,
+ ["gcy"] = 1075,
+ ["dcy"] = 1076,
+ ["iecy"] = 1077,
+ ["zhcy"] = 1078,
+ ["zcy"] = 1079,
+ ["icy"] = 1080,
+ ["jcy"] = 1081,
+ ["kcy"] = 1082,
+ ["lcy"] = 1083,
+ ["mcy"] = 1084,
+ ["ncy"] = 1085,
+ ["ocy"] = 1086,
+ ["pcy"] = 1087,
+ ["rcy"] = 1088,
+ ["scy"] = 1089,
+ ["tcy"] = 1090,
+ ["ucy"] = 1091,
+ ["fcy"] = 1092,
+ ["khcy"] = 1093,
+ ["tscy"] = 1094,
+ ["chcy"] = 1095,
+ ["shcy"] = 1096,
+ ["shchcy"] = 1097,
+ ["hardcy"] = 1098,
+ ["ycy"] = 1099,
+ ["softcy"] = 1100,
+ ["ecy"] = 1101,
+ ["yucy"] = 1102,
+ ["yacy"] = 1103,
+ ["iocy"] = 1105,
+ ["djcy"] = 1106,
+ ["gjcy"] = 1107,
+ ["jukcy"] = 1108,
+ ["dscy"] = 1109,
+ ["iukcy"] = 1110,
+ ["yicy"] = 1111,
+ ["jsercy"] = 1112,
+ ["ljcy"] = 1113,
+ ["njcy"] = 1114,
+ ["tshcy"] = 1115,
+ ["kjcy"] = 1116,
+ ["ubrcy"] = 1118,
+ ["dzcy"] = 1119,
+ ["ensp"] = 8194,
+ ["emsp"] = 8195,
+ ["emsp13"] = 8196,
+ ["emsp14"] = 8197,
+ ["numsp"] = 8199,
+ ["puncsp"] = 8200,
+ ["thinsp"] = 8201,
+ ["ThinSpace"] = 8201,
+ ["hairsp"] = 8202,
+ ["VeryThinSpace"] = 8202,
+ ["ZeroWidthSpace"] = 8203,
+ ["NegativeVeryThinSpace"] = 8203,
+ ["NegativeThinSpace"] = 8203,
+ ["NegativeMediumSpace"] = 8203,
+ ["NegativeThickSpace"] = 8203,
+ ["zwnj"] = 8204,
+ ["zwj"] = 8205,
+ ["lrm"] = 8206,
+ ["rlm"] = 8207,
+ ["hyphen"] = 8208,
+ ["dash"] = 8208,
+ ["ndash"] = 8211,
+ ["mdash"] = 8212,
+ ["horbar"] = 8213,
+ ["Verbar"] = 8214,
+ ["Vert"] = 8214,
+ ["lsquo"] = 8216,
+ ["OpenCurlyQuote"] = 8216,
+ ["rsquo"] = 8217,
+ ["rsquor"] = 8217,
+ ["CloseCurlyQuote"] = 8217,
+ ["lsquor"] = 8218,
+ ["sbquo"] = 8218,
+ ["ldquo"] = 8220,
+ ["OpenCurlyDoubleQuote"] = 8220,
+ ["rdquo"] = 8221,
+ ["rdquor"] = 8221,
+ ["CloseCurlyDoubleQuote"] = 8221,
+ ["ldquor"] = 8222,
+ ["bdquo"] = 8222,
+ ["dagger"] = 8224,
+ ["Dagger"] = 8225,
+ ["ddagger"] = 8225,
+ ["bull"] = 8226,
+ ["bullet"] = 8226,
+ ["nldr"] = 8229,
+ ["hellip"] = 8230,
+ ["mldr"] = 8230,
+ ["permil"] = 8240,
+ ["pertenk"] = 8241,
+ ["prime"] = 8242,
+ ["Prime"] = 8243,
+ ["tprime"] = 8244,
+ ["bprime"] = 8245,
+ ["backprime"] = 8245,
+ ["lsaquo"] = 8249,
+ ["rsaquo"] = 8250,
+ ["oline"] = 8254,
+ ["caret"] = 8257,
+ ["hybull"] = 8259,
+ ["frasl"] = 8260,
+ ["bsemi"] = 8271,
+ ["qprime"] = 8279,
+ ["MediumSpace"] = 8287,
+ ["NoBreak"] = 8288,
+ ["ApplyFunction"] = 8289,
+ ["af"] = 8289,
+ ["InvisibleTimes"] = 8290,
+ ["it"] = 8290,
+ ["InvisibleComma"] = 8291,
+ ["ic"] = 8291,
+ ["euro"] = 8364,
+ ["tdot"] = 8411,
+ ["TripleDot"] = 8411,
+ ["DotDot"] = 8412,
+ ["Copf"] = 8450,
+ ["complexes"] = 8450,
+ ["incare"] = 8453,
+ ["gscr"] = 8458,
+ ["hamilt"] = 8459,
+ ["HilbertSpace"] = 8459,
+ ["Hscr"] = 8459,
+ ["Hfr"] = 8460,
+ ["Poincareplane"] = 8460,
+ ["quaternions"] = 8461,
+ ["Hopf"] = 8461,
+ ["planckh"] = 8462,
+ ["planck"] = 8463,
+ ["hbar"] = 8463,
+ ["plankv"] = 8463,
+ ["hslash"] = 8463,
+ ["Iscr"] = 8464,
+ ["imagline"] = 8464,
+ ["image"] = 8465,
+ ["Im"] = 8465,
+ ["imagpart"] = 8465,
+ ["Ifr"] = 8465,
+ ["Lscr"] = 8466,
+ ["lagran"] = 8466,
+ ["Laplacetrf"] = 8466,
+ ["ell"] = 8467,
+ ["Nopf"] = 8469,
+ ["naturals"] = 8469,
+ ["numero"] = 8470,
+ ["copysr"] = 8471,
+ ["weierp"] = 8472,
+ ["wp"] = 8472,
+ ["Popf"] = 8473,
+ ["primes"] = 8473,
+ ["rationals"] = 8474,
+ ["Qopf"] = 8474,
+ ["Rscr"] = 8475,
+ ["realine"] = 8475,
+ ["real"] = 8476,
+ ["Re"] = 8476,
+ ["realpart"] = 8476,
+ ["Rfr"] = 8476,
+ ["reals"] = 8477,
+ ["Ropf"] = 8477,
+ ["rx"] = 8478,
+ ["trade"] = 8482,
+ ["TRADE"] = 8482,
+ ["integers"] = 8484,
+ ["Zopf"] = 8484,
+ ["ohm"] = 8486,
+ ["mho"] = 8487,
+ ["Zfr"] = 8488,
+ ["zeetrf"] = 8488,
+ ["iiota"] = 8489,
+ ["angst"] = 8491,
+ ["bernou"] = 8492,
+ ["Bernoullis"] = 8492,
+ ["Bscr"] = 8492,
+ ["Cfr"] = 8493,
+ ["Cayleys"] = 8493,
+ ["escr"] = 8495,
+ ["Escr"] = 8496,
+ ["expectation"] = 8496,
+ ["Fscr"] = 8497,
+ ["Fouriertrf"] = 8497,
+ ["phmmat"] = 8499,
+ ["Mellintrf"] = 8499,
+ ["Mscr"] = 8499,
+ ["order"] = 8500,
+ ["orderof"] = 8500,
+ ["oscr"] = 8500,
+ ["alefsym"] = 8501,
+ ["aleph"] = 8501,
+ ["beth"] = 8502,
+ ["gimel"] = 8503,
+ ["daleth"] = 8504,
+ ["CapitalDifferentialD"] = 8517,
+ ["DD"] = 8517,
+ ["DifferentialD"] = 8518,
+ ["dd"] = 8518,
+ ["ExponentialE"] = 8519,
+ ["exponentiale"] = 8519,
+ ["ee"] = 8519,
+ ["ImaginaryI"] = 8520,
+ ["ii"] = 8520,
+ ["frac13"] = 8531,
+ ["frac23"] = 8532,
+ ["frac15"] = 8533,
+ ["frac25"] = 8534,
+ ["frac35"] = 8535,
+ ["frac45"] = 8536,
+ ["frac16"] = 8537,
+ ["frac56"] = 8538,
+ ["frac18"] = 8539,
+ ["frac38"] = 8540,
+ ["frac58"] = 8541,
+ ["frac78"] = 8542,
+ ["larr"] = 8592,
+ ["leftarrow"] = 8592,
+ ["LeftArrow"] = 8592,
+ ["slarr"] = 8592,
+ ["ShortLeftArrow"] = 8592,
+ ["uarr"] = 8593,
+ ["uparrow"] = 8593,
+ ["UpArrow"] = 8593,
+ ["ShortUpArrow"] = 8593,
+ ["rarr"] = 8594,
+ ["rightarrow"] = 8594,
+ ["RightArrow"] = 8594,
+ ["srarr"] = 8594,
+ ["ShortRightArrow"] = 8594,
+ ["darr"] = 8595,
+ ["downarrow"] = 8595,
+ ["DownArrow"] = 8595,
+ ["ShortDownArrow"] = 8595,
+ ["harr"] = 8596,
+ ["leftrightarrow"] = 8596,
+ ["LeftRightArrow"] = 8596,
+ ["varr"] = 8597,
+ ["updownarrow"] = 8597,
+ ["UpDownArrow"] = 8597,
+ ["nwarr"] = 8598,
+ ["UpperLeftArrow"] = 8598,
+ ["nwarrow"] = 8598,
+ ["nearr"] = 8599,
+ ["UpperRightArrow"] = 8599,
+ ["nearrow"] = 8599,
+ ["searr"] = 8600,
+ ["searrow"] = 8600,
+ ["LowerRightArrow"] = 8600,
+ ["swarr"] = 8601,
+ ["swarrow"] = 8601,
+ ["LowerLeftArrow"] = 8601,
+ ["nlarr"] = 8602,
+ ["nleftarrow"] = 8602,
+ ["nrarr"] = 8603,
+ ["nrightarrow"] = 8603,
+ ["rarrw"] = 8605,
+ ["rightsquigarrow"] = 8605,
+ ["Larr"] = 8606,
+ ["twoheadleftarrow"] = 8606,
+ ["Uarr"] = 8607,
+ ["Rarr"] = 8608,
+ ["twoheadrightarrow"] = 8608,
+ ["Darr"] = 8609,
+ ["larrtl"] = 8610,
+ ["leftarrowtail"] = 8610,
+ ["rarrtl"] = 8611,
+ ["rightarrowtail"] = 8611,
+ ["LeftTeeArrow"] = 8612,
+ ["mapstoleft"] = 8612,
+ ["UpTeeArrow"] = 8613,
+ ["mapstoup"] = 8613,
+ ["map"] = 8614,
+ ["RightTeeArrow"] = 8614,
+ ["mapsto"] = 8614,
+ ["DownTeeArrow"] = 8615,
+ ["mapstodown"] = 8615,
+ ["larrhk"] = 8617,
+ ["hookleftarrow"] = 8617,
+ ["rarrhk"] = 8618,
+ ["hookrightarrow"] = 8618,
+ ["larrlp"] = 8619,
+ ["looparrowleft"] = 8619,
+ ["rarrlp"] = 8620,
+ ["looparrowright"] = 8620,
+ ["harrw"] = 8621,
+ ["leftrightsquigarrow"] = 8621,
+ ["nharr"] = 8622,
+ ["nleftrightarrow"] = 8622,
+ ["lsh"] = 8624,
+ ["Lsh"] = 8624,
+ ["rsh"] = 8625,
+ ["Rsh"] = 8625,
+ ["ldsh"] = 8626,
+ ["rdsh"] = 8627,
+ ["crarr"] = 8629,
+ ["cularr"] = 8630,
+ ["curvearrowleft"] = 8630,
+ ["curarr"] = 8631,
+ ["curvearrowright"] = 8631,
+ ["olarr"] = 8634,
+ ["circlearrowleft"] = 8634,
+ ["orarr"] = 8635,
+ ["circlearrowright"] = 8635,
+ ["lharu"] = 8636,
+ ["LeftVector"] = 8636,
+ ["leftharpoonup"] = 8636,
+ ["lhard"] = 8637,
+ ["leftharpoondown"] = 8637,
+ ["DownLeftVector"] = 8637,
+ ["uharr"] = 8638,
+ ["upharpoonright"] = 8638,
+ ["RightUpVector"] = 8638,
+ ["uharl"] = 8639,
+ ["upharpoonleft"] = 8639,
+ ["LeftUpVector"] = 8639,
+ ["rharu"] = 8640,
+ ["RightVector"] = 8640,
+ ["rightharpoonup"] = 8640,
+ ["rhard"] = 8641,
+ ["rightharpoondown"] = 8641,
+ ["DownRightVector"] = 8641,
+ ["dharr"] = 8642,
+ ["RightDownVector"] = 8642,
+ ["downharpoonright"] = 8642,
+ ["dharl"] = 8643,
+ ["LeftDownVector"] = 8643,
+ ["downharpoonleft"] = 8643,
+ ["rlarr"] = 8644,
+ ["rightleftarrows"] = 8644,
+ ["RightArrowLeftArrow"] = 8644,
+ ["udarr"] = 8645,
+ ["UpArrowDownArrow"] = 8645,
+ ["lrarr"] = 8646,
+ ["leftrightarrows"] = 8646,
+ ["LeftArrowRightArrow"] = 8646,
+ ["llarr"] = 8647,
+ ["leftleftarrows"] = 8647,
+ ["uuarr"] = 8648,
+ ["upuparrows"] = 8648,
+ ["rrarr"] = 8649,
+ ["rightrightarrows"] = 8649,
+ ["ddarr"] = 8650,
+ ["downdownarrows"] = 8650,
+ ["lrhar"] = 8651,
+ ["ReverseEquilibrium"] = 8651,
+ ["leftrightharpoons"] = 8651,
+ ["rlhar"] = 8652,
+ ["rightleftharpoons"] = 8652,
+ ["Equilibrium"] = 8652,
+ ["nlArr"] = 8653,
+ ["nLeftarrow"] = 8653,
+ ["nhArr"] = 8654,
+ ["nLeftrightarrow"] = 8654,
+ ["nrArr"] = 8655,
+ ["nRightarrow"] = 8655,
+ ["lArr"] = 8656,
+ ["Leftarrow"] = 8656,
+ ["DoubleLeftArrow"] = 8656,
+ ["uArr"] = 8657,
+ ["Uparrow"] = 8657,
+ ["DoubleUpArrow"] = 8657,
+ ["rArr"] = 8658,
+ ["Rightarrow"] = 8658,
+ ["Implies"] = 8658,
+ ["DoubleRightArrow"] = 8658,
+ ["dArr"] = 8659,
+ ["Downarrow"] = 8659,
+ ["DoubleDownArrow"] = 8659,
+ ["hArr"] = 8660,
+ ["Leftrightarrow"] = 8660,
+ ["DoubleLeftRightArrow"] = 8660,
+ ["iff"] = 8660,
+ ["vArr"] = 8661,
+ ["Updownarrow"] = 8661,
+ ["DoubleUpDownArrow"] = 8661,
+ ["nwArr"] = 8662,
+ ["neArr"] = 8663,
+ ["seArr"] = 8664,
+ ["swArr"] = 8665,
+ ["lAarr"] = 8666,
+ ["Lleftarrow"] = 8666,
+ ["rAarr"] = 8667,
+ ["Rrightarrow"] = 8667,
+ ["zigrarr"] = 8669,
+ ["larrb"] = 8676,
+ ["LeftArrowBar"] = 8676,
+ ["rarrb"] = 8677,
+ ["RightArrowBar"] = 8677,
+ ["duarr"] = 8693,
+ ["DownArrowUpArrow"] = 8693,
+ ["loarr"] = 8701,
+ ["roarr"] = 8702,
+ ["hoarr"] = 8703,
+ ["forall"] = 8704,
+ ["ForAll"] = 8704,
+ ["comp"] = 8705,
+ ["complement"] = 8705,
+ ["part"] = 8706,
+ ["PartialD"] = 8706,
+ ["exist"] = 8707,
+ ["Exists"] = 8707,
+ ["nexist"] = 8708,
+ ["NotExists"] = 8708,
+ ["nexists"] = 8708,
+ ["empty"] = 8709,
+ ["emptyset"] = 8709,
+ ["emptyv"] = 8709,
+ ["varnothing"] = 8709,
+ ["nabla"] = 8711,
+ ["Del"] = 8711,
+ ["isin"] = 8712,
+ ["isinv"] = 8712,
+ ["Element"] = 8712,
+ ["in"] = 8712,
+ ["notin"] = 8713,
+ ["NotElement"] = 8713,
+ ["notinva"] = 8713,
+ ["niv"] = 8715,
+ ["ReverseElement"] = 8715,
+ ["ni"] = 8715,
+ ["SuchThat"] = 8715,
+ ["notni"] = 8716,
+ ["notniva"] = 8716,
+ ["NotReverseElement"] = 8716,
+ ["prod"] = 8719,
+ ["Product"] = 8719,
+ ["coprod"] = 8720,
+ ["Coproduct"] = 8720,
+ ["sum"] = 8721,
+ ["Sum"] = 8721,
+ ["minus"] = 8722,
+ ["mnplus"] = 8723,
+ ["mp"] = 8723,
+ ["MinusPlus"] = 8723,
+ ["plusdo"] = 8724,
+ ["dotplus"] = 8724,
+ ["setmn"] = 8726,
+ ["setminus"] = 8726,
+ ["Backslash"] = 8726,
+ ["ssetmn"] = 8726,
+ ["smallsetminus"] = 8726,
+ ["lowast"] = 8727,
+ ["compfn"] = 8728,
+ ["SmallCircle"] = 8728,
+ ["radic"] = 8730,
+ ["Sqrt"] = 8730,
+ ["prop"] = 8733,
+ ["propto"] = 8733,
+ ["Proportional"] = 8733,
+ ["vprop"] = 8733,
+ ["varpropto"] = 8733,
+ ["infin"] = 8734,
+ ["angrt"] = 8735,
+ ["ang"] = 8736,
+ ["angle"] = 8736,
+ ["angmsd"] = 8737,
+ ["measuredangle"] = 8737,
+ ["angsph"] = 8738,
+ ["mid"] = 8739,
+ ["VerticalBar"] = 8739,
+ ["smid"] = 8739,
+ ["shortmid"] = 8739,
+ ["nmid"] = 8740,
+ ["NotVerticalBar"] = 8740,
+ ["nsmid"] = 8740,
+ ["nshortmid"] = 8740,
+ ["par"] = 8741,
+ ["parallel"] = 8741,
+ ["DoubleVerticalBar"] = 8741,
+ ["spar"] = 8741,
+ ["shortparallel"] = 8741,
+ ["npar"] = 8742,
+ ["nparallel"] = 8742,
+ ["NotDoubleVerticalBar"] = 8742,
+ ["nspar"] = 8742,
+ ["nshortparallel"] = 8742,
+ ["and"] = 8743,
+ ["wedge"] = 8743,
+ ["or"] = 8744,
+ ["vee"] = 8744,
+ ["cap"] = 8745,
+ ["cup"] = 8746,
+ ["int"] = 8747,
+ ["Integral"] = 8747,
+ ["Int"] = 8748,
+ ["tint"] = 8749,
+ ["iiint"] = 8749,
+ ["conint"] = 8750,
+ ["oint"] = 8750,
+ ["ContourIntegral"] = 8750,
+ ["Conint"] = 8751,
+ ["DoubleContourIntegral"] = 8751,
+ ["Cconint"] = 8752,
+ ["cwint"] = 8753,
+ ["cwconint"] = 8754,
+ ["ClockwiseContourIntegral"] = 8754,
+ ["awconint"] = 8755,
+ ["CounterClockwiseContourIntegral"] = 8755,
+ ["there4"] = 8756,
+ ["therefore"] = 8756,
+ ["Therefore"] = 8756,
+ ["becaus"] = 8757,
+ ["because"] = 8757,
+ ["Because"] = 8757,
+ ["ratio"] = 8758,
+ ["Colon"] = 8759,
+ ["Proportion"] = 8759,
+ ["minusd"] = 8760,
+ ["dotminus"] = 8760,
+ ["mDDot"] = 8762,
+ ["homtht"] = 8763,
+ ["sim"] = 8764,
+ ["Tilde"] = 8764,
+ ["thksim"] = 8764,
+ ["thicksim"] = 8764,
+ ["bsim"] = 8765,
+ ["backsim"] = 8765,
+ ["ac"] = 8766,
+ ["mstpos"] = 8766,
+ ["acd"] = 8767,
+ ["wreath"] = 8768,
+ ["VerticalTilde"] = 8768,
+ ["wr"] = 8768,
+ ["nsim"] = 8769,
+ ["NotTilde"] = 8769,
+ ["esim"] = 8770,
+ ["EqualTilde"] = 8770,
+ ["eqsim"] = 8770,
+ ["sime"] = 8771,
+ ["TildeEqual"] = 8771,
+ ["simeq"] = 8771,
+ ["nsime"] = 8772,
+ ["nsimeq"] = 8772,
+ ["NotTildeEqual"] = 8772,
+ ["cong"] = 8773,
+ ["TildeFullEqual"] = 8773,
+ ["simne"] = 8774,
+ ["ncong"] = 8775,
+ ["NotTildeFullEqual"] = 8775,
+ ["asymp"] = 8776,
+ ["ap"] = 8776,
+ ["TildeTilde"] = 8776,
+ ["approx"] = 8776,
+ ["thkap"] = 8776,
+ ["thickapprox"] = 8776,
+ ["nap"] = 8777,
+ ["NotTildeTilde"] = 8777,
+ ["napprox"] = 8777,
+ ["ape"] = 8778,
+ ["approxeq"] = 8778,
+ ["apid"] = 8779,
+ ["bcong"] = 8780,
+ ["backcong"] = 8780,
+ ["asympeq"] = 8781,
+ ["CupCap"] = 8781,
+ ["bump"] = 8782,
+ ["HumpDownHump"] = 8782,
+ ["Bumpeq"] = 8782,
+ ["bumpe"] = 8783,
+ ["HumpEqual"] = 8783,
+ ["bumpeq"] = 8783,
+ ["esdot"] = 8784,
+ ["DotEqual"] = 8784,
+ ["doteq"] = 8784,
+ ["eDot"] = 8785,
+ ["doteqdot"] = 8785,
+ ["efDot"] = 8786,
+ ["fallingdotseq"] = 8786,
+ ["erDot"] = 8787,
+ ["risingdotseq"] = 8787,
+ ["colone"] = 8788,
+ ["coloneq"] = 8788,
+ ["Assign"] = 8788,
+ ["ecolon"] = 8789,
+ ["eqcolon"] = 8789,
+ ["ecir"] = 8790,
+ ["eqcirc"] = 8790,
+ ["cire"] = 8791,
+ ["circeq"] = 8791,
+ ["wedgeq"] = 8793,
+ ["veeeq"] = 8794,
+ ["trie"] = 8796,
+ ["triangleq"] = 8796,
+ ["equest"] = 8799,
+ ["questeq"] = 8799,
+ ["ne"] = 8800,
+ ["NotEqual"] = 8800,
+ ["equiv"] = 8801,
+ ["Congruent"] = 8801,
+ ["nequiv"] = 8802,
+ ["NotCongruent"] = 8802,
+ ["le"] = 8804,
+ ["leq"] = 8804,
+ ["ge"] = 8805,
+ ["GreaterEqual"] = 8805,
+ ["geq"] = 8805,
+ ["lE"] = 8806,
+ ["LessFullEqual"] = 8806,
+ ["leqq"] = 8806,
+ ["gE"] = 8807,
+ ["GreaterFullEqual"] = 8807,
+ ["geqq"] = 8807,
+ ["lnE"] = 8808,
+ ["lneqq"] = 8808,
+ ["gnE"] = 8809,
+ ["gneqq"] = 8809,
+ ["Lt"] = 8810,
+ ["NestedLessLess"] = 8810,
+ ["ll"] = 8810,
+ ["Gt"] = 8811,
+ ["NestedGreaterGreater"] = 8811,
+ ["gg"] = 8811,
+ ["twixt"] = 8812,
+ ["between"] = 8812,
+ ["NotCupCap"] = 8813,
+ ["nlt"] = 8814,
+ ["NotLess"] = 8814,
+ ["nless"] = 8814,
+ ["ngt"] = 8815,
+ ["NotGreater"] = 8815,
+ ["ngtr"] = 8815,
+ ["nle"] = 8816,
+ ["NotLessEqual"] = 8816,
+ ["nleq"] = 8816,
+ ["nge"] = 8817,
+ ["NotGreaterEqual"] = 8817,
+ ["ngeq"] = 8817,
+ ["lsim"] = 8818,
+ ["LessTilde"] = 8818,
+ ["lesssim"] = 8818,
+ ["gsim"] = 8819,
+ ["gtrsim"] = 8819,
+ ["GreaterTilde"] = 8819,
+ ["nlsim"] = 8820,
+ ["NotLessTilde"] = 8820,
+ ["ngsim"] = 8821,
+ ["NotGreaterTilde"] = 8821,
+ ["lg"] = 8822,
+ ["lessgtr"] = 8822,
+ ["LessGreater"] = 8822,
+ ["gl"] = 8823,
+ ["gtrless"] = 8823,
+ ["GreaterLess"] = 8823,
+ ["ntlg"] = 8824,
+ ["NotLessGreater"] = 8824,
+ ["ntgl"] = 8825,
+ ["NotGreaterLess"] = 8825,
+ ["pr"] = 8826,
+ ["Precedes"] = 8826,
+ ["prec"] = 8826,
+ ["sc"] = 8827,
+ ["Succeeds"] = 8827,
+ ["succ"] = 8827,
+ ["prcue"] = 8828,
+ ["PrecedesSlantEqual"] = 8828,
+ ["preccurlyeq"] = 8828,
+ ["sccue"] = 8829,
+ ["SucceedsSlantEqual"] = 8829,
+ ["succcurlyeq"] = 8829,
+ ["prsim"] = 8830,
+ ["precsim"] = 8830,
+ ["PrecedesTilde"] = 8830,
+ ["scsim"] = 8831,
+ ["succsim"] = 8831,
+ ["SucceedsTilde"] = 8831,
+ ["npr"] = 8832,
+ ["nprec"] = 8832,
+ ["NotPrecedes"] = 8832,
+ ["nsc"] = 8833,
+ ["nsucc"] = 8833,
+ ["NotSucceeds"] = 8833,
+ ["sub"] = 8834,
+ ["subset"] = 8834,
+ ["sup"] = 8835,
+ ["supset"] = 8835,
+ ["Superset"] = 8835,
+ ["nsub"] = 8836,
+ ["nsup"] = 8837,
+ ["sube"] = 8838,
+ ["SubsetEqual"] = 8838,
+ ["subseteq"] = 8838,
+ ["supe"] = 8839,
+ ["supseteq"] = 8839,
+ ["SupersetEqual"] = 8839,
+ ["nsube"] = 8840,
+ ["nsubseteq"] = 8840,
+ ["NotSubsetEqual"] = 8840,
+ ["nsupe"] = 8841,
+ ["nsupseteq"] = 8841,
+ ["NotSupersetEqual"] = 8841,
+ ["subne"] = 8842,
+ ["subsetneq"] = 8842,
+ ["supne"] = 8843,
+ ["supsetneq"] = 8843,
+ ["cupdot"] = 8845,
+ ["uplus"] = 8846,
+ ["UnionPlus"] = 8846,
+ ["sqsub"] = 8847,
+ ["SquareSubset"] = 8847,
+ ["sqsubset"] = 8847,
+ ["sqsup"] = 8848,
+ ["SquareSuperset"] = 8848,
+ ["sqsupset"] = 8848,
+ ["sqsube"] = 8849,
+ ["SquareSubsetEqual"] = 8849,
+ ["sqsubseteq"] = 8849,
+ ["sqsupe"] = 8850,
+ ["SquareSupersetEqual"] = 8850,
+ ["sqsupseteq"] = 8850,
+ ["sqcap"] = 8851,
+ ["SquareIntersection"] = 8851,
+ ["sqcup"] = 8852,
+ ["SquareUnion"] = 8852,
+ ["oplus"] = 8853,
+ ["CirclePlus"] = 8853,
+ ["ominus"] = 8854,
+ ["CircleMinus"] = 8854,
+ ["otimes"] = 8855,
+ ["CircleTimes"] = 8855,
+ ["osol"] = 8856,
+ ["odot"] = 8857,
+ ["CircleDot"] = 8857,
+ ["ocir"] = 8858,
+ ["circledcirc"] = 8858,
+ ["oast"] = 8859,
+ ["circledast"] = 8859,
+ ["odash"] = 8861,
+ ["circleddash"] = 8861,
+ ["plusb"] = 8862,
+ ["boxplus"] = 8862,
+ ["minusb"] = 8863,
+ ["boxminus"] = 8863,
+ ["timesb"] = 8864,
+ ["boxtimes"] = 8864,
+ ["sdotb"] = 8865,
+ ["dotsquare"] = 8865,
+ ["vdash"] = 8866,
+ ["RightTee"] = 8866,
+ ["dashv"] = 8867,
+ ["LeftTee"] = 8867,
+ ["top"] = 8868,
+ ["DownTee"] = 8868,
+ ["bottom"] = 8869,
+ ["bot"] = 8869,
+ ["perp"] = 8869,
+ ["UpTee"] = 8869,
+ ["models"] = 8871,
+ ["vDash"] = 8872,
+ ["DoubleRightTee"] = 8872,
+ ["Vdash"] = 8873,
+ ["Vvdash"] = 8874,
+ ["VDash"] = 8875,
+ ["nvdash"] = 8876,
+ ["nvDash"] = 8877,
+ ["nVdash"] = 8878,
+ ["nVDash"] = 8879,
+ ["prurel"] = 8880,
+ ["vltri"] = 8882,
+ ["vartriangleleft"] = 8882,
+ ["LeftTriangle"] = 8882,
+ ["vrtri"] = 8883,
+ ["vartriangleright"] = 8883,
+ ["RightTriangle"] = 8883,
+ ["ltrie"] = 8884,
+ ["trianglelefteq"] = 8884,
+ ["LeftTriangleEqual"] = 8884,
+ ["rtrie"] = 8885,
+ ["trianglerighteq"] = 8885,
+ ["RightTriangleEqual"] = 8885,
+ ["origof"] = 8886,
+ ["imof"] = 8887,
+ ["mumap"] = 8888,
+ ["multimap"] = 8888,
+ ["hercon"] = 8889,
+ ["intcal"] = 8890,
+ ["intercal"] = 8890,
+ ["veebar"] = 8891,
+ ["barvee"] = 8893,
+ ["angrtvb"] = 8894,
+ ["lrtri"] = 8895,
+ ["xwedge"] = 8896,
+ ["Wedge"] = 8896,
+ ["bigwedge"] = 8896,
+ ["xvee"] = 8897,
+ ["Vee"] = 8897,
+ ["bigvee"] = 8897,
+ ["xcap"] = 8898,
+ ["Intersection"] = 8898,
+ ["bigcap"] = 8898,
+ ["xcup"] = 8899,
+ ["Union"] = 8899,
+ ["bigcup"] = 8899,
+ ["diam"] = 8900,
+ ["diamond"] = 8900,
+ ["Diamond"] = 8900,
+ ["sdot"] = 8901,
+ ["sstarf"] = 8902,
+ ["Star"] = 8902,
+ ["divonx"] = 8903,
+ ["divideontimes"] = 8903,
+ ["bowtie"] = 8904,
+ ["ltimes"] = 8905,
+ ["rtimes"] = 8906,
+ ["lthree"] = 8907,
+ ["leftthreetimes"] = 8907,
+ ["rthree"] = 8908,
+ ["rightthreetimes"] = 8908,
+ ["bsime"] = 8909,
+ ["backsimeq"] = 8909,
+ ["cuvee"] = 8910,
+ ["curlyvee"] = 8910,
+ ["cuwed"] = 8911,
+ ["curlywedge"] = 8911,
+ ["Sub"] = 8912,
+ ["Subset"] = 8912,
+ ["Sup"] = 8913,
+ ["Supset"] = 8913,
+ ["Cap"] = 8914,
+ ["Cup"] = 8915,
+ ["fork"] = 8916,
+ ["pitchfork"] = 8916,
+ ["epar"] = 8917,
+ ["ltdot"] = 8918,
+ ["lessdot"] = 8918,
+ ["gtdot"] = 8919,
+ ["gtrdot"] = 8919,
+ ["Ll"] = 8920,
+ ["Gg"] = 8921,
+ ["ggg"] = 8921,
+ ["leg"] = 8922,
+ ["LessEqualGreater"] = 8922,
+ ["lesseqgtr"] = 8922,
+ ["gel"] = 8923,
+ ["gtreqless"] = 8923,
+ ["GreaterEqualLess"] = 8923,
+ ["cuepr"] = 8926,
+ ["curlyeqprec"] = 8926,
+ ["cuesc"] = 8927,
+ ["curlyeqsucc"] = 8927,
+ ["nprcue"] = 8928,
+ ["NotPrecedesSlantEqual"] = 8928,
+ ["nsccue"] = 8929,
+ ["NotSucceedsSlantEqual"] = 8929,
+ ["nsqsube"] = 8930,
+ ["NotSquareSubsetEqual"] = 8930,
+ ["nsqsupe"] = 8931,
+ ["NotSquareSupersetEqual"] = 8931,
+ ["lnsim"] = 8934,
+ ["gnsim"] = 8935,
+ ["prnsim"] = 8936,
+ ["precnsim"] = 8936,
+ ["scnsim"] = 8937,
+ ["succnsim"] = 8937,
+ ["nltri"] = 8938,
+ ["ntriangleleft"] = 8938,
+ ["NotLeftTriangle"] = 8938,
+ ["nrtri"] = 8939,
+ ["ntriangleright"] = 8939,
+ ["NotRightTriangle"] = 8939,
+ ["nltrie"] = 8940,
+ ["ntrianglelefteq"] = 8940,
+ ["NotLeftTriangleEqual"] = 8940,
+ ["nrtrie"] = 8941,
+ ["ntrianglerighteq"] = 8941,
+ ["NotRightTriangleEqual"] = 8941,
+ ["vellip"] = 8942,
+ ["ctdot"] = 8943,
+ ["utdot"] = 8944,
+ ["dtdot"] = 8945,
+ ["disin"] = 8946,
+ ["isinsv"] = 8947,
+ ["isins"] = 8948,
+ ["isindot"] = 8949,
+ ["notinvc"] = 8950,
+ ["notinvb"] = 8951,
+ ["isinE"] = 8953,
+ ["nisd"] = 8954,
+ ["xnis"] = 8955,
+ ["nis"] = 8956,
+ ["notnivc"] = 8957,
+ ["notnivb"] = 8958,
+ ["barwed"] = 8965,
+ ["barwedge"] = 8965,
+ ["Barwed"] = 8966,
+ ["doublebarwedge"] = 8966,
+ ["lceil"] = 8968,
+ ["LeftCeiling"] = 8968,
+ ["rceil"] = 8969,
+ ["RightCeiling"] = 8969,
+ ["lfloor"] = 8970,
+ ["LeftFloor"] = 8970,
+ ["rfloor"] = 8971,
+ ["RightFloor"] = 8971,
+ ["drcrop"] = 8972,
+ ["dlcrop"] = 8973,
+ ["urcrop"] = 8974,
+ ["ulcrop"] = 8975,
+ ["bnot"] = 8976,
+ ["profline"] = 8978,
+ ["profsurf"] = 8979,
+ ["telrec"] = 8981,
+ ["target"] = 8982,
+ ["ulcorn"] = 8988,
+ ["ulcorner"] = 8988,
+ ["urcorn"] = 8989,
+ ["urcorner"] = 8989,
+ ["dlcorn"] = 8990,
+ ["llcorner"] = 8990,
+ ["drcorn"] = 8991,
+ ["lrcorner"] = 8991,
+ ["frown"] = 8994,
+ ["sfrown"] = 8994,
+ ["smile"] = 8995,
+ ["ssmile"] = 8995,
+ ["cylcty"] = 9005,
+ ["profalar"] = 9006,
+ ["topbot"] = 9014,
+ ["ovbar"] = 9021,
+ ["solbar"] = 9023,
+ ["angzarr"] = 9084,
+ ["lmoust"] = 9136,
+ ["lmoustache"] = 9136,
+ ["rmoust"] = 9137,
+ ["rmoustache"] = 9137,
+ ["tbrk"] = 9140,
+ ["OverBracket"] = 9140,
+ ["bbrk"] = 9141,
+ ["UnderBracket"] = 9141,
+ ["bbrktbrk"] = 9142,
+ ["OverParenthesis"] = 9180,
+ ["UnderParenthesis"] = 9181,
+ ["OverBrace"] = 9182,
+ ["UnderBrace"] = 9183,
+ ["trpezium"] = 9186,
+ ["elinters"] = 9191,
+ ["blank"] = 9251,
+ ["oS"] = 9416,
+ ["circledS"] = 9416,
+ ["boxh"] = 9472,
+ ["HorizontalLine"] = 9472,
+ ["boxv"] = 9474,
+ ["boxdr"] = 9484,
+ ["boxdl"] = 9488,
+ ["boxur"] = 9492,
+ ["boxul"] = 9496,
+ ["boxvr"] = 9500,
+ ["boxvl"] = 9508,
+ ["boxhd"] = 9516,
+ ["boxhu"] = 9524,
+ ["boxvh"] = 9532,
+ ["boxH"] = 9552,
+ ["boxV"] = 9553,
+ ["boxdR"] = 9554,
+ ["boxDr"] = 9555,
+ ["boxDR"] = 9556,
+ ["boxdL"] = 9557,
+ ["boxDl"] = 9558,
+ ["boxDL"] = 9559,
+ ["boxuR"] = 9560,
+ ["boxUr"] = 9561,
+ ["boxUR"] = 9562,
+ ["boxuL"] = 9563,
+ ["boxUl"] = 9564,
+ ["boxUL"] = 9565,
+ ["boxvR"] = 9566,
+ ["boxVr"] = 9567,
+ ["boxVR"] = 9568,
+ ["boxvL"] = 9569,
+ ["boxVl"] = 9570,
+ ["boxVL"] = 9571,
+ ["boxHd"] = 9572,
+ ["boxhD"] = 9573,
+ ["boxHD"] = 9574,
+ ["boxHu"] = 9575,
+ ["boxhU"] = 9576,
+ ["boxHU"] = 9577,
+ ["boxvH"] = 9578,
+ ["boxVh"] = 9579,
+ ["boxVH"] = 9580,
+ ["uhblk"] = 9600,
+ ["lhblk"] = 9604,
+ ["block"] = 9608,
+ ["blk14"] = 9617,
+ ["blk12"] = 9618,
+ ["blk34"] = 9619,
+ ["squ"] = 9633,
+ ["square"] = 9633,
+ ["Square"] = 9633,
+ ["squf"] = 9642,
+ ["squarf"] = 9642,
+ ["blacksquare"] = 9642,
+ ["FilledVerySmallSquare"] = 9642,
+ ["EmptyVerySmallSquare"] = 9643,
+ ["rect"] = 9645,
+ ["marker"] = 9646,
+ ["fltns"] = 9649,
+ ["xutri"] = 9651,
+ ["bigtriangleup"] = 9651,
+ ["utrif"] = 9652,
+ ["blacktriangle"] = 9652,
+ ["utri"] = 9653,
+ ["triangle"] = 9653,
+ ["rtrif"] = 9656,
+ ["blacktriangleright"] = 9656,
+ ["rtri"] = 9657,
+ ["triangleright"] = 9657,
+ ["xdtri"] = 9661,
+ ["bigtriangledown"] = 9661,
+ ["dtrif"] = 9662,
+ ["blacktriangledown"] = 9662,
+ ["dtri"] = 9663,
+ ["triangledown"] = 9663,
+ ["ltrif"] = 9666,
+ ["blacktriangleleft"] = 9666,
+ ["ltri"] = 9667,
+ ["triangleleft"] = 9667,
+ ["loz"] = 9674,
+ ["lozenge"] = 9674,
+ ["cir"] = 9675,
+ ["tridot"] = 9708,
+ ["xcirc"] = 9711,
+ ["bigcirc"] = 9711,
+ ["ultri"] = 9720,
+ ["urtri"] = 9721,
+ ["lltri"] = 9722,
+ ["EmptySmallSquare"] = 9723,
+ ["FilledSmallSquare"] = 9724,
+ ["starf"] = 9733,
+ ["bigstar"] = 9733,
+ ["star"] = 9734,
+ ["phone"] = 9742,
+ ["female"] = 9792,
+ ["male"] = 9794,
+ ["spades"] = 9824,
+ ["spadesuit"] = 9824,
+ ["clubs"] = 9827,
+ ["clubsuit"] = 9827,
+ ["hearts"] = 9829,
+ ["heartsuit"] = 9829,
+ ["diams"] = 9830,
+ ["diamondsuit"] = 9830,
+ ["sung"] = 9834,
+ ["flat"] = 9837,
+ ["natur"] = 9838,
+ ["natural"] = 9838,
+ ["sharp"] = 9839,
+ ["check"] = 10003,
+ ["checkmark"] = 10003,
+ ["cross"] = 10007,
+ ["malt"] = 10016,
+ ["maltese"] = 10016,
+ ["sext"] = 10038,
+ ["VerticalSeparator"] = 10072,
+ ["lbbrk"] = 10098,
+ ["rbbrk"] = 10099,
+ ["lobrk"] = 10214,
+ ["LeftDoubleBracket"] = 10214,
+ ["robrk"] = 10215,
+ ["RightDoubleBracket"] = 10215,
+ ["lang"] = 10216,
+ ["LeftAngleBracket"] = 10216,
+ ["langle"] = 10216,
+ ["rang"] = 10217,
+ ["RightAngleBracket"] = 10217,
+ ["rangle"] = 10217,
+ ["Lang"] = 10218,
+ ["Rang"] = 10219,
+ ["loang"] = 10220,
+ ["roang"] = 10221,
+ ["xlarr"] = 10229,
+ ["longleftarrow"] = 10229,
+ ["LongLeftArrow"] = 10229,
+ ["xrarr"] = 10230,
+ ["longrightarrow"] = 10230,
+ ["LongRightArrow"] = 10230,
+ ["xharr"] = 10231,
+ ["longleftrightarrow"] = 10231,
+ ["LongLeftRightArrow"] = 10231,
+ ["xlArr"] = 10232,
+ ["Longleftarrow"] = 10232,
+ ["DoubleLongLeftArrow"] = 10232,
+ ["xrArr"] = 10233,
+ ["Longrightarrow"] = 10233,
+ ["DoubleLongRightArrow"] = 10233,
+ ["xhArr"] = 10234,
+ ["Longleftrightarrow"] = 10234,
+ ["DoubleLongLeftRightArrow"] = 10234,
+ ["xmap"] = 10236,
+ ["longmapsto"] = 10236,
+ ["dzigrarr"] = 10239,
+ ["nvlArr"] = 10498,
+ ["nvrArr"] = 10499,
+ ["nvHarr"] = 10500,
+ ["Map"] = 10501,
+ ["lbarr"] = 10508,
+ ["rbarr"] = 10509,
+ ["bkarow"] = 10509,
+ ["lBarr"] = 10510,
+ ["rBarr"] = 10511,
+ ["dbkarow"] = 10511,
+ ["RBarr"] = 10512,
+ ["drbkarow"] = 10512,
+ ["DDotrahd"] = 10513,
+ ["UpArrowBar"] = 10514,
+ ["DownArrowBar"] = 10515,
+ ["Rarrtl"] = 10518,
+ ["latail"] = 10521,
+ ["ratail"] = 10522,
+ ["lAtail"] = 10523,
+ ["rAtail"] = 10524,
+ ["larrfs"] = 10525,
+ ["rarrfs"] = 10526,
+ ["larrbfs"] = 10527,
+ ["rarrbfs"] = 10528,
+ ["nwarhk"] = 10531,
+ ["nearhk"] = 10532,
+ ["searhk"] = 10533,
+ ["hksearow"] = 10533,
+ ["swarhk"] = 10534,
+ ["hkswarow"] = 10534,
+ ["nwnear"] = 10535,
+ ["nesear"] = 10536,
+ ["toea"] = 10536,
+ ["seswar"] = 10537,
+ ["tosa"] = 10537,
+ ["swnwar"] = 10538,
+ ["rarrc"] = 10547,
+ ["cudarrr"] = 10549,
+ ["ldca"] = 10550,
+ ["rdca"] = 10551,
+ ["cudarrl"] = 10552,
+ ["larrpl"] = 10553,
+ ["curarrm"] = 10556,
+ ["cularrp"] = 10557,
+ ["rarrpl"] = 10565,
+ ["harrcir"] = 10568,
+ ["Uarrocir"] = 10569,
+ ["lurdshar"] = 10570,
+ ["ldrushar"] = 10571,
+ ["LeftRightVector"] = 10574,
+ ["RightUpDownVector"] = 10575,
+ ["DownLeftRightVector"] = 10576,
+ ["LeftUpDownVector"] = 10577,
+ ["LeftVectorBar"] = 10578,
+ ["RightVectorBar"] = 10579,
+ ["RightUpVectorBar"] = 10580,
+ ["RightDownVectorBar"] = 10581,
+ ["DownLeftVectorBar"] = 10582,
+ ["DownRightVectorBar"] = 10583,
+ ["LeftUpVectorBar"] = 10584,
+ ["LeftDownVectorBar"] = 10585,
+ ["LeftTeeVector"] = 10586,
+ ["RightTeeVector"] = 10587,
+ ["RightUpTeeVector"] = 10588,
+ ["RightDownTeeVector"] = 10589,
+ ["DownLeftTeeVector"] = 10590,
+ ["DownRightTeeVector"] = 10591,
+ ["LeftUpTeeVector"] = 10592,
+ ["LeftDownTeeVector"] = 10593,
+ ["lHar"] = 10594,
+ ["uHar"] = 10595,
+ ["rHar"] = 10596,
+ ["dHar"] = 10597,
+ ["luruhar"] = 10598,
+ ["ldrdhar"] = 10599,
+ ["ruluhar"] = 10600,
+ ["rdldhar"] = 10601,
+ ["lharul"] = 10602,
+ ["llhard"] = 10603,
+ ["rharul"] = 10604,
+ ["lrhard"] = 10605,
+ ["udhar"] = 10606,
+ ["UpEquilibrium"] = 10606,
+ ["duhar"] = 10607,
+ ["ReverseUpEquilibrium"] = 10607,
+ ["RoundImplies"] = 10608,
+ ["erarr"] = 10609,
+ ["simrarr"] = 10610,
+ ["larrsim"] = 10611,
+ ["rarrsim"] = 10612,
+ ["rarrap"] = 10613,
+ ["ltlarr"] = 10614,
+ ["gtrarr"] = 10616,
+ ["subrarr"] = 10617,
+ ["suplarr"] = 10619,
+ ["lfisht"] = 10620,
+ ["rfisht"] = 10621,
+ ["ufisht"] = 10622,
+ ["dfisht"] = 10623,
+ ["lopar"] = 10629,
+ ["ropar"] = 10630,
+ ["lbrke"] = 10635,
+ ["rbrke"] = 10636,
+ ["lbrkslu"] = 10637,
+ ["rbrksld"] = 10638,
+ ["lbrksld"] = 10639,
+ ["rbrkslu"] = 10640,
+ ["langd"] = 10641,
+ ["rangd"] = 10642,
+ ["lparlt"] = 10643,
+ ["rpargt"] = 10644,
+ ["gtlPar"] = 10645,
+ ["ltrPar"] = 10646,
+ ["vzigzag"] = 10650,
+ ["vangrt"] = 10652,
+ ["angrtvbd"] = 10653,
+ ["ange"] = 10660,
+ ["range"] = 10661,
+ ["dwangle"] = 10662,
+ ["uwangle"] = 10663,
+ ["angmsdaa"] = 10664,
+ ["angmsdab"] = 10665,
+ ["angmsdac"] = 10666,
+ ["angmsdad"] = 10667,
+ ["angmsdae"] = 10668,
+ ["angmsdaf"] = 10669,
+ ["angmsdag"] = 10670,
+ ["angmsdah"] = 10671,
+ ["bemptyv"] = 10672,
+ ["demptyv"] = 10673,
+ ["cemptyv"] = 10674,
+ ["raemptyv"] = 10675,
+ ["laemptyv"] = 10676,
+ ["ohbar"] = 10677,
+ ["omid"] = 10678,
+ ["opar"] = 10679,
+ ["operp"] = 10681,
+ ["olcross"] = 10683,
+ ["odsold"] = 10684,
+ ["olcir"] = 10686,
+ ["ofcir"] = 10687,
+ ["olt"] = 10688,
+ ["ogt"] = 10689,
+ ["cirscir"] = 10690,
+ ["cirE"] = 10691,
+ ["solb"] = 10692,
+ ["bsolb"] = 10693,
+ ["boxbox"] = 10697,
+ ["trisb"] = 10701,
+ ["rtriltri"] = 10702,
+ ["LeftTriangleBar"] = 10703,
+ ["RightTriangleBar"] = 10704,
+ ["race"] = 10714,
+ ["iinfin"] = 10716,
+ ["infintie"] = 10717,
+ ["nvinfin"] = 10718,
+ ["eparsl"] = 10723,
+ ["smeparsl"] = 10724,
+ ["eqvparsl"] = 10725,
+ ["lozf"] = 10731,
+ ["blacklozenge"] = 10731,
+ ["RuleDelayed"] = 10740,
+ ["dsol"] = 10742,
+ ["xodot"] = 10752,
+ ["bigodot"] = 10752,
+ ["xoplus"] = 10753,
+ ["bigoplus"] = 10753,
+ ["xotime"] = 10754,
+ ["bigotimes"] = 10754,
+ ["xuplus"] = 10756,
+ ["biguplus"] = 10756,
+ ["xsqcup"] = 10758,
+ ["bigsqcup"] = 10758,
+ ["qint"] = 10764,
+ ["iiiint"] = 10764,
+ ["fpartint"] = 10765,
+ ["cirfnint"] = 10768,
+ ["awint"] = 10769,
+ ["rppolint"] = 10770,
+ ["scpolint"] = 10771,
+ ["npolint"] = 10772,
+ ["pointint"] = 10773,
+ ["quatint"] = 10774,
+ ["intlarhk"] = 10775,
+ ["pluscir"] = 10786,
+ ["plusacir"] = 10787,
+ ["simplus"] = 10788,
+ ["plusdu"] = 10789,
+ ["plussim"] = 10790,
+ ["plustwo"] = 10791,
+ ["mcomma"] = 10793,
+ ["minusdu"] = 10794,
+ ["loplus"] = 10797,
+ ["roplus"] = 10798,
+ ["Cross"] = 10799,
+ ["timesd"] = 10800,
+ ["timesbar"] = 10801,
+ ["smashp"] = 10803,
+ ["lotimes"] = 10804,
+ ["rotimes"] = 10805,
+ ["otimesas"] = 10806,
+ ["Otimes"] = 10807,
+ ["odiv"] = 10808,
+ ["triplus"] = 10809,
+ ["triminus"] = 10810,
+ ["tritime"] = 10811,
+ ["iprod"] = 10812,
+ ["intprod"] = 10812,
+ ["amalg"] = 10815,
+ ["capdot"] = 10816,
+ ["ncup"] = 10818,
+ ["ncap"] = 10819,
+ ["capand"] = 10820,
+ ["cupor"] = 10821,
+ ["cupcap"] = 10822,
+ ["capcup"] = 10823,
+ ["cupbrcap"] = 10824,
+ ["capbrcup"] = 10825,
+ ["cupcup"] = 10826,
+ ["capcap"] = 10827,
+ ["ccups"] = 10828,
+ ["ccaps"] = 10829,
+ ["ccupssm"] = 10832,
+ ["And"] = 10835,
+ ["Or"] = 10836,
+ ["andand"] = 10837,
+ ["oror"] = 10838,
+ ["orslope"] = 10839,
+ ["andslope"] = 10840,
+ ["andv"] = 10842,
+ ["orv"] = 10843,
+ ["andd"] = 10844,
+ ["ord"] = 10845,
+ ["wedbar"] = 10847,
+ ["sdote"] = 10854,
+ ["simdot"] = 10858,
+ ["congdot"] = 10861,
+ ["easter"] = 10862,
+ ["apacir"] = 10863,
+ ["apE"] = 10864,
+ ["eplus"] = 10865,
+ ["pluse"] = 10866,
+ ["Esim"] = 10867,
+ ["Colone"] = 10868,
+ ["Equal"] = 10869,
+ ["eDDot"] = 10871,
+ ["ddotseq"] = 10871,
+ ["equivDD"] = 10872,
+ ["ltcir"] = 10873,
+ ["gtcir"] = 10874,
+ ["ltquest"] = 10875,
+ ["gtquest"] = 10876,
+ ["les"] = 10877,
+ ["LessSlantEqual"] = 10877,
+ ["leqslant"] = 10877,
+ ["ges"] = 10878,
+ ["GreaterSlantEqual"] = 10878,
+ ["geqslant"] = 10878,
+ ["lesdot"] = 10879,
+ ["gesdot"] = 10880,
+ ["lesdoto"] = 10881,
+ ["gesdoto"] = 10882,
+ ["lesdotor"] = 10883,
+ ["gesdotol"] = 10884,
+ ["lap"] = 10885,
+ ["lessapprox"] = 10885,
+ ["gap"] = 10886,
+ ["gtrapprox"] = 10886,
+ ["lne"] = 10887,
+ ["lneq"] = 10887,
+ ["gne"] = 10888,
+ ["gneq"] = 10888,
+ ["lnap"] = 10889,
+ ["lnapprox"] = 10889,
+ ["gnap"] = 10890,
+ ["gnapprox"] = 10890,
+ ["lEg"] = 10891,
+ ["lesseqqgtr"] = 10891,
+ ["gEl"] = 10892,
+ ["gtreqqless"] = 10892,
+ ["lsime"] = 10893,
+ ["gsime"] = 10894,
+ ["lsimg"] = 10895,
+ ["gsiml"] = 10896,
+ ["lgE"] = 10897,
+ ["glE"] = 10898,
+ ["lesges"] = 10899,
+ ["gesles"] = 10900,
+ ["els"] = 10901,
+ ["eqslantless"] = 10901,
+ ["egs"] = 10902,
+ ["eqslantgtr"] = 10902,
+ ["elsdot"] = 10903,
+ ["egsdot"] = 10904,
+ ["el"] = 10905,
+ ["eg"] = 10906,
+ ["siml"] = 10909,
+ ["simg"] = 10910,
+ ["simlE"] = 10911,
+ ["simgE"] = 10912,
+ ["LessLess"] = 10913,
+ ["GreaterGreater"] = 10914,
+ ["glj"] = 10916,
+ ["gla"] = 10917,
+ ["ltcc"] = 10918,
+ ["gtcc"] = 10919,
+ ["lescc"] = 10920,
+ ["gescc"] = 10921,
+ ["smt"] = 10922,
+ ["lat"] = 10923,
+ ["smte"] = 10924,
+ ["late"] = 10925,
+ ["bumpE"] = 10926,
+ ["pre"] = 10927,
+ ["preceq"] = 10927,
+ ["PrecedesEqual"] = 10927,
+ ["sce"] = 10928,
+ ["succeq"] = 10928,
+ ["SucceedsEqual"] = 10928,
+ ["prE"] = 10931,
+ ["scE"] = 10932,
+ ["prnE"] = 10933,
+ ["precneqq"] = 10933,
+ ["scnE"] = 10934,
+ ["succneqq"] = 10934,
+ ["prap"] = 10935,
+ ["precapprox"] = 10935,
+ ["scap"] = 10936,
+ ["succapprox"] = 10936,
+ ["prnap"] = 10937,
+ ["precnapprox"] = 10937,
+ ["scnap"] = 10938,
+ ["succnapprox"] = 10938,
+ ["Pr"] = 10939,
+ ["Sc"] = 10940,
+ ["subdot"] = 10941,
+ ["supdot"] = 10942,
+ ["subplus"] = 10943,
+ ["supplus"] = 10944,
+ ["submult"] = 10945,
+ ["supmult"] = 10946,
+ ["subedot"] = 10947,
+ ["supedot"] = 10948,
+ ["subE"] = 10949,
+ ["subseteqq"] = 10949,
+ ["supE"] = 10950,
+ ["supseteqq"] = 10950,
+ ["subsim"] = 10951,
+ ["supsim"] = 10952,
+ ["subnE"] = 10955,
+ ["subsetneqq"] = 10955,
+ ["supnE"] = 10956,
+ ["supsetneqq"] = 10956,
+ ["csub"] = 10959,
+ ["csup"] = 10960,
+ ["csube"] = 10961,
+ ["csupe"] = 10962,
+ ["subsup"] = 10963,
+ ["supsub"] = 10964,
+ ["subsub"] = 10965,
+ ["supsup"] = 10966,
+ ["suphsub"] = 10967,
+ ["supdsub"] = 10968,
+ ["forkv"] = 10969,
+ ["topfork"] = 10970,
+ ["mlcp"] = 10971,
+ ["Dashv"] = 10980,
+ ["DoubleLeftTee"] = 10980,
+ ["Vdashl"] = 10982,
+ ["Barv"] = 10983,
+ ["vBar"] = 10984,
+ ["vBarv"] = 10985,
+ ["Vbar"] = 10987,
+ ["Not"] = 10988,
+ ["bNot"] = 10989,
+ ["rnmid"] = 10990,
+ ["cirmid"] = 10991,
+ ["midcir"] = 10992,
+ ["topcir"] = 10993,
+ ["nhpar"] = 10994,
+ ["parsim"] = 10995,
+ ["parsl"] = 11005,
+ ["fflig"] = 64256,
+ ["filig"] = 64257,
+ ["fllig"] = 64258,
+ ["ffilig"] = 64259,
+ ["ffllig"] = 64260,
+ ["Ascr"] = 119964,
+ ["Cscr"] = 119966,
+ ["Dscr"] = 119967,
+ ["Gscr"] = 119970,
+ ["Jscr"] = 119973,
+ ["Kscr"] = 119974,
+ ["Nscr"] = 119977,
+ ["Oscr"] = 119978,
+ ["Pscr"] = 119979,
+ ["Qscr"] = 119980,
+ ["Sscr"] = 119982,
+ ["Tscr"] = 119983,
+ ["Uscr"] = 119984,
+ ["Vscr"] = 119985,
+ ["Wscr"] = 119986,
+ ["Xscr"] = 119987,
+ ["Yscr"] = 119988,
+ ["Zscr"] = 119989,
+ ["ascr"] = 119990,
+ ["bscr"] = 119991,
+ ["cscr"] = 119992,
+ ["dscr"] = 119993,
+ ["fscr"] = 119995,
+ ["hscr"] = 119997,
+ ["iscr"] = 119998,
+ ["jscr"] = 119999,
+ ["kscr"] = 120000,
+ ["lscr"] = 120001,
+ ["mscr"] = 120002,
+ ["nscr"] = 120003,
+ ["pscr"] = 120005,
+ ["qscr"] = 120006,
+ ["rscr"] = 120007,
+ ["sscr"] = 120008,
+ ["tscr"] = 120009,
+ ["uscr"] = 120010,
+ ["vscr"] = 120011,
+ ["wscr"] = 120012,
+ ["xscr"] = 120013,
+ ["yscr"] = 120014,
+ ["zscr"] = 120015,
+ ["Afr"] = 120068,
+ ["Bfr"] = 120069,
+ ["Dfr"] = 120071,
+ ["Efr"] = 120072,
+ ["Ffr"] = 120073,
+ ["Gfr"] = 120074,
+ ["Jfr"] = 120077,
+ ["Kfr"] = 120078,
+ ["Lfr"] = 120079,
+ ["Mfr"] = 120080,
+ ["Nfr"] = 120081,
+ ["Ofr"] = 120082,
+ ["Pfr"] = 120083,
+ ["Qfr"] = 120084,
+ ["Sfr"] = 120086,
+ ["Tfr"] = 120087,
+ ["Ufr"] = 120088,
+ ["Vfr"] = 120089,
+ ["Wfr"] = 120090,
+ ["Xfr"] = 120091,
+ ["Yfr"] = 120092,
+ ["afr"] = 120094,
+ ["bfr"] = 120095,
+ ["cfr"] = 120096,
+ ["dfr"] = 120097,
+ ["efr"] = 120098,
+ ["ffr"] = 120099,
+ ["gfr"] = 120100,
+ ["hfr"] = 120101,
+ ["ifr"] = 120102,
+ ["jfr"] = 120103,
+ ["kfr"] = 120104,
+ ["lfr"] = 120105,
+ ["mfr"] = 120106,
+ ["nfr"] = 120107,
+ ["ofr"] = 120108,
+ ["pfr"] = 120109,
+ ["qfr"] = 120110,
+ ["rfr"] = 120111,
+ ["sfr"] = 120112,
+ ["tfr"] = 120113,
+ ["ufr"] = 120114,
+ ["vfr"] = 120115,
+ ["wfr"] = 120116,
+ ["xfr"] = 120117,
+ ["yfr"] = 120118,
+ ["zfr"] = 120119,
+ ["Aopf"] = 120120,
+ ["Bopf"] = 120121,
+ ["Dopf"] = 120123,
+ ["Eopf"] = 120124,
+ ["Fopf"] = 120125,
+ ["Gopf"] = 120126,
+ ["Iopf"] = 120128,
+ ["Jopf"] = 120129,
+ ["Kopf"] = 120130,
+ ["Lopf"] = 120131,
+ ["Mopf"] = 120132,
+ ["Oopf"] = 120134,
+ ["Sopf"] = 120138,
+ ["Topf"] = 120139,
+ ["Uopf"] = 120140,
+ ["Vopf"] = 120141,
+ ["Wopf"] = 120142,
+ ["Xopf"] = 120143,
+ ["Yopf"] = 120144,
+ ["aopf"] = 120146,
+ ["bopf"] = 120147,
+ ["copf"] = 120148,
+ ["dopf"] = 120149,
+ ["eopf"] = 120150,
+ ["fopf"] = 120151,
+ ["gopf"] = 120152,
+ ["hopf"] = 120153,
+ ["iopf"] = 120154,
+ ["jopf"] = 120155,
+ ["kopf"] = 120156,
+ ["lopf"] = 120157,
+ ["mopf"] = 120158,
+ ["nopf"] = 120159,
+ ["oopf"] = 120160,
+ ["popf"] = 120161,
+ ["qopf"] = 120162,
+ ["ropf"] = 120163,
+ ["sopf"] = 120164,
+ ["topf"] = 120165,
+ ["uopf"] = 120166,
+ ["vopf"] = 120167,
+ ["wopf"] = 120168,
+ ["xopf"] = 120169,
+ ["yopf"] = 120170,
+ ["zopf"] = 120171,
+}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Given a string `s` of decimal digits, the \luamdef{entities.dec_entity}
+% returns the corresponding \acro{utf}8-encoded Unicode codepoint.
+%
+% \end{markdown}
+% \begin{macrocode}
+function entities.dec_entity(s)
+ return unicode.utf8.char(tonumber(s))
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Given a string `s` of hexadecimal digits, the
+% \luamdef{entities.hex_entity} returns the corresponding
+% \acro{utf}8-encoded Unicode codepoint.
+%
+% \end{markdown}
+% \begin{macrocode}
+function entities.hex_entity(s)
+ return unicode.utf8.char(tonumber("0x"..s))
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Given a character entity name `s` (like `ouml`), the
+% \luamdef{entities.char_entity} returns the corresponding
+% \acro{utf}8-encoded Unicode codepoint.
+%
+% \end{markdown}
+% \begin{macrocode}
+function entities.char_entity(s)
+ local n = character_entities[s]
+ if n == nil then
+ return "&" .. s .. ";"
+ end
+ return unicode.utf8.char(n)
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Plain \TeX{} Writer
+% \label{sec:texwriter}
+% This section documents the \luam{writer} object, which implements the
+% routines for producing the \TeX{} output. The object is an amalgamate of the
+% generic, \TeX{}, \LaTeX{} writer objects that were located in the
+% `lunamark/writer/generic.lua`, `lunamark/writer/tex.lua`, and
+% `lunamark/writer/latex.lua` files in the Lunamark Lua module.
+%
+% Although not specified in the Lua interface (see Section
+% \ref{sec:luainterface}), the \luam{writer} object is exported, so that the
+% curious user could easily tinker with the methods of the objects produced by
+% the \luam{writer.new} method described below. The user should be aware,
+% however, that the implementation may change in a future revision.
+%
+% \end{markdown}
+% \begin{macrocode}
+M.writer = {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{writer.new} method creates and returns a new \TeX{} writer
+% object associated with the Lua interface options (see Section
+% \ref{sec:luaoptions}) `options`. When `options` are unspecified, it is
+% assumed that an empty table was passed to the method.
+%
+% The objects produced by the \luam{writer.new} method expose instance methods
+% and variables of their own. As a convention, I will refer to these
+% \meta{member}s as `writer->`\meta{member}.
+%
+% \end{markdown}
+% \begin{macrocode}
+function M.writer.new(options)
+ local self = {}
+ options = options or {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Make the `options` table inherit from the \luam{defaultOptions} table.
+%
+% \end{markdown}
+% \begin{macrocode}
+ setmetatable(options, { __index = function (_, key)
+ return defaultOptions[key] end })
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Parse the \Opt{slice} option and define \luamdef{writer->slice\_begin}
+% \luamdef{writer->slice\_end}, and \luamdef{writer->is\_writing}.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local slice_specifiers = {}
+ for specifier in options.slice:gmatch("[^%s]+") do
+ table.insert(slice_specifiers, specifier)
+ end
+
+ if #slice_specifiers == 2 then
+ self.slice_begin, self.slice_end = table.unpack(slice_specifiers)
+ local slice_begin_type = self.slice_begin:sub(1, 1)
+ if slice_begin_type ~= "^" and slice_begin_type ~= "$" then
+ self.slice_begin = "^" .. self.slice_begin
+ end
+ local slice_end_type = self.slice_end:sub(1, 1)
+ if slice_end_type ~= "^" and slice_end_type ~= "$" then
+ self.slice_end = "$" .. self.slice_end
+ end
+ elseif #slice_specifiers == 1 then
+ self.slice_begin = "^" .. slice_specifiers[1]
+ self.slice_end = "$" .. slice_specifiers[1]
+ end
+
+ if self.slice_begin == "^" and self.slice_end ~= "^" then
+ self.is_writing = true
+ else
+ self.is_writing = false
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->suffix} as the suffix of the produced cache files.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.suffix = ".tex"
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->space} as the output format of a space character.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.space = " "
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->nbsp} as the output format of a non-breaking space
+% character.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.nbsp = "\\markdownRendererNbsp{}"
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->plain} as a function that will transform an input
+% plain text block `s` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.plain(s)
+ return s
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->paragraph} as a function that will transform an
+% input paragraph `s` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.paragraph(s)
+ if not self.is_writing then return "" end
+ return s
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->pack} as a function that will take the filename
+% `name` of the output file prepared by the reader and transform it to the
+% output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.pack(name)
+ return [[\input ]] .. name .. [[\relax{}]]
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->interblocksep} as the output format of a block
+% element separator.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.interblocksep()
+ if not self.is_writing then return "" end
+ return "\\markdownRendererInterblockSeparator\n{}"
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->eof} as the end of file marker in the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.eof = [[\relax]]
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->linebreak} as the output format of a forced line break.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.linebreak = "\\markdownRendererLineBreak\n{}"
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->ellipsis} as the output format of an ellipsis.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.ellipsis = "\\markdownRendererEllipsis{}"
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->hrule} as the output format of a horizontal rule.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.hrule()
+ if not self.is_writing then return "" end
+ return "\\markdownRendererHorizontalRule{}"
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define a table \luamdef{escaped_chars} containing the mapping from special
+% plain \TeX{} characters (including the active pipe character (`|`) of
+% \Hologo{ConTeXt}) to their escaped variants. Define tables
+% \luamdef{escaped_minimal_chars} and \luamdef{escaped_minimal_strings}
+% containing the mapping from special plain characters and character strings
+% that need to be escaped even in content that will not be typeset.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local escaped_chars = {
+ ["{"] = "\\markdownRendererLeftBrace{}",
+ ["}"] = "\\markdownRendererRightBrace{}",
+ ["$"] = "\\markdownRendererDollarSign{}",
+ ["%"] = "\\markdownRendererPercentSign{}",
+ ["&"] = "\\markdownRendererAmpersand{}",
+ ["_"] = "\\markdownRendererUnderscore{}",
+ ["#"] = "\\markdownRendererHash{}",
+ ["^"] = "\\markdownRendererCircumflex{}",
+ ["\\"] = "\\markdownRendererBackslash{}",
+ ["~"] = "\\markdownRendererTilde{}",
+ ["|"] = "\\markdownRendererPipe{}",
+ }
+ local escaped_uri_chars = {
+ ["{"] = "\\markdownRendererLeftBrace{}",
+ ["}"] = "\\markdownRendererRightBrace{}",
+ ["%"] = "\\markdownRendererPercentSign{}",
+ ["\\"] = "\\markdownRendererBackslash{}",
+ }
+ local escaped_citation_chars = {
+ ["{"] = "\\markdownRendererLeftBrace{}",
+ ["}"] = "\\markdownRendererRightBrace{}",
+ ["%"] = "\\markdownRendererPercentSign{}",
+ ["#"] = "\\markdownRendererHash{}",
+ ["\\"] = "\\markdownRendererBackslash{}",
+ }
+ local escaped_minimal_strings = {
+ ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ",
+ }
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Use the \luam{escaped_chars} table to create an escaper function
+% \luamdef{escape} and the \luam{escaped_minimal_chars} and
+% \luam{escaped_minimal_strings} tables to create an escaper function
+% \luamdef{escape_minimal}.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local escape = util.escaper(escaped_chars)
+ local escape_citation = util.escaper(escaped_citation_chars,
+ escaped_minimal_strings)
+ local escape_uri = util.escaper(escaped_uri_chars, escaped_minimal_strings)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->string} as a function that will transform an input
+% plain text span `s` to the output format and \luamdef{writer->uri} as a
+% function that will transform an input \acro{uri} `u` to the output format.
+% If the \Opt{hybrid} option is `true`, use identity functions. Otherwise,
+% use the \luam{escape} and \luam{escape_minimal} functions.
+%
+% \end{markdown}
+% \begin{macrocode}
+ if options.hybrid then
+ self.string = function(s) return s end
+ self.citation = function(c) return c end
+ self.uri = function(u) return u end
+ else
+ self.string = escape
+ self.citation = escape_citation
+ self.uri = escape_uri
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->code} as a function that will transform an input
+% inlined code span `s` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.code(s)
+ return {"\\markdownRendererCodeSpan{",escape(s),"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->link} as a function that will transform an input
+% hyperlink to the output format, where `lab` corresponds to the label,
+% `src` to \acro{uri}, and `tit` to the title of the link.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.link(lab,src,tit)
+ return {"\\markdownRendererLink{",lab,"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->table} as a function that will transform an input
+% table to the output format, where `rows` is a sequence of columns and a
+% column is a sequence of cell texts.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.table(rows, caption)
+ local buffer = {"\\markdownRendererTable{",
+ caption or "", "}{", #rows - 1, "}{", #rows[1], "}"}
+ local temp = rows[2] -- put alignments on the first row
+ rows[2] = rows[1]
+ rows[1] = temp
+ for i, row in ipairs(rows) do
+ table.insert(buffer, "{")
+ for _, column in ipairs(row) do
+ if i > 1 then -- do not use braces for alignments
+ table.insert(buffer, "{")
+ end
+ table.insert(buffer, column)
+ if i > 1 then
+ table.insert(buffer, "}%\n")
+ end
+ end
+ table.insert(buffer, "}%\n")
+ end
+ return buffer
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->image} as a function that will transform an input
+% image to the output format, where `lab` corresponds to the label, `src`
+% to the \acro{url}, and `tit` to the title of the image.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.image(lab,src,tit)
+ return {"\\markdownRendererImage{",lab,"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{languages_json} table maps programming language filename
+% extensions to fence infostrings. All \luam{options.contentBlocksLanguageMap}
+% files located by \pkg{kpathsea} are loaded into a chain of tables.
+% \luam{languages_json} corresponds to the first table and is chained with
+% the rest via Lua metatables.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local languages_json = (function()
+ local kpse = require("kpse")
+ kpse.set_program_name("luatex")
+ local base, prev, curr
+ for _, file in ipairs{kpse.lookup(options.contentBlocksLanguageMap,
+ { all=true })} do
+ json = io.open(file, "r"):read("*all")
+ :gsub('("[^\n]-"):','[%1]=')
+ curr = (function()
+ local _ENV={ json=json, load=load } -- run in sandbox
+ return load("return "..json)()
+ end)()
+ if type(curr) == "table" then
+ if base == nil then
+ base = curr
+ else
+ setmetatable(prev, { __index = curr })
+ end
+ prev = curr
+ end
+ end
+ return base or {}
+ end)()
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->contentblock} as a function that will transform an
+% input iA\,Writer content block to the output format, where `src`
+% corresponds to the \acro{uri} prefix, `suf` to the \acro{uri} extension,
+% `type` to the type of the content block (`localfile` or `onlineimage`),
+% and `tit` to the title of the content block.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.contentblock(src,suf,type,tit)
+ if not self.is_writing then return "" end
+ src = src.."."..suf
+ suf = suf:lower()
+ if type == "onlineimage" then
+ return {"\\markdownRendererContentBlockOnlineImage{",suf,"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ elseif languages_json[suf] then
+ return {"\\markdownRendererContentBlockCode{",suf,"}",
+ "{",self.string(languages_json[suf]),"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ else
+ return {"\\markdownRendererContentBlock{",suf,"}",
+ "{",self.string(src),"}",
+ "{",self.uri(src),"}",
+ "{",self.string(tit or ""),"}"}
+ end
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->bulletlist} as a function that will transform an input
+% bulleted list to the output format, where `items` is an array of the list
+% items and `tight` specifies, whether the list is tight or not.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local function ulitem(s)
+ return {"\\markdownRendererUlItem ",s,
+ "\\markdownRendererUlItemEnd "}
+ end
+
+ function self.bulletlist(items,tight)
+ if not self.is_writing then return "" end
+ local buffer = {}
+ for _,item in ipairs(items) do
+ buffer[#buffer + 1] = ulitem(item)
+ end
+ local contents = util.intersperse(buffer,"\n")
+ if tight and options.tightLists then
+ return {"\\markdownRendererUlBeginTight\n",contents,
+ "\n\\markdownRendererUlEndTight "}
+ else
+ return {"\\markdownRendererUlBegin\n",contents,
+ "\n\\markdownRendererUlEnd "}
+ end
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->ollist} as a function that will transform an input
+% ordered list to the output format, where `items` is an array of the list
+% items and `tight` specifies, whether the list is tight or not. If the
+% optional parameter `startnum` is present, it should be used as the number
+% of the first list item.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local function olitem(s,num)
+ if num ~= nil then
+ return {"\\markdownRendererOlItemWithNumber{",num,"}",s,
+ "\\markdownRendererOlItemEnd "}
+ else
+ return {"\\markdownRendererOlItem ",s,
+ "\\markdownRendererOlItemEnd "}
+ end
+ end
+
+ function self.orderedlist(items,tight,startnum)
+ if not self.is_writing then return "" end
+ local buffer = {}
+ local num = startnum
+ for _,item in ipairs(items) do
+ buffer[#buffer + 1] = olitem(item,num)
+ if num ~= nil then
+ num = num + 1
+ end
+ end
+ local contents = util.intersperse(buffer,"\n")
+ if tight and options.tightLists then
+ return {"\\markdownRendererOlBeginTight\n",contents,
+ "\n\\markdownRendererOlEndTight "}
+ else
+ return {"\\markdownRendererOlBegin\n",contents,
+ "\n\\markdownRendererOlEnd "}
+ end
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->inline_html} and \luamdef{writer->display_html}
+% as functions that will transform an inline or block \acro{html} element
+% respectively to the output format, where `html` is the \acro{html}
+% input.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.inline_html(html) return "" end
+ function self.display_html(html) return "" end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->definitionlist} as a function that will transform an
+% input definition list to the output format, where `items` is an array of
+% tables, each of the form `{ term = t, definitions = defs }`, where `t`
+% is a term and `defs` is an array of definitions. `tight` specifies,
+% whether the list is tight or not.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local function dlitem(term, defs)
+ local retVal = {"\\markdownRendererDlItem{",term,"}"}
+ for _, def in ipairs(defs) do
+ retVal[#retVal+1] = {"\\markdownRendererDlDefinitionBegin ",def,
+ "\\markdownRendererDlDefinitionEnd "}
+ end
+ retVal[#retVal+1] = "\\markdownRendererDlItemEnd "
+ return retVal
+ end
+
+ function self.definitionlist(items,tight)
+ if not self.is_writing then return "" end
+ local buffer = {}
+ for _,item in ipairs(items) do
+ buffer[#buffer + 1] = dlitem(item.term, item.definitions)
+ end
+ if tight and options.tightLists then
+ return {"\\markdownRendererDlBeginTight\n", buffer,
+ "\n\\markdownRendererDlEndTight"}
+ else
+ return {"\\markdownRendererDlBegin\n", buffer,
+ "\n\\markdownRendererDlEnd"}
+ end
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->emphasis} as a function that will transform an
+% emphasized span `s` of input text to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.emphasis(s)
+ return {"\\markdownRendererEmphasis{",s,"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->strong} as a function that will transform a strongly
+% emphasized span `s` of input text to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.strong(s)
+ return {"\\markdownRendererStrongEmphasis{",s,"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->blockquote} as a function that will transform an
+% input block quote `s` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.blockquote(s)
+ if #util.rope_to_string(s) == 0 then return "" end
+ return {"\\markdownRendererBlockQuoteBegin\n",s,
+ "\n\\markdownRendererBlockQuoteEnd "}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->verbatim} as a function that will transform an
+% input code block `s` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.verbatim(s)
+ if not self.is_writing then return "" end
+ local name = util.cache(options.cacheDir, s, nil, nil, ".verbatim")
+ return {"\\markdownRendererInputVerbatim{",name,"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->codeFence} as a function that will transform an
+% input fenced code block `s` with the infostring `i` to the output
+% format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.fencedCode(i, s)
+ if not self.is_writing then return "" end
+ local name = util.cache(options.cacheDir, s, nil, nil, ".verbatim")
+ return {"\\markdownRendererInputFencedCode{",name,"}{",i,"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->active_headings} as a stack of identifiers
+% of the headings that are currently active.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.active_headings = {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->heading} as a function that will transform an
+% input heading `s` at level `level` with identifiers `identifiers` to the
+% output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.heading(s,level,attributes)
+ local active_headings = self.active_headings
+ local slice_begin_type = self.slice_begin:sub(1, 1)
+ local slice_begin_identifier = self.slice_begin:sub(2) or ""
+ local slice_end_type = self.slice_end:sub(1, 1)
+ local slice_end_identifier = self.slice_end:sub(2) or ""
+
+ while #active_headings < level do
+ -- push empty identifiers for implied sections
+ table.insert(active_headings, {})
+ end
+
+ while #active_headings >= level do
+ -- pop identifiers for sections that have ended
+ local active_identifiers = active_headings[#active_headings]
+ if active_identifiers[slice_begin_identifier] ~= nil
+ and slice_begin_type == "$" then
+ self.is_writing = true
+ end
+ if active_identifiers[slice_end_identifier] ~= nil
+ and slice_end_type == "$" then
+ self.is_writing = false
+ end
+ table.remove(active_headings, #active_headings)
+ end
+
+ -- push identifiers for the new section
+ attributes = attributes or {}
+ local identifiers = {}
+ for index = 1, #attributes do
+ attribute = attributes[index]
+ identifiers[attribute:sub(2)] = true
+ end
+ if identifiers[slice_begin_identifier] ~= nil
+ and slice_begin_type == "^" then
+ self.is_writing = true
+ end
+ if identifiers[slice_end_identifier] ~= nil
+ and slice_end_type == "^" then
+ self.is_writing = false
+ end
+ table.insert(active_headings, identifiers)
+
+ if not self.is_writing then return "" end
+
+ local cmd
+ level = level + options.shiftHeadings
+ if level <= 1 then
+ cmd = "\\markdownRendererHeadingOne"
+ elseif level == 2 then
+ cmd = "\\markdownRendererHeadingTwo"
+ elseif level == 3 then
+ cmd = "\\markdownRendererHeadingThree"
+ elseif level == 4 then
+ cmd = "\\markdownRendererHeadingFour"
+ elseif level == 5 then
+ cmd = "\\markdownRendererHeadingFive"
+ elseif level >= 6 then
+ cmd = "\\markdownRendererHeadingSix"
+ else
+ cmd = ""
+ end
+ return {cmd,"{",s,"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->note} as a function that will transform an
+% input footnote `s` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.note(s)
+ return {"\\markdownRendererFootnote{",s,"}"}
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->citations} as a function that will transform an
+% input array of citations `cites` to the output format. If `text_cites`
+% is `true`, the citations should be rendered in-text, when applicable.
+% The `cites` array contains tables with the following keys and values:
+% \begin{itemize}
+% \item`suppress_author` -- If the value of the key is true, then the
+% author of the work should be omitted in the citation, when applicable.
+% \item`prenote` -- The value of the key is either `nil` or a rope
+% that should be inserted before the citation.
+% \item`postnote` -- The value of the key is either `nil` or a rope
+% that should be inserted after the citation.
+% \item`name` -- The value of this key is the citation name.
+% \end{itemize}
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.citations(text_cites, cites)
+ local buffer = {"\\markdownRenderer", text_cites and "TextCite" or "Cite",
+ "{", #cites, "}"}
+ for _,cite in ipairs(cites) do
+ buffer[#buffer+1] = {cite.suppress_author and "-" or "+", "{",
+ cite.prenote or "", "}{", cite.postnote or "", "}{", cite.name, "}"}
+ end
+ return buffer
+ end
+
+ return self
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Parsers
+% The \luamdef{parsers} hash table stores \acro{peg} patterns that are
+% static and can be reused between different \luam{reader} objects.
+%
+% \end{markdown}
+% \begin{macrocode}
+local parsers = {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Basic Parsers
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.percent = P("%")
+parsers.at = P("@")
+parsers.comma = P(",")
+parsers.asterisk = P("*")
+parsers.dash = P("-")
+parsers.plus = P("+")
+parsers.underscore = P("_")
+parsers.period = P(".")
+parsers.hash = P("#")
+parsers.ampersand = P("&")
+parsers.backtick = P("`")
+parsers.less = P("<")
+parsers.more = P(">")
+parsers.space = P(" ")
+parsers.squote = P("'")
+parsers.dquote = P('"')
+parsers.lparent = P("(")
+parsers.rparent = P(")")
+parsers.lbracket = P("[")
+parsers.rbracket = P("]")
+parsers.lbrace = P("{")
+parsers.rbrace = P("}")
+parsers.circumflex = P("^")
+parsers.slash = P("/")
+parsers.equal = P("=")
+parsers.colon = P(":")
+parsers.semicolon = P(";")
+parsers.exclamation = P("!")
+parsers.pipe = P("|")
+parsers.tilde = P("~")
+parsers.tab = P("\t")
+parsers.newline = P("\n")
+parsers.tightblocksep = P("\001")
+
+parsers.digit = R("09")
+parsers.hexdigit = R("09","af","AF")
+parsers.letter = R("AZ","az")
+parsers.alphanumeric = R("AZ","az","09")
+parsers.keyword = parsers.letter
+ * parsers.alphanumeric^0
+parsers.citation_chars = parsers.alphanumeric
+ + S("#$%&-+<>~/_")
+parsers.internal_punctuation = S(":;,.?")
+
+parsers.doubleasterisks = P("**")
+parsers.doubleunderscores = P("__")
+parsers.fourspaces = P(" ")
+
+parsers.any = P(1)
+parsers.fail = parsers.any - 1
+
+parsers.escapable = S("\\`*_{}[]()+_.!<>#-~:^@;")
+parsers.anyescaped = P("\\") / "" * parsers.escapable
+ + parsers.any
+
+parsers.spacechar = S("\t ")
+parsers.spacing = S(" \n\r\t")
+parsers.nonspacechar = parsers.any - parsers.spacing
+parsers.optionalspace = parsers.spacechar^0
+
+parsers.specialchar = S("*_`&[]<!\\.@-^")
+
+parsers.normalchar = parsers.any - (parsers.specialchar
+ + parsers.spacing
+ + parsers.tightblocksep)
+parsers.eof = -parsers.any
+parsers.nonindentspace = parsers.space^-3 * - parsers.spacechar
+parsers.indent = parsers.space^-3 * parsers.tab
+ + parsers.fourspaces / ""
+parsers.linechar = P(1 - parsers.newline)
+
+parsers.blankline = parsers.optionalspace
+ * parsers.newline / "\n"
+parsers.blanklines = parsers.blankline^0
+parsers.skipblanklines = (parsers.optionalspace * parsers.newline)^0
+parsers.indentedline = parsers.indent /""
+ * C(parsers.linechar^1 * parsers.newline^-1)
+parsers.optionallyindentedline = parsers.indent^-1 /""
+ * C(parsers.linechar^1 * parsers.newline^-1)
+parsers.sp = parsers.spacing^0
+parsers.spnl = parsers.optionalspace
+ * (parsers.newline * parsers.optionalspace)^-1
+parsers.line = parsers.linechar^0 * parsers.newline
+parsers.nonemptyline = parsers.line - parsers.blankline
+
+parsers.chunk = parsers.line * (parsers.optionallyindentedline
+ - parsers.blankline)^0
+
+parsers.css_identifier_char = R("AZ", "az", "09") + S("-_")
+parsers.css_identifier = (parsers.hash + parsers.period)
+ * (((parsers.css_identifier_char
+ - parsers.dash - parsers.digit)
+ * parsers.css_identifier_char^1)
+ + (parsers.dash
+ * (parsers.css_identifier_char
+ - parsers.digit)
+ * parsers.css_identifier_char^0))
+parsers.attribute_name_char = parsers.any - parsers.space
+ - parsers.squote - parsers.dquote
+ - parsers.more - parsers.slash
+ - parsers.equal
+parsers.attribute_value_char = parsers.any - parsers.dquote
+ - parsers.more
+
+-- block followed by 0 or more optionally
+-- indented blocks with first line indented.
+parsers.indented_blocks = function(bl)
+ return Cs( bl
+ * (parsers.blankline^1 * parsers.indent * -parsers.blankline * bl)^0
+ * (parsers.blankline^1 + parsers.eof) )
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Markdown Lists
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.bulletchar = C(parsers.plus + parsers.asterisk + parsers.dash)
+
+parsers.bullet = ( parsers.bulletchar * #parsers.spacing
+ * (parsers.tab + parsers.space^-3)
+ + parsers.space * parsers.bulletchar * #parsers.spacing
+ * (parsers.tab + parsers.space^-2)
+ + parsers.space * parsers.space * parsers.bulletchar
+ * #parsers.spacing
+ * (parsers.tab + parsers.space^-1)
+ + parsers.space * parsers.space * parsers.space
+ * parsers.bulletchar * #parsers.spacing
+ )
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Markdown Code Spans
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.openticks = Cg(parsers.backtick^1, "ticks")
+
+local function captures_equal_length(s,i,a,b)
+ return #a == #b and i
+end
+
+parsers.closeticks = parsers.space^-1
+ * Cmt(C(parsers.backtick^1)
+ * Cb("ticks"), captures_equal_length)
+
+parsers.intickschar = (parsers.any - S(" \n\r`"))
+ + (parsers.newline * -parsers.blankline)
+ + (parsers.space - parsers.closeticks)
+ + (parsers.backtick^1 - parsers.closeticks)
+
+parsers.inticks = parsers.openticks * parsers.space^-1
+ * C(parsers.intickschar^0) * parsers.closeticks
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Fenced Code Blocks
+%
+% \end{markdown}
+% \begin{macrocode}
+local function captures_geq_length(s,i,a,b)
+ return #a >= #b and i
+end
+
+parsers.infostring = (parsers.linechar - (parsers.backtick
+ + parsers.space^1 * (parsers.newline + parsers.eof)))^0
+
+local fenceindent
+parsers.fencehead = function(char)
+ return C(parsers.nonindentspace) / function(s) fenceindent = #s end
+ * Cg(char^3, "fencelength")
+ * parsers.optionalspace * C(parsers.infostring)
+ * parsers.optionalspace * (parsers.newline + parsers.eof)
+end
+
+parsers.fencetail = function(char)
+ return parsers.nonindentspace
+ * Cmt(C(char^3) * Cb("fencelength"), captures_geq_length)
+ * parsers.optionalspace * (parsers.newline + parsers.eof)
+ + parsers.eof
+end
+
+parsers.fencedline = function(char)
+ return C(parsers.line - parsers.fencetail(char))
+ / function(s)
+ i = 1
+ remaining = fenceindent
+ while true do
+ c = s:sub(i, i)
+ if c == " " and remaining > 0 then
+ remaining = remaining - 1
+ i = i + 1
+ elseif c == "\t" and remaining > 3 then
+ remaining = remaining - 4
+ i = i + 1
+ else
+ break
+ end
+ end
+ return s:sub(i)
+ end
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Markdown Tags and Links
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.leader = parsers.space^-3
+
+-- content in balanced brackets, parentheses, or quotes:
+parsers.bracketed = P{ parsers.lbracket
+ * ((parsers.anyescaped - (parsers.lbracket
+ + parsers.rbracket
+ + parsers.blankline^2)
+ ) + V(1))^0
+ * parsers.rbracket }
+
+parsers.inparens = P{ parsers.lparent
+ * ((parsers.anyescaped - (parsers.lparent
+ + parsers.rparent
+ + parsers.blankline^2)
+ ) + V(1))^0
+ * parsers.rparent }
+
+parsers.squoted = P{ parsers.squote * parsers.alphanumeric
+ * ((parsers.anyescaped - (parsers.squote
+ + parsers.blankline^2)
+ ) + V(1))^0
+ * parsers.squote }
+
+parsers.dquoted = P{ parsers.dquote * parsers.alphanumeric
+ * ((parsers.anyescaped - (parsers.dquote
+ + parsers.blankline^2)
+ ) + V(1))^0
+ * parsers.dquote }
+
+-- bracketed tag for markdown links, allowing nested brackets:
+parsers.tag = parsers.lbracket
+ * Cs((parsers.alphanumeric^1
+ + parsers.bracketed
+ + parsers.inticks
+ + (parsers.anyescaped
+ - (parsers.rbracket + parsers.blankline^2)))^0)
+ * parsers.rbracket
+
+-- url for markdown links, allowing nested brackets:
+parsers.url = parsers.less * Cs((parsers.anyescaped
+ - parsers.more)^0)
+ * parsers.more
+ + Cs((parsers.inparens + (parsers.anyescaped
+ - parsers.spacing
+ - parsers.rparent))^1)
+
+-- quoted text, possibly with nested quotes:
+parsers.title_s = parsers.squote * Cs(((parsers.anyescaped-parsers.squote)
+ + parsers.squoted)^0)
+ * parsers.squote
+
+parsers.title_d = parsers.dquote * Cs(((parsers.anyescaped-parsers.dquote)
+ + parsers.dquoted)^0)
+ * parsers.dquote
+
+parsers.title_p = parsers.lparent
+ * Cs((parsers.inparens + (parsers.anyescaped-parsers.rparent))^0)
+ * parsers.rparent
+
+parsers.title = parsers.title_d + parsers.title_s + parsers.title_p
+
+parsers.optionaltitle
+ = parsers.spnl * parsers.title * parsers.spacechar^0
+ + Cc("")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for iA\,Writer Content Blocks
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.contentblock_tail
+ = parsers.optionaltitle
+ * (parsers.newline + parsers.eof)
+
+-- case insensitive online image suffix:
+parsers.onlineimagesuffix
+ = (function(...)
+ local parser = nil
+ for _,suffix in ipairs({...}) do
+ local pattern=nil
+ for i=1,#suffix do
+ local char=suffix:sub(i,i)
+ char = S(char:lower()..char:upper())
+ if pattern == nil then
+ pattern = char
+ else
+ pattern = pattern * char
+ end
+ end
+ if parser == nil then
+ parser = pattern
+ else
+ parser = parser + pattern
+ end
+ end
+ return parser
+ end)("png", "jpg", "jpeg", "gif", "tif", "tiff")
+
+-- online image url for iA Writer content blocks with mandatory suffix,
+-- allowing nested brackets:
+parsers.onlineimageurl
+ = (parsers.less
+ * Cs((parsers.anyescaped
+ - parsers.more
+ - #(parsers.period
+ * parsers.onlineimagesuffix
+ * parsers.more
+ * parsers.contentblock_tail))^0)
+ * parsers.period
+ * Cs(parsers.onlineimagesuffix)
+ * parsers.more
+ + (Cs((parsers.inparens
+ + (parsers.anyescaped
+ - parsers.spacing
+ - parsers.rparent
+ - #(parsers.period
+ * parsers.onlineimagesuffix
+ * parsers.contentblock_tail)))^0)
+ * parsers.period
+ * Cs(parsers.onlineimagesuffix))
+ ) * Cc("onlineimage")
+
+-- filename for iA Writer content blocks with mandatory suffix:
+parsers.localfilepath
+ = parsers.slash
+ * Cs((parsers.anyescaped
+ - parsers.tab
+ - parsers.newline
+ - #(parsers.period
+ * parsers.alphanumeric^1
+ * parsers.contentblock_tail))^1)
+ * parsers.period
+ * Cs(parsers.alphanumeric^1)
+ * Cc("localfile")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Citations
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.citation_name = Cs(parsers.dash^-1) * parsers.at
+ * Cs(parsers.citation_chars
+ * (((parsers.citation_chars + parsers.internal_punctuation
+ - parsers.comma - parsers.semicolon)
+ * -#((parsers.internal_punctuation - parsers.comma
+ - parsers.semicolon)^0
+ * -(parsers.citation_chars + parsers.internal_punctuation
+ - parsers.comma - parsers.semicolon)))^0
+ * parsers.citation_chars)^-1)
+
+parsers.citation_body_prenote
+ = Cs((parsers.alphanumeric^1
+ + parsers.bracketed
+ + parsers.inticks
+ + (parsers.anyescaped
+ - (parsers.rbracket + parsers.blankline^2))
+ - (parsers.spnl * parsers.dash^-1 * parsers.at))^0)
+
+parsers.citation_body_postnote
+ = Cs((parsers.alphanumeric^1
+ + parsers.bracketed
+ + parsers.inticks
+ + (parsers.anyescaped
+ - (parsers.rbracket + parsers.semicolon
+ + parsers.blankline^2))
+ - (parsers.spnl * parsers.rbracket))^0)
+
+parsers.citation_body_chunk
+ = parsers.citation_body_prenote
+ * parsers.spnl * parsers.citation_name
+ * (parsers.internal_punctuation - parsers.semicolon)^-1
+ * parsers.spnl * parsers.citation_body_postnote
+
+parsers.citation_body
+ = parsers.citation_body_chunk
+ * (parsers.semicolon * parsers.spnl
+ * parsers.citation_body_chunk)^0
+
+parsers.citation_headless_body_postnote
+ = Cs((parsers.alphanumeric^1
+ + parsers.bracketed
+ + parsers.inticks
+ + (parsers.anyescaped
+ - (parsers.rbracket + parsers.at
+ + parsers.semicolon + parsers.blankline^2))
+ - (parsers.spnl * parsers.rbracket))^0)
+
+parsers.citation_headless_body
+ = parsers.citation_headless_body_postnote
+ * (parsers.sp * parsers.semicolon * parsers.spnl
+ * parsers.citation_body_chunk)^0
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Footnotes
+%
+% \end{markdown}
+% \begin{macrocode}
+local function strip_first_char(s)
+ return s:sub(2)
+end
+
+parsers.RawNoteRef = #(parsers.lbracket * parsers.circumflex)
+ * parsers.tag / strip_first_char
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Tables
+%
+% \end{markdown}
+% \begin{macrocode}
+local function make_pipe_table_rectangular(rows)
+ local num_columns = #rows[2]
+ local rectangular_rows = {}
+ for i = 1, #rows do
+ local row = rows[i]
+ local rectangular_row = {}
+ for j = 1, num_columns do
+ rectangular_row[j] = row[j] or ""
+ end
+ table.insert(rectangular_rows, rectangular_row)
+ end
+ return rectangular_rows
+end
+
+local function pipe_table_row(allow_empty_first_column
+ , nonempty_column
+ , column_separator
+ , column)
+ local row_beginning
+ if allow_empty_first_column then
+ row_beginning = -- empty first column
+ #(parsers.spacechar^4
+ * column_separator)
+ * parsers.optionalspace
+ * column
+ * parsers.optionalspace
+ -- non-empty first column
+ + parsers.nonindentspace
+ * nonempty_column^-1
+ * parsers.optionalspace
+ else
+ row_beginning = parsers.nonindentspace
+ * nonempty_column^-1
+ * parsers.optionalspace
+ end
+
+ return Ct(row_beginning
+ * (-- single column with no leading pipes
+ #(column_separator
+ * parsers.optionalspace
+ * parsers.newline)
+ * column_separator
+ * parsers.optionalspace
+ -- single column with leading pipes or
+ -- more than a single column
+ + (column_separator
+ * parsers.optionalspace
+ * column
+ * parsers.optionalspace)^1
+ * (column_separator
+ * parsers.optionalspace)^-1))
+end
+
+parsers.table_hline_separator = parsers.pipe + parsers.plus
+parsers.table_hline_column = (parsers.dash
+ - #(parsers.dash
+ * (parsers.spacechar
+ + parsers.table_hline_separator
+ + parsers.newline)))^1
+ * (parsers.colon * Cc("r")
+ + parsers.dash * Cc("d"))
+ + parsers.colon
+ * (parsers.dash
+ - #(parsers.dash
+ * (parsers.spacechar
+ + parsers.table_hline_separator
+ + parsers.newline)))^1
+ * (parsers.colon * Cc("c")
+ + parsers.dash * Cc("l"))
+parsers.table_hline = pipe_table_row(false
+ , parsers.table_hline_column
+ , parsers.table_hline_separator
+ , parsers.table_hline_column)
+parsers.table_caption_beginning = parsers.skipblanklines
+ * parsers.nonindentspace
+ * (P("Table")^-1 * parsers.colon)
+ * parsers.optionalspace
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for HTML
+%
+% \end{markdown}
+% \begin{macrocode}
+-- case-insensitive match (we assume s is lowercase). must be single byte encoding
+parsers.keyword_exact = function(s)
+ local parser = P(0)
+ for i=1,#s do
+ local c = s:sub(i,i)
+ local m = c .. upper(c)
+ parser = parser * S(m)
+ end
+ return parser
+end
+
+parsers.block_keyword =
+ parsers.keyword_exact("address") + parsers.keyword_exact("blockquote") +
+ parsers.keyword_exact("center") + parsers.keyword_exact("del") +
+ parsers.keyword_exact("dir") + parsers.keyword_exact("div") +
+ parsers.keyword_exact("p") + parsers.keyword_exact("pre") +
+ parsers.keyword_exact("li") + parsers.keyword_exact("ol") +
+ parsers.keyword_exact("ul") + parsers.keyword_exact("dl") +
+ parsers.keyword_exact("dd") + parsers.keyword_exact("form") +
+ parsers.keyword_exact("fieldset") + parsers.keyword_exact("isindex") +
+ parsers.keyword_exact("ins") + parsers.keyword_exact("menu") +
+ parsers.keyword_exact("noframes") + parsers.keyword_exact("frameset") +
+ parsers.keyword_exact("h1") + parsers.keyword_exact("h2") +
+ parsers.keyword_exact("h3") + parsers.keyword_exact("h4") +
+ parsers.keyword_exact("h5") + parsers.keyword_exact("h6") +
+ parsers.keyword_exact("hr") + parsers.keyword_exact("script") +
+ parsers.keyword_exact("noscript") + parsers.keyword_exact("table") +
+ parsers.keyword_exact("tbody") + parsers.keyword_exact("tfoot") +
+ parsers.keyword_exact("thead") + parsers.keyword_exact("th") +
+ parsers.keyword_exact("td") + parsers.keyword_exact("tr")
+
+-- There is no reason to support bad html, so we expect quoted attributes
+parsers.htmlattributevalue
+ = parsers.squote * (parsers.any - (parsers.blankline
+ + parsers.squote))^0
+ * parsers.squote
+ + parsers.dquote * (parsers.any - (parsers.blankline
+ + parsers.dquote))^0
+ * parsers.dquote
+
+parsers.htmlattribute = parsers.spacing^1
+ * (parsers.alphanumeric + S("_-"))^1
+ * parsers.sp * parsers.equal * parsers.sp
+ * parsers.htmlattributevalue
+
+parsers.htmlcomment = P("<!--") * (parsers.any - P("-->"))^0 * P("-->")
+
+parsers.htmlinstruction = P("<?") * (parsers.any - P("?>" ))^0 * P("?>" )
+
+parsers.openelt_any = parsers.less * parsers.keyword * parsers.htmlattribute^0
+ * parsers.sp * parsers.more
+
+parsers.openelt_exact = function(s)
+ return parsers.less * parsers.sp * parsers.keyword_exact(s)
+ * parsers.htmlattribute^0 * parsers.sp * parsers.more
+end
+
+parsers.openelt_block = parsers.sp * parsers.block_keyword
+ * parsers.htmlattribute^0 * parsers.sp * parsers.more
+
+parsers.closeelt_any = parsers.less * parsers.sp * parsers.slash
+ * parsers.keyword * parsers.sp * parsers.more
+
+parsers.closeelt_exact = function(s)
+ return parsers.less * parsers.sp * parsers.slash * parsers.keyword_exact(s)
+ * parsers.sp * parsers.more
+end
+
+parsers.emptyelt_any = parsers.less * parsers.sp * parsers.keyword
+ * parsers.htmlattribute^0 * parsers.sp * parsers.slash
+ * parsers.more
+
+parsers.emptyelt_block = parsers.less * parsers.sp * parsers.block_keyword
+ * parsers.htmlattribute^0 * parsers.sp * parsers.slash
+ * parsers.more
+
+parsers.displaytext = (parsers.any - parsers.less)^1
+
+-- return content between two matched HTML tags
+parsers.in_matched = function(s)
+ return { parsers.openelt_exact(s)
+ * (V(1) + parsers.displaytext
+ + (parsers.less - parsers.closeelt_exact(s)))^0
+ * parsers.closeelt_exact(s) }
+end
+
+local function parse_matched_tags(s,pos)
+ local t = string.lower(lpeg.match(C(parsers.keyword),s,pos))
+ return lpeg.match(parsers.in_matched(t),s,pos-1)
+end
+
+parsers.in_matched_block_tags = parsers.less
+ * Cmt(#parsers.openelt_block, parse_matched_tags)
+
+parsers.displayhtml = parsers.htmlcomment
+ + parsers.emptyelt_block
+ + parsers.openelt_exact("hr")
+ + parsers.in_matched_block_tags
+ + parsers.htmlinstruction
+
+parsers.inlinehtml = parsers.emptyelt_any
+ + parsers.htmlcomment
+ + parsers.htmlinstruction
+ + parsers.openelt_any
+ + parsers.closeelt_any
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for HTML Entities
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.hexentity = parsers.ampersand * parsers.hash * S("Xx")
+ * C(parsers.hexdigit^1) * parsers.semicolon
+parsers.decentity = parsers.ampersand * parsers.hash
+ * C(parsers.digit^1) * parsers.semicolon
+parsers.tagentity = parsers.ampersand * C(parsers.alphanumeric^1)
+ * parsers.semicolon
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Helpers for References
+%
+% \end{markdown}
+% \begin{macrocode}
+-- parse a reference definition: [foo]: /bar "title"
+parsers.define_reference_parser = parsers.leader * parsers.tag * parsers.colon
+ * parsers.spacechar^0 * parsers.url
+ * parsers.optionaltitle * parsers.blankline^1
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Inline Elements
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.Inline = V("Inline")
+parsers.IndentedInline = V("IndentedInline")
+
+-- parse many p between starter and ender
+parsers.between = function(p, starter, ender)
+ local ender2 = B(parsers.nonspacechar) * ender
+ return (starter * #parsers.nonspacechar * Ct(p * (p - ender2)^0) * ender2)
+end
+
+parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Block Elements
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.Block = V("Block")
+
+parsers.OnlineImageURL
+ = parsers.leader
+ * parsers.onlineimageurl
+ * parsers.optionaltitle
+
+parsers.LocalFilePath
+ = parsers.leader
+ * parsers.localfilepath
+ * parsers.optionaltitle
+
+parsers.TildeFencedCode
+ = parsers.fencehead(parsers.tilde)
+ * Cs(parsers.fencedline(parsers.tilde)^0)
+ * parsers.fencetail(parsers.tilde)
+
+parsers.BacktickFencedCode
+ = parsers.fencehead(parsers.backtick)
+ * Cs(parsers.fencedline(parsers.backtick)^0)
+ * parsers.fencetail(parsers.backtick)
+
+parsers.lineof = function(c)
+ return (parsers.leader * (P(c) * parsers.optionalspace)^3
+ * (parsers.newline * parsers.blankline^1
+ + parsers.newline^-1 * parsers.eof))
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Lists
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.defstartchar = S("~:")
+parsers.defstart = ( parsers.defstartchar * #parsers.spacing
+ * (parsers.tab + parsers.space^-3)
+ + parsers.space * parsers.defstartchar * #parsers.spacing
+ * (parsers.tab + parsers.space^-2)
+ + parsers.space * parsers.space * parsers.defstartchar
+ * #parsers.spacing
+ * (parsers.tab + parsers.space^-1)
+ + parsers.space * parsers.space * parsers.space
+ * parsers.defstartchar * #parsers.spacing
+ )
+
+parsers.dlchunk = Cs(parsers.line * (parsers.indentedline - parsers.blankline)^0)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Headings
+%
+% \end{markdown}
+% \begin{macrocode}
+parsers.heading_attribute = C(parsers.css_identifier)
+ + C((parsers.attribute_name_char
+ - parsers.rbrace)^1
+ * parsers.equal
+ * (parsers.attribute_value_char
+ - parsers.rbrace)^1)
+parsers.HeadingAttributes = parsers.lbrace
+ * parsers.heading_attribute
+ * (parsers.spacechar^1
+ * parsers.heading_attribute)^0
+ * parsers.rbrace
+
+-- parse Atx heading start and return level
+parsers.HeadingStart = #parsers.hash * C(parsers.hash^-6)
+ * -parsers.hash / length
+
+-- parse setext header ending and return level
+parsers.HeadingLevel = parsers.equal^1 * Cc(1) + parsers.dash^1 * Cc(2)
+
+local function strip_atx_end(s)
+ return s:gsub("[#%s]*\n$","")
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Markdown Reader
+% \label{sec:markdownreader}
+% This section documents the \luam{reader} object, which implements the
+% routines for parsing the markdown input. The object corresponds to the
+% markdown reader object that was located in the
+% `lunamark/reader/markdown.lua` file in the Lunamark Lua module.
+%
+% Although not specified in the Lua interface (see Section
+% \ref{sec:luainterface}), the \luam{reader} object is exported, so that the
+% curious user could easily tinker with the methods of the objects produced by
+% the \luam{reader.new} method described below. The user should be aware,
+% however, that the implementation may change in a future revision.
+%
+% The \luamdef{reader.new} method creates and returns a new \TeX{} reader
+% object associated with the Lua interface options (see Section
+% \ref{sec:luaoptions}) `options` and with a writer object `writer`. When
+% `options` are unspecified, it is assumed that an empty table was passed to
+% the method.
+%
+% The objects produced by the \luam{reader.new} method expose instance methods
+% and variables of their own. As a convention, I will refer to these
+% \meta{member}s as `reader->`\meta{member}.
+%
+% \end{markdown}
+% \begin{macrocode}
+M.reader = {}
+function M.reader.new(writer, options)
+ local self = {}
+ options = options or {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Make the `options` table inherit from the \luam{defaultOptions} table.
+%
+% \end{markdown}
+% \begin{macrocode}
+ setmetatable(options, { __index = function (_, key)
+ return defaultOptions[key] end })
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Top-Level Helper Functions
+% Define \luamdef{normalize_tag} as a function that normalizes a markdown
+% reference tag by lowercasing it, and by collapsing any adjacent whitespace
+% characters.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local function normalize_tag(tag)
+ return unicode.utf8.lower(
+ gsub(util.rope_to_string(tag), "[ \n\r\t]+", " "))
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{expandtabs} either as an identity function, when the
+% \Opt{preserveTabs} Lua inrerface option is `true`, or to a function that
+% expands tabs into spaces otherwise.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local expandtabs
+ if options.preserveTabs then
+ expandtabs = function(s) return s end
+ else
+ expandtabs = function(s)
+ if s:find("\t") then
+ return s:gsub("[^\n]*", util.expand_tabs_in_line)
+ else
+ return s
+ end
+ end
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \luamdef{larsers} (as in ``local \luam{parsers}'') hash table stores
+% \acro{peg} patterns that depend on the received `options`, which impedes
+% their reuse between different \luam{reader} objects.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local larsers = {}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Top-Level Parser Functions
+%
+% \end{markdown}
+% \begin{macrocode}
+ local function create_parser(name, grammar)
+ return function(str)
+ local res = lpeg.match(grammar(), str)
+ if res == nil then
+ error(format("%s failed on:\n%s", name, str:sub(1,20)))
+ else
+ return res
+ end
+ end
+ end
+
+ local parse_blocks
+ = create_parser("parse_blocks",
+ function()
+ return larsers.blocks
+ end)
+
+ local parse_blocks_toplevel
+ = create_parser("parse_blocks_toplevel",
+ function()
+ return larsers.blocks_toplevel
+ end)
+
+ local parse_inlines
+ = create_parser("parse_inlines",
+ function()
+ return larsers.inlines
+ end)
+
+ local parse_inlines_no_link
+ = create_parser("parse_inlines_no_link",
+ function()
+ return larsers.inlines_no_link
+ end)
+
+ local parse_inlines_no_inline_note
+ = create_parser("parse_inlines_no_inline_note",
+ function()
+ return larsers.inlines_no_inline_note
+ end)
+
+ local parse_inlines_nbsp
+ = create_parser("parse_inlines_nbsp",
+ function()
+ return larsers.inlines_nbsp
+ end)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Markdown Lists (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ if options.hashEnumerators then
+ larsers.dig = parsers.digit + parsers.hash
+ else
+ larsers.dig = parsers.digit
+ end
+
+ larsers.enumerator = C(larsers.dig^3 * parsers.period) * #parsers.spacing
+ + C(larsers.dig^2 * parsers.period) * #parsers.spacing
+ * (parsers.tab + parsers.space^1)
+ + C(larsers.dig * parsers.period) * #parsers.spacing
+ * (parsers.tab + parsers.space^-2)
+ + parsers.space * C(larsers.dig^2 * parsers.period)
+ * #parsers.spacing
+ + parsers.space * C(larsers.dig * parsers.period)
+ * #parsers.spacing
+ * (parsers.tab + parsers.space^-1)
+ + parsers.space * parsers.space * C(larsers.dig^1
+ * parsers.period) * #parsers.spacing
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Blockquotes (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ -- strip off leading > and indents, and run through blocks
+ larsers.blockquote_body = ((parsers.leader * parsers.more * parsers.space^-1)/""
+ * parsers.linechar^0 * parsers.newline)^1
+ * (-(parsers.leader * parsers.more
+ + parsers.blankline) * parsers.linechar^1
+ * parsers.newline)^0
+
+ if not options.breakableBlockquotes then
+ larsers.blockquote_body = larsers.blockquote_body
+ * (parsers.blankline^0 / "")
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Citations (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ larsers.citations = function(text_cites, raw_cites)
+ local function normalize(str)
+ if str == "" then
+ str = nil
+ else
+ str = (options.citationNbsps and parse_inlines_nbsp or
+ parse_inlines)(str)
+ end
+ return str
+ end
+
+ local cites = {}
+ for i = 1,#raw_cites,4 do
+ cites[#cites+1] = {
+ prenote = normalize(raw_cites[i]),
+ suppress_author = raw_cites[i+1] == "-",
+ name = writer.citation(raw_cites[i+2]),
+ postnote = normalize(raw_cites[i+3]),
+ }
+ end
+ return writer.citations(text_cites, cites)
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Footnotes (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ local rawnotes = {}
+
+ -- like indirect_link
+ local function lookup_note(ref)
+ return function()
+ local found = rawnotes[normalize_tag(ref)]
+ if found then
+ return writer.note(parse_blocks_toplevel(found))
+ else
+ return {"[", parse_inlines("^" .. ref), "]"}
+ end
+ end
+ end
+
+ local function register_note(ref,rawnote)
+ rawnotes[normalize_tag(ref)] = rawnote
+ return ""
+ end
+
+ larsers.NoteRef = parsers.RawNoteRef / lookup_note
+
+
+ larsers.NoteBlock = parsers.leader * parsers.RawNoteRef * parsers.colon
+ * parsers.spnl * parsers.indented_blocks(parsers.chunk)
+ / register_note
+
+ larsers.InlineNote = parsers.circumflex
+ * (parsers.tag / parse_inlines_no_inline_note) -- no notes inside notes
+ / writer.note
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Parsers Used for Tables (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+larsers.table_row = pipe_table_row(true
+ , (C((parsers.linechar - parsers.pipe)^1)
+ / parse_inlines)
+ , parsers.pipe
+ , (C((parsers.linechar - parsers.pipe)^0)
+ / parse_inlines))
+
+if options.tableCaptions then
+ larsers.table_caption = #parsers.table_caption_beginning
+ * parsers.table_caption_beginning
+ * Ct(parsers.IndentedInline^1)
+ * parsers.newline
+else
+ larsers.table_caption = parsers.fail
+end
+
+larsers.PipeTable = Ct(larsers.table_row * parsers.newline
+ * parsers.table_hline
+ * (parsers.newline * larsers.table_row)^0)
+ / make_pipe_table_rectangular
+ * larsers.table_caption^-1
+ / writer.table
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Helpers for Links and References (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ -- List of references defined in the document
+ local references
+
+ -- add a reference to the list
+ local function register_link(tag,url,title)
+ references[normalize_tag(tag)] = { url = url, title = title }
+ return ""
+ end
+
+ -- lookup link reference and return either
+ -- the link or nil and fallback text.
+ local function lookup_reference(label,sps,tag)
+ local tagpart
+ if not tag then
+ tag = label
+ tagpart = ""
+ elseif tag == "" then
+ tag = label
+ tagpart = "[]"
+ else
+ tagpart = {"[", parse_inlines(tag), "]"}
+ end
+ if sps then
+ tagpart = {sps, tagpart}
+ end
+ local r = references[normalize_tag(tag)]
+ if r then
+ return r
+ else
+ return nil, {"[", parse_inlines(label), "]", tagpart}
+ end
+ end
+
+ -- lookup link reference and return a link, if the reference is found,
+ -- or a bracketed label otherwise.
+ local function indirect_link(label,sps,tag)
+ return function()
+ local r,fallback = lookup_reference(label,sps,tag)
+ if r then
+ return writer.link(parse_inlines_no_link(label), r.url, r.title)
+ else
+ return fallback
+ end
+ end
+ end
+
+ -- lookup image reference and return an image, if the reference is found,
+ -- or a bracketed label otherwise.
+ local function indirect_image(label,sps,tag)
+ return function()
+ local r,fallback = lookup_reference(label,sps,tag)
+ if r then
+ return writer.image(writer.string(label), r.url, r.title)
+ else
+ return {"!", fallback}
+ end
+ end
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Inline Elements (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ larsers.Str = parsers.normalchar^1 / writer.string
+
+ larsers.Symbol = (parsers.specialchar - parsers.tightblocksep)
+ / writer.string
+
+ larsers.Ellipsis = P("...") / writer.ellipsis
+
+ larsers.Smart = larsers.Ellipsis
+
+ larsers.Code = parsers.inticks / writer.code
+
+ if options.blankBeforeBlockquote then
+ larsers.bqstart = parsers.fail
+ else
+ larsers.bqstart = parsers.more
+ end
+
+ if options.blankBeforeHeading then
+ larsers.headerstart = parsers.fail
+ else
+ larsers.headerstart = parsers.hash
+ + (parsers.line * (parsers.equal^1 + parsers.dash^1)
+ * parsers.optionalspace * parsers.newline)
+ end
+
+ if not options.fencedCode or options.blankBeforeCodeFence then
+ larsers.fencestart = parsers.fail
+ else
+ larsers.fencestart = parsers.fencehead(parsers.backtick)
+ + parsers.fencehead(parsers.tilde)
+ end
+
+ larsers.Endline = parsers.newline * -( -- newline, but not before...
+ parsers.blankline -- paragraph break
+ + parsers.tightblocksep -- nested list
+ + parsers.eof -- end of document
+ + larsers.bqstart
+ + larsers.headerstart
+ + larsers.fencestart
+ ) * parsers.spacechar^0 / writer.space
+
+ larsers.OptionalIndent
+ = parsers.spacechar^1 / writer.space
+
+ larsers.Space = parsers.spacechar^2 * larsers.Endline / writer.linebreak
+ + parsers.spacechar^1 * larsers.Endline^-1 * parsers.eof / ""
+ + parsers.spacechar^1 * larsers.Endline^-1
+ * parsers.optionalspace / writer.space
+
+ larsers.NonbreakingEndline
+ = parsers.newline * -( -- newline, but not before...
+ parsers.blankline -- paragraph break
+ + parsers.tightblocksep -- nested list
+ + parsers.eof -- end of document
+ + larsers.bqstart
+ + larsers.headerstart
+ + larsers.fencestart
+ ) * parsers.spacechar^0 / writer.nbsp
+
+ larsers.NonbreakingSpace
+ = parsers.spacechar^2 * larsers.Endline / writer.linebreak
+ + parsers.spacechar^1 * larsers.Endline^-1 * parsers.eof / ""
+ + parsers.spacechar^1 * larsers.Endline^-1
+ * parsers.optionalspace / writer.nbsp
+
+ if options.underscores then
+ larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks,
+ parsers.doubleasterisks)
+ + parsers.between(parsers.Inline, parsers.doubleunderscores,
+ parsers.doubleunderscores)
+ ) / writer.strong
+
+ larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk,
+ parsers.asterisk)
+ + parsers.between(parsers.Inline, parsers.underscore,
+ parsers.underscore)
+ ) / writer.emphasis
+ else
+ larsers.Strong = ( parsers.between(parsers.Inline, parsers.doubleasterisks,
+ parsers.doubleasterisks)
+ ) / writer.strong
+
+ larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk,
+ parsers.asterisk)
+ ) / writer.emphasis
+ end
+
+ larsers.AutoLinkUrl = parsers.less
+ * C(parsers.alphanumeric^1 * P("://") * parsers.urlchar^1)
+ * parsers.more
+ / function(url)
+ return writer.link(writer.string(url), url)
+ end
+
+ larsers.AutoLinkEmail = parsers.less
+ * C((parsers.alphanumeric + S("-._+"))^1
+ * P("@") * parsers.urlchar^1)
+ * parsers.more
+ / function(email)
+ return writer.link(writer.string(email),
+ "mailto:"..email)
+ end
+
+ larsers.DirectLink = (parsers.tag / parse_inlines_no_link) -- no links inside links
+ * parsers.spnl
+ * parsers.lparent
+ * (parsers.url + Cc("")) -- link can be empty [foo]()
+ * parsers.optionaltitle
+ * parsers.rparent
+ / writer.link
+
+ larsers.IndirectLink = parsers.tag * (C(parsers.spnl) * parsers.tag)^-1
+ / indirect_link
+
+ -- parse a link or image (direct or indirect)
+ larsers.Link = larsers.DirectLink + larsers.IndirectLink
+
+ larsers.DirectImage = parsers.exclamation
+ * (parsers.tag / parse_inlines)
+ * parsers.spnl
+ * parsers.lparent
+ * (parsers.url + Cc("")) -- link can be empty [foo]()
+ * parsers.optionaltitle
+ * parsers.rparent
+ / writer.image
+
+ larsers.IndirectImage = parsers.exclamation * parsers.tag
+ * (C(parsers.spnl) * parsers.tag)^-1 / indirect_image
+
+ larsers.Image = larsers.DirectImage + larsers.IndirectImage
+
+ larsers.TextCitations = Ct(Cc("")
+ * parsers.citation_name
+ * ((parsers.spnl
+ * parsers.lbracket
+ * parsers.citation_headless_body
+ * parsers.rbracket) + Cc("")))
+ / function(raw_cites)
+ return larsers.citations(true, raw_cites)
+ end
+
+ larsers.ParenthesizedCitations
+ = Ct(parsers.lbracket
+ * parsers.citation_body
+ * parsers.rbracket)
+ / function(raw_cites)
+ return larsers.citations(false, raw_cites)
+ end
+
+ larsers.Citations = larsers.TextCitations + larsers.ParenthesizedCitations
+
+ -- avoid parsing long strings of * or _ as emph/strong
+ larsers.UlOrStarLine = parsers.asterisk^4 + parsers.underscore^4
+ / writer.string
+
+ larsers.EscapedChar = S("\\") * C(parsers.escapable) / writer.string
+
+ larsers.InlineHtml = C(parsers.inlinehtml) / writer.inline_html
+
+ larsers.HtmlEntity = parsers.hexentity / entities.hex_entity / writer.string
+ + parsers.decentity / entities.dec_entity / writer.string
+ + parsers.tagentity / entities.char_entity / writer.string
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Block Elements (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ larsers.ContentBlock = parsers.leader
+ * (parsers.localfilepath + parsers.onlineimageurl)
+ * parsers.contentblock_tail
+ / writer.contentblock
+
+ larsers.DisplayHtml = C(parsers.displayhtml)
+ / expandtabs / writer.display_html
+
+ larsers.Verbatim = Cs( (parsers.blanklines
+ * ((parsers.indentedline - parsers.blankline))^1)^1
+ ) / expandtabs / writer.verbatim
+
+ larsers.FencedCode = (parsers.TildeFencedCode
+ + parsers.BacktickFencedCode)
+ / function(infostring, code)
+ return writer.fencedCode(writer.string(infostring),
+ expandtabs(code))
+ end
+
+ larsers.Blockquote = Cs(larsers.blockquote_body^1)
+ / parse_blocks_toplevel / writer.blockquote
+
+ larsers.HorizontalRule = ( parsers.lineof(parsers.asterisk)
+ + parsers.lineof(parsers.dash)
+ + parsers.lineof(parsers.underscore)
+ ) / writer.hrule
+
+ larsers.Reference = parsers.define_reference_parser / register_link
+
+ larsers.Paragraph = parsers.nonindentspace * Ct(parsers.Inline^1)
+ * parsers.newline
+ * ( parsers.blankline^1
+ + #parsers.hash
+ + #(parsers.leader * parsers.more * parsers.space^-1)
+ )
+ / writer.paragraph
+
+ larsers.ToplevelParagraph
+ = parsers.nonindentspace * Ct(parsers.Inline^1)
+ * ( parsers.newline
+ * ( parsers.blankline^1
+ + #parsers.hash
+ + #(parsers.leader * parsers.more * parsers.space^-1)
+ + parsers.eof
+ )
+ + parsers.eof )
+ / writer.paragraph
+
+ larsers.Plain = parsers.nonindentspace * Ct(parsers.Inline^1)
+ / writer.plain
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Lists (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ larsers.starter = parsers.bullet + larsers.enumerator
+
+ -- we use \001 as a separator between a tight list item and a
+ -- nested list under it.
+ larsers.NestedList = Cs((parsers.optionallyindentedline
+ - larsers.starter)^1)
+ / function(a) return "\001"..a end
+
+ larsers.ListBlockLine = parsers.optionallyindentedline
+ - parsers.blankline - (parsers.indent^-1
+ * larsers.starter)
+
+ larsers.ListBlock = parsers.line * larsers.ListBlockLine^0
+
+ larsers.ListContinuationBlock = parsers.blanklines * (parsers.indent / "")
+ * larsers.ListBlock
+
+ larsers.TightListItem = function(starter)
+ return -larsers.HorizontalRule
+ * (Cs(starter / "" * larsers.ListBlock * larsers.NestedList^-1)
+ / parse_blocks)
+ * -(parsers.blanklines * parsers.indent)
+ end
+
+ larsers.LooseListItem = function(starter)
+ return -larsers.HorizontalRule
+ * Cs( starter / "" * larsers.ListBlock * Cc("\n")
+ * (larsers.NestedList + larsers.ListContinuationBlock^0)
+ * (parsers.blanklines / "\n\n")
+ ) / parse_blocks
+ end
+
+ larsers.BulletList = ( Ct(larsers.TightListItem(parsers.bullet)^1) * Cc(true)
+ * parsers.skipblanklines * -parsers.bullet
+ + Ct(larsers.LooseListItem(parsers.bullet)^1) * Cc(false)
+ * parsers.skipblanklines )
+ / writer.bulletlist
+
+ local function ordered_list(items,tight,startNumber)
+ if options.startNumber then
+ startNumber = tonumber(startNumber) or 1 -- fallback for '#'
+ if startNumber ~= nil then
+ startNumber = math.floor(startNumber)
+ end
+ else
+ startNumber = nil
+ end
+ return writer.orderedlist(items,tight,startNumber)
+ end
+
+ larsers.OrderedList = Cg(larsers.enumerator, "listtype") *
+ ( Ct(larsers.TightListItem(Cb("listtype"))
+ * larsers.TightListItem(larsers.enumerator)^0)
+ * Cc(true) * parsers.skipblanklines * -larsers.enumerator
+ + Ct(larsers.LooseListItem(Cb("listtype"))
+ * larsers.LooseListItem(larsers.enumerator)^0)
+ * Cc(false) * parsers.skipblanklines
+ ) * Cb("listtype") / ordered_list
+
+ local function definition_list_item(term, defs, tight)
+ return { term = parse_inlines(term), definitions = defs }
+ end
+
+ larsers.DefinitionListItemLoose = C(parsers.line) * parsers.skipblanklines
+ * Ct((parsers.defstart
+ * parsers.indented_blocks(parsers.dlchunk)
+ / parse_blocks_toplevel)^1)
+ * Cc(false) / definition_list_item
+
+ larsers.DefinitionListItemTight = C(parsers.line)
+ * Ct((parsers.defstart * parsers.dlchunk
+ / parse_blocks)^1)
+ * Cc(true) / definition_list_item
+
+ larsers.DefinitionList = ( Ct(larsers.DefinitionListItemLoose^1) * Cc(false)
+ + Ct(larsers.DefinitionListItemTight^1)
+ * (parsers.skipblanklines
+ * -larsers.DefinitionListItemLoose * Cc(true))
+ ) / writer.definitionlist
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Blank (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ larsers.Blank = parsers.blankline / ""
+ + larsers.NoteBlock
+ + larsers.Reference
+ + (parsers.tightblocksep / "\n")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Headings (local)
+%
+% \end{markdown}
+% \begin{macrocode}
+ -- parse atx header
+ if options.headerAttributes then
+ larsers.AtxHeading = Cg(parsers.HeadingStart,"level")
+ * parsers.optionalspace
+ * (C(((parsers.linechar
+ - ((parsers.hash^1
+ * parsers.optionalspace
+ * parsers.HeadingAttributes^-1
+ + parsers.HeadingAttributes)
+ * parsers.optionalspace
+ * parsers.newline))
+ * (parsers.linechar
+ - parsers.hash
+ - parsers.lbrace)^0)^1)
+ / parse_inlines)
+ * Cg(Ct(parsers.newline
+ + (parsers.hash^1
+ * parsers.optionalspace
+ * parsers.HeadingAttributes^-1
+ + parsers.HeadingAttributes)
+ * parsers.optionalspace
+ * parsers.newline), "attributes")
+ * Cb("level")
+ * Cb("attributes")
+ / writer.heading
+
+ larsers.SetextHeading = #(parsers.line * S("=-"))
+ * (C(((parsers.linechar
+ - (parsers.HeadingAttributes
+ * parsers.optionalspace
+ * parsers.newline))
+ * (parsers.linechar
+ - parsers.lbrace)^0)^1)
+ / parse_inlines)
+ * Cg(Ct(parsers.newline
+ + (parsers.HeadingAttributes
+ * parsers.optionalspace
+ * parsers.newline)), "attributes")
+ * parsers.HeadingLevel
+ * Cb("attributes")
+ * parsers.optionalspace
+ * parsers.newline
+ / writer.heading
+ else
+ larsers.AtxHeading = Cg(parsers.HeadingStart,"level")
+ * parsers.optionalspace
+ * (C(parsers.line) / strip_atx_end / parse_inlines)
+ * Cb("level")
+ / writer.heading
+
+ larsers.SetextHeading = #(parsers.line * S("=-"))
+ * Ct(parsers.linechar^1 / parse_inlines)
+ * parsers.newline
+ * parsers.HeadingLevel
+ * parsers.optionalspace
+ * parsers.newline
+ / writer.heading
+ end
+
+ larsers.Heading = larsers.AtxHeading + larsers.SetextHeading
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Syntax Specification
+%
+% \end{markdown}
+% \begin{macrocode}
+ local syntax =
+ { "Blocks",
+
+ Blocks = larsers.Blank^0 * parsers.Block^-1
+ * (larsers.Blank^0 / writer.interblocksep
+ * parsers.Block)^0
+ * larsers.Blank^0 * parsers.eof,
+
+ Blank = larsers.Blank,
+
+ Block = V("ContentBlock")
+ + V("Blockquote")
+ + V("PipeTable")
+ + V("Verbatim")
+ + V("FencedCode")
+ + V("HorizontalRule")
+ + V("BulletList")
+ + V("OrderedList")
+ + V("Heading")
+ + V("DefinitionList")
+ + V("DisplayHtml")
+ + V("Paragraph")
+ + V("Plain"),
+
+ ContentBlock = larsers.ContentBlock,
+ Blockquote = larsers.Blockquote,
+ Verbatim = larsers.Verbatim,
+ FencedCode = larsers.FencedCode,
+ HorizontalRule = larsers.HorizontalRule,
+ BulletList = larsers.BulletList,
+ OrderedList = larsers.OrderedList,
+ Heading = larsers.Heading,
+ DefinitionList = larsers.DefinitionList,
+ DisplayHtml = larsers.DisplayHtml,
+ Paragraph = larsers.Paragraph,
+ PipeTable = larsers.PipeTable,
+ Plain = larsers.Plain,
+
+ Inline = V("Str")
+ + V("Space")
+ + V("Endline")
+ + V("UlOrStarLine")
+ + V("Strong")
+ + V("Emph")
+ + V("InlineNote")
+ + V("NoteRef")
+ + V("Citations")
+ + V("Link")
+ + V("Image")
+ + V("Code")
+ + V("AutoLinkUrl")
+ + V("AutoLinkEmail")
+ + V("InlineHtml")
+ + V("HtmlEntity")
+ + V("EscapedChar")
+ + V("Smart")
+ + V("Symbol"),
+
+ IndentedInline = V("Str")
+ + V("OptionalIndent")
+ + V("Endline")
+ + V("UlOrStarLine")
+ + V("Strong")
+ + V("Emph")
+ + V("InlineNote")
+ + V("NoteRef")
+ + V("Citations")
+ + V("Link")
+ + V("Image")
+ + V("Code")
+ + V("AutoLinkUrl")
+ + V("AutoLinkEmail")
+ + V("InlineHtml")
+ + V("HtmlEntity")
+ + V("EscapedChar")
+ + V("Smart")
+ + V("Symbol"),
+
+ Str = larsers.Str,
+ Space = larsers.Space,
+ OptionalIndent = larsers.OptionalIndent,
+ Endline = larsers.Endline,
+ UlOrStarLine = larsers.UlOrStarLine,
+ Strong = larsers.Strong,
+ Emph = larsers.Emph,
+ InlineNote = larsers.InlineNote,
+ NoteRef = larsers.NoteRef,
+ Citations = larsers.Citations,
+ Link = larsers.Link,
+ Image = larsers.Image,
+ Code = larsers.Code,
+ AutoLinkUrl = larsers.AutoLinkUrl,
+ AutoLinkEmail = larsers.AutoLinkEmail,
+ InlineHtml = larsers.InlineHtml,
+ HtmlEntity = larsers.HtmlEntity,
+ EscapedChar = larsers.EscapedChar,
+ Smart = larsers.Smart,
+ Symbol = larsers.Symbol,
+ }
+
+ if not options.citations then
+ syntax.Citations = parsers.fail
+ end
+
+ if not options.contentBlocks then
+ syntax.ContentBlock = parsers.fail
+ end
+
+ if not options.codeSpans then
+ syntax.Code = parsers.fail
+ end
+
+ if not options.definitionLists then
+ syntax.DefinitionList = parsers.fail
+ end
+
+ if not options.fencedCode then
+ syntax.FencedCode = parsers.fail
+ end
+
+ if not options.footnotes then
+ syntax.NoteRef = parsers.fail
+ end
+
+ if not options.html then
+ syntax.DisplayHtml = parsers.fail
+ syntax.InlineHtml = parsers.fail
+ syntax.HtmlEntity = parsers.fail
+ end
+
+ if not options.inlineFootnotes then
+ syntax.InlineNote = parsers.fail
+ end
+
+ if not options.smartEllipses then
+ syntax.Smart = parsers.fail
+ end
+
+ if not options.pipeTables then
+ syntax.PipeTable = parsers.fail
+ end
+
+ local blocks_toplevel_t = util.table_copy(syntax)
+ blocks_toplevel_t.Paragraph = larsers.ToplevelParagraph
+ larsers.blocks_toplevel = Ct(blocks_toplevel_t)
+
+ larsers.blocks = Ct(syntax)
+
+ local inlines_t = util.table_copy(syntax)
+ inlines_t[1] = "Inlines"
+ inlines_t.Inlines = parsers.Inline^0 * (parsers.spacing^0 * parsers.eof / "")
+ larsers.inlines = Ct(inlines_t)
+
+ local inlines_no_link_t = util.table_copy(inlines_t)
+ inlines_no_link_t.Link = parsers.fail
+ larsers.inlines_no_link = Ct(inlines_no_link_t)
+
+ local inlines_no_inline_note_t = util.table_copy(inlines_t)
+ inlines_no_inline_note_t.InlineNote = parsers.fail
+ larsers.inlines_no_inline_note = Ct(inlines_no_inline_note_t)
+
+ local inlines_nbsp_t = util.table_copy(inlines_t)
+ inlines_nbsp_t.Endline = larsers.NonbreakingEndline
+ inlines_nbsp_t.Space = larsers.NonbreakingSpace
+ larsers.inlines_nbsp = Ct(inlines_nbsp_t)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%#### Exported Conversion Function
+% Define \luamdef{reader->convert} as a function that converts markdown string
+% `input` into a plain \TeX{} output and returns it. Note that the converter
+% assumes that the input has \acro{unix} line endings.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.convert(input)
+ references = {}
+% \end{macrocode}
+% \begin{markdown}
+% When determining the name of the cache file, create salt for the hashing
+% function out of the package version and the passed options recognized by the
+% Lua interface (see Section \ref{sec:luaoptions}). The \Opt{cacheDir} option
+% is disregarded.
+% \end{markdown}
+% \begin{macrocode}
+ local opt_string = {}
+ for k,_ in pairs(defaultOptions) do
+ local v = options[k]
+ if k ~= "cacheDir" then
+ opt_string[#opt_string+1] = k .. "=" .. tostring(v)
+ end
+ end
+ table.sort(opt_string)
+ local salt = table.concat(opt_string, ",") .. "," .. metadata.version
+% \end{macrocode}
+% \begin{markdown}
+% Produce the cache file, transform its filename via the \luam{writer->pack}
+% method, and return the result.
+% \end{markdown}
+% \begin{macrocode}
+ local name = util.cache(options.cacheDir, input, salt, function(input)
+ return util.rope_to_string(parse_blocks_toplevel(input)) .. writer.eof
+ end, ".md" .. writer.suffix)
+ return writer.pack(name)
+ end
+ return self
+end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Conversion from Markdown to Plain \TeX{}
+% The \luam{new} method returns the \luam{reader->convert} function of a reader
+% object associated with the Lua interface options (see Section
+% \ref{sec:luaoptions}) `options` and with a writer object associated with
+% `options`.
+%
+% \end{markdown}
+% \begin{macrocode}
+function M.new(options)
+ local writer = M.writer.new(options)
+ local reader = M.reader.new(writer, options)
+ return reader.convert
+end
+
+return M
+% \end{macrocode}
+% \iffalse
+%</lua>
+%<*lua-cli>
+% \fi
+% \par
+% \begin{markdown}
+%
+%### Command-Line Implementation
+% \label{sec:lua-cli-implementation}
+% The command-line implementation provides the actual conversion routine for
+% the command-line interface described in Section~\ref{sec:lua-cli-interface}.
+%
+% \end{markdown}
+% \begin{macrocode}
+
+local input
+if input_filename then
+ local input_file = io.open(input_filename, "r")
+ input = assert(input_file:read("*a"))
+ input_file:close()
+else
+ input = assert(io.read("*a"))
+end
+
+% \end{macrocode}
+% \begin{markdown}
+% First, ensure that the `options.cacheDir` directory exists.
+% \end{markdown}
+% \begin{macrocode}
+local lfs = require("lfs")
+if options.cacheDir and not lfs.isdir(options.cacheDir) then
+ assert(lfs.mkdir(options["cacheDir"]))
+end
+
+local kpse = require("kpse")
+kpse.set_program_name("luatex")
+local md = require("markdown")
+% \end{macrocode}
+% \begin{markdown}
+% Since we are loading the rest of the Lua implementation dynamically,
+% check that both the `markdown` module and the command line implementation
+% are the same version.
+% \end{markdown}
+% \begin{macrocode}
+if metadata.version ~= md.metadata.version then
+ warn("markdown-cli.lua " .. metadata.version .. " used with " ..
+ "markdown.lua " .. md.metadata.version .. ".")
+end
+local convert = md.new(options)
+local output = convert(input:gsub("\r\n?", "\n"))
+
+if output_filename then
+ local output_file = io.open(output_filename, "w")
+ assert(output_file:write(output))
+ assert(output_file:close())
+else
+ assert(io.write(output))
+end
+% \end{macrocode}
+% \iffalse
+%</lua-cli>
+%<*tex>
+% \fi
+% \par
+% \begin{markdown}
+%
+% Plain \TeX{} Implementation
+%----------------------------
+% \label{sec:teximplementation}
+% The plain \TeX{} implementation provides macros for the interfacing between
+% \TeX{} and Lua and for the buffering of input text. These macros are then
+% used to implement the macros for the conversion from markdown to plain \TeX{}
+% exposed by the plain \TeX{} interface (see Section \ref{sec:texinterface}).
+%
+%### Logging Facilities
+% \label{sec:texinterfacelogging}
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownInfo#1{%
+ \immediate\write-1{(l.\the\inputlineno) markdown.tex info: #1.}}%
+\def\markdownWarning#1{%
+ \immediate\write16{(l.\the\inputlineno) markdown.tex warning: #1}}%
+\def\markdownError#1#2{%
+ \errhelp{#2.}%
+ \errmessage{(l.\the\inputlineno) markdown.tex error: #1}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Token Renderer Prototypes
+% The following definitions should be considered placeholder.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownRendererInterblockSeparatorPrototype{\par}%
+\def\markdownRendererLineBreakPrototype{\hfil\break}%
+\let\markdownRendererEllipsisPrototype\dots
+\def\markdownRendererNbspPrototype{~}%
+\def\markdownRendererLeftBracePrototype{\char`\{}%
+\def\markdownRendererRightBracePrototype{\char`\}}%
+\def\markdownRendererDollarSignPrototype{\char`$}%
+\def\markdownRendererPercentSignPrototype{\char`\%}%
+\def\markdownRendererAmpersandPrototype{\char`&}%
+\def\markdownRendererUnderscorePrototype{\char`_}%
+\def\markdownRendererHashPrototype{\char`\#}%
+\def\markdownRendererCircumflexPrototype{\char`^}%
+\def\markdownRendererBackslashPrototype{\char`\\}%
+\def\markdownRendererTildePrototype{\char`~}%
+\def\markdownRendererPipePrototype{|}%
+\def\markdownRendererCodeSpanPrototype#1{{\tt#1}}%
+\def\markdownRendererLinkPrototype#1#2#3#4{#2}%
+\def\markdownRendererContentBlockPrototype#1#2#3#4{%
+ \markdownInput{#3}}%
+\def\markdownRendererContentBlockOnlineImagePrototype{%
+ \markdownRendererImage}%
+\def\markdownRendererContentBlockCodePrototype#1#2#3#4#5{%
+ \markdownRendererInputFencedCode{#3}{#2}}%
+\def\markdownRendererImagePrototype#1#2#3#4{#2}%
+\def\markdownRendererUlBeginPrototype{}%
+\def\markdownRendererUlBeginTightPrototype{}%
+\def\markdownRendererUlItemPrototype{}%
+\def\markdownRendererUlItemEndPrototype{}%
+\def\markdownRendererUlEndPrototype{}%
+\def\markdownRendererUlEndTightPrototype{}%
+\def\markdownRendererOlBeginPrototype{}%
+\def\markdownRendererOlBeginTightPrototype{}%
+\def\markdownRendererOlItemPrototype{}%
+\def\markdownRendererOlItemWithNumberPrototype#1{}%
+\def\markdownRendererOlItemEndPrototype{}%
+\def\markdownRendererOlEndPrototype{}%
+\def\markdownRendererOlEndTightPrototype{}%
+\def\markdownRendererDlBeginPrototype{}%
+\def\markdownRendererDlBeginTightPrototype{}%
+\def\markdownRendererDlItemPrototype#1{#1}%
+\def\markdownRendererDlItemEndPrototype{}%
+\def\markdownRendererDlDefinitionBeginPrototype{}%
+\def\markdownRendererDlDefinitionEndPrototype{\par}%
+\def\markdownRendererDlEndPrototype{}%
+\def\markdownRendererDlEndTightPrototype{}%
+\def\markdownRendererEmphasisPrototype#1{{\it#1}}%
+\def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}%
+\def\markdownRendererBlockQuoteBeginPrototype{\par\begingroup\it}%
+\def\markdownRendererBlockQuoteEndPrototype{\endgroup\par}%
+\def\markdownRendererInputVerbatimPrototype#1{%
+ \par{\tt\input#1\relax{}}\par}%
+\def\markdownRendererInputFencedCodePrototype#1#2{%
+ \markdownRendererInputVerbatimPrototype{#1}}%
+\def\markdownRendererHeadingOnePrototype#1{#1}%
+\def\markdownRendererHeadingTwoPrototype#1{#1}%
+\def\markdownRendererHeadingThreePrototype#1{#1}%
+\def\markdownRendererHeadingFourPrototype#1{#1}%
+\def\markdownRendererHeadingFivePrototype#1{#1}%
+\def\markdownRendererHeadingSixPrototype#1{#1}%
+\def\markdownRendererHorizontalRulePrototype{}%
+\def\markdownRendererFootnotePrototype#1{#1}%
+\def\markdownRendererCitePrototype#1{}%
+\def\markdownRendererTextCitePrototype#1{}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Lua Snippets
+% The \mdef{markdownLuaOptions} macro expands to a Lua table that
+% contains the plain \TeX{} options (see Section \ref{sec:texoptions}) in a
+% format recognized by Lua (see Section \ref{sec:luaoptions}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownLuaOptions{{%
+\ifx\markdownOptionBlankBeforeBlockquote\undefined\else
+ blankBeforeBlockquote = \markdownOptionBlankBeforeBlockquote,
+\fi
+\ifx\markdownOptionBlankBeforeCodeFence\undefined\else
+ blankBeforeCodeFence = \markdownOptionBlankBeforeCodeFence,
+\fi
+\ifx\markdownOptionBlankBeforeHeading\undefined\else
+ blankBeforeHeading = \markdownOptionBlankBeforeHeading,
+\fi
+\ifx\markdownOptionBreakableBlockquotes\undefined\else
+ breakableBlockquotes = \markdownOptionBreakableBlockquotes,
+\fi
+ cacheDir = "\markdownOptionCacheDir",
+\ifx\markdownOptionCitations\undefined\else
+ citations = \markdownOptionCitations,
+\fi
+\ifx\markdownOptionCitationNbsps\undefined\else
+ citationNbsps = \markdownOptionCitationNbsps,
+\fi
+\ifx\markdownOptionCodeSpans\undefined\else
+ codeSpans = \markdownOptionCodeSpans,
+\fi
+\ifx\markdownOptionContentBlocks\undefined\else
+ contentBlocks = \markdownOptionContentBlocks,
+\fi
+\ifx\markdownOptionContentBlocksLanguageMap\undefined\else
+ contentBlocksLanguageMap =
+ "\markdownOptionContentBlocksLanguageMap",
+\fi
+\ifx\markdownOptionDefinitionLists\undefined\else
+ definitionLists = \markdownOptionDefinitionLists,
+\fi
+\ifx\markdownOptionFootnotes\undefined\else
+ footnotes = \markdownOptionFootnotes,
+\fi
+\ifx\markdownOptionFencedCode\undefined\else
+ fencedCode = \markdownOptionFencedCode,
+\fi
+\ifx\markdownOptionHashEnumerators\undefined\else
+ hashEnumerators = \markdownOptionHashEnumerators,
+\fi
+\ifx\markdownOptionHeaderAttributes\undefined\else
+ headerAttributes = \markdownOptionHeaderAttributes,
+\fi
+\ifx\markdownOptionHtml\undefined\else
+ html = \markdownOptionHtml,
+\fi
+\ifx\markdownOptionHybrid\undefined\else
+ hybrid = \markdownOptionHybrid,
+\fi
+\ifx\markdownOptionInlineFootnotes\undefined\else
+ inlineFootnotes = \markdownOptionInlineFootnotes,
+\fi
+\ifx\markdownOptionPipeTables\undefined\else
+ pipeTables = \markdownOptionPipeTables,
+\fi
+\ifx\markdownOptionPreserveTabs\undefined\else
+ preserveTabs = \markdownOptionPreserveTabs,
+\fi
+\ifx\markdownOptionShiftHeadings\undefined\else
+ shiftHeadings = "\markdownOptionShiftHeadings",
+\fi
+\ifx\markdownOptionSlice\undefined\else
+ slice = "\markdownOptionSlice",
+\fi
+\ifx\markdownOptionSmartEllipses\undefined\else
+ smartEllipses = \markdownOptionSmartEllipses,
+\fi
+\ifx\markdownOptionStartNumber\undefined\else
+ startNumber = \markdownOptionStartNumber,
+\fi
+\ifx\markdownOptionTableCaptions\undefined\else
+ tableCaptions = \markdownOptionTableCaptions,
+\fi
+\ifx\markdownOptionTightLists\undefined\else
+ tightLists = \markdownOptionTightLists,
+\fi
+\ifx\markdownOptionUnderscores\undefined\else
+ underscores = \markdownOptionUnderscores,
+\fi}
+}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownPrepare} macro contains the Lua code that is executed prior
+% to any conversion from markdown to plain \TeX{}. It exposes the
+% \luam{convert} function for the use by any further Lua code.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownPrepare{%
+% \end{macrocode}
+% \begin{markdown}
+% First, ensure that the \m{markdownOptionCacheDir} directory exists.
+% \end{markdown}
+% \begin{macrocode}
+local lfs = require("lfs")
+local cacheDir = "\markdownOptionCacheDir"
+if not lfs.isdir(cacheDir) then
+ assert(lfs.mkdir(cacheDir))
+end
+% \end{macrocode}
+% \begin{markdown}
+% Next, load the `markdown` module and create a converter function using
+% the plain \TeX{} options, which were serialized to a Lua table via the
+% \m{markdownLuaOptions} macro.
+% \end{markdown}
+% \begin{macrocode}
+local md = require("markdown")
+local convert = md.new(\markdownLuaOptions)
+}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Buffering Markdown Input
+% \label{sec:buffering}
+% The macros \mdef{markdownInputFileStream} and \mdef{markdownOutputFileStream}
+% contain the number of the input and output file streams that will be used for
+% the IO operations of the package.
+%
+% \end{markdown}
+% \begin{macrocode}
+\csname newread\endcsname\markdownInputFileStream
+\csname newwrite\endcsname\markdownOutputFileStream
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownReadAndConvertTab} macro contains the tab character literal.
+%
+% \end{markdown}
+% \begin{macrocode}
+\begingroup
+ \catcode`\^^I=12%
+ \gdef\markdownReadAndConvertTab{^^I}%
+\endgroup
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \m{markdownReadAndConvert} macro is largely a rewrite of the
+% \Hologo{LaTeX2e} \m{filecontents} macro to plain \TeX{}.
+%
+% \end{markdown}
+% \begin{macrocode}
+\begingroup
+% \end{macrocode}
+% \begin{markdown}
+% Make the newline and tab characters active and swap the character codes of
+% the backslash symbol (`\`) and the pipe symbol (`|`), so that we can use the
+% backslash as an ordinary character inside the macro definition. Likewise,
+% swap the character codes of the percent sign (`%`) and the ampersand (`@`),
+% so that we can remove percent signs from the beginning of lines when
+% \m{markdownOptionStripPercentSigns} is `true`.
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`\^^M=13%
+ \catcode`\^^I=13%
+ \catcode`|=0%
+ \catcode`\\=12%
+ |catcode`@=14%
+ |catcode`|%=12@
+ |gdef|markdownReadAndConvert#1#2{@
+ |begingroup@
+% \end{macrocode}
+% \begin{markdown}
+% Open the \m{markdownOptionInputTempFileName} file for writing.
+% \end{markdown}
+% \begin{macrocode}
+ |immediate|openout|markdownOutputFileStream@
+ |markdownOptionInputTempFileName|relax@
+ |markdownInfo{Buffering markdown input into the temporary @
+ input file "|markdownOptionInputTempFileName" and scanning @
+ for the closing token sequence "#1"}@
+% \end{macrocode}
+% \begin{markdown}
+% Locally change the category of the special plain \TeX{} characters to
+% *other* in order to prevent unwanted interpretation of the input. Change
+% also the category of the space character, so that we can retrieve it
+% unaltered.
+% \end{markdown}
+% \begin{macrocode}
+ |def|do##1{|catcode`##1=12}|dospecials@
+ |catcode`| =12@
+ |markdownMakeOther@
+% \end{macrocode}
+% \begin{markdown}
+% The \mdef{markdownReadAndConvertStripPercentSigns} macro will process the
+% individual lines of output, stipping away leading percent signs (`%`) when
+% \m{markdownOptionStripPercentSigns} is `true`.
+% Notice the use of the comments (`@`) to ensure that the entire macro is at
+% a single line and therefore no (active) newline symbols
+% (`^^M`) are produced.
+% \end{markdown}
+% \begin{macrocode}
+ |def|markdownReadAndConvertStripPercentSign##1{@
+ |markdownIfOption{StripPercentSigns}@
+ |if##1%@
+ |expandafter|expandafter|expandafter@
+ |markdownReadAndConvertProcessLine@
+ |else@
+ |expandafter|expandafter|expandafter@
+ |markdownReadAndConvertProcessLine@
+ |expandafter|expandafter|expandafter##1@
+ |fi@
+ |else@
+ |expandafter@
+ |markdownReadAndConvertProcessLine@
+ |expandafter##1@
+ |fi}@
+% \end{macrocode}
+% \begin{markdown}
+% The \mdef{markdownReadAndConvertProcessLine} macro will process the individual
+% lines of output.
+% Notice the use of the comments (`@`) to ensure that the entire macro is at
+% a single line and therefore no (active) newline symbols
+% (`^^M`) are produced.
+% \end{markdown}
+% \begin{macrocode}
+ |def|markdownReadAndConvertProcessLine##1#1##2#1##3|relax{@
+% \end{macrocode}
+% \begin{markdown}
+% When the ending token sequence does not appear in the line, store the line in
+% the \m{markdownOptionInputTempFileName} file.
+% \end{markdown}
+% \begin{macrocode}
+ |ifx|relax##3|relax@
+ |immediate|write|markdownOutputFileStream{##1}@
+ |else@
+% \end{macrocode}
+% \begin{markdown}
+% When the ending token sequence appears in the line, make the next newline
+% character close the \m{markdownOptionInputTempFileName} file, return the
+% character categories back to the former state, convert the
+% \m{markdownOptionInputTempFileName} file from markdown to plain \TeX{},
+% \m{input} the result of the conversion, and expand the ending control
+% sequence.
+% \end{markdown}
+% \begin{macrocode}
+ |def^^M{@
+ |markdownInfo{The ending token sequence was found}@
+ |immediate|closeout|markdownOutputFileStream@
+ |endgroup@
+ |markdownInput|markdownOptionInputTempFileName@
+ #2}@
+ |fi@
+% \end{macrocode}
+% \begin{markdown}
+% Repeat with the next line.
+% \end{markdown}
+% \begin{macrocode}
+ ^^M}@
+% \end{macrocode}
+% \begin{markdown}
+% Make the tab character active at expansion time and make it expand to a
+% literal tab character.
+% \end{markdown}
+% \begin{macrocode}
+ |catcode`|^^I=13@
+ |def^^I{|markdownReadAndConvertTab}@
+% \end{macrocode}
+% \begin{markdown}
+% Make the newline character active at expansion time and make it consume the
+% rest of the line on expansion. Throw away the rest of the first line and
+% pass the second line to the \m{markdownReadAndConvertProcessLine} macro.
+% \end{markdown}
+% \begin{macrocode}
+ |catcode`|^^M=13@
+ |def^^M##1^^M{@
+ |def^^M####1^^M{@
+ |markdownReadAndConvertStripPercentSign####1#1#1|relax}@
+ ^^M}@
+ ^^M}@
+% \end{macrocode}
+% \begin{markdown}
+% Reset the character categories back to the former state.
+% \end{markdown}
+% \begin{macrocode}
+|endgroup
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Lua Shell Escape Bridge
+% \label{sec:luabridge}
+% The following \TeX{} code is intended for \TeX{} engines that do not provide
+% direct access to Lua, but expose the shell of the operating system. This
+% corresponds to the \m{markdownMode} values of `0` and `1`.
+%
+% The \m{markdownLuaExecute} macro defined here and in Section
+% \ref{sec:directlua} are meant to be indistinguishable to the remaining code.
+%
+% The package assumes that although the user is not using the Lua\TeX{} engine,
+% their \TeX{} distribution contains it, and uses shell access to produce and
+% execute Lua scripts using the \TeX{}Lua interpreter~[@luatex17, Section
+% 3.1.1].
+%
+% \end{markdown}
+% \begin{macrocode}
+\ifnum\markdownMode<2\relax
+\ifnum\markdownMode=0\relax
+ \markdownInfo{Using mode 0: Shell escape via write18}%
+\else
+ \markdownInfo{Using mode 1: Shell escape via os.execute}%
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownExecuteShellEscape} macro contains the numeric value indicating
+% whether the shell access is enabled (`1`), disabled (`0`), or restricted
+% (`2`).
+%
+% Inherit the value of the the \m{pdfshellescape} (Lua\TeX{}, \Hologo{pdfTeX})
+% or the \m{shellescape} (\Hologo{XeTeX}) commands. If neither of these
+% commands is defined and Lua is available, attempt to access the
+% \luam{status.shell_escape} configuration item.
+%
+% If you cannot detect, whether the shell access is enabled, act as if it were.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ifx\pdfshellescape\undefined
+ \ifx\shellescape\undefined
+ \ifnum\markdownMode=0\relax
+ \def\markdownExecuteShellEscape{1}%
+ \else
+ \def\markdownExecuteShellEscape{%
+ \directlua{tex.sprint(status.shell_escape or "1")}}%
+ \fi
+ \else
+ \let\markdownExecuteShellEscape\shellescape
+ \fi
+\else
+ \let\markdownExecuteShellEscape\pdfshellescape
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownExecuteDirect} macro executes the code it has received as
+% its first argument by writing it to the output file stream 18, if Lua is
+% unavailable, or by using the Lua \luam{os.execute} method otherwise.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ifnum\markdownMode=0\relax
+ \def\markdownExecuteDirect#1{\immediate\write18{#1}}%
+\else
+ \def\markdownExecuteDirect#1{%
+ \directlua{os.execute("\luaescapestring{#1}")}}%
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownExecute} macro is a wrapper on top of
+% \m{markdownExecuteDirect} that checks the value of
+% \m{markdownExecuteShellEscape} and prints an error message if the shell is
+% inaccessible.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownExecute#1{%
+ \ifnum\markdownExecuteShellEscape=1\relax
+ \markdownExecuteDirect{#1}%
+ \else
+ \markdownError{I can not access the shell}{Either run the TeX
+ compiler with the --shell-escape or the --enable-write18 flag,
+ or set shell_escape=t in the texmf.cnf file}%
+ \fi}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \mdef{markdownLuaExecute} macro executes the Lua code it has received as
+% its first argument. The Lua code may not directly interact with the \TeX{}
+% engine, but it can use the \luam{print} function in the same manner it
+% would use the \luam{tex.print} method.
+%
+% \end{markdown}
+% \begin{macrocode}
+\begingroup
+% \end{macrocode}
+% \begin{markdown}
+% Swap the category code of the backslash symbol and the pipe symbol, so that
+% we may use the backslash symbol freely inside the Lua code.
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`|=0%
+ \catcode`\\=12%
+ |gdef|markdownLuaExecute#1{%
+% \end{macrocode}
+% \begin{markdown}
+% Create the file \m{markdownOptionHelperScriptFileName} and fill it with the
+% input Lua code prepended with \pkg{kpathsea} initialization, so that Lua
+% modules from the \TeX{} distribution are available.
+% \end{markdown}
+% \begin{macrocode}
+ |immediate|openout|markdownOutputFileStream=%
+ |markdownOptionHelperScriptFileName
+ |markdownInfo{Writing a helper Lua script to the file
+ "|markdownOptionHelperScriptFileName"}%
+ |immediate|write|markdownOutputFileStream{%
+ local ran_ok, error = pcall(function()
+ local kpse = require("kpse")
+ kpse.set_program_name("luatex")
+ #1
+ end)
+% \end{macrocode}
+% \begin{markdown}
+% If there was an error, use the file \m{markdownOptionErrorTempFileName} to
+% store the error message.
+% \end{markdown}
+% \begin{macrocode}
+ if not ran_ok then
+ local file = io.open("%
+ |markdownOptionOutputDir
+ /|markdownOptionErrorTempFileName", "w")
+ if file then
+ file:write(error .. "\n")
+ file:close()
+ end
+ print('\\markdownError{An error was encountered while executing
+ Lua code}{For further clues, examine the file
+ "|markdownOptionOutputDir
+ /|markdownOptionErrorTempFileName"}')
+ end}%
+ |immediate|closeout|markdownOutputFileStream
+% \end{macrocode}
+% \begin{markdown}
+% Execute the generated \m{markdownOptionHelperScriptFileName} Lua script using
+% the \TeX{}Lua binary and store the output in the
+% \m{markdownOptionOutputTempFileName} file.
+% \end{markdown}
+% \begin{macrocode}
+ |markdownInfo{Executing a helper Lua script from the file
+ "|markdownOptionHelperScriptFileName" and storing the result in the
+ file "|markdownOptionOutputTempFileName"}%
+ |markdownExecute{texlua "|markdownOptionOutputDir
+ /|markdownOptionHelperScriptFileName" > %
+ "|markdownOptionOutputDir
+ /|markdownOptionOutputTempFileName"}%
+% \end{macrocode}
+% \begin{markdown}
+% \m{input} the generated \m{markdownOptionOutputTempFileName} file.
+% \end{markdown}
+% \begin{macrocode}
+ |input|markdownOptionOutputTempFileName|relax}%
+|endgroup
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Direct Lua Access
+% \label{sec:directlua}
+% The following \TeX{} code is intended for \TeX{} engines that provide
+% direct access to Lua (Lua\TeX{}). The macro \m{markdownLuaExecute} defined
+% here and in Section \ref{sec:luabridge} are meant to be indistinguishable to
+% the remaining code. This corresponds to the \m{markdownMode} value of `2`.
+%
+% \end{markdown}
+% \begin{macrocode}
+\else
+\markdownInfo{Using mode 2: Direct Lua access}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The direct Lua access version of the \m{markdownLuaExecute} macro is defined
+% in terms of the \m{directlua} primitive. The \luam{print} function is set as
+% an alias to the \m{tex.print} method in order to mimic the behaviour of the
+% \m{markdownLuaExecute} definition from Section \ref{sec:luabridge},
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownLuaExecute#1{\directlua{local print = tex.print #1}}%
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Typesetting Markdown
+% The \m{markdownInput} macro uses an implementation of the
+% \m{markdownLuaExecute} macro to convert the contents of the file whose
+% filename it has received as its single argument from markdown to plain
+% \TeX{}.
+%
+% \end{markdown}
+% \begin{macrocode}
+\begingroup
+% \end{macrocode}
+% \begin{markdown}
+% Swap the category code of the backslash symbol and the pipe symbol, so that
+% we may use the backslash symbol freely inside the Lua code.
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`|=0%
+ \catcode`\\=12%
+ |gdef|markdownInput#1{%
+ |markdownInfo{Including markdown document "#1"}%
+% \end{macrocode}
+% \begin{markdown}
+% Attempt to open the markdown document to record it in the `.log` and
+% `.fls` files. This allows external programs such as \LaTeX Mk to track
+% changes to the markdown document.
+% \end{markdown}
+% \begin{macrocode}
+ |openin|markdownInputFileStream#1
+ |closein|markdownInputFileStream
+ |markdownLuaExecute{%
+ |markdownPrepare
+ local input = assert(io.open("%
+ |markdownOptionOutputDir
+ /#1", "r"):read("*a"))
+% \end{macrocode}
+% \begin{markdown}
+% Since the Lua converter expects \acro{unix} line endings, normalize the
+% input.
+% \end{markdown}
+% \begin{macrocode}
+ print(convert(input:gsub("\r\n?", "\n")))}}%
+|endgroup
+% \end{macrocode}
+% \iffalse
+%</tex>
+%<*latex>
+% \fi
+% \par
+% \begin{markdown}
+%
+% \LaTeX{} Implementation
+%------------------------
+% \label{sec:lateximplementation}
+% The \LaTeX{} implemenation makes use of the fact that, apart from some subtle
+% differences, \LaTeX{} implements the majority of the plain \TeX{}
+% format~[@latex17, Section 9]. As a consequence, we can directly reuse the
+% existing plain \TeX{} implementation.
+%
+% \end{markdown}
+% \begin{macrocode}
+\input markdown
+\def\markdownVersionSpace{ }%
+\ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v%
+ \markdownVersion\markdownVersionSpace markdown renderer]%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Logging Facilities
+% The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see
+% Section \ref{sec:texinterfacelogging}) to use the \LaTeX{} \m{PackageInfo},
+% \m{PackageWarning}, and \m{PackageError} macros.
+%
+% \end{markdown}
+% \begin{macrocode}
+\renewcommand\markdownInfo[1]{\PackageInfo{markdown}{#1}}%
+\renewcommand\markdownWarning[1]{\PackageWarning{markdown}{#1}}%
+\renewcommand\markdownError[2]{\PackageError{markdown}{#1}{#2.}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Typesetting Markdown
+% The \mdef{markdownInputPlainTeX} macro is used to store the original plain
+% \TeX{} implementation of the \m{markdownInput} macro. The \m{markdownInput}
+% is then redefined to accept an optional argument with options recognized by
+% the \LaTeX{} interface (see Section \ref{sec:latexoptions}).
+%
+% \end{markdown}
+% \begin{macrocode}
+\let\markdownInputPlainTeX\markdownInput
+\renewcommand\markdownInput[2][]{%
+ \begingroup
+ \markdownSetup{#1}%
+ \markdownInputPlainTeX{#2}%
+ \endgroup}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The \envm{markdown}, and \envm{markdown*} \LaTeX{} environments are
+% implemented using the \m{markdownReadAndConvert} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\renewenvironment{markdown}{%
+ \markdownReadAndConvert@markdown{}}\relax
+\renewenvironment{markdown*}[1]{%
+ \markdownSetup{#1}%
+ \markdownReadAndConvert@markdown*}\relax
+\begingroup
+% \end{macrocode}
+% \begin{markdown}
+% Locally swap the category code of the backslash symbol with the pipe symbol,
+% and of the left (`{`) and right brace (`}`) with the less-than (`<`)
+% and greater-than (`>`) signs. This is required in order that all the
+% special symbols that appear in the first argument of the
+% `markdownReadAndConvert` macro have the category code *other*.
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`\|=0\catcode`\<=1\catcode`\>=2%
+ \catcode`\\=12|catcode`|{=12|catcode`|}=12%
+ |gdef|markdownReadAndConvert@markdown#1<%
+ |markdownReadAndConvert<\end{markdown#1}>%
+ <|end<markdown#1>>>%
+|endgroup
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Options
+% The supplied package options are processed using the \m{markdownSetup} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\DeclareOption*{%
+ \expandafter\markdownSetup\expandafter{\CurrentOption}}%
+\ProcessOptions\relax
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% After processing the options, activate the `renderers` and
+% `rendererPrototypes` keys.
+%
+% \end{markdown}
+% \begin{macrocode}
+\define@key{markdownOptions}{renderers}{%
+ \setkeys{markdownRenderers}{#1}%
+ \def\KV@prefix{KV@markdownOptions@}}%
+\define@key{markdownOptions}{rendererPrototypes}{%
+ \setkeys{markdownRendererPrototypes}{#1}%
+ \def\KV@prefix{KV@markdownOptions@}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Token Renderer Prototypes
+% The following configuration should be considered placeholder.
+%
+% If the \m{markdownOptionTightLists} macro expands to `false`, do not load
+% the \pkg{paralist} package. This is necessary for \Hologo{LaTeX2e} document
+% classes that do not play nice with \pkg{paralist}, such as \pkg{beamer}.
+% If the \m{markdownOptionTightLists} is undefined and the \pkg{beamer}
+% document class is in use, then do not load the \pkg{paralist} package either.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ifx\markdownOptionTightLists\undefined
+ \@ifclassloaded{beamer}{}{
+ \RequirePackage{paralist}}
+\else
+ \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{
+ \RequirePackage{paralist}}
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% If we loaded the \pkg{paralist} package, define the respective renderer
+% prototypes to make use of the capabilities of the package. Otherwise,
+% define the renderer prototypes to fall back on the corresponding renderers
+% for the non-tight lists.
+%
+% \end{markdown}
+% \begin{macrocode}
+\@ifpackageloaded{paralist}{
+ \markdownSetup{rendererPrototypes={
+ ulBeginTight = {\begin{compactitem}},
+ ulEndTight = {\end{compactitem}},
+ olBeginTight = {\begin{compactenum}},
+ olEndTight = {\end{compactenum}},
+ dlBeginTight = {\begin{compactdesc}},
+ dlEndTight = {\end{compactdesc}}}}
+}{
+ \markdownSetup{rendererPrototypes={
+ ulBeginTight = {\markdownRendererUlBegin},
+ ulEndTight = {\markdownRendererUlEnd},
+ olBeginTight = {\markdownRendererOlBegin},
+ olEndTight = {\markdownRendererOlEnd},
+ dlBeginTight = {\markdownRendererDlBegin},
+ dlEndTight = {\markdownRendererDlEnd}}}}
+\markdownSetup{rendererPrototypes={
+ lineBreak = {\\},
+ leftBrace = {\textbraceleft},
+ rightBrace = {\textbraceright},
+ dollarSign = {\textdollar},
+ underscore = {\textunderscore},
+ circumflex = {\textasciicircum},
+ backslash = {\textbackslash},
+ tilde = {\textasciitilde},
+ pipe = {\textbar},
+ codeSpan = {\texttt{#1}},
+ contentBlock = {%
+ \ifthenelse{\equal{#1}{csv}}{%
+ \begin{table}%
+ \begin{center}%
+ \csvautotabular{#3}%
+ \end{center}
+ \ifx\empty#4\empty\else
+ \caption{#4}%
+ \fi
+ \label{tab:#1}%
+ \end{table}}{%
+ \markdownInput{#3}}},
+ image = {%
+ \begin{figure}%
+ \begin{center}%
+ \includegraphics{#3}%
+ \end{center}%
+ \ifx\empty#4\empty\else
+ \caption{#4}%
+ \fi
+ \label{fig:#1}%
+ \end{figure}},
+ ulBegin = {\begin{itemize}},
+ ulItem = {\item},
+ ulEnd = {\end{itemize}},
+ olBegin = {\begin{enumerate}},
+ olItem = {\item},
+ olItemWithNumber = {\item[#1.]},
+ olEnd = {\end{enumerate}},
+ dlBegin = {\begin{description}},
+ dlItem = {\item[#1]},
+ dlEnd = {\end{description}},
+ emphasis = {\emph{#1}},
+ blockQuoteBegin = {\begin{quotation}},
+ blockQuoteEnd = {\end{quotation}},
+ inputVerbatim = {\VerbatimInput{#1}},
+ inputFencedCode = {%
+ \ifx\relax#2\relax
+ \VerbatimInput{#1}%
+ \else
+ \ifx\minted@code\undefined
+ \ifx\lst@version\undefined
+ \markdownRendererInputFencedCode{#1}{}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% When the \pkg{listings} package is loaded, use it for syntax highlighting.
+%
+% \end{markdown}
+% \begin{macrocode}
+ \else
+ \lstinputlisting[language=#2]{#1}%
+ \fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% When the \pkg{minted} package is loaded, use it for syntax highlighting.
+% The \pkg{minted} package is preferred over \pkg{listings}.
+%
+% \end{markdown}
+% \begin{macrocode}
+ \else
+ \inputminted{#2}{#1}%
+ \fi
+ \fi},
+ horizontalRule = {\noindent\rule[0.5ex]{\linewidth}{1pt}},
+ footnote = {\footnote{#1}}}}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Support the nesting of strong emphasis.
+%
+% \end{markdown}
+% \begin{macrocode}
+\newif\ifmarkdownLATEXStrongEmphasisNested
+\markdownLATEXStrongEmphasisNestedfalse
+\markdownSetup{rendererPrototypes={
+ strongEmphasis = {%
+ \ifmarkdownLATEXStrongEmphasisNested
+ \markdownLATEXStrongEmphasisNestedfalse
+ \textmd{#1}%
+ \markdownLATEXStrongEmphasisNestedtrue
+ \else
+ \markdownLATEXStrongEmphasisNestedtrue
+ \textbf{#1}%
+ \markdownLATEXStrongEmphasisNestedfalse
+ \fi}}}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Support \LaTeX{} document classes that do not provide chapters.
+%
+% \end{markdown}
+% \begin{macrocode}
+\ifx\chapter\undefined
+ \markdownSetup{rendererPrototypes = {
+ headingOne = {\section{#1}},
+ headingTwo = {\subsection{#1}},
+ headingThree = {\subsubsection{#1}},
+ headingFour = {\paragraph{#1}\leavevmode},
+ headingFive = {\subparagraph{#1}\leavevmode}}}
+\else
+ \markdownSetup{rendererPrototypes = {
+ headingOne = {\chapter{#1}},
+ headingTwo = {\section{#1}},
+ headingThree = {\subsection{#1}},
+ headingFour = {\subsubsection{#1}},
+ headingFive = {\paragraph{#1}\leavevmode},
+ headingSix = {\subparagraph{#1}\leavevmode}}}
+\fi
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% There is a basic implementation for citations that uses the \LaTeX{} \m{cite}
+% macro. There are also implementations that use the \pkg{natbib} \m{citep},
+% and \m{citet} macros, and the Bib\LaTeX{} \m{autocites} and \m{textcites}
+% macros. These implementations will be used, when the respective packages are
+% loaded.
+%
+% \end{markdown}
+% \begin{macrocode}
+\newcount\markdownLaTeXCitationsCounter
+
+% Basic implementation
+\def\markdownLaTeXBasicCitations#1#2#3#4#5#6{%
+ \advance\markdownLaTeXCitationsCounter by 1\relax
+ \ifx\relax#4\relax
+ \ifx\relax#5\relax
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \cite{#1#2#6}% Without prenotes and postnotes, just accumulate cites
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \@gobblethree
+ \fi
+ \else% Before a postnote (#5), dump the accumulator
+ \ifx\relax#1\relax\else
+ \cite{#1}%
+ \fi
+ \cite[#5]{#6}%
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \else
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \markdownLaTeXBasicCitations
+ \fi
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ \@gobblethree
+ \fi
+ \else% Before a prenote (#4), dump the accumulator
+ \ifx\relax#1\relax\else
+ \cite{#1}%
+ \fi
+ \ifnum\markdownLaTeXCitationsCounter>1\relax
+ \space % Insert a space before the prenote in later citations
+ \fi
+ #4~\expandafter\cite\ifx\relax#5\relax{#6}\else[#5]{#6}\fi
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \else
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \markdownLaTeXBasicCitations
+ \fi
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \expandafter
+ \@gobblethree
+ \fi\markdownLaTeXBasicCitations{#1#2#6},}
+\let\markdownLaTeXBasicTextCitations\markdownLaTeXBasicCitations
+
+% Natbib implementation
+\def\markdownLaTeXNatbibCitations#1#2#3#4#5{%
+ \advance\markdownLaTeXCitationsCounter by 1\relax
+ \ifx\relax#3\relax
+ \ifx\relax#4\relax
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \citep{#1,#5}% Without prenotes and postnotes, just accumulate cites
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \@gobbletwo
+ \fi
+ \else% Before a postnote (#4), dump the accumulator
+ \ifx\relax#1\relax\else
+ \citep{#1}%
+ \fi
+ \citep[][#4]{#5}%
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \else
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \markdownLaTeXNatbibCitations
+ \fi
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ \@gobbletwo
+ \fi
+ \else% Before a prenote (#3), dump the accumulator
+ \ifx\relax#1\relax\relax\else
+ \citep{#1}%
+ \fi
+ \citep[#3][#4]{#5}%
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \else
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \markdownLaTeXNatbibCitations
+ \fi
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \expandafter
+ \@gobbletwo
+ \fi\markdownLaTeXNatbibCitations{#1,#5}}
+\def\markdownLaTeXNatbibTextCitations#1#2#3#4#5{%
+ \advance\markdownLaTeXCitationsCounter by 1\relax
+ \ifx\relax#3\relax
+ \ifx\relax#4\relax
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \citet{#1,#5}% Without prenotes and postnotes, just accumulate cites
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \@gobbletwo
+ \fi
+ \else% After a prenote or a postnote, dump the accumulator
+ \ifx\relax#1\relax\else
+ \citet{#1}%
+ \fi
+ , \citet[#3][#4]{#5}%
+ \ifnum\markdownLaTeXCitationsCounter<\markdownLaTeXCitationsTotal\relax
+ ,
+ \else
+ \ifnum\markdownLaTeXCitationsCounter=\markdownLaTeXCitationsTotal\relax
+ ,
+ \fi
+ \fi
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter
+ \markdownLaTeXNatbibTextCitations
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter
+ \expandafter\expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter
+ \@gobbletwo
+ \fi
+ \else% After a prenote or a postnote, dump the accumulator
+ \ifx\relax#1\relax\relax\else
+ \citet{#1}%
+ \fi
+ , \citet[#3][#4]{#5}%
+ \ifnum\markdownLaTeXCitationsCounter<\markdownLaTeXCitationsTotal\relax
+ ,
+ \else
+ \ifnum\markdownLaTeXCitationsCounter=\markdownLaTeXCitationsTotal\relax
+ ,
+ \fi
+ \fi
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXNatbibTextCitations
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \expandafter
+ \@gobbletwo
+ \fi\markdownLaTeXNatbibTextCitations{#1,#5}}
+
+% BibLaTeX implementation
+\def\markdownLaTeXBibLaTeXCitations#1#2#3#4#5{%
+ \advance\markdownLaTeXCitationsCounter by 1\relax
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \autocites#1[#3][#4]{#5}%
+ \expandafter\@gobbletwo
+ \fi\markdownLaTeXBibLaTeXCitations{#1[#3][#4]{#5}}}
+\def\markdownLaTeXBibLaTeXTextCitations#1#2#3#4#5{%
+ \advance\markdownLaTeXCitationsCounter by 1\relax
+ \ifnum\markdownLaTeXCitationsCounter>\markdownLaTeXCitationsTotal\relax
+ \textcites#1[#3][#4]{#5}%
+ \expandafter\@gobbletwo
+ \fi\markdownLaTeXBibLaTeXTextCitations{#1[#3][#4]{#5}}}
+
+\markdownSetup{rendererPrototypes = {
+ cite = {%
+ \markdownLaTeXCitationsCounter=1%
+ \def\markdownLaTeXCitationsTotal{#1}%
+ \ifx\autocites\undefined
+ \ifx\citep\undefined
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXBasicCitations
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \else
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXNatbibCitations
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \fi
+ \else
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXBibLaTeXCitations
+ \expandafter{\expandafter}%
+ \fi},
+ textCite = {%
+ \markdownLaTeXCitationsCounter=1%
+ \def\markdownLaTeXCitationsTotal{#1}%
+ \ifx\autocites\undefined
+ \ifx\citep\undefined
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXBasicTextCitations
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \else
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXNatbibTextCitations
+ \expandafter\expandafter\expandafter{%
+ \expandafter\expandafter\expandafter}%
+ \fi
+ \else
+ \expandafter\expandafter\expandafter
+ \markdownLaTeXBibLaTeXTextCitations
+ \expandafter{\expandafter}%
+ \fi}}}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Before consuming the parameters for the hyperlink renderer, we change the
+% category code of the hash sign (`#`) to other, so that it cannot be
+% mistaken for a parameter character. After the hyperlink has been typeset,
+% we restore the original catcode.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownRendererLinkPrototype{%
+ \begingroup
+ \catcode`\#=12
+ \def\next##1##2##3##4{%
+ ##1\footnote{%
+ \ifx\empty##4\empty\else##4: \fi\texttt<\url{##3}\texttt>}%
+ \endgroup}%
+ \next}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% There is a basic implementation of tables. If the \pkg{booktabs} package is
+% loaded, then it is used to produce horizontal lines.
+%
+% \end{markdown}
+% \begin{macrocode}
+\newcount\markdownLaTeXRowCounter
+\newcount\markdownLaTeXRowTotal
+\newcount\markdownLaTeXColumnCounter
+\newcount\markdownLaTeXColumnTotal
+\newtoks\markdownLaTeXTable
+\newtoks\markdownLaTeXTableAlignment
+\newtoks\markdownLaTeXTableEnd
+\@ifpackageloaded{booktabs}{
+ \let\markdownLaTeXTopRule\toprule
+ \let\markdownLaTeXMidRule\midrule
+ \let\markdownLaTeXBottomRule\bottomrule
+}{
+ \let\markdownLaTeXTopRule\hline
+ \let\markdownLaTeXMidRule\hline
+ \let\markdownLaTeXBottomRule\hline
+}
+\markdownSetup{rendererPrototypes={
+ table = {%
+ \markdownLaTeXTable={}%
+ \markdownLaTeXTableAlignment={}%
+ \markdownLaTeXTableEnd={%
+ \markdownLaTeXBottomRule
+ \end{tabular}}%
+ \ifx\empty#1\empty\else
+ \addto@hook\markdownLaTeXTable{%
+ \begin{table}
+ \centering}%
+ \addto@hook\markdownLaTeXTableEnd{%
+ \caption{#1}
+ \end{table}}%
+ \fi
+ \addto@hook\markdownLaTeXTable{\begin{tabular}}%
+ \markdownLaTeXRowCounter=0%
+ \markdownLaTeXRowTotal=#2%
+ \markdownLaTeXColumnTotal=#3%
+ \markdownLaTeXRenderTableRow
+ }
+}}
+\def\markdownLaTeXRenderTableRow#1{%
+ \markdownLaTeXColumnCounter=0%
+ \ifnum\markdownLaTeXRowCounter=0\relax
+ \markdownLaTeXReadAlignments#1%
+ \markdownLaTeXTable=\expandafter\expandafter\expandafter{%
+ \expandafter\the\expandafter\markdownLaTeXTable\expandafter{%
+ \the\markdownLaTeXTableAlignment}}%
+ \addto@hook\markdownLaTeXTable{\markdownLaTeXTopRule}%
+ \else
+ \markdownLaTeXRenderTableCell#1%
+ \fi
+ \ifnum\markdownLaTeXRowCounter=1\relax
+ \addto@hook\markdownLaTeXTable\markdownLaTeXMidRule
+ \fi
+ \advance\markdownLaTeXRowCounter by 1\relax
+ \ifnum\markdownLaTeXRowCounter>\markdownLaTeXRowTotal\relax
+ \markdownInfo{\the\markdownLaTeXTable}
+ \markdownInfo{\the\markdownLaTeXTableEnd}
+ \the\markdownLaTeXTable
+ \the\markdownLaTeXTableEnd
+ \expandafter\@gobble
+ \fi\markdownLaTeXRenderTableRow}
+\def\markdownLaTeXReadAlignments#1{%
+ \advance\markdownLaTeXColumnCounter by 1\relax
+ \if#1d%
+ \addto@hook\markdownLaTeXTableAlignment{l}%
+ \else
+ \addto@hook\markdownLaTeXTableAlignment{#1}%
+ \fi
+ \ifnum\markdownLaTeXColumnCounter<\markdownLaTeXColumnTotal\relax\else
+ \expandafter\@gobble
+ \fi\markdownLaTeXReadAlignments}
+\def\markdownLaTeXRenderTableCell#1{%
+ \advance\markdownLaTeXColumnCounter by 1\relax
+ \ifnum\markdownLaTeXColumnCounter<\markdownLaTeXColumnTotal\relax
+ \addto@hook\markdownLaTeXTable{#1&}%
+ \else
+ \addto@hook\markdownLaTeXTable{#1\\}%
+ \expandafter\@gobble
+ \fi\markdownLaTeXRenderTableCell}
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Miscellanea
+% When buffering user input, we should disable the bytes with the high bit set,
+% since these are made active by the \pkg{inputenc} package. We will do this by
+% redefining the \m{markdownMakeOther} macro accordingly. The code is courtesy
+% of Scott Pakin, the creator of the \pkg{filecontents} package.
+%
+% \end{markdown}
+% \begin{macrocode}
+\newcommand\markdownMakeOther{%
+ \count0=128\relax
+ \loop
+ \catcode\count0=11\relax
+ \advance\count0 by 1\relax
+ \ifnum\count0<256\repeat}%
+% \end{macrocode}
+% \iffalse
+%</latex>
+%<*context>
+% \fi
+% \par
+% \begin{markdown}
+%
+% \Hologo{ConTeXt} Implementation
+%--------------------------------
+% \label{sec:contextimplementation}
+% The \Hologo{ConTeXt} implementation makes use of the fact that, apart from
+% some subtle differences, the Mark II and Mark IV \Hologo{ConTeXt} formats
+% *seem* to implement (the documentation is scarce) the majority of the
+% plain \TeX{} format required by the plain \TeX{} implementation. As a
+% consequence, we can directly reuse the existing plain \TeX{} implementation
+% after supplying the missing plain \TeX{} macros.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\dospecials{\do\ \do\\\do\{\do\}\do\$\do\&%
+ \do\#\do\^\do\_\do\%\do\~}%
+\input markdown
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% When buffering user input, we should disable the bytes with the high bit set,
+% since these are made active by the \m{enableregime} macro. We will do this
+% by redefining the \m{markdownMakeOther} macro accordingly. The code is
+% courtesy of Scott Pakin, the creator of the \pkg{filecontents} \LaTeX{}
+% package.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownMakeOther{%
+ \count0=128\relax
+ \loop
+ \catcode\count0=11\relax
+ \advance\count0 by 1\relax
+ \ifnum\count0<256\repeat
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% On top of that, make the pipe character (`|`) inactive during the scanning.
+% This is necessary, since the character is active in \Hologo{ConTeXt}.
+%
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`|=12}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Logging Facilities
+% The \Hologo{ConTeXt} implementation redefines the plain \TeX{} logging macros (see
+% Section \ref{sec:texinterfacelogging}) to use the \Hologo{ConTeXt}
+% \m{writestatus} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownInfo#1{\writestatus{markdown}{#1.}}%
+\def\markdownWarning#1{\writestatus{markdown\space warn}{#1.}}%
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Typesetting Markdown
+% The \m{startmarkdown} and \m{stopmarkdown} macros are implemented using the
+% \m{markdownReadAndConvert} macro.
+%
+% \end{markdown}
+% \begin{macrocode}
+\begingroup
+% \end{macrocode}
+% \begin{markdown}
+% Locally swap the category code of the backslash symbol with the pipe symbol.
+% This is required in order that all the special symbols that appear in the
+% first argument of the `markdownReadAndConvert` macro have the category code
+% *other*.
+% \end{markdown}
+% \begin{macrocode}
+ \catcode`\|=0%
+ \catcode`\\=12%
+ |gdef|startmarkdown{%
+ |markdownReadAndConvert{\stopmarkdown}%
+ {|stopmarkdown}}%
+|endgroup
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+%### Token Renderer Prototypes
+% The following configuration should be considered placeholder.
+%
+% \end{markdown}
+% \begin{macrocode}
+\def\markdownRendererLineBreakPrototype{\blank}%
+\def\markdownRendererLeftBracePrototype{\textbraceleft}%
+\def\markdownRendererRightBracePrototype{\textbraceright}%
+\def\markdownRendererDollarSignPrototype{\textdollar}%
+\def\markdownRendererPercentSignPrototype{\percent}%
+\def\markdownRendererUnderscorePrototype{\textunderscore}%
+\def\markdownRendererCircumflexPrototype{\textcircumflex}%
+\def\markdownRendererBackslashPrototype{\textbackslash}%
+\def\markdownRendererTildePrototype{\textasciitilde}%
+\def\markdownRendererPipePrototype{\char`|}%
+\def\markdownRendererLinkPrototype#1#2#3#4{%
+ \useURL[#1][#3][][#4]#1\footnote[#1]{\ifx\empty#4\empty\else#4:
+ \fi\tt<\hyphenatedurl{#3}>}}%
+\usemodule[database]
+\defineseparatedlist
+ [MarkdownConTeXtCSV]
+ [separator={,},
+ before=\bTABLE,after=\eTABLE,
+ first=\bTR,last=\eTR,
+ left=\bTD,right=\eTD]
+\def\markdownConTeXtCSV{csv}
+\def\markdownRendererContentBlockPrototype#1#2#3#4{%
+ \def\markdownConTeXtCSV@arg{#1}%
+ \ifx\markdownConTeXtCSV@arg\markdownConTeXtCSV
+ \placetable[][tab:#1]{#4}{%
+ \processseparatedfile[MarkdownConTeXtCSV][#3]}%
+ \else
+ \markdownInput{#3}%
+ \fi}%
+\def\markdownRendererImagePrototype#1#2#3#4{%
+ \placefigure[][fig:#1]{#4}{\externalfigure[#3]}}%
+\def\markdownRendererUlBeginPrototype{\startitemize}%
+\def\markdownRendererUlBeginTightPrototype{\startitemize[packed]}%
+\def\markdownRendererUlItemPrototype{\item}%
+\def\markdownRendererUlEndPrototype{\stopitemize}%
+\def\markdownRendererUlEndTightPrototype{\stopitemize}%
+\def\markdownRendererOlBeginPrototype{\startitemize[n]}%
+\def\markdownRendererOlBeginTightPrototype{\startitemize[packed,n]}%
+\def\markdownRendererOlItemPrototype{\item}%
+\def\markdownRendererOlItemWithNumberPrototype#1{\sym{#1.}}%
+\def\markdownRendererOlEndPrototype{\stopitemize}%
+\def\markdownRendererOlEndTightPrototype{\stopitemize}%
+\definedescription
+ [MarkdownConTeXtDlItemPrototype]
+ [location=hanging,
+ margin=standard,
+ headstyle=bold]%
+\definestartstop
+ [MarkdownConTeXtDlPrototype]
+ [before=\blank,
+ after=\blank]%
+\definestartstop
+ [MarkdownConTeXtDlTightPrototype]
+ [before=\blank\startpacked,
+ after=\stoppacked\blank]%
+\def\markdownRendererDlBeginPrototype{%
+ \startMarkdownConTeXtDlPrototype}%
+\def\markdownRendererDlBeginTightPrototype{%
+ \startMarkdownConTeXtDlTightPrototype}%
+\def\markdownRendererDlItemPrototype#1{%
+ \startMarkdownConTeXtDlItemPrototype{#1}}%
+\def\markdownRendererDlItemEndPrototype{%
+ \stopMarkdownConTeXtDlItemPrototype}%
+\def\markdownRendererDlEndPrototype{%
+ \stopMarkdownConTeXtDlPrototype}%
+\def\markdownRendererDlEndTightPrototype{%
+ \stopMarkdownConTeXtDlTightPrototype}%
+\def\markdownRendererEmphasisPrototype#1{{\em#1}}%
+\def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}%
+\def\markdownRendererBlockQuoteBeginPrototype{\startquotation}%
+\def\markdownRendererBlockQuoteEndPrototype{\stopquotation}%
+\def\markdownRendererInputVerbatimPrototype#1{\typefile{#1}}%
+\def\markdownRendererInputFencedCodePrototype#1#2{%
+ \ifx\relax#2\relax
+ \typefile{#1}%
+ \else
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% The code fence infostring is used as a name from the \Hologo{ConTeXt}
+% \m{definetyping} macro. This allows the user to set up code highlighting
+% mapping as follows:
+% ````` tex
+% % Map the `TEX` syntax highlighter to the `latex` infostring.
+% \definetyping [latex]
+% \setuptyping [latex] [option=TEX]
+%
+% \starttext
+% \startmarkdown
+% ~~~ latex
+% \documentclass{article}
+% \begin{document}
+% Hello world!
+% \end{document}
+% ~~~
+% \stopmarkdown
+% \stoptext
+% `````````
+%
+% \end{markdown}
+% \begin{macrocode}
+ \typefile[#2][]{#1}%
+ \fi}%
+\def\markdownRendererHeadingOnePrototype#1{\chapter{#1}}%
+\def\markdownRendererHeadingTwoPrototype#1{\section{#1}}%
+\def\markdownRendererHeadingThreePrototype#1{\subsection{#1}}%
+\def\markdownRendererHeadingFourPrototype#1{\subsubsection{#1}}%
+\def\markdownRendererHeadingFivePrototype#1{\subsubsubsection{#1}}%
+\def\markdownRendererHeadingSixPrototype#1{\subsubsubsubsection{#1}}%
+\def\markdownRendererHorizontalRulePrototype{%
+ \blackrule[height=1pt, width=\hsize]}%
+\def\markdownRendererFootnotePrototype#1{\footnote{#1}}%
+\stopmodule\protect
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% There is a basic implementation of tables.
+%
+% \end{markdown}
+% \begin{macrocode}
+\newcount\markdownConTeXtRowCounter
+\newcount\markdownConTeXtRowTotal
+\newcount\markdownConTeXtColumnCounter
+\newcount\markdownConTeXtColumnTotal
+\newtoks\markdownConTeXtTable
+\newtoks\markdownConTeXtTableFloat
+\def\markdownRendererTablePrototype#1#2#3{%
+ \markdownConTeXtTable={}%
+ \ifx\empty#1\empty
+ \markdownConTeXtTableFloat={%
+ \the\markdownConTeXtTable}%
+ \else
+ \markdownConTeXtTableFloat={%
+ \placetable{#1}{\the\markdownConTeXtTable}}%
+ \fi
+ \begingroup
+ \setupTABLE[r][each][topframe=off, bottomframe=off, leftframe=off, rightframe=off]
+ \setupTABLE[c][each][topframe=off, bottomframe=off, leftframe=off, rightframe=off]
+ \setupTABLE[r][1][topframe=on, bottomframe=on]
+ \setupTABLE[r][#1][bottomframe=on]
+ \markdownConTeXtRowCounter=0%
+ \markdownConTeXtRowTotal=#2%
+ \markdownConTeXtColumnTotal=#3%
+ \markdownConTeXtRenderTableRow}
+\def\markdownConTeXtRenderTableRow#1{%
+ \markdownConTeXtColumnCounter=0%
+ \ifnum\markdownConTeXtRowCounter=0\relax
+ \markdownConTeXtReadAlignments#1%
+ \markdownConTeXtTable={\bTABLE}%
+ \else
+ \markdownConTeXtTable=\expandafter{%
+ \the\markdownConTeXtTable\bTR}%
+ \markdownConTeXtRenderTableCell#1%
+ \markdownConTeXtTable=\expandafter{%
+ \the\markdownConTeXtTable\eTR}%
+ \fi
+ \advance\markdownConTeXtRowCounter by 1\relax
+ \ifnum\markdownConTeXtRowCounter>\markdownConTeXtRowTotal\relax
+ \markdownConTeXtTable=\expandafter{%
+ \the\markdownConTeXtTable\eTABLE}%
+ \the\markdownConTeXtTableFloat
+ \endgroup
+ \expandafter\gobbleoneargument
+ \fi\markdownConTeXtRenderTableRow}
+\def\markdownConTeXtReadAlignments#1{%
+ \advance\markdownConTeXtColumnCounter by 1\relax
+ \if#1d%
+ \setupTABLE[c][\the\markdownConTeXtColumnCounter][align=right]
+ \fi\if#1l%
+ \setupTABLE[c][\the\markdownConTeXtColumnCounter][align=right]
+ \fi\if#1c%
+ \setupTABLE[c][\the\markdownConTeXtColumnCounter][align=middle]
+ \fi\if#1r%
+ \setupTABLE[c][\the\markdownConTeXtColumnCounter][align=left]
+ \fi
+ \ifnum\markdownConTeXtColumnCounter<\markdownConTeXtColumnTotal\relax\else
+ \expandafter\gobbleoneargument
+ \fi\markdownConTeXtReadAlignments}
+\def\markdownConTeXtRenderTableCell#1{%
+ \advance\markdownConTeXtColumnCounter by 1\relax
+ \markdownConTeXtTable=\expandafter{%
+ \the\markdownConTeXtTable\bTD#1\eTD}%
+ \ifnum\markdownConTeXtColumnCounter<\markdownConTeXtColumnTotal\relax\else
+ \expandafter\gobbleoneargument
+ \fi\markdownConTeXtRenderTableCell}
+% \end{macrocode}
+% \iffalse
+%</context>
+% \fi
diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html
new file mode 100644
index 0000000000..e6ed568bff
--- /dev/null
+++ b/macros/generic/markdown/markdown.html
@@ -0,0 +1,5344 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
+<head>
+ <meta charset="utf-8" />
+ <meta name="generator" content="pandoc" />
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
+ <meta name="author" content="Vít Novotný" />
+ <title>Markdown Package User Manual</title>
+ <style type="text/css">
+ 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">
+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; position: absolute; }
+.sourceCode { overflow: visible; }
+code.sourceCode { white-space: pre; position: relative; }
+div.sourceCode { margin: 1em 0; }
+pre.sourceCode { margin: 0; }
+@media screen {
+div.sourceCode { overflow: auto; }
+}
+@media print {
+code.sourceCode { white-space: pre-wrap; }
+a.sourceLine { text-indent: -1em; padding-left: 1em; }
+}
+pre.numberSource a.sourceLine
+ { position: relative; }
+pre.numberSource a.sourceLine:empty
+ { position: absolute; }
+pre.numberSource a.sourceLine::before
+ { content: attr(data-line-number);
+ position: absolute; left: -5em; text-align: right; vertical-align: baseline;
+ border: none; pointer-events: all;
+ -webkit-touch-callout: none; -webkit-user-select: none;
+ -khtml-user-select: none; -moz-user-select: none;
+ -ms-user-select: none; user-select: none;
+ padding: 0 4px; width: 4em;
+ color: #aaaaaa;
+ }
+pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; }
+div.sourceCode
+ { }
+@media screen {
+a.sourceLine::before { text-decoration: underline; }
+}
+code span.al { color: #ff0000; font-weight: bold; } /* Alert */
+code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
+code span.at { color: #7d9029; } /* Attribute */
+code span.bn { color: #40a070; } /* BaseN */
+code span.bu { } /* BuiltIn */
+code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
+code span.ch { color: #4070a0; } /* Char */
+code span.cn { color: #880000; } /* Constant */
+code span.co { color: #60a0b0; font-style: italic; } /* Comment */
+code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
+code span.do { color: #ba2121; font-style: italic; } /* Documentation */
+code span.dt { color: #902000; } /* DataType */
+code span.dv { color: #40a070; } /* DecVal */
+code span.er { color: #ff0000; font-weight: bold; } /* Error */
+code span.ex { } /* Extension */
+code span.fl { color: #40a070; } /* Float */
+code span.fu { color: #06287e; } /* Function */
+code span.im { } /* Import */
+code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
+code span.kw { color: #007020; font-weight: bold; } /* Keyword */
+code span.op { color: #666666; } /* Operator */
+code span.ot { color: #007020; } /* Other */
+code span.pp { color: #bc7a00; } /* Preprocessor */
+code span.sc { color: #4070a0; } /* SpecialChar */
+code span.ss { color: #bb6688; } /* SpecialString */
+code span.st { color: #4070a0; } /* String */
+code span.va { color: #19177c; } /* Variable */
+code span.vs { color: #4070a0; } /* VerbatimString */
+code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
+ </style>
+ <link rel="stylesheet" href="markdown.css" />
+ <!--[if lt IE 9]>
+ <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
+ <![endif]-->
+</head>
+<body>
+<header>
+<h1 class="title">Markdown Package User Manual</h1>
+<p class="author">Vít Novotný</p>
+<p class="date">v2.8.1 (2019/04/30)</p>
+</header>
+<nav id="TOC">
+<ul>
+<li><a href="#introduction"><span class="toc-section-number">1</span> Introduction</a><ul>
+<li><a href="#requirements"><span class="toc-section-number">1.1</span> Requirements</a></li>
+<li><a href="#installation"><span class="toc-section-number">1.2</span> Installation</a><ul>
+<li><a href="#local-installation"><span class="toc-section-number">1.2.1</span> Local Installation</a></li>
+<li><a href="#portable-installation"><span class="toc-section-number">1.2.2</span> Portable Installation</a></li>
+</ul></li>
+<li><a href="#first-document"><span class="toc-section-number">1.3</span> First Document</a><ul>
+<li><a href="#using-lua"><span class="toc-section-number">1.3.1</span> Using Lua</a></li>
+<li><a href="#using-plain-tex"><span class="toc-section-number">1.3.2</span> Using Plain <span class="tex">T<sub>e</sub>X</span></a></li>
+<li><a href="#using-latex"><span class="toc-section-number">1.3.3</span> Using <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></a></li>
+<li><a href="#using-context"><span class="toc-section-number">1.3.4</span> Using Con<span class="tex">T<sub>e</sub>X</span>t</a></li>
+</ul></li>
+</ul></li>
+<li><a href="#examples"><span class="toc-section-number">2</span> Examples</a><ul>
+<li><a href="#interfaces"><span class="toc-section-number">2.1</span> Interfaces</a><ul>
+<li><a href="#lua"><span class="toc-section-number">2.1.1</span> Lua</a></li>
+<li><a href="#plain-tex"><span class="toc-section-number">2.1.2</span> Plain <span class="tex">T<sub>e</sub>X</span></a></li>
+<li><a href="#latex"><span class="toc-section-number">2.1.3</span> <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></a></li>
+<li><a href="#context"><span class="toc-section-number">2.1.4</span> Con<span class="tex">T<sub>e</sub>X</span>t</a></li>
+</ul></li>
+<li><a href="#options"><span class="toc-section-number">2.2</span> Options</a><ul>
+<li><a href="#lua-1"><span class="toc-section-number">2.2.1</span> Lua</a></li>
+<li><a href="#plain-tex-1"><span class="toc-section-number">2.2.2</span> Plain <span class="tex">T<sub>e</sub>X</span></a></li>
+</ul></li>
+<li><a href="#markdown-tokens"><span class="toc-section-number">2.3</span> Markdown Tokens</a><ul>
+<li><a href="#token-renderers"><span class="toc-section-number">2.3.1</span> Token Renderers</a></li>
+<li><a href="#token-renderer-prototypes"><span class="toc-section-number">2.3.2</span> Token Renderer Prototypes</a></li>
+</ul></li>
+</ul></li>
+</ul>
+</nav>
+<p><link href="https://afeld.github.io/emoji-css/emoji.css" rel="stylesheet" /></p>
+<h1 id="introduction"><span class="header-section-number">1</span> Introduction</h1>
+<p>The <a href="https://ctan.org/pkg/markdown" title="CTAN: Package markdown">Markdown package</a> converts <a href="https://daringfireball.net/projects/markdown/basics/" title="Daring Fireball: Markdown Basics">markdown</a> markup to <span class="tex">T<sub>e</sub>X</span> commands. The functionality is provided both as a Lua module and as plain <span class="tex">T<sub>e</sub>X</span>, <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span>, and Con<span class="tex">T<sub>e</sub>X</span>t macro packages that can be used to directly typeset documents containing markdown markup. Unlike other convertors, the Markdown package makes it easy to redefine how each and every markdown element is rendered. Creative abuse of the markdown syntax is encouraged. <i class="em em-wink"></i></p>
+<p>This document is a user manual for the <a href="https://ctan.org/pkg/markdown" title="CTAN: Package markdown">Markdown package</a>. It provides tutorials and code examples. For an in-depth description of the package requirements, interfaces, and implementation, please refer to the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for &lt;span class=&quot;tex&quot;&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;">technical documentation</a>.</p>
+<h2 id="requirements"><span class="header-section-number">1.1</span> Requirements</h2>
+<p>The package requires a working <span class="tex">T<sub>e</sub>X</span> distribution. <a href="https://www.tug.org/texlive/" title="TeX Live - TeX Users Group"><span class="tex">T<sub>e</sub>X</span> Live</a> ≥ 2013 is known to work and so are recent installation of <a href="https://miktex.org/" title="Home - MiKTeXorg">Mik<span class="tex">T<sub>e</sub>X</span></a>. If you are using a minimal installation of a <span class="tex">T<sub>e</sub>X</span> distribution, please consult the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for &lt;span class=&quot;tex&quot;&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;">technical documentation</a> for a detailed list of required packages.</p>
+<h2 id="installation"><span class="header-section-number">1.2</span> Installation</h2>
+<p>The package comes pre-installed with <a href="https://www.tug.org/texlive/" title="TeX Live - TeX Users Group"><span class="tex">T<sub>e</sub>X</span> Live</a> ≥ 2016 and with recent installations of <a href="https://miktex.org/" title="Home - MiKTeXorg">MikTeX</a>. Unless you explicitly wish to use the latest version of the package, you are encouraged to skip this step.</p>
+<p>To install the package, first download the package from the repository using Git:</p>
+<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="fu">git</span> clone https://github.com/witiko/markdown</a></code></pre></div>
+<p>Next, enter the directory named <code>markdown</code> and interpret the file named <code>markdown.ins</code> file using a Unicode-aware <span class="tex">T<sub>e</sub>X</span> engine, such as XeTeX or LuaTeX:</p>
+<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="bu">cd</span> markdown</a>
+<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="ex">luatex</span> markdown.ins</a></code></pre></div>
+<p>This should produce the following files:</p>
+<ul>
+<li><code>markdown.lua</code>, the Lua module,</li>
+<li><code>markdown-cli.lua</code>, the Lua command-line interface,</li>
+<li><code>markdown.tex</code>, the plain <span class="tex">T<sub>e</sub>X</span> macro package,</li>
+<li><code>markdown.sty</code>, the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> package, and</li>
+<li><code>t-markdown.tex</code>, the Con<span class="tex">T<sub>e</sub>X</span>t module.</li>
+</ul>
+<h3 id="local-installation"><span class="header-section-number">1.2.1</span> Local Installation</h3>
+<p>To perform a local installation, place the above files into your <span class="tex">T<sub>e</sub>X</span> directory structure. This is generally where the individual files should be placed:</p>
+<ul>
+<li><code>&lt;TEXMF&gt;/tex/luatex/markdown/markdown.lua</code></li>
+<li><code>&lt;TEXMF&gt;/scripts/markdown/markdown-cli.lua</code></li>
+<li><code>&lt;TEXMF&gt;/tex/generic/markdown/markdown.tex</code></li>
+<li><code>&lt;TEXMF&gt;/tex/latex/markdown/markdown.sty</code></li>
+<li><code>&lt;TEXMF&gt;/tex/context/third/markdown/t-markdown.tex</code></li>
+</ul>
+<p>where <code>&lt;TEXMF&gt;</code> corresponds to a root of your <span class="tex">T<sub>e</sub>X</span> distribution, such as <code>/usr/share/texmf</code> and <code>~/texmf</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf</code> on Windows systems. When in doubt, consult the manual of your <span class="tex">T<sub>e</sub>X</span> distribution.</p>
+<h3 id="portable-installation"><span class="header-section-number">1.2.2</span> Portable Installation</h3>
+<p>Alternatively, you can also store the above files in the same folder as your <span class="tex">T<sub>e</sub>X</span> document and distribute them together. This way your document can be portably typeset on legacy <span class="tex">T<sub>e</sub>X</span> distributions.</p>
+<h2 id="first-document"><span class="header-section-number">1.3</span> First Document</h2>
+<p>In this section, we will take the necessary steps to typeset our first markdown document in <span class="tex">T<sub>e</sub>X</span>. This will serve as our first hands-on experience with the package and also as a reassurance that the package has been correctly installed.</p>
+<h3 id="using-lua"><span class="header-section-number">1.3.1</span> Using Lua</h3>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb3"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="fu">\input</span> hello</a>
+<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="fu">\bye</span></a></code></pre></div>
+<h4 id="using-the-lua-module"><span class="header-section-number">1.3.1.1</span> Using the Lua Module</h4>
+<p>Using a text editor, create a text document named <code>hello.lua</code> with the following content:</p>
+<div class="sourceCode" id="cb4"><pre class="sourceCode lua"><code class="sourceCode lua"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="ot">#</span>!<span class="ot">/</span>usr<span class="ot">/</span>bin<span class="ot">/</span>env texlua</a>
+<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="kw">local</span> kpse <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">&quot;kpse&quot;</span><span class="ot">)</span></a>
+<a class="sourceLine" id="cb4-3" data-line-number="3">kpse<span class="ot">.</span>set_program_name<span class="ot">(</span><span class="st">&quot;luatex&quot;</span><span class="ot">)</span></a>
+<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="kw">local</span> markdown <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">&quot;markdown&quot;</span><span class="ot">)</span></a>
+<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="kw">local</span> convert <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">()</span></a>
+<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="fu">print</span><span class="ot">(</span>convert<span class="ot">(</span><span class="st">&quot;Hello *world*!&quot;</span><span class="ot">))</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="ex">texlua</span> hello.lua <span class="op">&gt;</span> hello.tex</a>
+<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="ex">texlua</span> hello.lua <span class="op">&gt;</span> hello.tex</a>
+<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="ex">pdftex</span> document.tex</a></code></pre></div>
+<h4 id="using-the-lua-command-line-interface"><span class="header-section-number">1.3.1.2</span> Using the Lua Command-Line Interface</h4>
+<p>Using a text editor, create a text document named <code>hello.md</code> with the following content:</p>
+<div class="sourceCode" id="cb7"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb7-1" data-line-number="1">Hello *world*!</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- hello.md hello.tex</a>
+<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- hello.md hello.tex</a>
+<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="ex">pdftex</span> document.tex</a></code></pre></div>
+<h3 id="using-plain-tex"><span class="header-section-number">1.3.2</span> Using Plain <span class="tex">T<sub>e</sub>X</span></h3>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb10"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb10-3" data-line-number="3">Hello *world*!</a>
+<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb11-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb12-1" data-line-number="1"><span class="ex">pdftex</span> --shell-escape document.tex</a></code></pre></div>
+<h3 id="using-latex"><span class="header-section-number">1.3.3</span> Using <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></h3>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb13"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb13-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb13-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb13-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb13-5" data-line-number="5">Hello *world*!</a>
+<a class="sourceLine" id="cb13-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb13-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb14-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb15-1" data-line-number="1"><span class="ex">pdflatex</span> --shell-escape document.tex</a></code></pre></div>
+<hr />
+<p>As the next step, try typesetting the example documents distributed along with the Markdown package:</p>
+<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb16-1" data-line-number="1"><span class="fu">git</span> clone https://github.com/witiko/markdown</a>
+<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="bu">cd</span> markdown/examples</a>
+<a class="sourceLine" id="cb16-3" data-line-number="3"><span class="ex">lualatex</span> latex.tex</a></code></pre></div>
+<p>A PDF document named <code>latex.pdf</code> should be produced. Open the text documents <code>latex.tex</code> and <code>example.md</code> in a text editor to see how the example documents are structured. Try changing the documents and typesetting them as follows:</p>
+<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb17-1" data-line-number="1"><span class="ex">lualatex</span> latex.tex</a></code></pre></div>
+<p>to see the effect of your changes.</p>
+<h3 id="using-context"><span class="header-section-number">1.3.4</span> Using Con<span class="tex">T<sub>e</sub>X</span>t</h3>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb18"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb18-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb18-3" data-line-number="3"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb18-4" data-line-number="4">Hello *world*!</a>
+<a class="sourceLine" id="cb18-5" data-line-number="5"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb18-6" data-line-number="6"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb19-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb20"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb20-1" data-line-number="1"><span class="ex">texexec</span> --passon=--shell-escape document.tex</a></code></pre></div>
+<hr />
+<p>As the next step, try typesetting the example documents distributed along with the Markdown package:</p>
+<div class="sourceCode" id="cb21"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb21-1" data-line-number="1"><span class="fu">git</span> clone https://github.com/witiko/markdown</a>
+<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="bu">cd</span> markdown/examples</a>
+<a class="sourceLine" id="cb21-3" data-line-number="3"><span class="ex">context</span> context.tex</a></code></pre></div>
+<p>A PDF document named <code>context.pdf</code> should be produced. Open the text documents <code>context.tex</code> and <code>example.md</code> in a text editor to see how the example documents are structured. Try changing the documents and typesetting them as follows:</p>
+<div class="sourceCode" id="cb22"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb22-1" data-line-number="1"><span class="ex">context</span> context.tex</a></code></pre></div>
+<p>to see the effect of your changes.</p>
+<h1 id="examples"><span class="header-section-number">2</span> Examples</h1>
+<p>In this section, I will describe the individual parts of the Markdown package. Each part will be shown by example, leaving the implementation details to the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for &lt;span class=&quot;tex&quot;&gt;T&lt;sub&gt;e&lt;/sub&gt;X&lt;/span&gt;">technical documentation</a>.</p>
+<h2 id="interfaces"><span class="header-section-number">2.1</span> Interfaces</h2>
+<p>In this section, I will describe the individual interfaces exposed by the Markdown package starting with the low-level Lua interfaces and all the way up to the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> and Con<span class="tex">T<sub>e</sub>X</span>t interfaces intended for the ordinary user.</p>
+<h3 id="lua"><span class="header-section-number">2.1.1</span> Lua</h3>
+<p>The Lua programming language is what drives the conversion from markdown to <span class="tex">T<sub>e</sub>X</span> in the Markdown package. Based on the <a href="https://github.com/jgm/lunamark" title="Lua library for conversion between markup formats">Lunamark</a> Lua library by John MacFarlane, the Lua implementation is largely independent on <span class="tex">T<sub>e</sub>X</span>, and can be used separately from typesetting a document. Lua provides two interfaces: a Lua module and a command-line interface (CLI).</p>
+<h4 id="lua-module"><span class="header-section-number">2.1.1.1</span> Lua Module</h4>
+<p>A Lua module is a software library that can be used from in other programs. The <code>markdown</code> Lua module makes it possible to convert markdown to <span class="tex">T<sub>e</sub>X</span> from within Lua<span class="tex">T<sub>e</sub>X</span> documents and Lua scripts.</p>
+<p>The <code>markdown</code> Lua module exposes the <code>new(</code>⟨<em>options</em>⟩<code>)</code> method, which creates a converter function from markdown to <span class="tex">T<sub>e</sub>X</span>. The properties of the converter function are specified by the Lua table <code>options</code>. The parameter is optional; when unspecified, the behaviour will be the same as if ⟨<em>options</em>⟩ were an empty table.</p>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb23"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb23-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb23-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb23-3" data-line-number="3"><span class="fu">\input</span> example</a>
+<a class="sourceLine" id="cb23-4" data-line-number="4"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>example.lua</code> with the following content:</p>
+<div class="sourceCode" id="cb24"><pre class="sourceCode lua"><code class="sourceCode lua"><a class="sourceLine" id="cb24-1" data-line-number="1"><span class="ot">#</span>!<span class="ot">/</span>usr<span class="ot">/</span>bin<span class="ot">/</span>env texlua</a>
+<a class="sourceLine" id="cb24-2" data-line-number="2"><span class="kw">local</span> kpse <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">&quot;kpse&quot;</span><span class="ot">)</span></a>
+<a class="sourceLine" id="cb24-3" data-line-number="3">kpse<span class="ot">.</span>set_program_name<span class="ot">(</span><span class="st">&quot;luatex&quot;</span><span class="ot">)</span></a>
+<a class="sourceLine" id="cb24-4" data-line-number="4"><span class="kw">local</span> markdown <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">&quot;markdown&quot;</span><span class="ot">)</span></a>
+<a class="sourceLine" id="cb24-5" data-line-number="5"><span class="kw">local</span> input<span class="ot">,</span> convert_safe<span class="ot">,</span> convert_unsafe<span class="ot">,</span> paragraph</a>
+<a class="sourceLine" id="cb24-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb24-7" data-line-number="7">input <span class="ot">=</span> <span class="st">[[$\sqrt{-1}$ *equals* $i$.]]</span></a>
+<a class="sourceLine" id="cb24-8" data-line-number="8">convert_safe <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">()</span></a>
+<a class="sourceLine" id="cb24-9" data-line-number="9">convert_unsafe <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">({</span>hybrid <span class="ot">=</span> <span class="kw">true</span><span class="ot">})</span></a>
+<a class="sourceLine" id="cb24-10" data-line-number="10">paragraph <span class="ot">=</span> <span class="st">[[\par]]</span></a>
+<a class="sourceLine" id="cb24-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb24-12" data-line-number="12"><span class="fu">print</span><span class="ot">(</span></a>
+<a class="sourceLine" id="cb24-13" data-line-number="13"> convert_safe<span class="ot">(</span>input<span class="ot">)</span> <span class="ot">..</span> paragraph <span class="ot">..</span></a>
+<a class="sourceLine" id="cb24-14" data-line-number="14"> convert_unsafe<span class="ot">(</span>input<span class="ot">)</span></a>
+<a class="sourceLine" id="cb24-15" data-line-number="15"><span class="ot">)</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb25"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb25-1" data-line-number="1"><span class="ex">texlua</span> example.lua <span class="op">&gt;</span> example.tex</a>
+<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<p>Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb26"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb26-1" data-line-number="1"><span class="ex">texlua</span> example.lua <span class="op">&gt;</span> example.tex</a>
+<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="ex">pdftex</span> document.tex</a></code></pre></div>
+<hr />
+<p>Rather than use the <code>texlua</code> interpreter, we can also access the <code>markdown</code> Lua module directly from our document. Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb27"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb27-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb27-4" data-line-number="4"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb27-5" data-line-number="5"> local input, convert_safe, convert_unsafe, paragraph</a>
+<a class="sourceLine" id="cb27-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb27-7" data-line-number="7"> input = [[<span class="ss">$</span><span class="sc">\string\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.]]</a>
+<a class="sourceLine" id="cb27-8" data-line-number="8"> convert_safe = markdown.new()</a>
+<a class="sourceLine" id="cb27-9" data-line-number="9"> convert_unsafe = markdown.new({hybrid = true})</a>
+<a class="sourceLine" id="cb27-10" data-line-number="10"> paragraph = [[<span class="fu">\par</span>]]</a>
+<a class="sourceLine" id="cb27-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb27-12" data-line-number="12"> tex.sprint(</a>
+<a class="sourceLine" id="cb27-13" data-line-number="13"> convert_safe(input) .. paragraph ..</a>
+<a class="sourceLine" id="cb27-14" data-line-number="14"> convert_unsafe(input)</a>
+<a class="sourceLine" id="cb27-15" data-line-number="15"> )</a>
+<a class="sourceLine" id="cb27-16" data-line-number="16">}</a>
+<a class="sourceLine" id="cb27-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb28"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb28-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<p>In this case, we cannot use pdfTeX, because pdfTeX does not define the <code>\directlua</code> <span class="tex">T<sub>e</sub>X</span> command.</p>
+<h4 id="lua-command-line-interface"><span class="header-section-number">2.1.1.2</span> Lua Command-Line Interface</h4>
+<p>The Lua command-line interface (CLI) of the Markdown package makes the functionality of the Lua module accessible from the command line. This makes it possible to convert documents from markdown to <span class="tex">T<sub>e</sub>X</span> manually without any knowledge of the Lua programming language.</p>
+<p>The Lua command-line interface accepts the same options as the <code>markdown</code> Lua module, but now the options are specified as command-line parameters.</p>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb29"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb29-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb29-3" data-line-number="3"><span class="fu">\input</span> safe</a>
+<a class="sourceLine" id="cb29-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb29-5" data-line-number="5"><span class="fu">\input</span> unsafe</a>
+<a class="sourceLine" id="cb29-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>example.md</code> with the following content:</p>
+<div class="sourceCode" id="cb30"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb30-1" data-line-number="1">$\sqrt{-1}$ *equals* $i$.</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb31"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb31-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- example.md safe.tex</a>
+<a class="sourceLine" id="cb31-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex</a>
+<a class="sourceLine" id="cb31-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<p>Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb32"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb32-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- example.md safe.tex</a>
+<a class="sourceLine" id="cb32-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex</a>
+<a class="sourceLine" id="cb32-3" data-line-number="3"><span class="ex">pdftex</span> document.tex</a></code></pre></div>
+<h3 id="plain-tex"><span class="header-section-number">2.1.2</span> Plain <span class="tex">T<sub>e</sub>X</span></h3>
+<p>The plain <span class="tex">T<sub>e</sub>X</span> interface provides <span class="tex">T<sub>e</sub>X</span> commands that typeset markdown documents by using the Lua interface behind the scenes. Unlike the Lua interface, the plain TeX interface does not provide low-level tools for converting markdown to <span class="tex">T<sub>e</sub>X</span>. Instead, its goal is to provide high-level typesetting capabilities.</p>
+<p>The plain <span class="tex">T<sub>e</sub>X</span> interface accepts the same options as the <code>markdown</code> Lua module, in addition to its own options, but now the options are specified as <span class="tex">T<sub>e</sub>X</span> commands.</p>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb33"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb33-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb33-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb33-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb33-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb33-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb33-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb33-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb33-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb33-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb33-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb33-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb33-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb34"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb34-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<p>Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb35"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb35-1" data-line-number="1"><span class="ex">pdftex</span> --shell-escape document.tex</a></code></pre></div>
+<h3 id="latex"><span class="header-section-number">2.1.3</span> <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></h3>
+<p>The <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> interface provides the same level of functionality as the plain <span class="tex">T<sub>e</sub>X</span> interface by using the plain <span class="tex">T<sub>e</sub>X</span> interface behind the scenes. Unlike the plain <span class="tex">T<sub>e</sub>X</span> interface, the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> interface uses familiar <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> idioms, such as package options and environments.</p>
+<p>The <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> interface accepts the same options as the plain <span class="tex">T<sub>e</sub>X</span> interface, but now the options are specified as ⟨<em>key</em>⟩<span class="math inline"> = </span>⟨<em>value</em>⟩ pairs and they are passed either as package options, in the <code>\markdownSetup</code> command, or as parameters for the <code>markdown*</code> <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> environment.</p>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb36"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb36-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb36-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb36-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb36-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb36-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb36-6" data-line-number="6"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb36-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb36-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb36-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid}</a>
+<a class="sourceLine" id="cb36-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb36-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb36-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb36-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb37"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb37-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<p>Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb38"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb38-1" data-line-number="1"><span class="ex">pdflatex</span> --shell-escape document.tex</a></code></pre></div>
+<h3 id="context"><span class="header-section-number">2.1.4</span> Con<span class="tex">T<sub>e</sub>X</span>t</h3>
+<p>The Con<span class="tex">T<sub>e</sub>X</span>t interface provides the same level of functionality as the plain <span class="tex">T<sub>e</sub>X</span> interface by using the plain <span class="tex">T<sub>e</sub>X</span> interface behind the scenes. Unlike the plain <span class="tex">T<sub>e</sub>X</span> interface, the Con<span class="tex">T<sub>e</sub>X</span>t interface uses familiar Con<span class="tex">T<sub>e</sub>X</span>t idioms, such as environments.</p>
+<p>The Con<span class="tex">T<sub>e</sub>X</span>t interface accepts the same options as the plain <span class="tex">T<sub>e</sub>X</span> interface.</p>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb39"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb39-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb39-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb39-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb39-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb39-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb39-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb39-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb39-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb39-9" data-line-number="9"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb39-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb39-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb39-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb39-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb40"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb40-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<p>Invoking pdfTeX should have the same effect:</p>
+<div class="sourceCode" id="cb41"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb41-1" data-line-number="1"><span class="ex">texexec</span> --passon=--shell-escape document.tex</a></code></pre></div>
+<h2 id="options"><span class="header-section-number">2.2</span> Options</h2>
+<p>In this section, I will describe all the options recognized by the Markdown package.</p>
+<h3 id="lua-1"><span class="header-section-number">2.2.1</span> Lua</h3>
+<p>Lua options control the conversion from markdown to <span class="tex">T<sub>e</sub>X</span>. They are supported by all interfaces of the Markdown package starting with the low-level Lua interfaces and all the way up to the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> and Con<span class="tex">T<sub>e</sub>X</span>t interfaces.</p>
+<h4 id="option-cachedir"><span class="header-section-number">2.2.1.1</span> Option <code>cacheDir</code></h4>
+<dl>
+<dt><code>cacheDir</code> (default value: <code>&quot;.&quot;</code>)</dt>
+<dd><p>A path to the directory containing auxiliary cache files. If the last segment of the path does not exist, it will be created by the Lua command-line and plain <span class="tex">T<sub>e</sub>X</span> implementations. The Lua implementation expects that the entire path already exists.</p>
+<p>When iteratively writing and typesetting a markdown document, the cache files are going to accumulate over time. You are advised to clean the cache directory every now and then, or to set it to a temporary filesystem (such as <code>/tmp</code> on UN*X systems), which gets periodically emptied.</p>
+</dd>
+</dl>
+<h5 id="lua-module-example" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb42"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb42-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb42-2" data-line-number="2"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb42-3" data-line-number="3"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb42-4" data-line-number="4"> local convert = markdown.new({cacheDir = &quot;cache&quot;})</a>
+<a class="sourceLine" id="cb42-5" data-line-number="5"> local input = &quot;Hello *world*!&quot;</a>
+<a class="sourceLine" id="cb42-6" data-line-number="6"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb42-7" data-line-number="7"><span class="fu">\bye</span></a></code></pre></div>
+<p>Create an empty directory named <code>cache</code> next to our text document. Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb43"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb43-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Several cache files of the Markdown package will also be produced in the <code>cache</code> directory as we requested using the <code>cacheDir</code> option.</p>
+<h5 id="lua-cli-example" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb44"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb44-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb44-2" data-line-number="2"><span class="fu">\input</span> hello</a>
+<a class="sourceLine" id="cb44-3" data-line-number="3"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>hello.md</code> with the following content:</p>
+<div class="sourceCode" id="cb45"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb45-1" data-line-number="1">Hello *world*!</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb46"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb46-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex</a>
+<a class="sourceLine" id="cb46-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p>
+<h5 id="plain-tex-example" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb47"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb47-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb47-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionCacheDir{cache}</a>
+<a class="sourceLine" id="cb47-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb47-4" data-line-number="4">Hello *world*!</a>
+<a class="sourceLine" id="cb47-5" data-line-number="5"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb47-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb48"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb48-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p>
+<h5 id="latex-example" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb49"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb49-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb49-2" data-line-number="2"><span class="bu">\usepackage</span>[cacheDir=cache]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb49-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb49-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb49-5" data-line-number="5">Hello *world*!</a>
+<a class="sourceLine" id="cb49-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb49-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb50"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb50-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p>
+<h5 id="context-example" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb51"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb51-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb51-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionCacheDir{cache}</a>
+<a class="sourceLine" id="cb51-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb51-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb51-5" data-line-number="5">Hello *world*!</a>
+<a class="sourceLine" id="cb51-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb51-7" data-line-number="7"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb52"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb52-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p>
+<h4 id="option-blankbeforeblockquote"><span class="header-section-number">2.2.1.2</span> Option <code>blankBeforeBlockquote</code></h4>
+<dl>
+<dt><code>blankBeforeBlockquote</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Require a blank line between a paragraph and the following blockquote.</p>
+</dd>
+<dt>false</dt>
+<dd><p>Do not require a blank line between a paragraph and the following blockquote.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-1" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb53"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb53-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb53-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb53-3" data-line-number="3"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb53-4" data-line-number="4"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb53-5" data-line-number="5"> local newline = [[^^J^^J]]</a>
+<a class="sourceLine" id="cb53-6" data-line-number="6"> local convert, input</a>
+<a class="sourceLine" id="cb53-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb53-8" data-line-number="8"> convert = markdown.new()</a>
+<a class="sourceLine" id="cb53-9" data-line-number="9"> input = &quot;A paragraph.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb53-10" data-line-number="10"> &quot;&gt; A quote.&quot; .. newline</a>
+<a class="sourceLine" id="cb53-11" data-line-number="11"> tex.sprint(convert(input))</a>
+<a class="sourceLine" id="cb53-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb53-13" data-line-number="13"> convert = markdown.new({blankBeforeBlockquote = true})</a>
+<a class="sourceLine" id="cb53-14" data-line-number="14"> input = &quot;A paragraph.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb53-15" data-line-number="15"> &quot;&gt; Not a quote.&quot; .. newline</a>
+<a class="sourceLine" id="cb53-16" data-line-number="16"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb53-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb54"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb54-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<blockquote>
+<p>A quote.</p>
+</blockquote>
+<p>A paragraph &gt; Not a quote.</p>
+</blockquote>
+<h5 id="lua-cli-example-1" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb55"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb55-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb55-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb55-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb55-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb55-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb56"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb56-1" data-line-number="1">A paragraph.</a>
+<a class="sourceLine" id="cb56-2" data-line-number="2">&gt;<span class="dt"> A quote?</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb57"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb57-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb57-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb57-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<blockquote>
+<p>A quote?</p>
+</blockquote>
+<p>A paragraph. &gt; A quote?</p>
+</blockquote>
+<h5 id="plain-tex-example-1" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb58"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb58-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb58-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb58-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb58-4" data-line-number="4">A paragraph.</a>
+<a class="sourceLine" id="cb58-5" data-line-number="5">&gt; A quote.</a>
+<a class="sourceLine" id="cb58-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb58-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb58-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionBlankBeforeBlockquote{true}</a>
+<a class="sourceLine" id="cb58-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb58-10" data-line-number="10">A paragraph.</a>
+<a class="sourceLine" id="cb58-11" data-line-number="11">&gt; Not a quote.</a>
+<a class="sourceLine" id="cb58-12" data-line-number="12"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb58-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb58-14" data-line-number="14"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb59"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb59-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<blockquote>
+<p>A quote.</p>
+</blockquote>
+<p>A paragraph &gt; Not a quote.</p>
+</blockquote>
+<h5 id="latex-example-1" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb60"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb60-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb60-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb60-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb60-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb60-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb60-6" data-line-number="6">A paragraph.</a>
+<a class="sourceLine" id="cb60-7" data-line-number="7">&gt; A quote.</a>
+<a class="sourceLine" id="cb60-8" data-line-number="8"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb60-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb60-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeBlockquote}</a>
+<a class="sourceLine" id="cb60-11" data-line-number="11">A paragraph.</a>
+<a class="sourceLine" id="cb60-12" data-line-number="12">&gt; Not a quote.</a>
+<a class="sourceLine" id="cb60-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb60-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb60-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb61"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb61-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<blockquote>
+<p>A quote.</p>
+</blockquote>
+<p>A paragraph &gt; Not a quote.</p>
+</blockquote>
+<h5 id="context-example-1" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb62"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb62-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb62-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb62-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb62-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb62-5" data-line-number="5">A paragraph.</a>
+<a class="sourceLine" id="cb62-6" data-line-number="6">&gt; A quote.</a>
+<a class="sourceLine" id="cb62-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb62-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb62-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionBlankBeforeBlockquote{true}</a>
+<a class="sourceLine" id="cb62-10" data-line-number="10"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb62-11" data-line-number="11">A paragraph.</a>
+<a class="sourceLine" id="cb62-12" data-line-number="12">&gt; Not a quote.</a>
+<a class="sourceLine" id="cb62-13" data-line-number="13"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb62-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb62-15" data-line-number="15"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb63"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb63-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<blockquote>
+<p>A quote.</p>
+</blockquote>
+<p>A paragraph &gt; Not a quote.</p>
+</blockquote>
+<h4 id="option-blankbeforecodefence"><span class="header-section-number">2.2.1.3</span> Option <code>blankBeforeCodeFence</code></h4>
+<dl>
+<dt><code>blankBeforeCodeFence</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Require a blank line between a paragraph and the following fenced code block.</p>
+</dd>
+<dt>false</dt>
+<dd><p>Do not require a blank line between a paragraph and the following fenced code block.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-2" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb64"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb64-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb64-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb64-3" data-line-number="3"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb64-4" data-line-number="4"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb64-5" data-line-number="5"> local newline = [[^^J^^J]]</a>
+<a class="sourceLine" id="cb64-6" data-line-number="6"> local convert, input</a>
+<a class="sourceLine" id="cb64-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb64-8" data-line-number="8"> convert = markdown.new({fencedCode = true})</a>
+<a class="sourceLine" id="cb64-9" data-line-number="9"> input = &quot;A paragraph.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb64-10" data-line-number="10"> &quot;```&quot; .. newline ..</a>
+<a class="sourceLine" id="cb64-11" data-line-number="11"> &quot;A code fence.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb64-12" data-line-number="12"> &quot;```&quot; .. newline</a>
+<a class="sourceLine" id="cb64-13" data-line-number="13"> tex.sprint(convert(input))</a>
+<a class="sourceLine" id="cb64-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb64-15" data-line-number="15"> convert = markdown.new({</a>
+<a class="sourceLine" id="cb64-16" data-line-number="16"> fencedCode = true, blankBeforeCodeFence = true})</a>
+<a class="sourceLine" id="cb64-17" data-line-number="17"> input = &quot;A paragraph.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb64-18" data-line-number="18"> &quot;```&quot; .. newline ..</a>
+<a class="sourceLine" id="cb64-19" data-line-number="19"> &quot;Not a code fence.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb64-20" data-line-number="20"> &quot;```&quot; .. newline</a>
+<a class="sourceLine" id="cb64-21" data-line-number="21"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb64-22" data-line-number="22"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb65"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb65-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<pre><code>A code fence.</code></pre>
+<p>A paragraph. <code>Not a code fence.</code></p>
+</blockquote>
+<h5 id="lua-cli-example-2" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb67"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb67-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb67-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb67-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb67-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb67-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb68"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb68-1" data-line-number="1">A paragraph.</a>
+<a class="sourceLine" id="cb68-2" data-line-number="2">```</a>
+<a class="sourceLine" id="cb68-3" data-line-number="3">A code fence?</a>
+<a class="sourceLine" id="cb68-4" data-line-number="4">```</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb69"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb69-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb69-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb69-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<pre><code>A code fence?</code></pre>
+<p>A paragraph. <code>A code fence?</code></p>
+</blockquote>
+<h5 id="plain-tex-example-2" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb71"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb71-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb71-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFencedCode{true}</a>
+<a class="sourceLine" id="cb71-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb71-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb71-5" data-line-number="5">A paragraph.</a>
+<a class="sourceLine" id="cb71-6" data-line-number="6">```</a>
+<a class="sourceLine" id="cb71-7" data-line-number="7">A code fence.</a>
+<a class="sourceLine" id="cb71-8" data-line-number="8">```</a>
+<a class="sourceLine" id="cb71-9" data-line-number="9"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb71-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb71-11" data-line-number="11"><span class="fu">\def</span>\markdownOptionBlankBeforeCodeFence{true}</a>
+<a class="sourceLine" id="cb71-12" data-line-number="12"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb71-13" data-line-number="13">A paragraph.</a>
+<a class="sourceLine" id="cb71-14" data-line-number="14">```</a>
+<a class="sourceLine" id="cb71-15" data-line-number="15">Not a code fence.</a>
+<a class="sourceLine" id="cb71-16" data-line-number="16">```</a>
+<a class="sourceLine" id="cb71-17" data-line-number="17"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb71-18" data-line-number="18"></a>
+<a class="sourceLine" id="cb71-19" data-line-number="19"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb72"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb72-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<pre><code>A code fence.</code></pre>
+<p>A paragraph. <code>Not a code fence.</code></p>
+</blockquote>
+<h5 id="latex-example-2" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb74"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb74-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb74-2" data-line-number="2"><span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb74-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb74-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb74-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb74-6" data-line-number="6">A paragraph.</a>
+<a class="sourceLine" id="cb74-7" data-line-number="7">```</a>
+<a class="sourceLine" id="cb74-8" data-line-number="8">A code fence.</a>
+<a class="sourceLine" id="cb74-9" data-line-number="9">```</a>
+<a class="sourceLine" id="cb74-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb74-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb74-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeCodeFence}</a>
+<a class="sourceLine" id="cb74-13" data-line-number="13">A paragraph.</a>
+<a class="sourceLine" id="cb74-14" data-line-number="14">```</a>
+<a class="sourceLine" id="cb74-15" data-line-number="15">Not a code fence.</a>
+<a class="sourceLine" id="cb74-16" data-line-number="16">```</a>
+<a class="sourceLine" id="cb74-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb74-18" data-line-number="18"></a>
+<a class="sourceLine" id="cb74-19" data-line-number="19"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb75"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb75-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<pre><code>A code fence.</code></pre>
+<p>A paragraph. <code>Not a code fence.</code></p>
+</blockquote>
+<h5 id="context-example-2" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb77"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb77-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb77-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFencedCode{true}</a>
+<a class="sourceLine" id="cb77-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb77-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb77-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb77-6" data-line-number="6">A paragraph.</a>
+<a class="sourceLine" id="cb77-7" data-line-number="7">```</a>
+<a class="sourceLine" id="cb77-8" data-line-number="8">A code fence.</a>
+<a class="sourceLine" id="cb77-9" data-line-number="9">```</a>
+<a class="sourceLine" id="cb77-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb77-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb77-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionBlankBeforeCodeFence{true}</a>
+<a class="sourceLine" id="cb77-13" data-line-number="13"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb77-14" data-line-number="14">A paragraph.</a>
+<a class="sourceLine" id="cb77-15" data-line-number="15">```</a>
+<a class="sourceLine" id="cb77-16" data-line-number="16">Not a code fence.</a>
+<a class="sourceLine" id="cb77-17" data-line-number="17">```</a>
+<a class="sourceLine" id="cb77-18" data-line-number="18"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb77-19" data-line-number="19"></a>
+<a class="sourceLine" id="cb77-20" data-line-number="20"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb78"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb78-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<pre><code>A code fence.</code></pre>
+<p>A paragraph. <code>Not a code fence.</code></p>
+</blockquote>
+<h4 id="option-blankbeforeheading"><span class="header-section-number">2.2.1.4</span> Option <code>blankBeforeHeading</code></h4>
+<dl>
+<dt><code>blankBeforeHeading</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Require a blank line between a paragraph and the following header.</p>
+</dd>
+<dt>false</dt>
+<dd><p>Do not require a blank line between a paragraph and the following header.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-3" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb80"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb80-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb80-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb80-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bf #1}\par}</a>
+<a class="sourceLine" id="cb80-4" data-line-number="4"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb80-5" data-line-number="5"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb80-6" data-line-number="6"> local newline = [[^^J^^J]]</a>
+<a class="sourceLine" id="cb80-7" data-line-number="7"> local convert, input</a>
+<a class="sourceLine" id="cb80-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb80-9" data-line-number="9"> convert = markdown.new()</a>
+<a class="sourceLine" id="cb80-10" data-line-number="10"> input = &quot;A paragraph.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb80-11" data-line-number="11"> &quot;A heading.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb80-12" data-line-number="12"> &quot;==========&quot; .. newline</a>
+<a class="sourceLine" id="cb80-13" data-line-number="13"> tex.sprint(convert(input))</a>
+<a class="sourceLine" id="cb80-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb80-15" data-line-number="15"> convert = markdown.new({blankBeforeHeading = true})</a>
+<a class="sourceLine" id="cb80-16" data-line-number="16"> input = &quot;A paragraph.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb80-17" data-line-number="17"> &quot;Not a heading.&quot; .. newline ..</a>
+<a class="sourceLine" id="cb80-18" data-line-number="18"> &quot;==============&quot; .. newline</a>
+<a class="sourceLine" id="cb80-19" data-line-number="19"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb80-20" data-line-number="20"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb81"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb81-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<h1 id="a-heading.">A heading.</h1>
+<p>A paragraph. Not a heading. ==============</p>
+</blockquote>
+<h5 id="lua-cli-example-3" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb82"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb82-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb82-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb82-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb82-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb82-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb83"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb83-1" data-line-number="1">A paragraph.</a>
+<a class="sourceLine" id="cb83-2" data-line-number="2">A heading?</a>
+<a class="sourceLine" id="cb83-3" data-line-number="3">==========</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb84"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb84-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb84-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb84-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<h1 id="a-heading">A heading?</h1>
+<p>A paragraph. A heading? ==========</p>
+</blockquote>
+<h5 id="plain-tex-example-3" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb85"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb85-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb85-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb85-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb85-4" data-line-number="4">A paragraph.</a>
+<a class="sourceLine" id="cb85-5" data-line-number="5">A heading.</a>
+<a class="sourceLine" id="cb85-6" data-line-number="6">==========</a>
+<a class="sourceLine" id="cb85-7" data-line-number="7"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb85-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb85-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionBlankBeforeHeading{true}</a>
+<a class="sourceLine" id="cb85-10" data-line-number="10"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb85-11" data-line-number="11">A paragraph.</a>
+<a class="sourceLine" id="cb85-12" data-line-number="12">Not a heading.</a>
+<a class="sourceLine" id="cb85-13" data-line-number="13">==============</a>
+<a class="sourceLine" id="cb85-14" data-line-number="14"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb85-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb85-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb86"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb86-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<h1 id="a-heading.-1">A heading.</h1>
+<p>A paragraph. Not a heading. ==============</p>
+</blockquote>
+<h5 id="latex-example-3" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb87"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb87-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb87-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb87-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb87-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb87-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb87-6" data-line-number="6">A paragraph.</a>
+<a class="sourceLine" id="cb87-7" data-line-number="7">A heading.</a>
+<a class="sourceLine" id="cb87-8" data-line-number="8">==========</a>
+<a class="sourceLine" id="cb87-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb87-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb87-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeHeading}</a>
+<a class="sourceLine" id="cb87-12" data-line-number="12">A paragraph.</a>
+<a class="sourceLine" id="cb87-13" data-line-number="13">Not a heading.</a>
+<a class="sourceLine" id="cb87-14" data-line-number="14">==============</a>
+<a class="sourceLine" id="cb87-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb87-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb87-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb88"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb88-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<h1 id="a-heading.-2">A heading.</h1>
+<p>A paragraph. Not a heading. ==============</p>
+</blockquote>
+<h5 id="context-example-3" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb89"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb89-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb89-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb89-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb89-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb89-5" data-line-number="5">A paragraph.</a>
+<a class="sourceLine" id="cb89-6" data-line-number="6">A heading.</a>
+<a class="sourceLine" id="cb89-7" data-line-number="7">==========</a>
+<a class="sourceLine" id="cb89-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb89-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb89-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionBlankBeforeHeading{true}</a>
+<a class="sourceLine" id="cb89-11" data-line-number="11"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb89-12" data-line-number="12">A paragraph.</a>
+<a class="sourceLine" id="cb89-13" data-line-number="13">Not a heading.</a>
+<a class="sourceLine" id="cb89-14" data-line-number="14">==============</a>
+<a class="sourceLine" id="cb89-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb89-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb89-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb90"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb90-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A paragraph.</p>
+<h1 id="a-heading.-3">A heading.</h1>
+<p>A paragraph. Not a heading. ==============</p>
+</blockquote>
+<h4 id="option-breakableblockquotes"><span class="header-section-number">2.2.1.5</span> Option <code>breakableBlockquotes</code></h4>
+<dl>
+<dt><code>breakableBlockquotes</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>A blank line separates block quotes.</p>
+</dd>
+<dt>false</dt>
+<dd><p>Blank lines in the middle of a block quote are ignored.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-4" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb91"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb91-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb91-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb91-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bf #1}\par}</a>
+<a class="sourceLine" id="cb91-4" data-line-number="4"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb91-5" data-line-number="5"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb91-6" data-line-number="6"> local newline = [[^^J^^J]]</a>
+<a class="sourceLine" id="cb91-7" data-line-number="7"> local convert, input</a>
+<a class="sourceLine" id="cb91-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb91-9" data-line-number="9"> convert = markdown.new()</a>
+<a class="sourceLine" id="cb91-10" data-line-number="10"> input = &quot;&gt; A single&quot; .. newline .. newline ..</a>
+<a class="sourceLine" id="cb91-11" data-line-number="11"> &quot;&gt; block quote.&quot; .. newline</a>
+<a class="sourceLine" id="cb91-12" data-line-number="12"> tex.sprint(convert(input))</a>
+<a class="sourceLine" id="cb91-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb91-14" data-line-number="14"> convert = markdown.new({breakableBlockquotes = true})</a>
+<a class="sourceLine" id="cb91-15" data-line-number="15"> input = &quot;&gt; A block quote.&quot; .. newline .. newline ..</a>
+<a class="sourceLine" id="cb91-16" data-line-number="16"> &quot;&gt; Another block quote.&quot; .. newline</a>
+<a class="sourceLine" id="cb91-17" data-line-number="17"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb91-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb92"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb92-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<blockquote>
+<p>A single block quote.</p>
+</blockquote>
+<blockquote>
+<p>A block quote.</p>
+</blockquote>
+<blockquote>
+<p>Another block quote.</p>
+</blockquote>
+</blockquote>
+<h5 id="lua-cli-example-4" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb93"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb93-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb93-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb93-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb93-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb93-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb94"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb94-1" data-line-number="1">&gt;<span class="dt"> A single block quote</span></a>
+<a class="sourceLine" id="cb94-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb94-3" data-line-number="3">&gt;<span class="dt"> or two block quotes?</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb95"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb95-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb95-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb95-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<blockquote>
+<p>A single block quote or two block quotes?</p>
+</blockquote>
+<blockquote>
+<p>A single block quote</p>
+</blockquote>
+<blockquote>
+<p>or two block quotes?</p>
+</blockquote>
+</blockquote>
+<h5 id="plain-tex-example-4" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb96"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb96-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb96-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb96-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb96-4" data-line-number="4">&gt; A single</a>
+<a class="sourceLine" id="cb96-5" data-line-number="5"></a>
+<a class="sourceLine" id="cb96-6" data-line-number="6">&gt; block quote.</a>
+<a class="sourceLine" id="cb96-7" data-line-number="7"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb96-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb96-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionBreakableBlockquotes{true}</a>
+<a class="sourceLine" id="cb96-10" data-line-number="10"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb96-11" data-line-number="11">&gt; A block quote.</a>
+<a class="sourceLine" id="cb96-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb96-13" data-line-number="13">&gt; Another block quote.</a>
+<a class="sourceLine" id="cb96-14" data-line-number="14"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb96-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb96-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb97"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb97-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<blockquote>
+<p>A single block quote.</p>
+</blockquote>
+<blockquote>
+<p>A block quote.</p>
+</blockquote>
+<blockquote>
+<p>Another block quote.</p>
+</blockquote>
+</blockquote>
+<h5 id="latex-example-4" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb98"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb98-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb98-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb98-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb98-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb98-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb98-6" data-line-number="6">&gt; A single</a>
+<a class="sourceLine" id="cb98-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb98-8" data-line-number="8">&gt; block quote.</a>
+<a class="sourceLine" id="cb98-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb98-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb98-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{breakableBlockquotes}</a>
+<a class="sourceLine" id="cb98-12" data-line-number="12">&gt; A block quote.</a>
+<a class="sourceLine" id="cb98-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb98-14" data-line-number="14">&gt; Another block quote.</a>
+<a class="sourceLine" id="cb98-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb98-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb98-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb99"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb99-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<blockquote>
+<p>A single block quote.</p>
+</blockquote>
+<blockquote>
+<p>A block quote.</p>
+</blockquote>
+<blockquote>
+<p>Another block quote.</p>
+</blockquote>
+</blockquote>
+<h5 id="context-example-4" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb100"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb100-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb100-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb100-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb100-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb100-5" data-line-number="5">&gt; A single</a>
+<a class="sourceLine" id="cb100-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb100-7" data-line-number="7">&gt; block quote.</a>
+<a class="sourceLine" id="cb100-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb100-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb100-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionBreakableBlockquotes{true}</a>
+<a class="sourceLine" id="cb100-11" data-line-number="11"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb100-12" data-line-number="12">&gt; A block quote.</a>
+<a class="sourceLine" id="cb100-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb100-14" data-line-number="14">&gt; Another block quote.</a>
+<a class="sourceLine" id="cb100-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb100-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb100-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb101"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb101-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<blockquote>
+<p>A single block quote.</p>
+</blockquote>
+<blockquote>
+<p>A block quote.</p>
+</blockquote>
+<blockquote>
+<p>Another block quote.</p>
+</blockquote>
+</blockquote>
+<h4 id="option-citationnbsps"><span class="header-section-number">2.2.1.6</span> Option <code>citationNbsps</code></h4>
+<dl>
+<dt><code>citationNbsps</code> (default value: <code>true</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Replace regular spaces with non-breakable spaces inside the prenotes and postnotes of citations produced via the pandoc citation syntax extension.</p>
+</dd>
+<dt>false</dt>
+<dd><p>Do not replace regular spaces with non-breakable spaces inside the prenotes and postnotes of citations produced via the pandoc citation syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-5" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.bib</code> with the following content:</p>
+<div class="sourceCode" id="cb102"><pre class="sourceCode bib"><code class="sourceCode bibtex"><a class="sourceLine" id="cb102-1" data-line-number="1"><span class="va">@book</span>{<span class="ot">knuth:tex</span>,</a>
+<a class="sourceLine" id="cb102-2" data-line-number="2"> <span class="dt">author</span> = &quot;<span class="st">Knuth, Donald Ervin</span>&quot;,</a>
+<a class="sourceLine" id="cb102-3" data-line-number="3"> <span class="dt">title</span> = &quot;<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>&quot;,</a>
+<a class="sourceLine" id="cb102-4" data-line-number="4"> <span class="dt">publisher</span> = &quot;<span class="st">Addison-Wesley</span>&quot;,</a>
+<a class="sourceLine" id="cb102-5" data-line-number="5"> <span class="dt">year</span> = &quot;<span class="st">1984</span>&quot;</a>
+<a class="sourceLine" id="cb102-6" data-line-number="6">}</a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb103"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb103-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb103-2" data-line-number="2"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb103-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb103-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb103-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb103-6" data-line-number="6">The TeXbook [@knuth:tex, p. 123 and 130] is good.</a>
+<a class="sourceLine" id="cb103-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb103-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb103-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{citationNbsps = false}</a>
+<a class="sourceLine" id="cb103-10" data-line-number="10">The TeXbook [@knuth:tex, p. 123 and 130] is good.</a>
+<a class="sourceLine" id="cb103-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb103-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb103-13" data-line-number="13"><span class="bu">\bibliographystyle</span>{<span class="ex">plain</span>}</a>
+<a class="sourceLine" id="cb103-14" data-line-number="14"><span class="bu">\bibliography</span>{<span class="ex">document.bib</span>}</a>
+<a class="sourceLine" id="cb103-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX and BibTeX from the terminal:</p>
+<div class="sourceCode" id="cb104"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb104-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a>
+<a class="sourceLine" id="cb104-2" data-line-number="2"><span class="ex">bibtex</span> document.aux</a>
+<a class="sourceLine" id="cb104-3" data-line-number="3"><span class="ex">lualatex</span> document.tex</a>
+<a class="sourceLine" id="cb104-4" data-line-number="4"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p>
+<blockquote>
+<p>The TeXbook [1, p.·123·and·130] is good.</p>
+<p>The TeXbook [1, p. 123 and 130] is good.</p>
+<h3 id="references">References</h3>
+<p>[1] Donald·Ervin Knuth. <em>The TeXbook, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p>
+</blockquote>
+<h4 id="option-citations"><span class="header-section-number">2.2.1.7</span> Option <code>citations</code></h4>
+<dl>
+<dt><code>citations</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the pandoc citation syntax extension:</p>
+<div class="sourceCode" id="cb105"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb105-1" data-line-number="1">Here is a simple parenthetical citation [@doe99] and here</a>
+<a class="sourceLine" id="cb105-2" data-line-number="2">is a string of several [see @doe99, pp. 33-35; also</a>
+<a class="sourceLine" id="cb105-3" data-line-number="3">@smith04, chap. 1].</a>
+<a class="sourceLine" id="cb105-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb105-5" data-line-number="5">A parenthetical citation can have a [prenote @doe99] and</a>
+<a class="sourceLine" id="cb105-6" data-line-number="6">a [@smith04 postnote]. The name of the author can be</a>
+<a class="sourceLine" id="cb105-7" data-line-number="7">suppressed by inserting a dash before the name of an</a>
+<a class="sourceLine" id="cb105-8" data-line-number="8">author as follows [-@smith04].</a>
+<a class="sourceLine" id="cb105-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb105-10" data-line-number="10">Here is a simple text citation @doe99 and here is</a>
+<a class="sourceLine" id="cb105-11" data-line-number="11">a string of several @doe99 [pp. 33-35; also @smith04,</a>
+<a class="sourceLine" id="cb105-12" data-line-number="12">chap. 1]. Here is one with the name of the author</a>
+<a class="sourceLine" id="cb105-13" data-line-number="13">suppressed -@doe99.</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the pandoc citation syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-6" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.bib</code> with the following content:</p>
+<div class="sourceCode" id="cb106"><pre class="sourceCode bib"><code class="sourceCode bibtex"><a class="sourceLine" id="cb106-1" data-line-number="1"><span class="va">@book</span>{<span class="ot">knuth:tex</span>,</a>
+<a class="sourceLine" id="cb106-2" data-line-number="2"> <span class="dt">author</span> = &quot;<span class="st">Knuth, Donald Ervin</span>&quot;,</a>
+<a class="sourceLine" id="cb106-3" data-line-number="3"> <span class="dt">title</span> = &quot;<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>&quot;,</a>
+<a class="sourceLine" id="cb106-4" data-line-number="4"> <span class="dt">publisher</span> = &quot;<span class="st">Addison-Wesley</span>&quot;,</a>
+<a class="sourceLine" id="cb106-5" data-line-number="5"> <span class="dt">year</span> = &quot;<span class="st">1984</span>&quot;</a>
+<a class="sourceLine" id="cb106-6" data-line-number="6">}</a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb107"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb107-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb107-2" data-line-number="2"><span class="bu">\usepackage</span>[backend=biber]{<span class="ex">biblatex</span>}</a>
+<a class="sourceLine" id="cb107-3" data-line-number="3"><span class="fu">\addbibresource</span>{document.bib}</a>
+<a class="sourceLine" id="cb107-4" data-line-number="4"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb107-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb107-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb107-7" data-line-number="7"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb107-8" data-line-number="8">The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.</a>
+<a class="sourceLine" id="cb107-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb107-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb107-11" data-line-number="11"><span class="fu">\printbibliography</span></a>
+<a class="sourceLine" id="cb107-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX and Biber from the terminal:</p>
+<div class="sourceCode" id="cb108"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb108-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a>
+<a class="sourceLine" id="cb108-2" data-line-number="2"><span class="ex">biber</span> document.bcf</a>
+<a class="sourceLine" id="cb108-3" data-line-number="3"><span class="ex">lualatex</span> document.tex</a>
+<a class="sourceLine" id="cb108-4" data-line-number="4"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The TeXbook [1, p.·123 and 130] was written by Knuth [1].</p>
+<h3 id="references-1">References</h3>
+<p>[1] Donald Ervin Knuth. <em>The <span class="tex">T<sub>e</sub>X</span>book, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p>
+</blockquote>
+<h4 id="option-codespans"><span class="header-section-number">2.2.1.8</span> Option <code>codeSpans</code></h4>
+<dl>
+<dt><code>codeSpans</code> (default value: <code>true</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the code span syntax:</p>
+<div class="sourceCode" id="cb109"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb109-1" data-line-number="1">Use the <span class="bn">`printf()`</span> function.</a>
+<a class="sourceLine" id="cb109-2" data-line-number="2">`<span class="bn">`There is a literal backtick (`</span>) here.``</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the code span syntax. This allows you to easily use the quotation mark ligatures in texts that do not contain code spans:</p>
+<pre><code>``This is a quote.&#39;&#39;</code></pre>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-5" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb111"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb111-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb111-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb111-3" data-line-number="3"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb111-4" data-line-number="4"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb111-5" data-line-number="5"> local convert = markdown.new()</a>
+<a class="sourceLine" id="cb111-6" data-line-number="6"> local input =</a>
+<a class="sourceLine" id="cb111-7" data-line-number="7"> &quot;``This is a code span.&#39;&#39; &quot; ..</a>
+<a class="sourceLine" id="cb111-8" data-line-number="8"> &quot;``This is no longer a code span.&#39;&#39;&quot;</a>
+<a class="sourceLine" id="cb111-9" data-line-number="9"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb111-10" data-line-number="10"><span class="fu">\par</span></a>
+<a class="sourceLine" id="cb111-11" data-line-number="11"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb111-12" data-line-number="12"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb111-13" data-line-number="13"> local convert = markdown.new({codeSpans = false})</a>
+<a class="sourceLine" id="cb111-14" data-line-number="14"> local input =</a>
+<a class="sourceLine" id="cb111-15" data-line-number="15"> &quot;``This is a quote.&#39;&#39; &quot; ..</a>
+<a class="sourceLine" id="cb111-16" data-line-number="16"> &quot;``This is another quote.&#39;&#39;&quot;</a>
+<a class="sourceLine" id="cb111-17" data-line-number="17"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb111-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb112"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb112-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p><code>This is a code span.''</code>This is no longer a code span.’’</p>
+<p>“This is a quote.” “This is another quote.”</p>
+</blockquote>
+<h5 id="lua-cli-example-5" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb113"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb113-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb113-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb113-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb113-4" data-line-number="4"><span class="fu">\par</span></a>
+<a class="sourceLine" id="cb113-5" data-line-number="5"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb113-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb114"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb114-1" data-line-number="1">`<span class="bn">`Is this a code span?&#39;&#39; `</span>`Or a quote?&#39;&#39;</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb115"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb115-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb115-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb115-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>“Is this a code span?” “Or a quote?”</p>
+<p><code>Is this a code span?''</code>Or a quote?’’</p>
+</blockquote>
+<h5 id="plain-tex-example-5" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb116"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb116-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb116-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb116-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb116-4" data-line-number="4">``This is a code span.&#39;&#39;</a>
+<a class="sourceLine" id="cb116-5" data-line-number="5">``This is no longer a code span.&#39;&#39;</a>
+<a class="sourceLine" id="cb116-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb116-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb116-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionCodeSpans{false}</a>
+<a class="sourceLine" id="cb116-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb116-10" data-line-number="10">``This is a quote.&#39;&#39;</a>
+<a class="sourceLine" id="cb116-11" data-line-number="11">``This is another quote.&#39;&#39;</a>
+<a class="sourceLine" id="cb116-12" data-line-number="12"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb116-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb116-14" data-line-number="14"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb117"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb117-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p><code>This is a code span.''</code>This is no longer a code span.’’</p>
+<p>“This is a quote.” “This is another quote.”</p>
+</blockquote>
+<h5 id="latex-example-7" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb118"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb118-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb118-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb118-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb118-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb118-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb118-6" data-line-number="6">``This is a code span.&#39;&#39;</a>
+<a class="sourceLine" id="cb118-7" data-line-number="7">``This is no longer a code span.&#39;&#39;</a>
+<a class="sourceLine" id="cb118-8" data-line-number="8"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb118-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb118-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{codeSpans=false}</a>
+<a class="sourceLine" id="cb118-11" data-line-number="11">``This is a quote.&#39;&#39;</a>
+<a class="sourceLine" id="cb118-12" data-line-number="12">``This is another quote.&#39;&#39;</a>
+<a class="sourceLine" id="cb118-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb118-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb118-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb119"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb119-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p><code>This is a code span.''</code>This is no longer a code span.’’</p>
+<p>“This is a quote.” “This is another quote.”</p>
+</blockquote>
+<h5 id="context-example-5" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb120"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb120-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb120-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb120-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb120-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb120-5" data-line-number="5">``This is a code span.&#39;&#39;</a>
+<a class="sourceLine" id="cb120-6" data-line-number="6">``This is no longer a code span.&#39;&#39;</a>
+<a class="sourceLine" id="cb120-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb120-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb120-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionCodeSpans{false}</a>
+<a class="sourceLine" id="cb120-10" data-line-number="10"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb120-11" data-line-number="11">``This is a quote.&#39;&#39;</a>
+<a class="sourceLine" id="cb120-12" data-line-number="12">``This is another quote.&#39;&#39;</a>
+<a class="sourceLine" id="cb120-13" data-line-number="13"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb120-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb120-15" data-line-number="15"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb121"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb121-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p><code>This is a code span.''</code>This is no longer a code span.’’</p>
+<p>“This is a quote.” “This is another quote.”</p>
+</blockquote>
+<h4 id="option-contentblocks"><span class="header-section-number">2.2.1.9</span> Option <code>contentBlocks</code></h4>
+<dl>
+<dt><code>contentBlocks</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the iA Writer content blocks syntax extension:</p>
+<div class="sourceCode" id="cb122"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb122-1" data-line-number="1">http://example.com/minard.jpg (Napoleon&#39;s</a>
+<a class="sourceLine" id="cb122-2" data-line-number="2"> disastrous Russian campaign of 1812)</a>
+<a class="sourceLine" id="cb122-3" data-line-number="3">/Flowchart.png &quot;Engineering Flowchart&quot;</a>
+<a class="sourceLine" id="cb122-4" data-line-number="4">/Savings Account.csv &#39;Recent Transactions&#39;</a>
+<a class="sourceLine" id="cb122-5" data-line-number="5">/Example.swift</a>
+<a class="sourceLine" id="cb122-6" data-line-number="6">/Lorem Ipsum.txt</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the iA Writer content blocks syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-8" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p>
+<pre class="csv"><code>Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847</code></pre>
+<p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p>
+<div class="sourceCode" id="cb124"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb124-1" data-line-number="1"><span class="op">{</span></a>
+<a class="sourceLine" id="cb124-2" data-line-number="2"> <span class="st">&quot;tex&quot;</span><span class="op">:</span> <span class="st">&quot;LaTeX&quot;</span></a>
+<a class="sourceLine" id="cb124-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<p>Create also a text document named <code>code.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb125"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb125-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div>
+<p>Create also a text document named <code>part.md</code> with the following content:</p>
+<div class="sourceCode" id="cb126"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb126-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div>
+<p>Create also a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb127"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb127-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb127-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">minted</span>}</a>
+<a class="sourceLine" id="cb127-3" data-line-number="3"><span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb127-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb127-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb127-6" data-line-number="6">/table.csv (An example table)</a>
+<a class="sourceLine" id="cb127-7" data-line-number="7">/code.tex (An example code listing)</a>
+<a class="sourceLine" id="cb127-8" data-line-number="8">/part.md (A file transclusion example)</a>
+<a class="sourceLine" id="cb127-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb127-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb128"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb128-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<thead>
+<tr class="header">
+<th>Name</th>
+<th>Surname</th>
+<th>Born</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td>Albert</td>
+<td>Einstein</td>
+<td>1879</td>
+</tr>
+<tr class="even">
+<td>Marie</td>
+<td>Curie</td>
+<td>1867</td>
+</tr>
+<tr class="odd">
+<td>Thomas</td>
+<td>Edison</td>
+<td>1847</td>
+</tr>
+</tbody>
+</table>
+<p>Table 1: An example table</p>
+<div class="sourceCode" id="cb129"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb129-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div>
+<p>This is a <em>transcluded markdown document</em>.</p>
+</blockquote>
+<h5 id="context-example-6" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p>
+<pre class="csv"><code>Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847</code></pre>
+<p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p>
+<div class="sourceCode" id="cb131"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb131-1" data-line-number="1"><span class="op">{</span></a>
+<a class="sourceLine" id="cb131-2" data-line-number="2"> <span class="st">&quot;tex&quot;</span><span class="op">:</span> <span class="st">&quot;ConTeXt&quot;</span></a>
+<a class="sourceLine" id="cb131-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<p>Create also a text document named <code>code.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb132"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb132-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div>
+<p>Create also a text document named <code>part.md</code> with the following content:</p>
+<div class="sourceCode" id="cb133"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb133-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div>
+<p>Create also a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb134"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb134-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb134-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a>
+<a class="sourceLine" id="cb134-3" data-line-number="3"><span class="fu">\definetyping</span> [ConTeXt]</a>
+<a class="sourceLine" id="cb134-4" data-line-number="4"><span class="fu">\setuptyping</span> [ConTeXt] [option=TEX]</a>
+<a class="sourceLine" id="cb134-5" data-line-number="5"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb134-6" data-line-number="6"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb134-7" data-line-number="7">/table.csv (An example table)</a>
+<a class="sourceLine" id="cb134-8" data-line-number="8">/code.tex (An example code listing)</a>
+<a class="sourceLine" id="cb134-9" data-line-number="9">/part.md (A file transclusion example)</a>
+<a class="sourceLine" id="cb134-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb134-11" data-line-number="11"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb135"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb135-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<thead>
+<tr class="header">
+<th>Name</th>
+<th>Surname</th>
+<th>Born</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td>Albert</td>
+<td>Einstein</td>
+<td>1879</td>
+</tr>
+<tr class="even">
+<td>Marie</td>
+<td>Curie</td>
+<td>1867</td>
+</tr>
+<tr class="odd">
+<td>Thomas</td>
+<td>Edison</td>
+<td>1847</td>
+</tr>
+</tbody>
+</table>
+<p>Table 1: An example table</p>
+<div class="sourceCode" id="cb136"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb136-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div>
+<p>This is a <em>transcluded markdown document</em>.</p>
+</blockquote>
+<h4 id="option-contentblockslanguagemap"><span class="header-section-number">2.2.1.10</span> Option <code>contentBlocksLanguageMap</code></h4>
+<dl>
+<dt><code>contentBlocksLanguageMap</code> (default value: <code>&quot;markdown-languages.json&quot;</code>)</dt>
+<dd><p>The filename of the JSON file that maps filename extensions to programming language names in the iA Writer content blocks.</p>
+</dd>
+</dl>
+<h5 id="latex-example-9" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p>
+<pre class="csv"><code>Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847</code></pre>
+<p>Create also a text document named <code>language-map.json</code> with the following content:</p>
+<div class="sourceCode" id="cb138"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb138-1" data-line-number="1"><span class="op">{</span></a>
+<a class="sourceLine" id="cb138-2" data-line-number="2"> <span class="st">&quot;tex&quot;</span><span class="op">:</span> <span class="st">&quot;LaTeX&quot;</span></a>
+<a class="sourceLine" id="cb138-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<p>Create also a text document named <code>code.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb139"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb139-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div>
+<p>Create also a text document named <code>part.md</code> with the following content:</p>
+<div class="sourceCode" id="cb140"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb140-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div>
+<p>Create also a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb141"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb141-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb141-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">minted</span>}</a>
+<a class="sourceLine" id="cb141-3" data-line-number="3"><span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb141-4" data-line-number="4"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb141-5" data-line-number="5"> contentBlocksLanguageMap = {language-map.json},</a>
+<a class="sourceLine" id="cb141-6" data-line-number="6">}</a>
+<a class="sourceLine" id="cb141-7" data-line-number="7"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb141-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb141-9" data-line-number="9">/table.csv (An example table)</a>
+<a class="sourceLine" id="cb141-10" data-line-number="10">/code.tex (An example code listing)</a>
+<a class="sourceLine" id="cb141-11" data-line-number="11">/part.md (A file transclusion example)</a>
+<a class="sourceLine" id="cb141-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb141-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb142"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb142-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<thead>
+<tr class="header">
+<th>Name</th>
+<th>Surname</th>
+<th>Born</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td>Albert</td>
+<td>Einstein</td>
+<td>1879</td>
+</tr>
+<tr class="even">
+<td>Marie</td>
+<td>Curie</td>
+<td>1867</td>
+</tr>
+<tr class="odd">
+<td>Thomas</td>
+<td>Edison</td>
+<td>1847</td>
+</tr>
+</tbody>
+</table>
+<p>Table 1: An example table</p>
+<div class="sourceCode" id="cb143"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb143-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div>
+<p>This is a <em>transcluded markdown document</em>.</p>
+</blockquote>
+<h5 id="context-example-7" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p>
+<pre class="csv"><code>Name,Surname,Born
+Albert,Einstein,1879
+Marie,Curie,1867
+Thomas,Edison,1847</code></pre>
+<p>Create also a text document named <code>language-map.json</code> with the following content:</p>
+<div class="sourceCode" id="cb145"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb145-1" data-line-number="1"><span class="op">{</span></a>
+<a class="sourceLine" id="cb145-2" data-line-number="2"> <span class="st">&quot;tex&quot;</span><span class="op">:</span> <span class="st">&quot;ConTeXt&quot;</span></a>
+<a class="sourceLine" id="cb145-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<p>Create also a text document named <code>code.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb146"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb146-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div>
+<p>Create also a text document named <code>part.md</code> with the following content:</p>
+<div class="sourceCode" id="cb147"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb147-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div>
+<p>Create also a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb148"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb148-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb148-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a>
+<a class="sourceLine" id="cb148-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionContentBlocksLanguageMap{language-map.json}</a>
+<a class="sourceLine" id="cb148-4" data-line-number="4"><span class="fu">\definetyping</span> [ConTeXt]</a>
+<a class="sourceLine" id="cb148-5" data-line-number="5"><span class="fu">\setuptyping</span> [ConTeXt] [option=TEX]</a>
+<a class="sourceLine" id="cb148-6" data-line-number="6"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb148-7" data-line-number="7"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb148-8" data-line-number="8">/table.csv (An example table)</a>
+<a class="sourceLine" id="cb148-9" data-line-number="9">/code.tex (An example code listing)</a>
+<a class="sourceLine" id="cb148-10" data-line-number="10">/part.md (A file transclusion example)</a>
+<a class="sourceLine" id="cb148-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb148-12" data-line-number="12"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb149"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb149-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<thead>
+<tr class="header">
+<th>Name</th>
+<th>Surname</th>
+<th>Born</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td>Albert</td>
+<td>Einstein</td>
+<td>1879</td>
+</tr>
+<tr class="even">
+<td>Marie</td>
+<td>Curie</td>
+<td>1867</td>
+</tr>
+<tr class="odd">
+<td>Thomas</td>
+<td>Edison</td>
+<td>1847</td>
+</tr>
+</tbody>
+</table>
+<p>Table 1: An example table</p>
+<div class="sourceCode" id="cb150"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb150-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div>
+<p>This is a <em>transcluded markdown document</em>.</p>
+</blockquote>
+<h4 id="option-definitionlists"><span class="header-section-number">2.2.1.11</span> Option <code>definitionLists</code></h4>
+<dl>
+<dt><code>definitionLists</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the pandoc definition list syntax extension:</p>
+<div class="sourceCode" id="cb151"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb151-1" data-line-number="1">Term 1</a>
+<a class="sourceLine" id="cb151-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb151-3" data-line-number="3">: Definition 1</a>
+<a class="sourceLine" id="cb151-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb151-5" data-line-number="5">Term 2 with *inline markup*</a>
+<a class="sourceLine" id="cb151-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb151-7" data-line-number="7">: Definition 2</a>
+<a class="sourceLine" id="cb151-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb151-9" data-line-number="9"><span class="bn"> { some code, part of Definition 2 }</span></a>
+<a class="sourceLine" id="cb151-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb151-11" data-line-number="11"><span class="bn"> Third paragraph of definition 2.</span></a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the pandoc definition list syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-10" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb152"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb152-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb152-2" data-line-number="2"><span class="bu">\usepackage</span>[definitionLists]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb152-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb152-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb152-5" data-line-number="5">Term 1</a>
+<a class="sourceLine" id="cb152-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb152-7" data-line-number="7">: Definition 1</a>
+<a class="sourceLine" id="cb152-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb152-9" data-line-number="9">Term 2 with *inline markup*</a>
+<a class="sourceLine" id="cb152-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb152-11" data-line-number="11">: Definition 2</a>
+<a class="sourceLine" id="cb152-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb152-13" data-line-number="13"> { some code, part of Definition 2 }</a>
+<a class="sourceLine" id="cb152-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb152-15" data-line-number="15"> Third paragraph of definition 2.</a>
+<a class="sourceLine" id="cb152-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb152-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb153"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb153-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<dl>
+<dt>Term 1</dt>
+<dd><p>Definition 1</p>
+</dd>
+<dt>Term 2 with <em>inline markup</em></dt>
+<dd><p>Definition 2</p>
+<pre><code>{ some code, part of Definition 2 }</code></pre>
+<p>Third paragraph of definition 2.</p>
+</dd>
+</dl>
+</blockquote>
+<h5 id="context-example-8" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb155"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb155-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb155-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionDefinitionLists{true}</a>
+<a class="sourceLine" id="cb155-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb155-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb155-5" data-line-number="5">Term 1</a>
+<a class="sourceLine" id="cb155-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb155-7" data-line-number="7">: Definition 1</a>
+<a class="sourceLine" id="cb155-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb155-9" data-line-number="9">Term 2 with *inline markup*</a>
+<a class="sourceLine" id="cb155-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb155-11" data-line-number="11">: Definition 2</a>
+<a class="sourceLine" id="cb155-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb155-13" data-line-number="13"> { some code, part of Definition 2 }</a>
+<a class="sourceLine" id="cb155-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb155-15" data-line-number="15"> Third paragraph of definition 2.</a>
+<a class="sourceLine" id="cb155-16" data-line-number="16"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb155-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb156"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb156-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<dl>
+<dt>Term 1</dt>
+<dd><p>Definition 1</p>
+</dd>
+<dt>Term 2 with <em>inline markup</em></dt>
+<dd><p>Definition 2</p>
+<pre><code>{ some code, part of Definition 2 }</code></pre>
+<p>Third paragraph of definition 2.</p>
+</dd>
+</dl>
+</blockquote>
+<h4 id="option-fencedcode"><span class="header-section-number">2.2.1.12</span> Option <code>fencedCode</code></h4>
+<dl>
+<dt><code>fencedCode</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the commonmark fenced code block extension:</p>
+<div class="sourceCode" id="cb158"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb158-1" data-line-number="1">~~~ js</a>
+<a class="sourceLine" id="cb158-2" data-line-number="2">if (a &gt; 3) {</a>
+<a class="sourceLine" id="cb158-3" data-line-number="3"><span class="bn"> moveShip(5 * gravity, DOWN);</span></a>
+<a class="sourceLine" id="cb158-4" data-line-number="4">}</a>
+<a class="sourceLine" id="cb158-5" data-line-number="5">~~~~~~</a>
+<a class="sourceLine" id="cb158-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb158-7" data-line-number="7"> ``` html</a>
+<a class="sourceLine" id="cb158-8" data-line-number="8"> &lt;pre&gt;</a>
+<a class="sourceLine" id="cb158-9" data-line-number="9"><span class="bn"> &lt;code&gt;</span></a>
+<a class="sourceLine" id="cb158-10" data-line-number="10"><span class="bn"> // Some comments</span></a>
+<a class="sourceLine" id="cb158-11" data-line-number="11"><span class="bn"> line 1 of code</span></a>
+<a class="sourceLine" id="cb158-12" data-line-number="12"><span class="bn"> line 2 of code</span></a>
+<a class="sourceLine" id="cb158-13" data-line-number="13"><span class="bn"> line 3 of code</span></a>
+<a class="sourceLine" id="cb158-14" data-line-number="14"><span class="bn"> &lt;/code&gt;</span></a>
+<a class="sourceLine" id="cb158-15" data-line-number="15"> &lt;/pre&gt;</a>
+<a class="sourceLine" id="cb158-16" data-line-number="16"> ```</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the commonmark fenced code block extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-11" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb159"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb159-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb159-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">minted</span>}</a>
+<a class="sourceLine" id="cb159-3" data-line-number="3"><span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb159-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb159-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb159-6" data-line-number="6">~~~ js</a>
+<a class="sourceLine" id="cb159-7" data-line-number="7">if (a &gt; 3) {</a>
+<a class="sourceLine" id="cb159-8" data-line-number="8"> moveShip(5 * gravity, DOWN);</a>
+<a class="sourceLine" id="cb159-9" data-line-number="9">}</a>
+<a class="sourceLine" id="cb159-10" data-line-number="10">~~~~~~</a>
+<a class="sourceLine" id="cb159-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb159-12" data-line-number="12"> ``` html</a>
+<a class="sourceLine" id="cb159-13" data-line-number="13"> &lt;pre&gt;</a>
+<a class="sourceLine" id="cb159-14" data-line-number="14"> &lt;code&gt;</a>
+<a class="sourceLine" id="cb159-15" data-line-number="15"> // Some comments</a>
+<a class="sourceLine" id="cb159-16" data-line-number="16"> line 1 of code</a>
+<a class="sourceLine" id="cb159-17" data-line-number="17"> line 2 of code</a>
+<a class="sourceLine" id="cb159-18" data-line-number="18"> line 3 of code</a>
+<a class="sourceLine" id="cb159-19" data-line-number="19"> &lt;/code&gt;</a>
+<a class="sourceLine" id="cb159-20" data-line-number="20"> &lt;/pre&gt;</a>
+<a class="sourceLine" id="cb159-21" data-line-number="21"> ```</a>
+<a class="sourceLine" id="cb159-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb159-23" data-line-number="23"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb160"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb160-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<div class="sourceCode" id="cb161"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb161-1" data-line-number="1"><span class="cf">if</span> (a <span class="op">&gt;</span> <span class="dv">3</span>) <span class="op">{</span></a>
+<a class="sourceLine" id="cb161-2" data-line-number="2"> <span class="at">moveShip</span>(<span class="dv">5</span> <span class="op">*</span> gravity<span class="op">,</span> DOWN)<span class="op">;</span></a>
+<a class="sourceLine" id="cb161-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<div class="sourceCode" id="cb162"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb162-1" data-line-number="1"><span class="kw">&lt;pre&gt;</span></a>
+<a class="sourceLine" id="cb162-2" data-line-number="2"> <span class="kw">&lt;code&gt;</span></a>
+<a class="sourceLine" id="cb162-3" data-line-number="3"> // Some comments</a>
+<a class="sourceLine" id="cb162-4" data-line-number="4"> line 1 of code</a>
+<a class="sourceLine" id="cb162-5" data-line-number="5"> line 2 of code</a>
+<a class="sourceLine" id="cb162-6" data-line-number="6"> line 3 of code</a>
+<a class="sourceLine" id="cb162-7" data-line-number="7"> <span class="kw">&lt;/code&gt;</span></a>
+<a class="sourceLine" id="cb162-8" data-line-number="8"><span class="kw">&lt;/pre&gt;</span></a></code></pre></div>
+</blockquote>
+<h5 id="context-example-9" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb163"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb163-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb163-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFencedCode{true}</a>
+<a class="sourceLine" id="cb163-3" data-line-number="3"><span class="fu">\definetyping</span> [js]</a>
+<a class="sourceLine" id="cb163-4" data-line-number="4"><span class="fu">\definetyping</span> [html]</a>
+<a class="sourceLine" id="cb163-5" data-line-number="5"><span class="fu">\setuptyping</span> [html] [option=XML]</a>
+<a class="sourceLine" id="cb163-6" data-line-number="6"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb163-7" data-line-number="7"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb163-8" data-line-number="8">~~~ js</a>
+<a class="sourceLine" id="cb163-9" data-line-number="9">if (a &gt; 3) {</a>
+<a class="sourceLine" id="cb163-10" data-line-number="10"> moveShip(5 * gravity, DOWN);</a>
+<a class="sourceLine" id="cb163-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb163-12" data-line-number="12">~~~~~~</a>
+<a class="sourceLine" id="cb163-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb163-14" data-line-number="14"> ``` html</a>
+<a class="sourceLine" id="cb163-15" data-line-number="15"> &lt;pre&gt;</a>
+<a class="sourceLine" id="cb163-16" data-line-number="16"> &lt;code&gt;</a>
+<a class="sourceLine" id="cb163-17" data-line-number="17"> // Some comments</a>
+<a class="sourceLine" id="cb163-18" data-line-number="18"> line 1 of code</a>
+<a class="sourceLine" id="cb163-19" data-line-number="19"> line 2 of code</a>
+<a class="sourceLine" id="cb163-20" data-line-number="20"> line 3 of code</a>
+<a class="sourceLine" id="cb163-21" data-line-number="21"> &lt;/code&gt;</a>
+<a class="sourceLine" id="cb163-22" data-line-number="22"> &lt;/pre&gt;</a>
+<a class="sourceLine" id="cb163-23" data-line-number="23"> ```</a>
+<a class="sourceLine" id="cb163-24" data-line-number="24"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb163-25" data-line-number="25"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb164"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb164-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<div class="sourceCode" id="cb165"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb165-1" data-line-number="1"><span class="cf">if</span> (a <span class="op">&gt;</span> <span class="dv">3</span>) <span class="op">{</span></a>
+<a class="sourceLine" id="cb165-2" data-line-number="2"> <span class="at">moveShip</span>(<span class="dv">5</span> <span class="op">*</span> gravity<span class="op">,</span> DOWN)<span class="op">;</span></a>
+<a class="sourceLine" id="cb165-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<div class="sourceCode" id="cb166"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb166-1" data-line-number="1"><span class="kw">&lt;pre&gt;</span></a>
+<a class="sourceLine" id="cb166-2" data-line-number="2"> <span class="kw">&lt;code&gt;</span></a>
+<a class="sourceLine" id="cb166-3" data-line-number="3"> // Some comments</a>
+<a class="sourceLine" id="cb166-4" data-line-number="4"> line 1 of code</a>
+<a class="sourceLine" id="cb166-5" data-line-number="5"> line 2 of code</a>
+<a class="sourceLine" id="cb166-6" data-line-number="6"> line 3 of code</a>
+<a class="sourceLine" id="cb166-7" data-line-number="7"> <span class="kw">&lt;/code&gt;</span></a>
+<a class="sourceLine" id="cb166-8" data-line-number="8"><span class="kw">&lt;/pre&gt;</span></a></code></pre></div>
+</blockquote>
+<h4 id="option-footnotes"><span class="header-section-number">2.2.1.13</span> Option <code>footnotes</code></h4>
+<dl>
+<dt><code>footnotes</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the pandoc footnote syntax extension:</p>
+<div class="sourceCode" id="cb167"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb167-1" data-line-number="1">Here is a footnote reference,<span class="ot">[^1]</span> and another.<span class="ot">[^longnote]</span></a>
+<a class="sourceLine" id="cb167-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb167-3" data-line-number="3"><span class="ot">[^1]</span>: Here is the footnote.</a>
+<a class="sourceLine" id="cb167-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb167-5" data-line-number="5"><span class="ot">[^longnote]</span>: Here&#39;s one with multiple blocks.</a>
+<a class="sourceLine" id="cb167-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb167-7" data-line-number="7"><span class="bn"> Subsequent paragraphs are indented to show that they</span></a>
+<a class="sourceLine" id="cb167-8" data-line-number="8">belong to the previous footnote.</a>
+<a class="sourceLine" id="cb167-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb167-10" data-line-number="10"><span class="bn"> { some.code }</span></a>
+<a class="sourceLine" id="cb167-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb167-12" data-line-number="12"><span class="bn"> The whole paragraph can be indented, or just the</span></a>
+<a class="sourceLine" id="cb167-13" data-line-number="13"><span class="bn"> first line. In this way, multi-paragraph footnotes</span></a>
+<a class="sourceLine" id="cb167-14" data-line-number="14"><span class="bn"> work like multi-paragraph list items.</span></a>
+<a class="sourceLine" id="cb167-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb167-16" data-line-number="16">This paragraph won&#39;t be part of the note, because it</a>
+<a class="sourceLine" id="cb167-17" data-line-number="17">isn&#39;t indented.</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the pandoc footnote syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-12" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb168"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb168-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb168-2" data-line-number="2"><span class="bu">\usepackage</span>[footnotes]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb168-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb168-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb168-5" data-line-number="5">Here is a footnote reference,[^1] and another.[^longnote]</a>
+<a class="sourceLine" id="cb168-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb168-7" data-line-number="7">[^1]: Here is the footnote.</a>
+<a class="sourceLine" id="cb168-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb168-9" data-line-number="9">[^longnote]: Here&#39;s one with multiple blocks.</a>
+<a class="sourceLine" id="cb168-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb168-11" data-line-number="11"> Subsequent paragraphs are indented to show that they</a>
+<a class="sourceLine" id="cb168-12" data-line-number="12">belong to the previous footnote.</a>
+<a class="sourceLine" id="cb168-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb168-14" data-line-number="14"> { some.code }</a>
+<a class="sourceLine" id="cb168-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb168-16" data-line-number="16"> The whole paragraph can be indented, or just the</a>
+<a class="sourceLine" id="cb168-17" data-line-number="17"> first line. In this way, multi-paragraph footnotes</a>
+<a class="sourceLine" id="cb168-18" data-line-number="18"> work like multi-paragraph list items.</a>
+<a class="sourceLine" id="cb168-19" data-line-number="19"></a>
+<a class="sourceLine" id="cb168-20" data-line-number="20">This paragraph won&#39;t be part of the note, because it</a>
+<a class="sourceLine" id="cb168-21" data-line-number="21">isn&#39;t indented.</a>
+<a class="sourceLine" id="cb168-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb168-23" data-line-number="23"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb169"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb169-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Here is a footnote reference,<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a></p>
+<p>This paragraph won’t be part of the note, because it isn’t indented.</p>
+</blockquote>
+<h5 id="context-example-10" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb171"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb171-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb171-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a>
+<a class="sourceLine" id="cb171-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb171-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb171-5" data-line-number="5">Here is a footnote reference,[^1] and another.[^longnote]</a>
+<a class="sourceLine" id="cb171-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb171-7" data-line-number="7">[^1]: Here is the footnote.</a>
+<a class="sourceLine" id="cb171-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb171-9" data-line-number="9">[^longnote]: Here&#39;s one with multiple blocks.</a>
+<a class="sourceLine" id="cb171-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb171-11" data-line-number="11"> Subsequent paragraphs are indented to show that they</a>
+<a class="sourceLine" id="cb171-12" data-line-number="12">belong to the previous footnote.</a>
+<a class="sourceLine" id="cb171-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb171-14" data-line-number="14"> { some.code }</a>
+<a class="sourceLine" id="cb171-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb171-16" data-line-number="16"> The whole paragraph can be indented, or just the</a>
+<a class="sourceLine" id="cb171-17" data-line-number="17"> first line. In this way, multi-paragraph footnotes</a>
+<a class="sourceLine" id="cb171-18" data-line-number="18"> work like multi-paragraph list items.</a>
+<a class="sourceLine" id="cb171-19" data-line-number="19"></a>
+<a class="sourceLine" id="cb171-20" data-line-number="20">This paragraph won&#39;t be part of the note, because it</a>
+<a class="sourceLine" id="cb171-21" data-line-number="21">isn&#39;t indented.</a>
+<a class="sourceLine" id="cb171-22" data-line-number="22"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb171-23" data-line-number="23"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb172"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb172-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Here is a footnote reference,<a href="#fn3" class="footnote-ref" id="fnref3"><sup>3</sup></a> and another.<a href="#fn4" class="footnote-ref" id="fnref4"><sup>4</sup></a></p>
+<p>This paragraph won’t be part of the note, because it isn’t indented.</p>
+</blockquote>
+<h4 id="option-hashenumerators"><span class="header-section-number">2.2.1.14</span> Option <code>hashEnumerators</code></h4>
+<dl>
+<dt><code>hashEnumerators</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the use of hash symbols (<code>#</code>) as ordered item list markers:</p>
+<div class="sourceCode" id="cb174"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb174-1" data-line-number="1">#. Bird</a>
+<a class="sourceLine" id="cb174-2" data-line-number="2">#. McHale</a>
+<a class="sourceLine" id="cb174-3" data-line-number="3">#. Parish</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the use of hash symbols (<code>#</code>) as ordered item list markers.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-13" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb175"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb175-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb175-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb175-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb175-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb175-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb175-6" data-line-number="6">. Bird</a>
+<a class="sourceLine" id="cb175-7" data-line-number="7">. McHale</a>
+<a class="sourceLine" id="cb175-8" data-line-number="8">. Parish</a>
+<a class="sourceLine" id="cb175-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb175-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb175-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hashEnumerators}</a>
+<a class="sourceLine" id="cb175-12" data-line-number="12">. Bird</a>
+<a class="sourceLine" id="cb175-13" data-line-number="13">. McHale</a>
+<a class="sourceLine" id="cb175-14" data-line-number="14">. Parish</a>
+<a class="sourceLine" id="cb175-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb175-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb175-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb176"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb176-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="bird">. Bird</h1>
+<h1 id="mchale">. McHale</h1>
+<h1 id="parish">. Parish</h1>
+<ol>
+<li>Bird</li>
+<li>McHale</li>
+<li>Parish</li>
+</ol>
+</blockquote>
+<h5 id="context-example-11" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb177"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb177-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb177-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb177-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb177-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb177-5" data-line-number="5">. Bird</a>
+<a class="sourceLine" id="cb177-6" data-line-number="6">. McHale</a>
+<a class="sourceLine" id="cb177-7" data-line-number="7">. Parish</a>
+<a class="sourceLine" id="cb177-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb177-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb177-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionHashEnumerators{true}</a>
+<a class="sourceLine" id="cb177-11" data-line-number="11"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb177-12" data-line-number="12">. Bird</a>
+<a class="sourceLine" id="cb177-13" data-line-number="13">. McHale</a>
+<a class="sourceLine" id="cb177-14" data-line-number="14">. Parish</a>
+<a class="sourceLine" id="cb177-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb177-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb177-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb178"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb178-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="bird-1">. Bird</h1>
+<h1 id="mchale-1">. McHale</h1>
+<h1 id="parish-1">. Parish</h1>
+<ol>
+<li>Bird</li>
+<li>McHale</li>
+<li>Parish</li>
+</ol>
+</blockquote>
+<h4 id="header-attributes"><span class="header-section-number">2.2.1.15</span> Option <code>headerAttributes</code></h4>
+<dl>
+<dt><code>headerAttributes</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the assignment of HTML attributes to headings:</p>
+<div class="sourceCode" id="cb179"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb179-1" data-line-number="1"><span class="fu"># My first heading {#foo}</span></a>
+<a class="sourceLine" id="cb179-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb179-3" data-line-number="3"><span class="fu">## My second heading ## {#bar .baz}</span></a>
+<a class="sourceLine" id="cb179-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb179-5" data-line-number="5">Yet another heading {key=value}</a>
+<a class="sourceLine" id="cb179-6" data-line-number="6">===================</a></code></pre></div>
+<p>These HTML attributes have currently no effect other than enabling <a href="#slice">content slicing</a>.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the assignment of HTML attributes to headings.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h4 id="option-html"><span class="header-section-number">2.2.1.16</span> Option <code>html</code></h4>
+<dl>
+<dt><code>html</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the recognition of HTML tags, block elements, comments, HTML instructions, and entities in the input. Tags, block elements (along with contents), HTML instructions, and comments will be ignored and HTML entities will be replaced with the corresponding Unicode codepoints.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the recognition of HTML markup. Any HTML markup in the input will be rendered as plain text.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-6" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb180"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb180-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb180-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb180-3" data-line-number="3"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb180-4" data-line-number="4"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb180-5" data-line-number="5"> local convert = markdown.new()</a>
+<a class="sourceLine" id="cb180-6" data-line-number="6"> local newline = [[^^J^^J]]</a>
+<a class="sourceLine" id="cb180-7" data-line-number="7"> local input =</a>
+<a class="sourceLine" id="cb180-8" data-line-number="8"> &quot;&lt;div&gt;*There is no block tag support.*&lt;/div&gt;&quot; .. newline ..</a>
+<a class="sourceLine" id="cb180-9" data-line-number="9"> &quot;*There is no &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*&quot; .. newline ..</a>
+<a class="sourceLine" id="cb180-10" data-line-number="10"> &quot;_There is no &lt;!-- comment --&gt; support._&quot; .. newline ..</a>
+<a class="sourceLine" id="cb180-11" data-line-number="11"> &quot;_There is no &lt;? HTML instruction ?&gt; support._&quot;</a>
+<a class="sourceLine" id="cb180-12" data-line-number="12"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb180-13" data-line-number="13"><span class="fu">\par</span></a>
+<a class="sourceLine" id="cb180-14" data-line-number="14"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb180-15" data-line-number="15"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb180-16" data-line-number="16"> local convert = markdown.new({html = true})</a>
+<a class="sourceLine" id="cb180-17" data-line-number="17"> local input =</a>
+<a class="sourceLine" id="cb180-18" data-line-number="18"> &quot;&lt;div&gt;*There is block tag support.*&lt;/div&gt;&quot; .. newline ..</a>
+<a class="sourceLine" id="cb180-19" data-line-number="19"> &quot;*There is &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*&quot; .. newline ..</a>
+<a class="sourceLine" id="cb180-20" data-line-number="20"> &quot;_There is &lt;!-- comment --&gt; support._&quot; .. newline ..</a>
+<a class="sourceLine" id="cb180-21" data-line-number="21"> &quot;_There is &lt;? HTML instruction ?&gt; support._&quot;</a>
+<a class="sourceLine" id="cb180-22" data-line-number="22"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb180-23" data-line-number="23"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb181"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb181-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>&lt;div&gt;There is no block tag support.&lt;/div&gt; There is no &lt;inline tag=”tag”&gt;&lt;/inline&gt; support. There is no &lt;!– comment –&gt; support. There is no &lt;? HTML instruction ?&gt; support.</p>
+<p>There is support. There is support. There is support.</p>
+</blockquote>
+<h5 id="lua-cli-example-6" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb182"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb182-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb182-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb182-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb182-4" data-line-number="4"><span class="fu">\par</span></a>
+<a class="sourceLine" id="cb182-5" data-line-number="5"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb182-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb183"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb183-1" data-line-number="1"><span class="kw">&lt;div&gt;</span></a>
+<a class="sourceLine" id="cb183-2" data-line-number="2">*Is there block tag support?*</a>
+<a class="sourceLine" id="cb183-3" data-line-number="3"><span class="kw">&lt;/div&gt;</span></a>
+<a class="sourceLine" id="cb183-4" data-line-number="4">*Is there <span class="kw">&lt;inline</span><span class="ot"> tag=</span><span class="st">&quot;tag&quot;</span><span class="kw">&gt;&lt;/inline&gt;</span> support?*</a>
+<a class="sourceLine" id="cb183-5" data-line-number="5">_Is there <span class="co">&lt;!-- comment --&gt;</span> support?_</a>
+<a class="sourceLine" id="cb183-6" data-line-number="6">_Is there <span class="kw">&lt;?</span> HTML instruction <span class="kw">?&gt;</span> support?_</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb184"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb184-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb184-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb184-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>&lt;div&gt;Is there block tag support?&lt;/div&gt; Is there &lt;inline tag=”tag”&gt;&lt;/inline&gt; support? Is there &lt;!– comment –&gt; support? Is there &lt;? HTML instruction ?&gt; support?</p>
+<p>Is there support? Is there support? Is there support?</p>
+</blockquote>
+<h5 id="plain-tex-example-6" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb185"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb185-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb185-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb185-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb185-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb185-5" data-line-number="5">&lt;div&gt;</a>
+<a class="sourceLine" id="cb185-6" data-line-number="6">*There is no block tag support.*</a>
+<a class="sourceLine" id="cb185-7" data-line-number="7">&lt;/div&gt;</a>
+<a class="sourceLine" id="cb185-8" data-line-number="8">*There is no &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*</a>
+<a class="sourceLine" id="cb185-9" data-line-number="9">_There is no &lt;!-- comment --&gt; support._</a>
+<a class="sourceLine" id="cb185-10" data-line-number="10">_There is no &lt;? HTML instruction ?&gt; support._</a>
+<a class="sourceLine" id="cb185-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb185-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb185-13" data-line-number="13"><span class="fu">\def</span>\markdownOptionHtml{true}</a>
+<a class="sourceLine" id="cb185-14" data-line-number="14"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb185-15" data-line-number="15">&lt;div&gt;</a>
+<a class="sourceLine" id="cb185-16" data-line-number="16">*There is block tag support.*</a>
+<a class="sourceLine" id="cb185-17" data-line-number="17">&lt;/div&gt;</a>
+<a class="sourceLine" id="cb185-18" data-line-number="18">*There is &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*</a>
+<a class="sourceLine" id="cb185-19" data-line-number="19">_There is &lt;!-- comment --&gt; support._</a>
+<a class="sourceLine" id="cb185-20" data-line-number="20">_There is &lt;? HTML instruction ?&gt; support._</a>
+<a class="sourceLine" id="cb185-21" data-line-number="21"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb185-22" data-line-number="22"></a>
+<a class="sourceLine" id="cb185-23" data-line-number="23"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb186"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb186-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>&lt;div&gt;There is no block tag support.&lt;/div&gt; There is no &lt;inline tag=”tag”&gt;&lt;/inline&gt; support. There is no &lt;!– comment –&gt; support. There is no &lt;? HTML instruction ?&gt; support.</p>
+<p>There is support. There is support. There is support.</p>
+</blockquote>
+<h5 id="latex-example-14" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb187"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb187-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb187-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb187-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb187-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb187-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb187-6" data-line-number="6">&lt;div&gt;</a>
+<a class="sourceLine" id="cb187-7" data-line-number="7">*There is no block tag support.*</a>
+<a class="sourceLine" id="cb187-8" data-line-number="8">&lt;/div&gt;</a>
+<a class="sourceLine" id="cb187-9" data-line-number="9">*There is no &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*</a>
+<a class="sourceLine" id="cb187-10" data-line-number="10">_There is no &lt;!-- comment --&gt; support._</a>
+<a class="sourceLine" id="cb187-11" data-line-number="11">_There is no &lt;? HTML instruction ?&gt; support._</a>
+<a class="sourceLine" id="cb187-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb187-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb187-14" data-line-number="14"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{html}</a>
+<a class="sourceLine" id="cb187-15" data-line-number="15">&lt;div&gt;</a>
+<a class="sourceLine" id="cb187-16" data-line-number="16">*There is block tag support.*</a>
+<a class="sourceLine" id="cb187-17" data-line-number="17">&lt;/div&gt;</a>
+<a class="sourceLine" id="cb187-18" data-line-number="18">*There is &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*</a>
+<a class="sourceLine" id="cb187-19" data-line-number="19">_There is &lt;!-- comment --&gt; support._</a>
+<a class="sourceLine" id="cb187-20" data-line-number="20">_There is &lt;? HTML instruction ?&gt; support._</a>
+<a class="sourceLine" id="cb187-21" data-line-number="21"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb187-22" data-line-number="22"></a>
+<a class="sourceLine" id="cb187-23" data-line-number="23"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb188"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb188-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>&lt;div&gt;There is no block tag support.&lt;/div&gt; There is no &lt;inline tag=”tag”&gt;&lt;/inline&gt; support. There is no &lt;!– comment –&gt; support. There is no &lt;? HTML instruction ?&gt; support.</p>
+<p>There is support. There is support. There is support.</p>
+</blockquote>
+<h5 id="context-example-12" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb189"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb189-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb189-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb189-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb189-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb189-5" data-line-number="5">&lt;div&gt;</a>
+<a class="sourceLine" id="cb189-6" data-line-number="6">*There is no block tag support.*</a>
+<a class="sourceLine" id="cb189-7" data-line-number="7">&lt;/div&gt;</a>
+<a class="sourceLine" id="cb189-8" data-line-number="8">*There is no &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*</a>
+<a class="sourceLine" id="cb189-9" data-line-number="9">_There is no &lt;!-- comment --&gt; support._</a>
+<a class="sourceLine" id="cb189-10" data-line-number="10">_There is no &lt;? HTML instruction ?&gt; support._</a>
+<a class="sourceLine" id="cb189-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb189-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb189-13" data-line-number="13"><span class="fu">\def</span>\markdownOptionHtml{true}</a>
+<a class="sourceLine" id="cb189-14" data-line-number="14"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb189-15" data-line-number="15">&lt;div&gt;</a>
+<a class="sourceLine" id="cb189-16" data-line-number="16">*There is block tag support.*</a>
+<a class="sourceLine" id="cb189-17" data-line-number="17">&lt;/div&gt;</a>
+<a class="sourceLine" id="cb189-18" data-line-number="18">*There is &lt;inline tag=&quot;tag&quot;&gt;&lt;/inline&gt; support.*</a>
+<a class="sourceLine" id="cb189-19" data-line-number="19">_There is &lt;!-- comment --&gt; support._</a>
+<a class="sourceLine" id="cb189-20" data-line-number="20">_There is &lt;? HTML instruction ?&gt; support._</a>
+<a class="sourceLine" id="cb189-21" data-line-number="21"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb189-22" data-line-number="22"></a>
+<a class="sourceLine" id="cb189-23" data-line-number="23"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb190"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb190-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>&lt;div&gt;There is no block tag support.&lt;/div&gt; There is no &lt;inline tag=”tag”&gt;&lt;/inline&gt; support. There is no &lt;!– comment –&gt; support. There is no &lt;? HTML instruction ?&gt; support.</p>
+<p>There is support. There is support. There is support.</p>
+</blockquote>
+<h4 id="option-hybrid"><span class="header-section-number">2.2.1.17</span> Option <code>hybrid</code></h4>
+<dl>
+<dt><code>hybrid</code> (default value: <code>true</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Disable the escaping of special plain <span class="tex">T<sub>e</sub>X</span> characters, which makes it possible to intersperse your markdown markup with <span class="tex">T<sub>e</sub>X</span> code. The intended usage is in documents prepared manually by a human author. In such documents, it can often be desirable to mix <span class="tex">T<sub>e</sub>X</span> and markdown markup freely.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Enable the escaping of special plain <span class="tex">T<sub>e</sub>X</span> characters outside verbatim environments, so that they are not interpretted by <span class="tex">T<sub>e</sub>X</span>. This is encouraged when typesetting automatically generated content or markdown documents that were not prepared with this package in mind.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-7" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb191"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb191-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb191-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb191-3" data-line-number="3"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb191-4" data-line-number="4"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb191-5" data-line-number="5"> local input, convert_safe, convert_unsafe, paragraph</a>
+<a class="sourceLine" id="cb191-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb191-7" data-line-number="7"> input = [[<span class="ss">$</span><span class="sc">\string\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.]]</a>
+<a class="sourceLine" id="cb191-8" data-line-number="8"> convert_safe = markdown.new()</a>
+<a class="sourceLine" id="cb191-9" data-line-number="9"> convert_unsafe = markdown.new({hybrid = true})</a>
+<a class="sourceLine" id="cb191-10" data-line-number="10"> paragraph = [[<span class="fu">\par</span>]]</a>
+<a class="sourceLine" id="cb191-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb191-12" data-line-number="12"> tex.sprint(</a>
+<a class="sourceLine" id="cb191-13" data-line-number="13"> convert_safe(input) .. paragraph ..</a>
+<a class="sourceLine" id="cb191-14" data-line-number="14"> convert_unsafe(input)</a>
+<a class="sourceLine" id="cb191-15" data-line-number="15"> )</a>
+<a class="sourceLine" id="cb191-16" data-line-number="16">}</a>
+<a class="sourceLine" id="cb191-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb192"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb192-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt {-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h5 id="lua-cli-example-7" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb193"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb193-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb193-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb193-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb193-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb193-5" data-line-number="5"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb193-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb194"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb194-1" data-line-number="1">$\sqrt{-1}$ *equals* $i$.</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb195"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb195-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb195-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb195-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt {-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h5 id="plain-tex-example-7" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb196"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb196-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb196-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb196-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb196-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb196-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb196-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb196-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb196-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb196-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb196-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb196-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb196-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb196-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb197"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb197-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt {-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h5 id="latex-example-15" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb198"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb198-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb198-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb198-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb198-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb198-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb198-6" data-line-number="6"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb198-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb198-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb198-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid}</a>
+<a class="sourceLine" id="cb198-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb198-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb198-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb198-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb199"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb199-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt {-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h5 id="context-example-13" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb200"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb200-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb200-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb200-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb200-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb200-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb200-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb200-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb200-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb200-9" data-line-number="9"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb200-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a>
+<a class="sourceLine" id="cb200-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb200-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb200-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb201"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb201-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt {-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h4 id="option-inlinefootnotes"><span class="header-section-number">2.2.1.18</span> Option <code>inlineFootnotes</code></h4>
+<dl>
+<dt><code>inlineFootnotes</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the pandoc inline footnote syntax extension:</p>
+<div class="sourceCode" id="cb202"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb202-1" data-line-number="1">Here is an inline note.^[Inlines notes are easier to</a>
+<a class="sourceLine" id="cb202-2" data-line-number="2">write, since you don&#39;t have to pick an identifier and</a>
+<a class="sourceLine" id="cb202-3" data-line-number="3">move down to type the note.]</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the pandoc inline footnote syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-16" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb203"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb203-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb203-2" data-line-number="2"><span class="bu">\usepackage</span>[footnotes, inlineFootnotes]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb203-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb203-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb203-5" data-line-number="5">Here is an inline note.^[Inlines notes are easier to</a>
+<a class="sourceLine" id="cb203-6" data-line-number="6">write, since you don&#39;t have to pick an identifier and</a>
+<a class="sourceLine" id="cb203-7" data-line-number="7">move down to type the note.]</a>
+<a class="sourceLine" id="cb203-8" data-line-number="8"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb203-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb204"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb204-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Here is an inline note.<a href="#fn5" class="footnote-ref" id="fnref5"><sup>5</sup></a></p>
+</blockquote>
+<h5 id="context-example-14" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb205"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb205-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb205-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a>
+<a class="sourceLine" id="cb205-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionInlineFootnotes{true}</a>
+<a class="sourceLine" id="cb205-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb205-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb205-6" data-line-number="6">Here is an inline note.^[Inlines notes are easier to</a>
+<a class="sourceLine" id="cb205-7" data-line-number="7">write, since you don&#39;t have to pick an identifier and</a>
+<a class="sourceLine" id="cb205-8" data-line-number="8">move down to type the note.]</a>
+<a class="sourceLine" id="cb205-9" data-line-number="9"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb205-10" data-line-number="10"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb206"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb206-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Here is an inline note.<a href="#fn6" class="footnote-ref" id="fnref6"><sup>6</sup></a></p>
+</blockquote>
+<h4 id="pipe-tables"><span class="header-section-number">2.2.1.19</span> Option <code>pipeTables</code></h4>
+<dl>
+<dt><code>pipeTables</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the <abbr>PHP</abbr> Markdown table syntax extension:</p>
+<div class="sourceCode" id="cb207"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb207-1" data-line-number="1">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb207-2" data-line-number="2">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb207-3" data-line-number="3">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb207-4" data-line-number="4">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb207-5" data-line-number="5">| 1 | 1 | 1 | 1 |</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Disable the <abbr>PHP</abbr> Markdown table syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-17" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb208"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb208-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb208-2" data-line-number="2"><span class="bu">\usepackage</span>[pipeTables]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb208-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb208-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb208-5" data-line-number="5">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb208-6" data-line-number="6">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb208-7" data-line-number="7">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb208-8" data-line-number="8">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb208-9" data-line-number="9">| 1 | 1 | 1 | 1 |</a>
+<a class="sourceLine" id="cb208-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb208-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb209"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb209-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<thead>
+<tr class="header">
+<th style="text-align: right;">Right</th>
+<th style="text-align: left;">Left</th>
+<th>Default</th>
+<th style="text-align: center;">Center</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: right;">12</td>
+<td style="text-align: left;">12</td>
+<td>12</td>
+<td style="text-align: center;">12</td>
+</tr>
+<tr class="even">
+<td style="text-align: right;">123</td>
+<td style="text-align: left;">123</td>
+<td>123</td>
+<td style="text-align: center;">123</td>
+</tr>
+<tr class="odd">
+<td style="text-align: right;">1</td>
+<td style="text-align: left;">1</td>
+<td>1</td>
+<td style="text-align: center;">1</td>
+</tr>
+</tbody>
+</table>
+</blockquote>
+<h5 id="context-example-15" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb210"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb210-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb210-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionPipeTables{true}</a>
+<a class="sourceLine" id="cb210-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb210-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb210-5" data-line-number="5">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb210-6" data-line-number="6">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb210-7" data-line-number="7">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb210-8" data-line-number="8">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb210-9" data-line-number="9">| 1 | 1 | 1 | 1 |</a>
+<a class="sourceLine" id="cb210-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb210-11" data-line-number="11"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb211"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb211-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<thead>
+<tr class="header">
+<th style="text-align: right;">Right</th>
+<th style="text-align: left;">Left</th>
+<th>Default</th>
+<th style="text-align: center;">Center</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: right;">12</td>
+<td style="text-align: left;">12</td>
+<td>12</td>
+<td style="text-align: center;">12</td>
+</tr>
+<tr class="even">
+<td style="text-align: right;">123</td>
+<td style="text-align: left;">123</td>
+<td>123</td>
+<td style="text-align: center;">123</td>
+</tr>
+<tr class="odd">
+<td style="text-align: right;">1</td>
+<td style="text-align: left;">1</td>
+<td>1</td>
+<td style="text-align: center;">1</td>
+</tr>
+</tbody>
+</table>
+</blockquote>
+<h4 id="option-preservetabs"><span class="header-section-number">2.2.1.20</span> Option <code>preserveTabs</code></h4>
+<dl>
+<dt><code>preserveTabs</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Preserve tabs in code block and fenced code blocks.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Convert any tabs in the input to spaces.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h4 id="option-shiftheadings"><span class="header-section-number">2.2.1.21</span> Option <code>shiftHeadings</code></h4>
+<dl>
+<dt><code>shiftHeadings</code> (default value: <code>0</code>)</dt>
+<dd><p>All headings will be shifted by ⟨<em>shift amount</em>⟩, which can be both positive and negative. Headings will not be shifted beyond level 6 or below level 1. Instead, those headings will be shifted to level 6, when ⟨<em>shift amount</em>⟩ is positive, and to level 1, when ⟨<em>shift amount</em>⟩ is negative.</p>
+</dd>
+</dl>
+<h5 id="plain-tex-example-8" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>example.md</code> with the following content:</p>
+<div class="sourceCode" id="cb212"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb212-1" data-line-number="1"><span class="fu">## A section</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb213"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb213-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb213-2" data-line-number="2"></a>
+<a class="sourceLine" id="cb213-3" data-line-number="3"><span class="fu">\font\normal</span>=cmr10<span class="fu">\normal</span></a>
+<a class="sourceLine" id="cb213-4" data-line-number="4"><span class="fu">\font\big</span>=cmr10 at 12pt</a>
+<a class="sourceLine" id="cb213-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererHeadingTwo#1{{\big #1\par}}</a>
+<a class="sourceLine" id="cb213-6" data-line-number="6"><span class="fu">\font\bigger</span>=cmr10 scaled 1440</a>
+<a class="sourceLine" id="cb213-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bigger #1\par}}</a>
+<a class="sourceLine" id="cb213-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb213-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionShiftHeadings{-1}</a>
+<a class="sourceLine" id="cb213-10" data-line-number="10"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb213-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb213-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionShiftHeadings{0}</a>
+<a class="sourceLine" id="cb213-13" data-line-number="13"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb213-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb213-15" data-line-number="15"><span class="fu">\def</span>\markdownOptionShiftHeadings{+1}</a>
+<a class="sourceLine" id="cb213-16" data-line-number="16"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb213-17" data-line-number="17"></a>
+<a class="sourceLine" id="cb213-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb214"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb214-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="a-section">A section</h1>
+<h2 id="a-section-1">A section</h2>
+<h3 id="a-section-2">A section</h3>
+</blockquote>
+<h5 id="latex-example-18" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb215"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb215-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb215-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb215-3" data-line-number="3"><span class="bu">\usepackage</span>{<span class="ex">filecontents</span>}</a>
+<a class="sourceLine" id="cb215-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">filecontents*</span>}{example.md}</a>
+<a class="sourceLine" id="cb215-5" data-line-number="5">## A section</a>
+<a class="sourceLine" id="cb215-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">filecontents*</span>}</a>
+<a class="sourceLine" id="cb215-7" data-line-number="7"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb215-8" data-line-number="8"><span class="fu">\markdownInput</span>[shiftHeadings=-1]{example.md}</a>
+<a class="sourceLine" id="cb215-9" data-line-number="9"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb215-10" data-line-number="10"><span class="fu">\markdownInput</span>[shiftHeadings=+1]{example.md}</a>
+<a class="sourceLine" id="cb215-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb216"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb216-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="a-section-3">A section</h1>
+<h2 id="a-section-4">A section</h2>
+<h3 id="a-section-5">A section</h3>
+</blockquote>
+<h5 id="context-example-16" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>example.md</code> with the following content:</p>
+<div class="sourceCode" id="cb217"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb217-1" data-line-number="1"><span class="fu">## A section</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb218"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb218-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb218-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb218-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb218-4" data-line-number="4"><span class="fu">\def</span>\markdownOptionShiftHeadings{-1}</a>
+<a class="sourceLine" id="cb218-5" data-line-number="5"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb218-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb218-7" data-line-number="7"><span class="fu">\def</span>\markdownOptionShiftHeadings{0}</a>
+<a class="sourceLine" id="cb218-8" data-line-number="8"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb218-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb218-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionShiftHeadings{+1}</a>
+<a class="sourceLine" id="cb218-11" data-line-number="11"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb218-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb218-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb219"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb219-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="a-section-6">A section</h1>
+<h2 id="a-section-7">A section</h2>
+<h3 id="a-section-8">A section</h3>
+</blockquote>
+<h4 id="slice"><span class="header-section-number">2.2.1.22</span> Option <code>slice</code></h4>
+<dl>
+<dt><code>slice</code> (default value: <code>^ $</code>)</dt>
+<dd><p>Two space-separated selectors that specify the slice of a document that will be processed, whereas the remainder of the document will be ignored. The following selectors are recognized:</p>
+<ul>
+<li>The circumflex (<code>^</code>) selects the beginning of a document.</li>
+<li>The dollar sign (<code>$</code>) selects the end of a document.</li>
+<li><code>^</code>⟨<em>identifier</em>⟩ selects the beginning of a section with the <a href="#header-attributes"><abbr>HTML</abbr> attribute</a> <code>#</code>⟨<em>identifier</em>⟩.</li>
+<li><code>$</code>⟨<em>identifier</em>⟩ selects the end of a section with the <abbr>HTML</abbr> attribute <code>#</code>⟨<em>identifier</em>⟩.</li>
+<li>⟨<em>identifier</em>⟩ corresponds to <code>^</code>⟨<em>identifier</em>⟩ for the first selector and to <code>$</code>⟨<em>identifier</em>⟩ for the second selector.</li>
+</ul>
+<p>Specifying only a single selector, ⟨<em>identifier</em>⟩, is equivalent to specifying the two selectors ⟨<em>identifier</em>⟩ ⟨<em>identifier</em>⟩, which is equivalent to <code>^</code>⟨<em>identifier</em>⟩ <code>$</code>⟨<em>identifier</em>⟩, i.e. the entire section with the <abbr>HTML</abbr> attribute <code>#</code>⟨<em>identifier</em>⟩ will be selected.</p>
+</dd>
+</dl>
+<h5 id="plain-tex-example-9" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>hamlet.md</code> with the following content:</p>
+<div class="sourceCode" id="cb220"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb220-1" data-line-number="1"><span class="fu"># The Tragedy of Hamlet</span></a>
+<a class="sourceLine" id="cb220-2" data-line-number="2">Shakespeare&#39;s longest play.</a>
+<a class="sourceLine" id="cb220-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb220-4" data-line-number="4"><span class="fu">## Act III {#act-3}</span></a>
+<a class="sourceLine" id="cb220-5" data-line-number="5">Hamlet kills Polonius.</a>
+<a class="sourceLine" id="cb220-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb220-7" data-line-number="7"><span class="fu">## Act V {#act-5}</span></a>
+<a class="sourceLine" id="cb220-8" data-line-number="8">Hamlet dies.</a>
+<a class="sourceLine" id="cb220-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb220-10" data-line-number="10"><span class="fu">## Act I {#act-1}</span></a>
+<a class="sourceLine" id="cb220-11" data-line-number="11">Hamlet talks to ghost.</a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb221"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb221-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb221-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHeaderAttributes{true}</a>
+<a class="sourceLine" id="cb221-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb221-4" data-line-number="4"><span class="fu">\font\normal</span>=cmr10<span class="fu">\normal</span></a>
+<a class="sourceLine" id="cb221-5" data-line-number="5"><span class="fu">\font\big</span>=cmr10 at 12pt</a>
+<a class="sourceLine" id="cb221-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererHeadingTwo#1{{\big #1\par}}</a>
+<a class="sourceLine" id="cb221-7" data-line-number="7"><span class="fu">\font\bigger</span>=cmr10 scaled 1440</a>
+<a class="sourceLine" id="cb221-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bigger #1\par}}</a>
+<a class="sourceLine" id="cb221-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb221-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionSlice{^ ^act-3}</a>
+<a class="sourceLine" id="cb221-11" data-line-number="11"><span class="fu">\markdownInput</span>{hamlet.md}</a>
+<a class="sourceLine" id="cb221-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb221-13" data-line-number="13"><span class="fu">\def</span>\markdownOptionSlice{act-1}</a>
+<a class="sourceLine" id="cb221-14" data-line-number="14"><span class="fu">\markdownInput</span>{hamlet.md}</a>
+<a class="sourceLine" id="cb221-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb221-16" data-line-number="16"><span class="fu">\def</span>\markdownOptionSlice{act-3 act-5}</a>
+<a class="sourceLine" id="cb221-17" data-line-number="17"><span class="fu">\markdownInput</span>{hamlet.md}</a>
+<a class="sourceLine" id="cb221-18" data-line-number="18"></a>
+<a class="sourceLine" id="cb221-19" data-line-number="19"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb222"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb222-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="the-tragedy-of-hamlet">The Tragedy of Hamlet</h1>
+<p>Shakespeare’s longest play.</p>
+<h2 id="act-i">Act I</h2>
+<p>Hamlet talks to ghost.</p>
+<h2 id="act-iii">Act III</h2>
+<p>Hamlet kills Polonius.</p>
+<h2 id="act-v">Act V</h2>
+<p>Hamlet dies.</p>
+</blockquote>
+<h5 id="latex-example-19" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb223"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb223-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb223-2" data-line-number="2"><span class="bu">\usepackage</span>[headerAttributes]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb223-3" data-line-number="3"><span class="bu">\usepackage</span>{<span class="ex">filecontents</span>}</a>
+<a class="sourceLine" id="cb223-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">filecontents*</span>}{hamlet.md}</a>
+<a class="sourceLine" id="cb223-5" data-line-number="5"># The Tragedy of Hamlet</a>
+<a class="sourceLine" id="cb223-6" data-line-number="6">Shakespeare&#39;s longest play.</a>
+<a class="sourceLine" id="cb223-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb223-8" data-line-number="8">## Act III {#act-3}</a>
+<a class="sourceLine" id="cb223-9" data-line-number="9">Hamlet kills Polonius.</a>
+<a class="sourceLine" id="cb223-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb223-11" data-line-number="11">## Act V {#act-5}</a>
+<a class="sourceLine" id="cb223-12" data-line-number="12">Hamlet dies.</a>
+<a class="sourceLine" id="cb223-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb223-14" data-line-number="14">## Act I {#act-1}</a>
+<a class="sourceLine" id="cb223-15" data-line-number="15">Hamlet talks to ghost.</a>
+<a class="sourceLine" id="cb223-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">filecontents*</span>}</a>
+<a class="sourceLine" id="cb223-17" data-line-number="17"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb223-18" data-line-number="18"><span class="fu">\markdownInput</span>[slice=^ ^act-3]{hamlet.md}</a>
+<a class="sourceLine" id="cb223-19" data-line-number="19"><span class="fu">\markdownInput</span>[slice=act-1]{hamlet.md}</a>
+<a class="sourceLine" id="cb223-20" data-line-number="20"><span class="fu">\markdownInput</span>[slice=act-3 act-5]{hamlet.md}</a>
+<a class="sourceLine" id="cb223-21" data-line-number="21"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb224"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb224-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="the-tragedy-of-hamlet-1">The Tragedy of Hamlet</h1>
+<p>Shakespeare’s longest play.</p>
+<h2 id="act-i-1">Act I</h2>
+<p>Hamlet talks to ghost.</p>
+<h2 id="act-iii-1">Act III</h2>
+<p>Hamlet kills Polonius.</p>
+<h2 id="act-v-1">Act V</h2>
+<p>Hamlet dies.</p>
+</blockquote>
+<h5 id="context-example-17" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>hamlet.md</code> with the following content:</p>
+<div class="sourceCode" id="cb225"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb225-1" data-line-number="1"><span class="fu"># The Tragedy of Hamlet</span></a>
+<a class="sourceLine" id="cb225-2" data-line-number="2">Shakespeare&#39;s longest play.</a>
+<a class="sourceLine" id="cb225-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb225-4" data-line-number="4"><span class="fu">## Act III {#act-3}</span></a>
+<a class="sourceLine" id="cb225-5" data-line-number="5">Hamlet kills Polonius.</a>
+<a class="sourceLine" id="cb225-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb225-7" data-line-number="7"><span class="fu">## Act V {#act-5}</span></a>
+<a class="sourceLine" id="cb225-8" data-line-number="8">Hamlet dies.</a>
+<a class="sourceLine" id="cb225-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb225-10" data-line-number="10"><span class="fu">## Act I {#act-1}</span></a>
+<a class="sourceLine" id="cb225-11" data-line-number="11">Hamlet talks to ghost.</a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb226"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb226-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb226-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHeaderAttributes{true}</a>
+<a class="sourceLine" id="cb226-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb226-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb226-5" data-line-number="5"><span class="fu">\def</span>\markdownOptionSlice{^ ^act-3}</a>
+<a class="sourceLine" id="cb226-6" data-line-number="6"><span class="fu">\markdownInput</span>{hamlet.md}</a>
+<a class="sourceLine" id="cb226-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb226-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionSlice{act-1}</a>
+<a class="sourceLine" id="cb226-9" data-line-number="9"><span class="fu">\markdownInput</span>{hamlet.md}</a>
+<a class="sourceLine" id="cb226-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb226-11" data-line-number="11"><span class="fu">\def</span>\markdownOptionSlice{act-3 act-5}</a>
+<a class="sourceLine" id="cb226-12" data-line-number="12"><span class="fu">\markdownInput</span>{hamlet.md}</a>
+<a class="sourceLine" id="cb226-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb226-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb227"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb227-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<h1 id="the-tragedy-of-hamlet-2">The Tragedy of Hamlet</h1>
+<p>Shakespeare’s longest play.</p>
+<h2 id="act-i-2">Act I</h2>
+<p>Hamlet talks to ghost.</p>
+<h2 id="act-iii-2">Act III</h2>
+<p>Hamlet kills Polonius.</p>
+<h2 id="act-v-2">Act V</h2>
+<p>Hamlet dies.</p>
+</blockquote>
+<h4 id="option-smartellipses"><span class="header-section-number">2.2.1.23</span> Option <code>smartEllipses</code></h4>
+<dl>
+<dt><code>smartEllipses</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Convert any ellipses in the input to the <code>\markdownRendererEllipsis</code> <span class="tex">T<sub>e</sub>X</span> macro.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Preserve all ellipses in the input.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="lua-module-example-8" class="unnumbered">Lua Module Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb228"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb228-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb228-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a>
+<a class="sourceLine" id="cb228-3" data-line-number="3"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb228-4" data-line-number="4"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb228-5" data-line-number="5"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb228-6" data-line-number="6"> local convert = markdown.new()</a>
+<a class="sourceLine" id="cb228-7" data-line-number="7"> local input = &quot;These are just three regular dots ...&quot;</a>
+<a class="sourceLine" id="cb228-8" data-line-number="8"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb228-9" data-line-number="9"><span class="fu">\par</span></a>
+<a class="sourceLine" id="cb228-10" data-line-number="10"><span class="fu">\directlua</span>{</a>
+<a class="sourceLine" id="cb228-11" data-line-number="11"> local markdown = require(&quot;markdown&quot;)</a>
+<a class="sourceLine" id="cb228-12" data-line-number="12"> local convert = markdown.new({smartEllipses = true})</a>
+<a class="sourceLine" id="cb228-13" data-line-number="13"> local input = &quot;... and this is a victorian ellipsis.&quot;</a>
+<a class="sourceLine" id="cb228-14" data-line-number="14"> tex.sprint(convert(input)) }</a>
+<a class="sourceLine" id="cb228-15" data-line-number="15"><span class="fu">\bye</span></a></code></pre></div>
+<p>Then, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb229"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb229-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>These are just three regular dots …</p>
+<p>. . . and this is a victorian ellipsis.</p>
+</blockquote>
+<h5 id="lua-cli-example-8" class="unnumbered">Lua CLI Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb230"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb230-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb230-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a>
+<a class="sourceLine" id="cb230-3" data-line-number="3"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb230-4" data-line-number="4"><span class="fu">\input</span> optionfalse</a>
+<a class="sourceLine" id="cb230-5" data-line-number="5"><span class="fu">\par</span></a>
+<a class="sourceLine" id="cb230-6" data-line-number="6"><span class="fu">\input</span> optiontrue</a>
+<a class="sourceLine" id="cb230-7" data-line-number="7"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p>
+<div class="sourceCode" id="cb231"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb231-1" data-line-number="1">Are these just three regular dots, a victorian ellipsis, or ... ?</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb232"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb232-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a>
+<a class="sourceLine" id="cb232-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex</a>
+<a class="sourceLine" id="cb232-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Are these just three regular dots, a victorian ellipsis, or … ?</p>
+<p>Are these just three regular dots, a victorian ellipsis, or . . . ?</p>
+</blockquote>
+<h5 id="plain-tex-example-10" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb233"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb233-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb233-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a>
+<a class="sourceLine" id="cb233-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb233-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb233-5" data-line-number="5">These are just three regular dots ...</a>
+<a class="sourceLine" id="cb233-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb233-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb233-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a>
+<a class="sourceLine" id="cb233-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb233-10" data-line-number="10">... and this is a victorian ellipsis.</a>
+<a class="sourceLine" id="cb233-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb233-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb233-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb234"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb234-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>These are just three regular dots …</p>
+<p>. . . and this is a victorian ellipsis.</p>
+</blockquote>
+<h5 id="latex-example-20" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb235"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb235-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb235-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb235-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb235-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb235-5" data-line-number="5"> ellipsis = {. . .} }}</a>
+<a class="sourceLine" id="cb235-6" data-line-number="6"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb235-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb235-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb235-9" data-line-number="9">These are just three regular dots ...</a>
+<a class="sourceLine" id="cb235-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb235-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb235-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{smartEllipses}</a>
+<a class="sourceLine" id="cb235-13" data-line-number="13">... and this is a victorian ellipsis.</a>
+<a class="sourceLine" id="cb235-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb235-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb235-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb236"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb236-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>These are just three regular dots …</p>
+<p>. . . and this is a victorian ellipsis.</p>
+</blockquote>
+<h5 id="context-example-18" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb237"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb237-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb237-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a>
+<a class="sourceLine" id="cb237-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb237-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb237-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb237-6" data-line-number="6">These are just three regular dots ...</a>
+<a class="sourceLine" id="cb237-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb237-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb237-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a>
+<a class="sourceLine" id="cb237-10" data-line-number="10"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb237-11" data-line-number="11">... and this is a victorian ellipsis.</a>
+<a class="sourceLine" id="cb237-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb237-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb237-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb238"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb238-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>These are just three regular dots …</p>
+<p>. . . and this is a victorian ellipsis.</p>
+</blockquote>
+<h4 id="option-startnumber"><span class="header-section-number">2.2.1.24</span> Option <code>startNumber</code></h4>
+<dl>
+<dt><code>startNumber</code> (default value: <code>true</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Make the number in the first item of an ordered lists significant. The item numbers will be passed to the <code>\markdownRendererOlItemWithNumber</code> <span class="tex">T<sub>e</sub>X</span> macro.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Ignore the numbers in the ordered list items. Each item will only produce a <code>\markdownRendererOlItem</code> <span class="tex">T<sub>e</sub>X</span> macro.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-21" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb239"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb239-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb239-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb239-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb239-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb239-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb239-6" data-line-number="6">The following list respects the numbers specified in the markup:</a>
+<a class="sourceLine" id="cb239-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb239-8" data-line-number="8">3. third item</a>
+<a class="sourceLine" id="cb239-9" data-line-number="9">4. fourth item</a>
+<a class="sourceLine" id="cb239-10" data-line-number="10">5. fifth item</a>
+<a class="sourceLine" id="cb239-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb239-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb239-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{startNumber=false}</a>
+<a class="sourceLine" id="cb239-14" data-line-number="14">The following list does not respect the numbers specified in the</a>
+<a class="sourceLine" id="cb239-15" data-line-number="15">markup:</a>
+<a class="sourceLine" id="cb239-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb239-17" data-line-number="17">3. third item</a>
+<a class="sourceLine" id="cb239-18" data-line-number="18">4. fourth item</a>
+<a class="sourceLine" id="cb239-19" data-line-number="19">5. fifth item</a>
+<a class="sourceLine" id="cb239-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb239-21" data-line-number="21"></a>
+<a class="sourceLine" id="cb239-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb240"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb240-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The following list respects the numbers specified in the markup:</p>
+<ol start="3" type="1">
+<li>third item</li>
+<li>fourth item</li>
+<li>fifth item</li>
+</ol>
+<p>The following list does not respect the numbers specified in the markup:</p>
+<ol type="1">
+<li>third item</li>
+<li>fourth item</li>
+<li>fifth item</li>
+</ol>
+</blockquote>
+<h5 id="context-example-19" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb241"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb241-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb241-2" data-line-number="2"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb241-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb241-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb241-5" data-line-number="5">The following list respects the numbers specified in the markup:</a>
+<a class="sourceLine" id="cb241-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb241-7" data-line-number="7">3. third item</a>
+<a class="sourceLine" id="cb241-8" data-line-number="8">4. fourth item</a>
+<a class="sourceLine" id="cb241-9" data-line-number="9">5. fifth item</a>
+<a class="sourceLine" id="cb241-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb241-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb241-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionStartNumber{false}</a>
+<a class="sourceLine" id="cb241-13" data-line-number="13"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb241-14" data-line-number="14">The following list respects the numbers specified in the markup:</a>
+<a class="sourceLine" id="cb241-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb241-16" data-line-number="16">3. third item</a>
+<a class="sourceLine" id="cb241-17" data-line-number="17">4. fourth item</a>
+<a class="sourceLine" id="cb241-18" data-line-number="18">5. fifth item</a>
+<a class="sourceLine" id="cb241-19" data-line-number="19"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb241-20" data-line-number="20"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb242"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb242-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The following list respects the numbers specified in the markup:</p>
+<ol start="3" type="1">
+<li>third item</li>
+<li>fourth item</li>
+<li>fifth item</li>
+</ol>
+<p>The following list does not respect the numbers specified in the markup:</p>
+<ol type="1">
+<li>third item</li>
+<li>fourth item</li>
+<li>fifth item</li>
+</ol>
+</blockquote>
+<h4 id="option-tablecaptions"><span class="header-section-number">2.2.1.25</span> Option <code>tableCaptions</code></h4>
+<dl>
+<dt><code>tableCaptions</code> (default value: <code>false</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Enable the Pandoc <code>table_captions</code> syntax extension for <a href="#pipe-tables">pipe tables</a>.</p>
+<div class="sourceCode" id="cb243"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb243-1" data-line-number="1">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb243-2" data-line-number="2">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb243-3" data-line-number="3">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb243-4" data-line-number="4">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb243-5" data-line-number="5">| 1 | 1 | 1 | 1 |</a>
+<a class="sourceLine" id="cb243-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb243-7" data-line-number="7"> : Demonstration of pipe table syntax.</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Enable the Pandoc <code>table_captions</code> syntax extension.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-22" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb244"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb244-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb244-2" data-line-number="2"><span class="bu">\usepackage</span>[pipeTables, tableCaptions]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb244-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb244-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb244-5" data-line-number="5">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb244-6" data-line-number="6">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb244-7" data-line-number="7">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb244-8" data-line-number="8">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb244-9" data-line-number="9">| 1 | 1 | 1 | 1 |</a>
+<a class="sourceLine" id="cb244-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb244-11" data-line-number="11"> : Demonstration of pipe table syntax.</a>
+<a class="sourceLine" id="cb244-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb244-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb245"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb245-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<caption>Demonstration of pipe table syntax.</caption>
+<thead>
+<tr class="header">
+<th style="text-align: right;">Right</th>
+<th style="text-align: left;">Left</th>
+<th>Default</th>
+<th style="text-align: center;">Center</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: right;">12</td>
+<td style="text-align: left;">12</td>
+<td>12</td>
+<td style="text-align: center;">12</td>
+</tr>
+<tr class="even">
+<td style="text-align: right;">123</td>
+<td style="text-align: left;">123</td>
+<td>123</td>
+<td style="text-align: center;">123</td>
+</tr>
+<tr class="odd">
+<td style="text-align: right;">1</td>
+<td style="text-align: left;">1</td>
+<td>1</td>
+<td style="text-align: center;">1</td>
+</tr>
+</tbody>
+</table>
+</blockquote>
+<h5 id="context-example-20" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb246"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb246-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb246-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionPipeTables{true}</a>
+<a class="sourceLine" id="cb246-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionTableCaptions{true}</a>
+<a class="sourceLine" id="cb246-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb246-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb246-6" data-line-number="6">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb246-7" data-line-number="7">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb246-8" data-line-number="8">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb246-9" data-line-number="9">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb246-10" data-line-number="10">| 1 | 1 | 1 | 1 |</a>
+<a class="sourceLine" id="cb246-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb246-12" data-line-number="12"> : Demonstration of pipe table syntax.</a>
+<a class="sourceLine" id="cb246-13" data-line-number="13"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb246-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb247"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb247-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<table>
+<caption>Demonstration of pipe table syntax.</caption>
+<thead>
+<tr class="header">
+<th style="text-align: right;">Right</th>
+<th style="text-align: left;">Left</th>
+<th>Default</th>
+<th style="text-align: center;">Center</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: right;">12</td>
+<td style="text-align: left;">12</td>
+<td>12</td>
+<td style="text-align: center;">12</td>
+</tr>
+<tr class="even">
+<td style="text-align: right;">123</td>
+<td style="text-align: left;">123</td>
+<td>123</td>
+<td style="text-align: center;">123</td>
+</tr>
+<tr class="odd">
+<td style="text-align: right;">1</td>
+<td style="text-align: left;">1</td>
+<td>1</td>
+<td style="text-align: center;">1</td>
+</tr>
+</tbody>
+</table>
+</blockquote>
+<h4 id="option-tightlists"><span class="header-section-number">2.2.1.26</span> Option <code>tightLists</code></h4>
+<dl>
+<dt><code>tightLists</code> (default value: <code>true</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Lists whose bullets do not consist of multiple paragraphs will be passed to the <code>\markdownRendererOlBeginTight</code>, <code>\markdownRendererOlEndTight</code>, <code>\markdownRendererUlBeginTight</code>, <code>\markdownRendererUlEndTight</code>, <code>\markdownRendererDlBeginTight</code>, and <code>\markdownRendererDlEndTight</code> <span class="tex">T<sub>e</sub>X</span> macros.</p>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Lists whose bullets do not consist of multiple paragraphs will be treated the same way as lists that do consist of multiple paragraphs.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="latex-example-23" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb248"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb248-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb248-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb248-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb248-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb248-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb248-6" data-line-number="6">The following list is tight:</a>
+<a class="sourceLine" id="cb248-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb248-8" data-line-number="8"> - first item</a>
+<a class="sourceLine" id="cb248-9" data-line-number="9"> - second item</a>
+<a class="sourceLine" id="cb248-10" data-line-number="10"> - third item</a>
+<a class="sourceLine" id="cb248-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb248-12" data-line-number="12">The following list is loose:</a>
+<a class="sourceLine" id="cb248-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb248-14" data-line-number="14"> - first item</a>
+<a class="sourceLine" id="cb248-15" data-line-number="15"> - second item that spans</a>
+<a class="sourceLine" id="cb248-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb248-17" data-line-number="17"> multiple paragraphs</a>
+<a class="sourceLine" id="cb248-18" data-line-number="18"> - third item</a>
+<a class="sourceLine" id="cb248-19" data-line-number="19"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb248-20" data-line-number="20"></a>
+<a class="sourceLine" id="cb248-21" data-line-number="21"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{tightLists=false}</a>
+<a class="sourceLine" id="cb248-22" data-line-number="22">The following list is now also loose:</a>
+<a class="sourceLine" id="cb248-23" data-line-number="23"></a>
+<a class="sourceLine" id="cb248-24" data-line-number="24"> - first item</a>
+<a class="sourceLine" id="cb248-25" data-line-number="25"> - second item</a>
+<a class="sourceLine" id="cb248-26" data-line-number="26"> - third item</a>
+<a class="sourceLine" id="cb248-27" data-line-number="27"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb248-28" data-line-number="28"></a>
+<a class="sourceLine" id="cb248-29" data-line-number="29"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb249"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb249-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The following list is tight:</p>
+<ul>
+<li>first item</li>
+<li>second item</li>
+<li>third item</li>
+</ul>
+<p>The following list is loose:</p>
+<ul>
+<li>first item</li>
+<li><p>second item that spans</p>
+multiple paragraphs</li>
+<li><p>third item</p></li>
+</ul>
+<p>The following list is now also loose:</p>
+<ul>
+<li><p>first item</p></li>
+<li><p>second item</p></li>
+<li><p>third item</p></li>
+</ul>
+</blockquote>
+<h4 id="option-underscores"><span class="header-section-number">2.2.1.27</span> Option <code>underscores</code></h4>
+<dl>
+<dt><code>underscores</code> (default value: <code>true</code>)</dt>
+<dd><dl>
+<dt>true</dt>
+<dd><p>Both underscores and asterisks can be used to denote emphasis and strong emphasis:</p>
+<div class="sourceCode" id="cb250"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb250-1" data-line-number="1">*single asterisks*</a>
+<a class="sourceLine" id="cb250-2" data-line-number="2">_single underscores_</a>
+<a class="sourceLine" id="cb250-3" data-line-number="3">**double asterisks**</a>
+<a class="sourceLine" id="cb250-4" data-line-number="4">__double underscores__</a></code></pre></div>
+</dd>
+</dl>
+</dd>
+<dd><dl>
+<dt>false</dt>
+<dd><p>Only asterisks can be used to denote emphasis and strong emphasis. This makes it easy to write math with the <strong><code>hybrid</code></strong> option without the need to constantly escape subscripts.</p>
+</dd>
+</dl>
+</dd>
+</dl>
+<h5 id="plain-tex-example-11" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb251"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb251-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb251-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb251-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb251-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb251-5" data-line-number="5">This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>.</a>
+<a class="sourceLine" id="cb251-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb251-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb251-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionUnderscores{false}</a>
+<a class="sourceLine" id="cb251-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb251-10" data-line-number="10">This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>.</a>
+<a class="sourceLine" id="cb251-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb251-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb251-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb252"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb252-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p>
+<p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p>
+</blockquote>
+<h5 id="latex-example-24" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb253"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb253-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb253-2" data-line-number="2"><span class="bu">\usepackage</span>[hybrid]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb253-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb253-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb253-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb253-6" data-line-number="6">This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>.</a>
+<a class="sourceLine" id="cb253-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb253-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb253-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{underscores=false}</a>
+<a class="sourceLine" id="cb253-10" data-line-number="10">This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>.</a>
+<a class="sourceLine" id="cb253-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb253-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb253-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb254"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb254-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p>
+<p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p>
+</blockquote>
+<h5 id="context-example-21" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb255"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb255-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb255-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb255-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb255-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb255-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb255-6" data-line-number="6">This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>.</a>
+<a class="sourceLine" id="cb255-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb255-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb255-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionUnderscores{false}</a>
+<a class="sourceLine" id="cb255-10" data-line-number="10"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb255-11" data-line-number="11">This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>.</a>
+<a class="sourceLine" id="cb255-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb255-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb255-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb256"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb256-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p>
+<p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p>
+</blockquote>
+<h3 id="plain-tex-1"><span class="header-section-number">2.2.2</span> Plain <span class="tex">T<sub>e</sub>X</span></h3>
+<p>Plain <span class="tex">T<sub>e</sub>X</span> options control the communication between the <span class="tex">T<sub>e</sub>X</span> interface and the <code>markdown</code> Lua module. They are supported by all higher-level interfaces of the Markdown package, i.e. the plain <span class="tex">T<sub>e</sub>X</span>, <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> and Con<span class="tex">T<sub>e</sub>X</span>t interfaces.</p>
+<h4 id="file-and-directory-names"><span class="header-section-number">2.2.2.1</span> File and Directory Names</h4>
+<p>The plain <span class="tex">T<sub>e</sub>X</span> interface provides the following commands that you can use to specify the location of temporary files produced during the conversion from Markdown to <span class="tex">T<sub>e</sub>X</span>:</p>
+<ul>
+<li><code>\markdownOptionHelperScriptFileName</code>,</li>
+<li><code>\markdownOptionInputTempFileName</code>,</li>
+<li><code>\markdownOptionOutputTempFileName</code>,</li>
+<li><code>\markdownOptionErrorTempFileName</code>,</li>
+<li><code>\markdownOptionOutputDir</code>, and</li>
+<li><code>\markdownOptionCacheDir</code>.</li>
+</ul>
+<p>Using a text editor, create a folder named <code>output-directory</code> and a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb257"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb257-1" data-line-number="1"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb257-2" data-line-number="2"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb257-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionHelperScriptFileName{helper-script.lua}</a>
+<a class="sourceLine" id="cb257-4" data-line-number="4"><span class="fu">\def</span>\markdownOptionInputTempFileName{temporary-input.md}</a>
+<a class="sourceLine" id="cb257-5" data-line-number="5"><span class="fu">\def</span>\markdownOptionOutputTempFileName{temporary-output.tex}</a>
+<a class="sourceLine" id="cb257-6" data-line-number="6"><span class="fu">\def</span>\markdownOptionErrorTempFileName{error-output.txt}</a>
+<a class="sourceLine" id="cb257-7" data-line-number="7"><span class="fu">\def</span>\markdownOptionOutputDir{output-directory}</a>
+<a class="sourceLine" id="cb257-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionCacheDir{output-directory/cache-directory}</a>
+<a class="sourceLine" id="cb257-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb257-10" data-line-number="10">Hello *world*!</a>
+<a class="sourceLine" id="cb257-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb257-12" data-line-number="12"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb258"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb258-1" data-line-number="1"><span class="ex">luatex</span> --output-directory output-directory document.tex</a></code></pre></div>
+<p>A text document named <code>temporary-input.md</code> should be produced in the folder named <code>output-directory</code> and contain the following text:</p>
+<blockquote>
+<p>Hello *world*!</p>
+</blockquote>
+<p>A folder named <code>output-directory/cache-directory</code> should also be produced and contain fragments of the converted markdown document. LuaTeX does not need other temporary files to perform the conversion from markdown to <span class="tex">T<sub>e</sub>X</span>. To produce the remaining temporary files, invoke pdfTeX from the terminal:</p>
+<div class="sourceCode" id="cb259"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb259-1" data-line-number="1"><span class="ex">pdftex</span> --output-directory output-directory --shell-escape document.tex</a></code></pre></div>
+<p>Text documents named <code>helper-script.lua</code>, and <code>temporary-output.md</code> should be produced in the folder named <code>output-directory</code>. The document named <code>helper-script.lua</code> will contain Lua code that was executed to convert markdown to plain <span class="tex">T<sub>e</sub>X</span>. The document named <code>temporary-output.tex</code> will contain the input markdown document converted to <span class="tex">T<sub>e</sub>X</span>.</p>
+<p>No document named <code>error-output.txt</code> should be produced in the folder named <code>output-directory</code>. This document would only be produced if an error had occured while executing the Lua code. If this happens, please <a href="https://github.com/witiko/markdown/issues">file a bug</a>.</p>
+<h4 id="package-documentation"><span class="header-section-number">2.2.2.2</span> Package Documentation</h4>
+<p>The <code>\markdownOptionStripPercentSigns</code> macro controls whether a percent sign (<code>%</code>) at the beginning of a line will be discarded when reading Markdown input from a <span class="tex">T<sub>e</sub>X</span> document. This enables the use of markdown when writing <span class="tex">T<sub>e</sub>X</span> package documentation using the <a href="https://ctan.org/pkg/doc" title="doc – Format LaTeX documentation">Doc <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> package</a> by Frank Mittelbach.</p>
+<p>Using a text editor, create a text document named <code>document.dtx</code> with the following content:</p>
+<div class="sourceCode" id="cb260"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb260-1" data-line-number="1"><span class="co">% \iffalse</span></a>
+<a class="sourceLine" id="cb260-2" data-line-number="2"><span class="bu">\documentclass</span>{<span class="ex">ltxdoc</span>}</a>
+<a class="sourceLine" id="cb260-3" data-line-number="3"><span class="bu">\usepackage</span>[stripPercentSigns]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb260-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb260-5" data-line-number="5"><span class="fu">\DocInput</span>{document.dtx}</a>
+<a class="sourceLine" id="cb260-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb260-7" data-line-number="7"><span class="co">% \fi</span></a>
+<a class="sourceLine" id="cb260-8" data-line-number="8"><span class="co">%</span></a>
+<a class="sourceLine" id="cb260-9" data-line-number="9"><span class="co">% \begin{markdown}</span></a>
+<a class="sourceLine" id="cb260-10" data-line-number="10"><span class="co">% Hello *world*!</span></a>
+<a class="sourceLine" id="cb260-11" data-line-number="11"><span class="co">% \end{markdown}</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb261"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb261-1" data-line-number="1"><span class="ex">lualatex</span> document.dtx</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!”</p>
+<h2 id="markdown-tokens"><span class="header-section-number">2.3</span> Markdown Tokens</h2>
+<p>A key feature of the Markdown package is the support for manipulating markdown tokens, such as headings, emphasized text, links, and lists, in <span class="tex">T<sub>e</sub>X</span>. Instead of reducing <span class="tex">T<sub>e</sub>X</span> to a PDF document producer, the Markdown package allows the user to specify how every markdown token should be processed and rendered.</p>
+<h3 id="token-renderers"><span class="header-section-number">2.3.1</span> Token Renderers</h3>
+<p>Token renderers are user-defined <span class="tex">T<sub>e</sub>X</span> macros, which render markdown tokens. In this section, I will describe the individual token renderers.</p>
+<h4 id="interblock-separator-renderer"><span class="header-section-number">2.3.1.1</span> Interblock Separator Renderer</h4>
+<p>The <code>\markdownRendererInterblockSeparator</code> macro represents a separator between two markdown block elements. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-12" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb262"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb262-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb262-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb262-3" data-line-number="3"> \par</a>
+<a class="sourceLine" id="cb262-4" data-line-number="4"> {\it(The end of a block)}<span class="co">%</span></a>
+<a class="sourceLine" id="cb262-5" data-line-number="5"> \par</a>
+<a class="sourceLine" id="cb262-6" data-line-number="6">}</a>
+<a class="sourceLine" id="cb262-7" data-line-number="7"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb262-8" data-line-number="8">Hello *world*!</a>
+<a class="sourceLine" id="cb262-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb262-10" data-line-number="10">_Foo_ bar!</a>
+<a class="sourceLine" id="cb262-11" data-line-number="11"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb262-12" data-line-number="12"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb263"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb263-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(The end of a block)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h5 id="latex-example-25" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb264"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb264-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb264-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb264-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb264-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb264-5" data-line-number="5"> interblockSeparator = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb264-6" data-line-number="6"> <span class="fu">\par</span></a>
+<a class="sourceLine" id="cb264-7" data-line-number="7"> <span class="fu">\emph</span>{(The end of a block)}<span class="co">%</span></a>
+<a class="sourceLine" id="cb264-8" data-line-number="8"> <span class="fu">\par</span></a>
+<a class="sourceLine" id="cb264-9" data-line-number="9"> },</a>
+<a class="sourceLine" id="cb264-10" data-line-number="10"> },</a>
+<a class="sourceLine" id="cb264-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb264-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb264-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb264-14" data-line-number="14">Hello *world*!</a>
+<a class="sourceLine" id="cb264-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb264-16" data-line-number="16">_Foo_ bar!</a>
+<a class="sourceLine" id="cb264-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb264-18" data-line-number="18"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb265"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb265-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(The end of a block)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h5 id="context-example-22" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb266"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb266-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb266-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb266-3" data-line-number="3"> \par</a>
+<a class="sourceLine" id="cb266-4" data-line-number="4"> \emph{(The end of a block)}<span class="co">%</span></a>
+<a class="sourceLine" id="cb266-5" data-line-number="5"> \par</a>
+<a class="sourceLine" id="cb266-6" data-line-number="6">}</a>
+<a class="sourceLine" id="cb266-7" data-line-number="7"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb266-8" data-line-number="8"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb266-9" data-line-number="9">Hello *world*!</a>
+<a class="sourceLine" id="cb266-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb266-11" data-line-number="11">_Foo_ bar!</a>
+<a class="sourceLine" id="cb266-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb266-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb267"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb267-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(The end of a block)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h4 id="line-break-renderer"><span class="header-section-number">2.3.1.2</span> Line Break Renderer</h4>
+<p>The <code>\markdownRendererLineBreak</code> macro represents a forced line break. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-13" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb268"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb268-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb268-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLineBreak{<span class="co">%</span></a>
+<a class="sourceLine" id="cb268-3" data-line-number="3"> \par</a>
+<a class="sourceLine" id="cb268-4" data-line-number="4"> {\it(A forced linebreak)}<span class="co">%</span></a>
+<a class="sourceLine" id="cb268-5" data-line-number="5"> \par</a>
+<a class="sourceLine" id="cb268-6" data-line-number="6">}</a>
+<a class="sourceLine" id="cb268-7" data-line-number="7"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb268-8" data-line-number="8"><span class="fu">\bye</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>example.md</code> with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the limitations of the <span class="tex">T<sub>e</sub>X</span> input processor, hard linebreaks would be ignored if we typed them directly into the <code>document.tex</code> document.</p>
+<pre><code>Hello world! <br/>_Foo_ bar!</code></pre>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb269"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb269-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(A forced linebreak)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h5 id="latex-example-26" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb270"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb270-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb270-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb270-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb270-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb270-5" data-line-number="5"> lineBreak = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb270-6" data-line-number="6"> <span class="fu">\par</span></a>
+<a class="sourceLine" id="cb270-7" data-line-number="7"> <span class="fu">\emph</span>{(A forced linebreak)}<span class="co">%</span></a>
+<a class="sourceLine" id="cb270-8" data-line-number="8"> <span class="fu">\par</span></a>
+<a class="sourceLine" id="cb270-9" data-line-number="9"> },</a>
+<a class="sourceLine" id="cb270-10" data-line-number="10"> },</a>
+<a class="sourceLine" id="cb270-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb270-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb270-13" data-line-number="13"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb270-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Using a text editor, create a text document named <code>example.md</code> with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the limitations of the <span class="tex">T<sub>e</sub>X</span> input processor, hard linebreaks would be ignored if we typed them directly into the <code>document.tex</code> document.</p>
+<pre><code>Hello world! <br/>_Foo_ bar!</code></pre>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb271"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb271-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(A forced linebreak)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h5 id="context-example-23" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb272"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb272-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb272-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLineBreak{<span class="co">%</span></a>
+<a class="sourceLine" id="cb272-3" data-line-number="3"> \par</a>
+<a class="sourceLine" id="cb272-4" data-line-number="4"> \emph{(A forced linebreak)}<span class="co">%</span></a>
+<a class="sourceLine" id="cb272-5" data-line-number="5"> \par</a>
+<a class="sourceLine" id="cb272-6" data-line-number="6">}</a>
+<a class="sourceLine" id="cb272-7" data-line-number="7"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb272-8" data-line-number="8"><span class="fu">\markdownInput</span>{example.md}</a>
+<a class="sourceLine" id="cb272-9" data-line-number="9"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Using a text editor, create a text document named <code>example.md</code> with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the limitations of the <span class="tex">T<sub>e</sub>X</span> input processor, hard linebreaks would be ignored if we typed them directly into the <code>document.tex</code> document.</p>
+<pre><code>Hello world! <br/>_Foo_ bar!</code></pre>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb273"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb273-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(A forced linebreak)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h4 id="ellipsis-renderer"><span class="header-section-number">2.3.1.3</span> Ellipsis Renderer</h4>
+<p>The <code>\markdownRendererEllipsis</code> macro replaces any occurance of ASCII ellipses in the input text. This macro will only be produced, when the <strong><code>smartEllipses</code></strong> option is <code>true</code>. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-14" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb274"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb274-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb274-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a>
+<a class="sourceLine" id="cb274-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererEllipsis{{\it SHAZAM}!}</a>
+<a class="sourceLine" id="cb274-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb274-5" data-line-number="5">The secret word is ...</a>
+<a class="sourceLine" id="cb274-6" data-line-number="6"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb274-7" data-line-number="7"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb275"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb275-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The secret word is <em>SHAZAM</em>!</p>
+</blockquote>
+<h5 id="latex-example-27" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb276"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb276-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb276-2" data-line-number="2"><span class="bu">\usepackage</span>[smartEllipses]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb276-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb276-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb276-5" data-line-number="5"> ellipsis = <span class="fu">\emph</span>{SHAZAM}!,</a>
+<a class="sourceLine" id="cb276-6" data-line-number="6"> },</a>
+<a class="sourceLine" id="cb276-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb276-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb276-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb276-10" data-line-number="10">The secret word is ...</a>
+<a class="sourceLine" id="cb276-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb276-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb277"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb277-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The secret word is <em>SHAZAM</em>!</p>
+</blockquote>
+<h5 id="context-example-24" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb278"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb278-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb278-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a>
+<a class="sourceLine" id="cb278-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererEllipsis{\emph{SHAZAM}!}</a>
+<a class="sourceLine" id="cb278-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb278-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb278-6" data-line-number="6">The secret word is ...</a>
+<a class="sourceLine" id="cb278-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb278-8" data-line-number="8"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb279"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb279-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Hello <em>world</em>!</p>
+<p><em>(The end of a block)</em></p>
+<p><em>Foo</em> bar!</p>
+</blockquote>
+<h4 id="non-breaking-space-renderer"><span class="header-section-number">2.3.1.4</span> Non-Breaking Space Renderer</h4>
+<p>The <code>\markdownRendererNbsp</code> macro represents a non-breaking space.</p>
+<h5 id="latex-example-28" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.bib</code> with the following content:</p>
+<div class="sourceCode" id="cb280"><pre class="sourceCode bib"><code class="sourceCode bibtex"><a class="sourceLine" id="cb280-1" data-line-number="1"><span class="va">@book</span>{<span class="ot">knuth:tex</span>,</a>
+<a class="sourceLine" id="cb280-2" data-line-number="2"> <span class="dt">author</span> = &quot;<span class="st">Knuth, Donald Ervin</span>&quot;,</a>
+<a class="sourceLine" id="cb280-3" data-line-number="3"> <span class="dt">title</span> = &quot;<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>&quot;,</a>
+<a class="sourceLine" id="cb280-4" data-line-number="4"> <span class="dt">publisher</span> = &quot;<span class="st">Addison-Wesley</span>&quot;,</a>
+<a class="sourceLine" id="cb280-5" data-line-number="5"> <span class="dt">year</span> = &quot;<span class="st">1984</span>&quot;</a>
+<a class="sourceLine" id="cb280-6" data-line-number="6">}</a></code></pre></div>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb281"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb281-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb281-2" data-line-number="2"><span class="bu">\usepackage</span>[</a>
+<a class="sourceLine" id="cb281-3" data-line-number="3"> citations,</a>
+<a class="sourceLine" id="cb281-4" data-line-number="4"> citationNbsps,</a>
+<a class="sourceLine" id="cb281-5" data-line-number="5">]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb281-6" data-line-number="6"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb281-7" data-line-number="7"> renderers = {</a>
+<a class="sourceLine" id="cb281-8" data-line-number="8"> nbsp = {<span class="ss">$</span><span class="sc">\cdot</span><span class="ss">$</span>},</a>
+<a class="sourceLine" id="cb281-9" data-line-number="9"> },</a>
+<a class="sourceLine" id="cb281-10" data-line-number="10">}</a>
+<a class="sourceLine" id="cb281-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb281-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb281-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb281-14" data-line-number="14">The TeXbook [@knuth:tex, p. 123 and 130] is good.</a>
+<a class="sourceLine" id="cb281-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb281-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb281-17" data-line-number="17"><span class="bu">\bibliographystyle</span>{<span class="ex">plain</span>}</a>
+<a class="sourceLine" id="cb281-18" data-line-number="18"><span class="bu">\bibliography</span>{<span class="ex">document.bib</span>}</a>
+<a class="sourceLine" id="cb281-19" data-line-number="19"></a>
+<a class="sourceLine" id="cb281-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX and BibTeX from the terminal:</p>
+<div class="sourceCode" id="cb282"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb282-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a>
+<a class="sourceLine" id="cb282-2" data-line-number="2"><span class="ex">bibtex</span> document.aux</a>
+<a class="sourceLine" id="cb282-3" data-line-number="3"><span class="ex">lualatex</span> document.tex</a>
+<a class="sourceLine" id="cb282-4" data-line-number="4"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>The TeXbook [1, p.·123·and·130] is good.</p>
+<h3 id="references-2">References</h3>
+<p>[1] Donald Ervin Knuth. <em>The TeXbook, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p>
+</blockquote>
+<h4 id="special-character-renderers"><span class="header-section-number">2.3.1.5</span> Special Character Renderers</h4>
+<p>The following macros replace any special plain <span class="tex">T<sub>e</sub>X</span> characters, including the active pipe character (<code>|</code>) of Con<span class="tex">T<sub>e</sub>X</span>t, in the input text:</p>
+<ul>
+<li><code>\markdownRendererAmpersand</code> replaces the ampersand (<code>&amp;</code>).</li>
+<li><code>\markdownRendererBackslash</code> replaces the backslash (<code>\</code>).</li>
+<li><code>\markdownRendererCircumflex</code> replaces the circumflex (<code>^</code>).</li>
+<li><code>\markdownRendererDollarSign</code> replaces the dollar sign (<code>$</code>).</li>
+<li><code>\markdownRendererHash</code> replaces the hash sign (<code>#</code>).</li>
+<li><code>\markdownRendererLeftBrace</code> replaces the left brace (<code>{</code>).</li>
+<li><code>\markdownRendererPercentSign</code> replaces the percent sign (<code>%</code>).</li>
+<li><code>\markdownRendererPipe</code> replaces the pipe character (<code>|</code>).</li>
+<li><code>\markdownRendererRightBrace</code> replaces the right brace (<code>}</code>).</li>
+<li><code>\markdownRendererTilde</code> replaces the tilde (<code>~</code>).</li>
+<li><code>\markdownRendererUnderscore</code> replaces the underscore (<code>_</code>).</li>
+</ul>
+<h5 id="plain-tex-example-15" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content. We will make the tilde behave as if it were written in <span class="tex">T<sub>e</sub>X</span>, where it represents a non-breaking space.</p>
+<div class="sourceCode" id="cb283"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb283-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb283-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTilde{~}</a>
+<a class="sourceLine" id="cb283-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb283-4" data-line-number="4">Bartel~Leendert van~der~Waerden</a>
+<a class="sourceLine" id="cb283-5" data-line-number="5"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb283-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb284"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb284-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p>
+<blockquote>
+<p>Bartel·Leendert van·der·Waerden</p>
+</blockquote>
+<h5 id="latex-example-29" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content. We will make the tilde behave as if it were written in <span class="tex">T<sub>e</sub>X</span>, where it represents a non-breaking space.</p>
+<div class="sourceCode" id="cb285"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb285-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb285-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb285-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb285-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb285-5" data-line-number="5"> tilde = ~,</a>
+<a class="sourceLine" id="cb285-6" data-line-number="6"> },</a>
+<a class="sourceLine" id="cb285-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb285-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb285-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb285-10" data-line-number="10">Bartel~Leendert van~der~Waerden</a>
+<a class="sourceLine" id="cb285-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb285-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb286"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb286-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p>
+<blockquote>
+<p>Bartel·Leendert van·der·Waerden</p>
+</blockquote>
+<h5 id="context-example-25" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content. We will make the tilde behave as if it were written in <span class="tex">T<sub>e</sub>X</span>, where it represents a non-breaking space.</p>
+<div class="sourceCode" id="cb287"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb287-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb287-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTilde{~}</a>
+<a class="sourceLine" id="cb287-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb287-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb287-5" data-line-number="5">Bartel~Leendert van~der~Waerden</a>
+<a class="sourceLine" id="cb287-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb287-7" data-line-number="7"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb288"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb288-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p>
+<blockquote>
+<p>Bartel·Leendert van·der·Waerden</p>
+</blockquote>
+<h4 id="code-span-renderer"><span class="header-section-number">2.3.1.6</span> Code Span Renderer</h4>
+<p>The <code>\markdownRendererCodeSpan</code> macro represents inlined code span in the input text. It receives a single argument that corresponds to the inlined code span.</p>
+<h5 id="plain-tex-example-16" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb289"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb289-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb289-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a>
+<a class="sourceLine" id="cb289-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb289-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererCodeSpan#1{#1}</a>
+<a class="sourceLine" id="cb289-5" data-line-number="5"></a>
+<a class="sourceLine" id="cb289-6" data-line-number="6"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb289-7" data-line-number="7">`<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>`</a>
+<a class="sourceLine" id="cb289-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb289-9" data-line-number="9"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb289-10" data-line-number="10"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb289-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb289-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb289-13" data-line-number="13"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb289-14" data-line-number="14"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb289-15" data-line-number="15"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb289-16" data-line-number="16"></a>
+<a class="sourceLine" id="cb289-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb290"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb290-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ *equals* $i$.</p>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h5 id="latex-example-30" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb291"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb291-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb291-2" data-line-number="2"><span class="bu">\usepackage</span>[smartEllipses]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb291-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb291-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb291-5" data-line-number="5"> codeSpan = {#1},</a>
+<a class="sourceLine" id="cb291-6" data-line-number="6"> },</a>
+<a class="sourceLine" id="cb291-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb291-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb291-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb291-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb291-11" data-line-number="11">`<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>`</a>
+<a class="sourceLine" id="cb291-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb291-13" data-line-number="13"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb291-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb291-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb291-16" data-line-number="16"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid}</a>
+<a class="sourceLine" id="cb291-17" data-line-number="17"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb291-18" data-line-number="18"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb291-19" data-line-number="19"></a>
+<a class="sourceLine" id="cb291-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb292"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb292-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ *equals* $i$.</p>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h5 id="context-example-26" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb293"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb293-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb293-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererCodeSpan#1{#1}</a>
+<a class="sourceLine" id="cb293-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb293-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb293-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb293-6" data-line-number="6">`<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>`</a>
+<a class="sourceLine" id="cb293-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb293-8" data-line-number="8"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb293-9" data-line-number="9"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb293-10" data-line-number="10"></a>
+<a class="sourceLine" id="cb293-11" data-line-number="11"><span class="fu">\def</span>\markdownOptionHybrid{true}</a>
+<a class="sourceLine" id="cb293-12" data-line-number="12"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb293-13" data-line-number="13"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a>
+<a class="sourceLine" id="cb293-14" data-line-number="14"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb293-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb293-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb294"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb294-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>$\sqrt{-1}$ *equals* $i$.</p>
+<p>$\sqrt{-1}$ <em>equals</em> $i$.</p>
+<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p>
+</blockquote>
+<h4 id="link-renderer"><span class="header-section-number">2.3.1.7</span> Link Renderer</h4>
+<p>The <code>\markdownRendererLink</code> macro represents a hyperlink. It receives four arguments: the label, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the link.</p>
+<h5 id="plain-tex-example-17" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb295"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb295-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb295-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLink#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb295-3" data-line-number="3"> #1 {\tt#2} titled {\it#4}<span class="co">%</span></a>
+<a class="sourceLine" id="cb295-4" data-line-number="4">}</a>
+<a class="sourceLine" id="cb295-5" data-line-number="5"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb295-6" data-line-number="6">Please visit [the link][ctan].</a>
+<a class="sourceLine" id="cb295-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb295-8" data-line-number="8"> [ctan]: https://ctan.org/</a>
+<a class="sourceLine" id="cb295-9" data-line-number="9"> (the Comprehensive TeX Archive Network)</a>
+<a class="sourceLine" id="cb295-10" data-line-number="10"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb295-11" data-line-number="11"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb296"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb296-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Please visit the link <a href="https://ctan.org/" class="uri">https://ctan.org/</a> titled <em>the Comprehensive TeX Archive Network</em>.</p>
+</blockquote>
+<h5 id="latex-example-31" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb297"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb297-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb297-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb297-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb297-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb297-5" data-line-number="5"> link = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb297-6" data-line-number="6"> #1 <span class="fu">\texttt</span>{#2} titled <span class="fu">\emph</span>{#4}<span class="co">%</span></a>
+<a class="sourceLine" id="cb297-7" data-line-number="7"> },</a>
+<a class="sourceLine" id="cb297-8" data-line-number="8"> },</a>
+<a class="sourceLine" id="cb297-9" data-line-number="9">}</a>
+<a class="sourceLine" id="cb297-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb297-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb297-12" data-line-number="12">Please visit [the link][ctan].</a>
+<a class="sourceLine" id="cb297-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb297-14" data-line-number="14"> [ctan]: https://ctan.org/</a>
+<a class="sourceLine" id="cb297-15" data-line-number="15"> (the Comprehensive TeX Archive Network)</a>
+<a class="sourceLine" id="cb297-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb297-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb298"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb298-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Please visit the link <a href="https://ctan.org/" class="uri">https://ctan.org/</a> titled <em>the Comprehensive TeX Archive Network</em>.</p>
+</blockquote>
+<h5 id="context-example-27" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb299"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb299-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb299-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLink#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb299-3" data-line-number="3"> #1 {\tt#2} titled \emph{#4}<span class="co">%</span></a>
+<a class="sourceLine" id="cb299-4" data-line-number="4">}</a>
+<a class="sourceLine" id="cb299-5" data-line-number="5"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb299-6" data-line-number="6"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb299-7" data-line-number="7">Please visit [the link][ctan].</a>
+<a class="sourceLine" id="cb299-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb299-9" data-line-number="9"> [ctan]: https://ctan.org/</a>
+<a class="sourceLine" id="cb299-10" data-line-number="10"> (the Comprehensive TeX Archive Network)</a>
+<a class="sourceLine" id="cb299-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb299-12" data-line-number="12"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb300"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb300-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Please visit the link <a href="https://ctan.org/" class="uri">https://ctan.org/</a> titled <em>the Comprehensive TeX Archive Network</em>.</p>
+</blockquote>
+<h4 id="image-renderer"><span class="header-section-number">2.3.1.8</span> Image Renderer</h4>
+<p>The <code>\markdownRendererImage</code> macro represents an image. It receives four arguments: the label, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the link.</p>
+<h5 id="latex-example-32" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb301"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb301-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb301-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb301-3" data-line-number="3"><span class="fu">\begingroup</span></a>
+<a class="sourceLine" id="cb301-4" data-line-number="4"><span class="fu">\catcode</span>`<span class="fu">\@</span>=11</a>
+<a class="sourceLine" id="cb301-5" data-line-number="5"><span class="fu">\catcode</span>`<span class="fu">\%</span>=12</a>
+<a class="sourceLine" id="cb301-6" data-line-number="6"><span class="fu">\catcode</span>`<span class="fu">\^</span>^A=14</a>
+<a class="sourceLine" id="cb301-7" data-line-number="7"><span class="fu">\global\def</span>\markdownRendererImage#1#2#3#4{^^A</a>
+<a class="sourceLine" id="cb301-8" data-line-number="8"> \immediate\write18{^^A</a>
+<a class="sourceLine" id="cb301-9" data-line-number="9"> if printf &#39;<span class="co">%s&#39; &quot;#3&quot; | grep -q ^http; then</span></a>
+<a class="sourceLine" id="cb301-10" data-line-number="10"> OUTPUT=&quot;$(printf &#39;<span class="co">%s&#39; &quot;#3&quot; | md5sum | cut -d&#39; &#39; -f1).^^A</span></a>
+<a class="sourceLine" id="cb301-11" data-line-number="11"> $(printf &#39;<span class="co">%s&#39; &quot;#3&quot; | sed &#39;s/.*[.]//&#39;)&quot;;</span></a>
+<a class="sourceLine" id="cb301-12" data-line-number="12"> if ! [ -e &quot;$OUTPUT&quot; ]; then</a>
+<a class="sourceLine" id="cb301-13" data-line-number="13"> wget -O &quot;$OUTPUT&quot; &#39;#3&#39; || rm &quot;$OUTPUT&quot;;</a>
+<a class="sourceLine" id="cb301-14" data-line-number="14"> convert &quot;$OUTPUT&quot; png:&quot;$OUTPUT&quot;;</a>
+<a class="sourceLine" id="cb301-15" data-line-number="15"> fi;</a>
+<a class="sourceLine" id="cb301-16" data-line-number="16"> printf &#39;<span class="co">%s%%&#39; &quot;$OUTPUT&quot; &gt; \jobname.fetched;</span></a>
+<a class="sourceLine" id="cb301-17" data-line-number="17"> else</a>
+<a class="sourceLine" id="cb301-18" data-line-number="18"> printf &#39;<span class="co">%s%%&#39; &quot;#3&quot; &gt; \jobname.fetched;</span></a>
+<a class="sourceLine" id="cb301-19" data-line-number="19"> fi^^A</a>
+<a class="sourceLine" id="cb301-20" data-line-number="20"> }^^A</a>
+<a class="sourceLine" id="cb301-21" data-line-number="21"> {^^A</a>
+<a class="sourceLine" id="cb301-22" data-line-number="22"> \everyeof={\noexpand}^^A</a>
+<a class="sourceLine" id="cb301-23" data-line-number="23"> \edef\filename{\@@input&quot;\jobname.fetched&quot; }^^A</a>
+<a class="sourceLine" id="cb301-24" data-line-number="24"> \includegraphics[width=\textwidth]{\filename}^^A</a>
+<a class="sourceLine" id="cb301-25" data-line-number="25"> }^^A</a>
+<a class="sourceLine" id="cb301-26" data-line-number="26">}</a>
+<a class="sourceLine" id="cb301-27" data-line-number="27"><span class="fu">\endgroup</span></a>
+<a class="sourceLine" id="cb301-28" data-line-number="28"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb301-29" data-line-number="29"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb301-30" data-line-number="30">![TUGboat](https://tug.org/tugboat/noword.jpg)</a>
+<a class="sourceLine" id="cb301-31" data-line-number="31"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb301-32" data-line-number="32"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb302"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb302-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following content. This assumes that you use a Unix-like operating system with Bourne or Bourne again shell as the default shell of the current user. It also assumes that the <code>md5sum</code>, <code>wget</code>, and <code>convert</code> binaries are installed and that the <span class="tex">T<sub>e</sub>X</span> engine has shell access.</p>
+<blockquote>
+<p><img src="https://tug.org/tugboat/noword.jpg" title="The Communications of the TeX Users Group" /></p>
+</blockquote>
+<h4 id="content-block-renderers"><span class="header-section-number">2.3.1.9</span> Content Block Renderers</h4>
+<p> The <code>\markdownRendererContentBlock</code> macro represents an iA Writer content block. It receives four arguments: the local file or online image filename extension cast to the lower case, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the content block.</p>
+<p>The <code>\markdownRendererContentBlockOnlineImage</code> macro represents an iA Writer online image content block. The macro receives the same arguments as <code>\markdownRendererContentBlock</code>.</p>
+<p>The <code>\markdownRendererContentBlockCode</code> macro represents an iA Writer content block that was recognized as a file in a known programming language by its filename extension <span class="math inline"><em>s</em></span>. If any <code>markdown-languages.json</code> file found by contains a record <span class="math inline">(<em>k</em>, <em>v</em>)</span>, then a non-online-image content block with the filename extension <span class="math inline"><em>s</em>, <em>s</em></span><code>:lower()</code><span class="math inline"> = <em>k</em></span> is considered to be in a known programming language <span class="math inline"><em>v</em></span>. The macro receives five arguments: the local file name extension <span class="math inline"><em>s</em></span> cast to the lower case, the language <span class="math inline"><em>v</em></span>, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the content block.</p>
+<p>Note that you will need to place place a <code>markdown-languages.json</code> file inside your working directory or inside your local <span class="tex">T<sub>e</sub>X</span> directory structure. In this file, you will define a mapping between filename extensions and the language names recognized by your favorite syntax highlighter; there may exist other creative uses beside syntax highlighting. <a href="https://github.com/iainc/Markdown-Content-Blocks" title="File transclusion syntax for Markdown">The <code>Languages.json</code> file provided by Anton Sotkov</a> is a good starting point.</p>
+<h5 id="plain-tex-example-18" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb303"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb303-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb303-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a>
+<a class="sourceLine" id="cb303-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererContentBlock#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb303-4" data-line-number="4"> This is {\tt #2}, #4.</a>
+<a class="sourceLine" id="cb303-5" data-line-number="5">}</a>
+<a class="sourceLine" id="cb303-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererContentBlockOnlineImage#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb303-7" data-line-number="7"> This is the image {\tt #2}, #4.</a>
+<a class="sourceLine" id="cb303-8" data-line-number="8">}</a>
+<a class="sourceLine" id="cb303-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererContentBlockCode#1#2#3#4#5{<span class="co">%</span></a>
+<a class="sourceLine" id="cb303-10" data-line-number="10"> This is the #2 (\uppercase{#1}) document {\tt #3}, #5.</a>
+<a class="sourceLine" id="cb303-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb303-12" data-line-number="12"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb303-13" data-line-number="13">/document.tex (the document that we are currently typesetting)</a>
+<a class="sourceLine" id="cb303-14" data-line-number="14">/markdown-languages.json (the mapping between filename extensions</a>
+<a class="sourceLine" id="cb303-15" data-line-number="15"> and programming language names)</a>
+<a class="sourceLine" id="cb303-16" data-line-number="16">https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)</a>
+<a class="sourceLine" id="cb303-17" data-line-number="17"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb303-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div>
+<p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p>
+<div class="sourceCode" id="cb304"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb304-1" data-line-number="1"><span class="op">{</span></a>
+<a class="sourceLine" id="cb304-2" data-line-number="2"> <span class="st">&quot;json&quot;</span><span class="op">:</span> <span class="st">&quot;JavaScript Object Notation&quot;</span><span class="op">,</span></a>
+<a class="sourceLine" id="cb304-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb305"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb305-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <code>document.tex</code>, the document that we are currently typesetting.</p>
+<p>This is the JavaScript Object Notation (JSON) document <code>markdown-languages.json</code>, the mapping between filename extensions and programming language names.</p>
+<p>This is the image <code>https://tug.org/tugboat/noword.jpg</code>, the logotype of TUGboat.</p>
+</blockquote>
+<h5 id="latex-example-33" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb306"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb306-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb306-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">filecontents</span>}</a>
+<a class="sourceLine" id="cb306-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">filecontents*</span>}{markdown-languages.json}</a>
+<a class="sourceLine" id="cb306-4" data-line-number="4">{</a>
+<a class="sourceLine" id="cb306-5" data-line-number="5"> &quot;json&quot;: &quot;JavaScript Object Notation&quot;,</a>
+<a class="sourceLine" id="cb306-6" data-line-number="6">}</a>
+<a class="sourceLine" id="cb306-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">filecontents*</span>}</a>
+<a class="sourceLine" id="cb306-8" data-line-number="8"><span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb306-9" data-line-number="9"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb306-10" data-line-number="10"> renderers = {</a>
+<a class="sourceLine" id="cb306-11" data-line-number="11"> contentBlock = {This is <span class="fu">\texttt</span>{#2}, #4.},</a>
+<a class="sourceLine" id="cb306-12" data-line-number="12"> contentBlockOnlineImage = {This is the image <span class="fu">\texttt</span>{#2}, #4.},</a>
+<a class="sourceLine" id="cb306-13" data-line-number="13"> contentBlockCode = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb306-14" data-line-number="14"> This is the #2 (<span class="fu">\MakeUppercase</span>{#1}) document <span class="fu">\texttt</span>{#3}, #5.</a>
+<a class="sourceLine" id="cb306-15" data-line-number="15"> },</a>
+<a class="sourceLine" id="cb306-16" data-line-number="16"> },</a>
+<a class="sourceLine" id="cb306-17" data-line-number="17">}</a>
+<a class="sourceLine" id="cb306-18" data-line-number="18"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb306-19" data-line-number="19"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb306-20" data-line-number="20">/document.tex (the document that we are currently typesetting)</a>
+<a class="sourceLine" id="cb306-21" data-line-number="21">/markdown-languages.json (the mapping between filename extensions</a>
+<a class="sourceLine" id="cb306-22" data-line-number="22"> and programming language names)</a>
+<a class="sourceLine" id="cb306-23" data-line-number="23">https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)</a>
+<a class="sourceLine" id="cb306-24" data-line-number="24"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb306-25" data-line-number="25"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb307"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb307-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <code>document.tex</code>, the document that we are currently typesetting.</p>
+<p>This is the JavaScript Object Notation (JSON) document <code>markdown-languages.json</code>, the mapping between filename extensions and programming language names.</p>
+<p>This is the image <code>https://tug.org/tugboat/noword.jpg</code>, the logotype of TUGboat.</p>
+</blockquote>
+<h5 id="context-example-28" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb308"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb308-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb308-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a>
+<a class="sourceLine" id="cb308-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererContentBlock#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb308-4" data-line-number="4"> This is {\tt #2}, #4.</a>
+<a class="sourceLine" id="cb308-5" data-line-number="5">}</a>
+<a class="sourceLine" id="cb308-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererContentBlockOnlineImage#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb308-7" data-line-number="7"> This is the image {\tt #2}, #4.</a>
+<a class="sourceLine" id="cb308-8" data-line-number="8">}</a>
+<a class="sourceLine" id="cb308-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererContentBlockCode#1#2#3#4#5{<span class="co">%</span></a>
+<a class="sourceLine" id="cb308-10" data-line-number="10"> This is the #2 (\uppercase{#1}) document {\tt #3}, #5.</a>
+<a class="sourceLine" id="cb308-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb308-12" data-line-number="12"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb308-13" data-line-number="13"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb308-14" data-line-number="14">/document.tex (the document that we are currently typesetting)</a>
+<a class="sourceLine" id="cb308-15" data-line-number="15">/markdown-languages.json (the mapping between filename extensions</a>
+<a class="sourceLine" id="cb308-16" data-line-number="16"> and programming language names)</a>
+<a class="sourceLine" id="cb308-17" data-line-number="17">https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)</a>
+<a class="sourceLine" id="cb308-18" data-line-number="18"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb308-19" data-line-number="19"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p>
+<div class="sourceCode" id="cb309"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb309-1" data-line-number="1"><span class="op">{</span></a>
+<a class="sourceLine" id="cb309-2" data-line-number="2"> <span class="st">&quot;json&quot;</span><span class="op">:</span> <span class="st">&quot;JavaScript Object Notation&quot;</span><span class="op">,</span></a>
+<a class="sourceLine" id="cb309-3" data-line-number="3"><span class="op">}</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb310"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb310-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <code>document.tex</code>, the document that we are currently typesetting.</p>
+<p>This is the JavaScript Object Notation (JSON) document <code>markdown-languages.json</code>, the mapping between filename extensions and programming language names.</p>
+<p>This is the image <code>https://tug.org/tugboat/noword.jpg</code>, the logotype of TUGboat.</p>
+</blockquote>
+<h4 id="bullet-list-renderers"><span class="header-section-number">2.3.1.10</span> Bullet List Renderers</h4>
+<p>The <code>\markdownRendererUlBegin</code> macro represents the beginning of a bulleted list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p>
+<p>The <code>\markdownRendererUlBeginTight</code> macro represents the beginning of a bulleted list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererUlItem</code> macro represents an item in a bulleted list. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererUlItemEnd</code> macro represents the end of an item in a bulleted list. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererUlEnd</code> macro represents the end of a bulleted list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p>
+<p>The <code>\markdownRendererUlEndTight</code> macro represents the end of a bulleted list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-19" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb311"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb311-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb311-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a>
+<a class="sourceLine" id="cb311-3" data-line-number="3"></a>
+<a class="sourceLine" id="cb311-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a>
+<a class="sourceLine" id="cb311-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererUlBeginTight{ (}</a>
+<a class="sourceLine" id="cb311-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererUlItem{<span class="co">%</span></a>
+<a class="sourceLine" id="cb311-7" data-line-number="7"> \def\markdownRendererUlItem{<span class="co">%</span></a>
+<a class="sourceLine" id="cb311-8" data-line-number="8"> ,</a>
+<a class="sourceLine" id="cb311-9" data-line-number="9"> \def\markdownRendererUlItem{, and }<span class="co">%</span></a>
+<a class="sourceLine" id="cb311-10" data-line-number="10"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb311-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb311-12" data-line-number="12"><span class="fu">\def</span>\markdownRendererUlItemEnd{}</a>
+<a class="sourceLine" id="cb311-13" data-line-number="13"><span class="fu">\def</span>\markdownRendererUlEndTight{).}</a>
+<a class="sourceLine" id="cb311-14" data-line-number="14"></a>
+<a class="sourceLine" id="cb311-15" data-line-number="15"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb311-16" data-line-number="16">This is a tight list</a>
+<a class="sourceLine" id="cb311-17" data-line-number="17"></a>
+<a class="sourceLine" id="cb311-18" data-line-number="18">- the first item</a>
+<a class="sourceLine" id="cb311-19" data-line-number="19">- the second item</a>
+<a class="sourceLine" id="cb311-20" data-line-number="20">- the third item</a>
+<a class="sourceLine" id="cb311-21" data-line-number="21"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb311-22" data-line-number="22"></a>
+<a class="sourceLine" id="cb311-23" data-line-number="23"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb311-24" data-line-number="24"> :\par</a>
+<a class="sourceLine" id="cb311-25" data-line-number="25"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb311-26" data-line-number="26">}</a>
+<a class="sourceLine" id="cb311-27" data-line-number="27"><span class="fu">\def</span>\markdownRendererUlBegin{}</a>
+<a class="sourceLine" id="cb311-28" data-line-number="28"><span class="fu">\def</span>\markdownRendererUlItem{--\kern 0.5em}</a>
+<a class="sourceLine" id="cb311-29" data-line-number="29"><span class="fu">\def</span>\markdownRendererUlItemEnd{.\par}</a>
+<a class="sourceLine" id="cb311-30" data-line-number="30"><span class="fu">\def</span>\markdownRendererUlEnd{}</a>
+<a class="sourceLine" id="cb311-31" data-line-number="31"></a>
+<a class="sourceLine" id="cb311-32" data-line-number="32"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb311-33" data-line-number="33">This is a loose list</a>
+<a class="sourceLine" id="cb311-34" data-line-number="34"></a>
+<a class="sourceLine" id="cb311-35" data-line-number="35">- This is the first item</a>
+<a class="sourceLine" id="cb311-36" data-line-number="36"></a>
+<a class="sourceLine" id="cb311-37" data-line-number="37">- This is the second item</a>
+<a class="sourceLine" id="cb311-38" data-line-number="38"></a>
+<a class="sourceLine" id="cb311-39" data-line-number="39">- This is the third item</a>
+<a class="sourceLine" id="cb311-40" data-line-number="40"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb311-41" data-line-number="41"></a>
+<a class="sourceLine" id="cb311-42" data-line-number="42"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb312"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb312-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight list (the first item, the second item, and the third item).</p>
+<p>This is a loose list:</p>
+<ul>
+<li><p>This is the first item.</p></li>
+<li><p>This is the second item.</p></li>
+<li><p>This is the third item.</p></li>
+</ul>
+</blockquote>
+<h5 id="latex-example-34" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb313"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb313-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb313-2" data-line-number="2"><span class="bu">\usepackage</span>[tightLists]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb313-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb313-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb313-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb313-6" data-line-number="6"> renderers = {</a>
+<a class="sourceLine" id="cb313-7" data-line-number="7"> interblockSeparator = {},</a>
+<a class="sourceLine" id="cb313-8" data-line-number="8"> ulBeginTight = { (},</a>
+<a class="sourceLine" id="cb313-9" data-line-number="9"> ulItem = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb313-10" data-line-number="10"> <span class="fu">\def</span>\markdownRendererUlItem{<span class="co">%</span></a>
+<a class="sourceLine" id="cb313-11" data-line-number="11"> ,</a>
+<a class="sourceLine" id="cb313-12" data-line-number="12"> \def\markdownRendererUlItem{, and }<span class="co">%</span></a>
+<a class="sourceLine" id="cb313-13" data-line-number="13"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb313-14" data-line-number="14"> },</a>
+<a class="sourceLine" id="cb313-15" data-line-number="15"> ulItemEnd = {},</a>
+<a class="sourceLine" id="cb313-16" data-line-number="16"> ulEndTight = {).},</a>
+<a class="sourceLine" id="cb313-17" data-line-number="17"> },</a>
+<a class="sourceLine" id="cb313-18" data-line-number="18">}</a>
+<a class="sourceLine" id="cb313-19" data-line-number="19">This is a tight list</a>
+<a class="sourceLine" id="cb313-20" data-line-number="20"></a>
+<a class="sourceLine" id="cb313-21" data-line-number="21">- the first item</a>
+<a class="sourceLine" id="cb313-22" data-line-number="22">- the second item</a>
+<a class="sourceLine" id="cb313-23" data-line-number="23">- the third item</a>
+<a class="sourceLine" id="cb313-24" data-line-number="24"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb313-25" data-line-number="25"></a>
+<a class="sourceLine" id="cb313-26" data-line-number="26"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb313-27" data-line-number="27"> renderers = {</a>
+<a class="sourceLine" id="cb313-28" data-line-number="28"> interblockSeparator = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb313-29" data-line-number="29"> :<span class="fu">\par</span></a>
+<a class="sourceLine" id="cb313-30" data-line-number="30"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb313-31" data-line-number="31"> },</a>
+<a class="sourceLine" id="cb313-32" data-line-number="32"> ulBeginTight = {<span class="kw">\begin</span>{<span class="ex">itemize</span>}},</a>
+<a class="sourceLine" id="cb313-33" data-line-number="33"> ulItem = {<span class="fu">\item</span>},</a>
+<a class="sourceLine" id="cb313-34" data-line-number="34"> ulItemEnd = {.},</a>
+<a class="sourceLine" id="cb313-35" data-line-number="35"> ulEnd = {<span class="kw">\end</span>{<span class="ex">itemize</span>}},</a>
+<a class="sourceLine" id="cb313-36" data-line-number="36"> },</a>
+<a class="sourceLine" id="cb313-37" data-line-number="37">}</a>
+<a class="sourceLine" id="cb313-38" data-line-number="38">This is a loose list</a>
+<a class="sourceLine" id="cb313-39" data-line-number="39"></a>
+<a class="sourceLine" id="cb313-40" data-line-number="40">- This is the first item</a>
+<a class="sourceLine" id="cb313-41" data-line-number="41"></a>
+<a class="sourceLine" id="cb313-42" data-line-number="42">- This is the second item</a>
+<a class="sourceLine" id="cb313-43" data-line-number="43"></a>
+<a class="sourceLine" id="cb313-44" data-line-number="44">- This is the third item</a>
+<a class="sourceLine" id="cb313-45" data-line-number="45"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb313-46" data-line-number="46"></a>
+<a class="sourceLine" id="cb313-47" data-line-number="47"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb314"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb314-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight list (the first item, the second item, and the third item).</p>
+<p>This is a loose list:</p>
+<ul>
+<li><p>This is the first item.</p></li>
+<li><p>This is the second item.</p></li>
+<li><p>This is the third item.</p></li>
+</ul>
+</blockquote>
+<h5 id="context-example-29" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb315"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb315-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb315-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a>
+<a class="sourceLine" id="cb315-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb315-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb315-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a>
+<a class="sourceLine" id="cb315-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererUlBeginTight{ (}</a>
+<a class="sourceLine" id="cb315-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererUlItem{<span class="co">%</span></a>
+<a class="sourceLine" id="cb315-8" data-line-number="8"> \def\markdownRendererUlItem{<span class="co">%</span></a>
+<a class="sourceLine" id="cb315-9" data-line-number="9"> ,</a>
+<a class="sourceLine" id="cb315-10" data-line-number="10"> \def\markdownRendererUlItem{, and }<span class="co">%</span></a>
+<a class="sourceLine" id="cb315-11" data-line-number="11"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb315-12" data-line-number="12">}</a>
+<a class="sourceLine" id="cb315-13" data-line-number="13"><span class="fu">\def</span>\markdownRendererUlItemEnd{}</a>
+<a class="sourceLine" id="cb315-14" data-line-number="14"><span class="fu">\def</span>\markdownRendererUlEndTight{).}</a>
+<a class="sourceLine" id="cb315-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb315-16" data-line-number="16"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb315-17" data-line-number="17">This is a tight list</a>
+<a class="sourceLine" id="cb315-18" data-line-number="18"></a>
+<a class="sourceLine" id="cb315-19" data-line-number="19">- the first item</a>
+<a class="sourceLine" id="cb315-20" data-line-number="20">- the second item</a>
+<a class="sourceLine" id="cb315-21" data-line-number="21">- the third item</a>
+<a class="sourceLine" id="cb315-22" data-line-number="22"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb315-23" data-line-number="23"></a>
+<a class="sourceLine" id="cb315-24" data-line-number="24"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb315-25" data-line-number="25"> :\par</a>
+<a class="sourceLine" id="cb315-26" data-line-number="26"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb315-27" data-line-number="27">}</a>
+<a class="sourceLine" id="cb315-28" data-line-number="28"><span class="fu">\def</span>\markdownRendererUlBegin{\startitemize}</a>
+<a class="sourceLine" id="cb315-29" data-line-number="29"><span class="fu">\def</span>\markdownRendererUlItem{\item}</a>
+<a class="sourceLine" id="cb315-30" data-line-number="30"><span class="fu">\def</span>\markdownRendererUlItemEnd{.}</a>
+<a class="sourceLine" id="cb315-31" data-line-number="31"><span class="fu">\def</span>\markdownRendererUlEnd{\stopitemize}</a>
+<a class="sourceLine" id="cb315-32" data-line-number="32"></a>
+<a class="sourceLine" id="cb315-33" data-line-number="33"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb315-34" data-line-number="34">This is a loose list</a>
+<a class="sourceLine" id="cb315-35" data-line-number="35"></a>
+<a class="sourceLine" id="cb315-36" data-line-number="36">- This is the first item</a>
+<a class="sourceLine" id="cb315-37" data-line-number="37"></a>
+<a class="sourceLine" id="cb315-38" data-line-number="38">- This is the second item</a>
+<a class="sourceLine" id="cb315-39" data-line-number="39"></a>
+<a class="sourceLine" id="cb315-40" data-line-number="40">- This is the third item</a>
+<a class="sourceLine" id="cb315-41" data-line-number="41"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb315-42" data-line-number="42"></a>
+<a class="sourceLine" id="cb315-43" data-line-number="43"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb316"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb316-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight list (the first item, the second item, and the third item).</p>
+<p>This is a loose list:</p>
+<ul>
+<li><p>This is the first item.</p></li>
+<li><p>This is the second item.</p></li>
+<li><p>This is the third item.</p></li>
+</ul>
+</blockquote>
+<h4 id="ordered-list-renderers"><span class="header-section-number">2.3.1.11</span> Ordered List Renderers</h4>
+<p>The <code>\markdownRendererOlBegin</code> macro represents the beginning of an ordered list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p>
+<p>The <code>\markdownRendererOlBeginTight</code> macro represents the beginning of an ordered list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererOlItem</code> macro represents an item in an ordered list. This macro will only be produced, when the <strong><code>startNumber</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererOlItemEnd</code> macro represents the end of an item in an ordered list. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererOlItemWithNumber</code> macro represents an item in an ordered list. This macro will only be produced, when the <strong><code>startNumber</code></strong> option is <code>true</code>. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererOlEnd</code> macro represents the end of an ordered list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p>
+<p>The <code>\markdownRendererOlEndTight</code> macro represents the end of an ordered list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-20" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb317"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb317-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb317-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a>
+<a class="sourceLine" id="cb317-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionStartNumber{true}</a>
+<a class="sourceLine" id="cb317-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb317-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a>
+<a class="sourceLine" id="cb317-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererOlBeginTight{ (}</a>
+<a class="sourceLine" id="cb317-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb317-8" data-line-number="8"> \ifnum #1=1\relax</a>
+<a class="sourceLine" id="cb317-9" data-line-number="9"> the first</a>
+<a class="sourceLine" id="cb317-10" data-line-number="10"> \else</a>
+<a class="sourceLine" id="cb317-11" data-line-number="11"> \ifnum #1=2\relax</a>
+<a class="sourceLine" id="cb317-12" data-line-number="12"> , the second</a>
+<a class="sourceLine" id="cb317-13" data-line-number="13"> \else</a>
+<a class="sourceLine" id="cb317-14" data-line-number="14"> , and the third</a>
+<a class="sourceLine" id="cb317-15" data-line-number="15"> \fi</a>
+<a class="sourceLine" id="cb317-16" data-line-number="16"> \fi</a>
+<a class="sourceLine" id="cb317-17" data-line-number="17">}</a>
+<a class="sourceLine" id="cb317-18" data-line-number="18"><span class="fu">\def</span>\markdownRendererOlItemEnd{}</a>
+<a class="sourceLine" id="cb317-19" data-line-number="19"><span class="fu">\def</span>\markdownRendererOlEndTight{).}</a>
+<a class="sourceLine" id="cb317-20" data-line-number="20"></a>
+<a class="sourceLine" id="cb317-21" data-line-number="21"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb317-22" data-line-number="22">This is a tight list</a>
+<a class="sourceLine" id="cb317-23" data-line-number="23"></a>
+<a class="sourceLine" id="cb317-24" data-line-number="24">1. item</a>
+<a class="sourceLine" id="cb317-25" data-line-number="25">2. item</a>
+<a class="sourceLine" id="cb317-26" data-line-number="26">3. item</a>
+<a class="sourceLine" id="cb317-27" data-line-number="27"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb317-28" data-line-number="28"></a>
+<a class="sourceLine" id="cb317-29" data-line-number="29"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb317-30" data-line-number="30"> :\par</a>
+<a class="sourceLine" id="cb317-31" data-line-number="31"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb317-32" data-line-number="32">}</a>
+<a class="sourceLine" id="cb317-33" data-line-number="33"><span class="fu">\def</span>\markdownRendererOlBegin{}</a>
+<a class="sourceLine" id="cb317-34" data-line-number="34"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb317-35" data-line-number="35"> #1.\kern 0.5em<span class="co">%</span></a>
+<a class="sourceLine" id="cb317-36" data-line-number="36"> This is the</a>
+<a class="sourceLine" id="cb317-37" data-line-number="37"> \ifnum #1=1\relax</a>
+<a class="sourceLine" id="cb317-38" data-line-number="38"> first</a>
+<a class="sourceLine" id="cb317-39" data-line-number="39"> \else</a>
+<a class="sourceLine" id="cb317-40" data-line-number="40"> \ifnum #1=2\relax</a>
+<a class="sourceLine" id="cb317-41" data-line-number="41"> second</a>
+<a class="sourceLine" id="cb317-42" data-line-number="42"> \else</a>
+<a class="sourceLine" id="cb317-43" data-line-number="43"> third</a>
+<a class="sourceLine" id="cb317-44" data-line-number="44"> \fi</a>
+<a class="sourceLine" id="cb317-45" data-line-number="45"> \fi</a>
+<a class="sourceLine" id="cb317-46" data-line-number="46">}</a>
+<a class="sourceLine" id="cb317-47" data-line-number="47"><span class="fu">\def</span>\markdownRendererOlItemEnd{.\par}</a>
+<a class="sourceLine" id="cb317-48" data-line-number="48"><span class="fu">\def</span>\markdownRendererOlEnd{}</a>
+<a class="sourceLine" id="cb317-49" data-line-number="49"></a>
+<a class="sourceLine" id="cb317-50" data-line-number="50"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb317-51" data-line-number="51">This is a loose list</a>
+<a class="sourceLine" id="cb317-52" data-line-number="52"></a>
+<a class="sourceLine" id="cb317-53" data-line-number="53">1. item</a>
+<a class="sourceLine" id="cb317-54" data-line-number="54"></a>
+<a class="sourceLine" id="cb317-55" data-line-number="55">2. item</a>
+<a class="sourceLine" id="cb317-56" data-line-number="56"></a>
+<a class="sourceLine" id="cb317-57" data-line-number="57">3. item</a>
+<a class="sourceLine" id="cb317-58" data-line-number="58"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb317-59" data-line-number="59"></a>
+<a class="sourceLine" id="cb317-60" data-line-number="60"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb318"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb318-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight list (the first item, the second item, and the third item).</p>
+<p>This is a loose list:</p>
+<ol type="1">
+<li><p>This is the first item.</p></li>
+<li><p>This is the second item.</p></li>
+<li><p>This is the third item.</p></li>
+</ol>
+</blockquote>
+<h5 id="latex-example-35" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb319"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb319-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb319-2" data-line-number="2"><span class="bu">\usepackage</span>[tightLists, startNumber]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb319-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb319-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb319-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb319-6" data-line-number="6"> renderers = {</a>
+<a class="sourceLine" id="cb319-7" data-line-number="7"> interblockSeparator = {},</a>
+<a class="sourceLine" id="cb319-8" data-line-number="8"> olBeginTight = { (},</a>
+<a class="sourceLine" id="cb319-9" data-line-number="9"> olItemWithNumber = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb319-10" data-line-number="10"> <span class="fu">\ifnum</span> #1=1<span class="fu">\relax</span></a>
+<a class="sourceLine" id="cb319-11" data-line-number="11"> the first</a>
+<a class="sourceLine" id="cb319-12" data-line-number="12"> <span class="fu">\else</span></a>
+<a class="sourceLine" id="cb319-13" data-line-number="13"> <span class="fu">\ifnum</span> #1=2<span class="fu">\relax</span></a>
+<a class="sourceLine" id="cb319-14" data-line-number="14"> , the second</a>
+<a class="sourceLine" id="cb319-15" data-line-number="15"> <span class="fu">\else</span></a>
+<a class="sourceLine" id="cb319-16" data-line-number="16"> , and the third</a>
+<a class="sourceLine" id="cb319-17" data-line-number="17"> <span class="fu">\fi</span></a>
+<a class="sourceLine" id="cb319-18" data-line-number="18"> <span class="fu">\fi</span></a>
+<a class="sourceLine" id="cb319-19" data-line-number="19"> },</a>
+<a class="sourceLine" id="cb319-20" data-line-number="20"> olItemEnd = {},</a>
+<a class="sourceLine" id="cb319-21" data-line-number="21"> olEndTight = {).},</a>
+<a class="sourceLine" id="cb319-22" data-line-number="22"> },</a>
+<a class="sourceLine" id="cb319-23" data-line-number="23">}</a>
+<a class="sourceLine" id="cb319-24" data-line-number="24">This is a tight list</a>
+<a class="sourceLine" id="cb319-25" data-line-number="25"></a>
+<a class="sourceLine" id="cb319-26" data-line-number="26">1. item</a>
+<a class="sourceLine" id="cb319-27" data-line-number="27">2. item</a>
+<a class="sourceLine" id="cb319-28" data-line-number="28">3. item</a>
+<a class="sourceLine" id="cb319-29" data-line-number="29"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb319-30" data-line-number="30"></a>
+<a class="sourceLine" id="cb319-31" data-line-number="31"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb319-32" data-line-number="32"> renderers = {</a>
+<a class="sourceLine" id="cb319-33" data-line-number="33"> interblockSeparator = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb319-34" data-line-number="34"> :<span class="fu">\par</span></a>
+<a class="sourceLine" id="cb319-35" data-line-number="35"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb319-36" data-line-number="36"> },</a>
+<a class="sourceLine" id="cb319-37" data-line-number="37"> olBeginTight = {<span class="kw">\begin</span>{<span class="ex">enumerate</span>}},</a>
+<a class="sourceLine" id="cb319-38" data-line-number="38"> olItemWithNumber = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb319-39" data-line-number="39"> <span class="fu">\item</span> This is the</a>
+<a class="sourceLine" id="cb319-40" data-line-number="40"> <span class="fu">\ifnum</span> #1=1<span class="fu">\relax</span></a>
+<a class="sourceLine" id="cb319-41" data-line-number="41"> first</a>
+<a class="sourceLine" id="cb319-42" data-line-number="42"> <span class="fu">\else</span></a>
+<a class="sourceLine" id="cb319-43" data-line-number="43"> <span class="fu">\ifnum</span> #1=2<span class="fu">\relax</span></a>
+<a class="sourceLine" id="cb319-44" data-line-number="44"> second</a>
+<a class="sourceLine" id="cb319-45" data-line-number="45"> <span class="fu">\else</span></a>
+<a class="sourceLine" id="cb319-46" data-line-number="46"> third</a>
+<a class="sourceLine" id="cb319-47" data-line-number="47"> <span class="fu">\fi</span></a>
+<a class="sourceLine" id="cb319-48" data-line-number="48"> <span class="fu">\fi</span></a>
+<a class="sourceLine" id="cb319-49" data-line-number="49"> },</a>
+<a class="sourceLine" id="cb319-50" data-line-number="50"> olItemEnd = {.},</a>
+<a class="sourceLine" id="cb319-51" data-line-number="51"> olEnd = {<span class="kw">\end</span>{<span class="ex">enumerate</span>}},</a>
+<a class="sourceLine" id="cb319-52" data-line-number="52"> },</a>
+<a class="sourceLine" id="cb319-53" data-line-number="53">}</a>
+<a class="sourceLine" id="cb319-54" data-line-number="54">This is a loose list</a>
+<a class="sourceLine" id="cb319-55" data-line-number="55"></a>
+<a class="sourceLine" id="cb319-56" data-line-number="56">1. item</a>
+<a class="sourceLine" id="cb319-57" data-line-number="57"></a>
+<a class="sourceLine" id="cb319-58" data-line-number="58">2. item</a>
+<a class="sourceLine" id="cb319-59" data-line-number="59"></a>
+<a class="sourceLine" id="cb319-60" data-line-number="60">3. item</a>
+<a class="sourceLine" id="cb319-61" data-line-number="61"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb319-62" data-line-number="62"></a>
+<a class="sourceLine" id="cb319-63" data-line-number="63"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb320"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb320-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight list (the first item, the second item, and the third item).</p>
+<p>This is a loose list:</p>
+<ol type="1">
+<li><p>This is the first item.</p></li>
+<li><p>This is the second item.</p></li>
+<li><p>This is the third item.</p></li>
+</ol>
+</blockquote>
+<h5 id="context-example-30" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb321"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb321-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb321-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a>
+<a class="sourceLine" id="cb321-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionStartNumber{true}</a>
+<a class="sourceLine" id="cb321-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb321-5" data-line-number="5"></a>
+<a class="sourceLine" id="cb321-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a>
+<a class="sourceLine" id="cb321-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererOlBeginTight{ (}</a>
+<a class="sourceLine" id="cb321-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb321-9" data-line-number="9"> \ifnum #1=1\relax</a>
+<a class="sourceLine" id="cb321-10" data-line-number="10"> the first</a>
+<a class="sourceLine" id="cb321-11" data-line-number="11"> \else</a>
+<a class="sourceLine" id="cb321-12" data-line-number="12"> \ifnum #1=2\relax</a>
+<a class="sourceLine" id="cb321-13" data-line-number="13"> , the second</a>
+<a class="sourceLine" id="cb321-14" data-line-number="14"> \else</a>
+<a class="sourceLine" id="cb321-15" data-line-number="15"> , and the third</a>
+<a class="sourceLine" id="cb321-16" data-line-number="16"> \fi</a>
+<a class="sourceLine" id="cb321-17" data-line-number="17"> \fi</a>
+<a class="sourceLine" id="cb321-18" data-line-number="18">}</a>
+<a class="sourceLine" id="cb321-19" data-line-number="19"><span class="fu">\def</span>\markdownRendererOlItemEnd{}</a>
+<a class="sourceLine" id="cb321-20" data-line-number="20"><span class="fu">\def</span>\markdownRendererOlEndTight{).}</a>
+<a class="sourceLine" id="cb321-21" data-line-number="21"></a>
+<a class="sourceLine" id="cb321-22" data-line-number="22"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb321-23" data-line-number="23">This is a tight list</a>
+<a class="sourceLine" id="cb321-24" data-line-number="24"></a>
+<a class="sourceLine" id="cb321-25" data-line-number="25">1. item</a>
+<a class="sourceLine" id="cb321-26" data-line-number="26">2. item</a>
+<a class="sourceLine" id="cb321-27" data-line-number="27">3. item</a>
+<a class="sourceLine" id="cb321-28" data-line-number="28"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb321-29" data-line-number="29"></a>
+<a class="sourceLine" id="cb321-30" data-line-number="30"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb321-31" data-line-number="31"> :\par</a>
+<a class="sourceLine" id="cb321-32" data-line-number="32"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb321-33" data-line-number="33">}</a>
+<a class="sourceLine" id="cb321-34" data-line-number="34"><span class="fu">\def</span>\markdownRendererOlBegin{\startitemize}</a>
+<a class="sourceLine" id="cb321-35" data-line-number="35"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb321-36" data-line-number="36"> \sym{#1.}</a>
+<a class="sourceLine" id="cb321-37" data-line-number="37"> This is the</a>
+<a class="sourceLine" id="cb321-38" data-line-number="38"> \ifnum #1=1\relax</a>
+<a class="sourceLine" id="cb321-39" data-line-number="39"> first</a>
+<a class="sourceLine" id="cb321-40" data-line-number="40"> \else</a>
+<a class="sourceLine" id="cb321-41" data-line-number="41"> \ifnum #1=2\relax</a>
+<a class="sourceLine" id="cb321-42" data-line-number="42"> second</a>
+<a class="sourceLine" id="cb321-43" data-line-number="43"> \else</a>
+<a class="sourceLine" id="cb321-44" data-line-number="44"> third</a>
+<a class="sourceLine" id="cb321-45" data-line-number="45"> \fi</a>
+<a class="sourceLine" id="cb321-46" data-line-number="46"> \fi</a>
+<a class="sourceLine" id="cb321-47" data-line-number="47">}</a>
+<a class="sourceLine" id="cb321-48" data-line-number="48"><span class="fu">\def</span>\markdownRendererOlItemEnd{.\par}</a>
+<a class="sourceLine" id="cb321-49" data-line-number="49"><span class="fu">\def</span>\markdownRendererOlEnd{\stopitemize}</a>
+<a class="sourceLine" id="cb321-50" data-line-number="50"></a>
+<a class="sourceLine" id="cb321-51" data-line-number="51"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb321-52" data-line-number="52">This is a loose list</a>
+<a class="sourceLine" id="cb321-53" data-line-number="53"></a>
+<a class="sourceLine" id="cb321-54" data-line-number="54">1. item</a>
+<a class="sourceLine" id="cb321-55" data-line-number="55"></a>
+<a class="sourceLine" id="cb321-56" data-line-number="56">2. item</a>
+<a class="sourceLine" id="cb321-57" data-line-number="57"></a>
+<a class="sourceLine" id="cb321-58" data-line-number="58">3. item</a>
+<a class="sourceLine" id="cb321-59" data-line-number="59"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb321-60" data-line-number="60"></a>
+<a class="sourceLine" id="cb321-61" data-line-number="61"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb322"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb322-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight list (the first item, the second item, and the third item).</p>
+<p>This is a loose list:</p>
+<ol type="1">
+<li><p>This is the first item.</p></li>
+<li><p>This is the second item.</p></li>
+<li><p>This is the third item.</p></li>
+</ol>
+</blockquote>
+<h4 id="definition-list-renderers"><span class="header-section-number">2.3.1.12</span> Definition List Renderers</h4>
+<p>The following macros are only produced, when the <strong><code>definitionLists</code></strong> option is <code>true</code>.</p>
+<p>The <code>\markdownRendererDlBegin</code> macro represents the beginning of a definition list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p>
+<p>The <code>\markdownRendererDlBeginTight</code> macro represents the beginning of a definition list that contains an item with several paragraphs of text (the list is not tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<p>The <code>\markdownRendererDlItem</code> macro represents a term in a definition list. The macro receives a single argument that corresponds to the term being defined.</p>
+<p>The <code>\markdownRendererDlItemEnd</code> macro represents the end of a list of definitions for a single term.</p>
+<p>The <code>\markdownRendererDlDefinitionBegin</code> macro represents the beginning of a definition in a definition list. There can be several definitions for a single term.</p>
+<p>The <code>\markdownRendererDlDefinitionEnd</code> macro represents the end of a definition in a definition list. There can be several definitions for a single term.</p>
+<p>The <code>\markdownRendererDlEnd</code> macro represents the end of a definition list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p>
+<p>The <code>\markdownRendererDlEndTight</code> macro represents the end of a definition list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-21" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb323"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb323-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb323-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionDefinitionLists{true}</a>
+<a class="sourceLine" id="cb323-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionTightLists{true}</a>
+<a class="sourceLine" id="cb323-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb323-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-6" data-line-number="6"> :<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-7" data-line-number="7"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-8" data-line-number="8">}</a>
+<a class="sourceLine" id="cb323-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererDlBeginTight{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-10" data-line-number="10"> \begingroup</a>
+<a class="sourceLine" id="cb323-11" data-line-number="11"> \parindent=0pt</a>
+<a class="sourceLine" id="cb323-12" data-line-number="12">}</a>
+<a class="sourceLine" id="cb323-13" data-line-number="13"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-14" data-line-number="14"> \par{\bf#1}<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-15" data-line-number="15"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-16" data-line-number="16"> ,</a>
+<a class="sourceLine" id="cb323-17" data-line-number="17"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-18" data-line-number="18"> , and</a>
+<a class="sourceLine" id="cb323-19" data-line-number="19"> \def\markdownRendererDlDefinitionEnd{.}<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-20" data-line-number="20"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-21" data-line-number="21"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-22" data-line-number="22">}</a>
+<a class="sourceLine" id="cb323-23" data-line-number="23"><span class="fu">\def</span>\markdownRendererDlItemEnd{}</a>
+<a class="sourceLine" id="cb323-24" data-line-number="24"><span class="fu">\def</span>\markdownRendererDlDefinitionBegin{\par--\kern 0.5em}</a>
+<a class="sourceLine" id="cb323-25" data-line-number="25"><span class="fu">\def</span>\markdownRendererDlEndTight{\endgroup}</a>
+<a class="sourceLine" id="cb323-26" data-line-number="26"></a>
+<a class="sourceLine" id="cb323-27" data-line-number="27"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb323-28" data-line-number="28">This is a tight definition list</a>
+<a class="sourceLine" id="cb323-29" data-line-number="29"></a>
+<a class="sourceLine" id="cb323-30" data-line-number="30">Coffee</a>
+<a class="sourceLine" id="cb323-31" data-line-number="31">: black hot drink</a>
+<a class="sourceLine" id="cb323-32" data-line-number="32">: prepared from roasted coffee beans</a>
+<a class="sourceLine" id="cb323-33" data-line-number="33">: one of the most traded agricultural commodities in the world</a>
+<a class="sourceLine" id="cb323-34" data-line-number="34"></a>
+<a class="sourceLine" id="cb323-35" data-line-number="35">Milk</a>
+<a class="sourceLine" id="cb323-36" data-line-number="36">: white cold drink</a>
+<a class="sourceLine" id="cb323-37" data-line-number="37">: nutrient-rich</a>
+<a class="sourceLine" id="cb323-38" data-line-number="38">: produced on an industrial scale</a>
+<a class="sourceLine" id="cb323-39" data-line-number="39"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb323-40" data-line-number="40"></a>
+<a class="sourceLine" id="cb323-41" data-line-number="41"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-42" data-line-number="42"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-43" data-line-number="43">}</a>
+<a class="sourceLine" id="cb323-44" data-line-number="44"><span class="fu">\def</span>\markdownRendererDlBegin{}</a>
+<a class="sourceLine" id="cb323-45" data-line-number="45"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-46" data-line-number="46"> . #1 is a</a>
+<a class="sourceLine" id="cb323-47" data-line-number="47"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-48" data-line-number="48"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-49" data-line-number="49"> ,</a>
+<a class="sourceLine" id="cb323-50" data-line-number="50"> \def\markdownRendererDlDefinitionBegin{, and }<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-51" data-line-number="51"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-52" data-line-number="52"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb323-53" data-line-number="53">}</a>
+<a class="sourceLine" id="cb323-54" data-line-number="54"><span class="fu">\def</span>\markdownRendererDlItemEnd{}</a>
+<a class="sourceLine" id="cb323-55" data-line-number="55"><span class="fu">\def</span>\markdownRendererDlDefinitionEnd{}</a>
+<a class="sourceLine" id="cb323-56" data-line-number="56"><span class="fu">\def</span>\markdownRendererDlEnd{.}</a>
+<a class="sourceLine" id="cb323-57" data-line-number="57"></a>
+<a class="sourceLine" id="cb323-58" data-line-number="58"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb323-59" data-line-number="59">This is a loose definition list</a>
+<a class="sourceLine" id="cb323-60" data-line-number="60"></a>
+<a class="sourceLine" id="cb323-61" data-line-number="61">Coffee</a>
+<a class="sourceLine" id="cb323-62" data-line-number="62"></a>
+<a class="sourceLine" id="cb323-63" data-line-number="63">: black hot drink</a>
+<a class="sourceLine" id="cb323-64" data-line-number="64"></a>
+<a class="sourceLine" id="cb323-65" data-line-number="65">: prepared from roasted coffee beans</a>
+<a class="sourceLine" id="cb323-66" data-line-number="66"></a>
+<a class="sourceLine" id="cb323-67" data-line-number="67">: one of the most traded agricultural commodities in the world</a>
+<a class="sourceLine" id="cb323-68" data-line-number="68"></a>
+<a class="sourceLine" id="cb323-69" data-line-number="69">Milk</a>
+<a class="sourceLine" id="cb323-70" data-line-number="70"></a>
+<a class="sourceLine" id="cb323-71" data-line-number="71">: white cold drink</a>
+<a class="sourceLine" id="cb323-72" data-line-number="72"></a>
+<a class="sourceLine" id="cb323-73" data-line-number="73">: nutrient-rich</a>
+<a class="sourceLine" id="cb323-74" data-line-number="74"></a>
+<a class="sourceLine" id="cb323-75" data-line-number="75">: produced on an industrial scale</a>
+<a class="sourceLine" id="cb323-76" data-line-number="76"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb323-77" data-line-number="77"></a>
+<a class="sourceLine" id="cb323-78" data-line-number="78"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb324"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb324-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight definition list:</p>
+<p><strong>Coffee</strong></p>
+<ul>
+<li>black hot drink,</li>
+<li>prepared from roasted coffee beans, and</li>
+<li>one of the most traded agricultural commodities in the world.</li>
+</ul>
+<p><strong>Milk</strong></p>
+<ul>
+<li>white cold drink,</li>
+<li>nutrient-rich, and</li>
+<li>produced on an industrial scale.</li>
+</ul>
+<p>This is a loose definition list. Coffee is a black hot drink, prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.</p>
+</blockquote>
+<h5 id="latex-example-36" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb325"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb325-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb325-2" data-line-number="2"><span class="bu">\usepackage</span>[definitionLists, tightLists]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb325-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb325-4" data-line-number="4"></a>
+<a class="sourceLine" id="cb325-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb325-6" data-line-number="6"> renderers = {</a>
+<a class="sourceLine" id="cb325-7" data-line-number="7"> interblockSeparator = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-8" data-line-number="8"> :<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-9" data-line-number="9"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-10" data-line-number="10"> },</a>
+<a class="sourceLine" id="cb325-11" data-line-number="11"> dlBeginTight = {<span class="kw">\begin</span>{<span class="ex">description</span>}},</a>
+<a class="sourceLine" id="cb325-12" data-line-number="12"> dlItem = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-13" data-line-number="13"> <span class="fu">\item</span>[#1]</a>
+<a class="sourceLine" id="cb325-14" data-line-number="14"> <span class="kw">\begin</span>{<span class="ex">itemize</span>}</a>
+<a class="sourceLine" id="cb325-15" data-line-number="15"> <span class="fu">\def</span>\markdownRendererDlDefinitionEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-16" data-line-number="16"> ,</a>
+<a class="sourceLine" id="cb325-17" data-line-number="17"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-18" data-line-number="18"> , and</a>
+<a class="sourceLine" id="cb325-19" data-line-number="19"> \def\markdownRendererDlDefinitionEnd{.}<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-20" data-line-number="20"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-21" data-line-number="21"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-22" data-line-number="22"> },</a>
+<a class="sourceLine" id="cb325-23" data-line-number="23"> dlItemEnd = {<span class="kw">\end</span>{<span class="ex">itemize</span>}},</a>
+<a class="sourceLine" id="cb325-24" data-line-number="24"> dlDefinitionBegin = <span class="fu">\item</span>,</a>
+<a class="sourceLine" id="cb325-25" data-line-number="25"> dlEndTight = {<span class="kw">\end</span>{<span class="ex">description</span>}},</a>
+<a class="sourceLine" id="cb325-26" data-line-number="26"> },</a>
+<a class="sourceLine" id="cb325-27" data-line-number="27">}</a>
+<a class="sourceLine" id="cb325-28" data-line-number="28">This is a tight definition list</a>
+<a class="sourceLine" id="cb325-29" data-line-number="29"></a>
+<a class="sourceLine" id="cb325-30" data-line-number="30">Coffee</a>
+<a class="sourceLine" id="cb325-31" data-line-number="31">: black hot drink</a>
+<a class="sourceLine" id="cb325-32" data-line-number="32">: prepared from roasted coffee beans</a>
+<a class="sourceLine" id="cb325-33" data-line-number="33">: one of the most traded agricultural commodities in the world</a>
+<a class="sourceLine" id="cb325-34" data-line-number="34"></a>
+<a class="sourceLine" id="cb325-35" data-line-number="35">Milk</a>
+<a class="sourceLine" id="cb325-36" data-line-number="36">: white cold drink</a>
+<a class="sourceLine" id="cb325-37" data-line-number="37">: nutrient-rich</a>
+<a class="sourceLine" id="cb325-38" data-line-number="38">: produced on an industrial scale</a>
+<a class="sourceLine" id="cb325-39" data-line-number="39"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb325-40" data-line-number="40"></a>
+<a class="sourceLine" id="cb325-41" data-line-number="41"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb325-42" data-line-number="42"> renderers = {</a>
+<a class="sourceLine" id="cb325-43" data-line-number="43"> interblockSeparator = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-44" data-line-number="44"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-45" data-line-number="45"> },</a>
+<a class="sourceLine" id="cb325-46" data-line-number="46"> dlBegin = {},</a>
+<a class="sourceLine" id="cb325-47" data-line-number="47"> dlItem = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-48" data-line-number="48"> . #1 is a</a>
+<a class="sourceLine" id="cb325-49" data-line-number="49"> <span class="fu">\def</span>\markdownRendererDlDefinitionBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-50" data-line-number="50"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-51" data-line-number="51"> ,</a>
+<a class="sourceLine" id="cb325-52" data-line-number="52"> \def\markdownRendererDlDefinitionBegin{, and }<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-53" data-line-number="53"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-54" data-line-number="54"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb325-55" data-line-number="55"> },</a>
+<a class="sourceLine" id="cb325-56" data-line-number="56"> dlItemEnd = {},</a>
+<a class="sourceLine" id="cb325-57" data-line-number="57"> dlDefinitionEnd = {},</a>
+<a class="sourceLine" id="cb325-58" data-line-number="58"> dlEnd = {.},</a>
+<a class="sourceLine" id="cb325-59" data-line-number="59"> },</a>
+<a class="sourceLine" id="cb325-60" data-line-number="60">}</a>
+<a class="sourceLine" id="cb325-61" data-line-number="61">This is a loose definition list</a>
+<a class="sourceLine" id="cb325-62" data-line-number="62"></a>
+<a class="sourceLine" id="cb325-63" data-line-number="63">Coffee</a>
+<a class="sourceLine" id="cb325-64" data-line-number="64"></a>
+<a class="sourceLine" id="cb325-65" data-line-number="65">: black hot drink</a>
+<a class="sourceLine" id="cb325-66" data-line-number="66"></a>
+<a class="sourceLine" id="cb325-67" data-line-number="67">: prepared from roasted coffee beans</a>
+<a class="sourceLine" id="cb325-68" data-line-number="68"></a>
+<a class="sourceLine" id="cb325-69" data-line-number="69">: one of the most traded agricultural commodities in the world</a>
+<a class="sourceLine" id="cb325-70" data-line-number="70"></a>
+<a class="sourceLine" id="cb325-71" data-line-number="71">Milk</a>
+<a class="sourceLine" id="cb325-72" data-line-number="72"></a>
+<a class="sourceLine" id="cb325-73" data-line-number="73">: white cold drink</a>
+<a class="sourceLine" id="cb325-74" data-line-number="74"></a>
+<a class="sourceLine" id="cb325-75" data-line-number="75">: nutrient-rich</a>
+<a class="sourceLine" id="cb325-76" data-line-number="76"></a>
+<a class="sourceLine" id="cb325-77" data-line-number="77">: produced on an industrial scale</a>
+<a class="sourceLine" id="cb325-78" data-line-number="78"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb325-79" data-line-number="79"></a>
+<a class="sourceLine" id="cb325-80" data-line-number="80"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb326"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb326-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight definition list:</p>
+<p><strong>Coffee</strong></p>
+<ul>
+<li>black hot drink,</li>
+<li>prepared from roasted coffee beans, and</li>
+<li>one of the most traded agricultural commodities in the world.</li>
+</ul>
+<p><strong>Milk</strong></p>
+<ul>
+<li>white cold drink,</li>
+<li>nutrient-rich, and</li>
+<li>produced on an industrial scale.</li>
+</ul>
+<p>This is a loose definition list. Coffee is a black hot drink, prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.</p>
+</blockquote>
+<h5 id="context-example-31" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb327"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb327-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb327-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionDefinitionLists{true}</a>
+<a class="sourceLine" id="cb327-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionTightLists{true}</a>
+<a class="sourceLine" id="cb327-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb327-5" data-line-number="5"></a>
+<a class="sourceLine" id="cb327-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-7" data-line-number="7"> :<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-8" data-line-number="8"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-9" data-line-number="9">}</a>
+<a class="sourceLine" id="cb327-10" data-line-number="10"><span class="fu">\def</span>\markdownRendererDlBeginTight{}</a>
+<a class="sourceLine" id="cb327-11" data-line-number="11"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-12" data-line-number="12"> \par{\bf#1}<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-13" data-line-number="13"> \startitemize</a>
+<a class="sourceLine" id="cb327-14" data-line-number="14"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-15" data-line-number="15"> ,</a>
+<a class="sourceLine" id="cb327-16" data-line-number="16"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-17" data-line-number="17"> , and</a>
+<a class="sourceLine" id="cb327-18" data-line-number="18"> \def\markdownRendererDlDefinitionEnd{.}<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-19" data-line-number="19"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-20" data-line-number="20"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-21" data-line-number="21">}</a>
+<a class="sourceLine" id="cb327-22" data-line-number="22"><span class="fu">\def</span>\markdownRendererDlItemEnd{\stopitemize}</a>
+<a class="sourceLine" id="cb327-23" data-line-number="23"><span class="fu">\def</span>\markdownRendererDlDefinitionBegin{\item}</a>
+<a class="sourceLine" id="cb327-24" data-line-number="24"><span class="fu">\def</span>\markdownRendererDlEndTight{}</a>
+<a class="sourceLine" id="cb327-25" data-line-number="25"></a>
+<a class="sourceLine" id="cb327-26" data-line-number="26"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb327-27" data-line-number="27">This is a tight definition list</a>
+<a class="sourceLine" id="cb327-28" data-line-number="28"></a>
+<a class="sourceLine" id="cb327-29" data-line-number="29">Coffee</a>
+<a class="sourceLine" id="cb327-30" data-line-number="30">: black hot drink</a>
+<a class="sourceLine" id="cb327-31" data-line-number="31">: prepared from roasted coffee beans</a>
+<a class="sourceLine" id="cb327-32" data-line-number="32">: one of the most traded agricultural commodities in the world</a>
+<a class="sourceLine" id="cb327-33" data-line-number="33"></a>
+<a class="sourceLine" id="cb327-34" data-line-number="34">Milk</a>
+<a class="sourceLine" id="cb327-35" data-line-number="35">: white cold drink</a>
+<a class="sourceLine" id="cb327-36" data-line-number="36">: nutrient-rich</a>
+<a class="sourceLine" id="cb327-37" data-line-number="37">: produced on an industrial scale</a>
+<a class="sourceLine" id="cb327-38" data-line-number="38"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb327-39" data-line-number="39"></a>
+<a class="sourceLine" id="cb327-40" data-line-number="40"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-41" data-line-number="41"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-42" data-line-number="42">}</a>
+<a class="sourceLine" id="cb327-43" data-line-number="43"><span class="fu">\def</span>\markdownRendererDlBegin{}</a>
+<a class="sourceLine" id="cb327-44" data-line-number="44"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-45" data-line-number="45"> . #1 is a</a>
+<a class="sourceLine" id="cb327-46" data-line-number="46"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-47" data-line-number="47"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-48" data-line-number="48"> ,</a>
+<a class="sourceLine" id="cb327-49" data-line-number="49"> \def\markdownRendererDlDefinitionBegin{, and }<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-50" data-line-number="50"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-51" data-line-number="51"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb327-52" data-line-number="52">}</a>
+<a class="sourceLine" id="cb327-53" data-line-number="53"><span class="fu">\def</span>\markdownRendererDlItemEnd{}</a>
+<a class="sourceLine" id="cb327-54" data-line-number="54"><span class="fu">\def</span>\markdownRendererDlDefinitionEnd{}</a>
+<a class="sourceLine" id="cb327-55" data-line-number="55"><span class="fu">\def</span>\markdownRendererDlEnd{.}</a>
+<a class="sourceLine" id="cb327-56" data-line-number="56"></a>
+<a class="sourceLine" id="cb327-57" data-line-number="57"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb327-58" data-line-number="58">This is a loose definition list</a>
+<a class="sourceLine" id="cb327-59" data-line-number="59"></a>
+<a class="sourceLine" id="cb327-60" data-line-number="60">Coffee</a>
+<a class="sourceLine" id="cb327-61" data-line-number="61"></a>
+<a class="sourceLine" id="cb327-62" data-line-number="62">: black hot drink</a>
+<a class="sourceLine" id="cb327-63" data-line-number="63"></a>
+<a class="sourceLine" id="cb327-64" data-line-number="64">: prepared from roasted coffee beans</a>
+<a class="sourceLine" id="cb327-65" data-line-number="65"></a>
+<a class="sourceLine" id="cb327-66" data-line-number="66">: one of the most traded agricultural commodities in the world</a>
+<a class="sourceLine" id="cb327-67" data-line-number="67"></a>
+<a class="sourceLine" id="cb327-68" data-line-number="68">Milk</a>
+<a class="sourceLine" id="cb327-69" data-line-number="69"></a>
+<a class="sourceLine" id="cb327-70" data-line-number="70">: white cold drink</a>
+<a class="sourceLine" id="cb327-71" data-line-number="71"></a>
+<a class="sourceLine" id="cb327-72" data-line-number="72">: nutrient-rich</a>
+<a class="sourceLine" id="cb327-73" data-line-number="73"></a>
+<a class="sourceLine" id="cb327-74" data-line-number="74">: produced on an industrial scale</a>
+<a class="sourceLine" id="cb327-75" data-line-number="75"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb327-76" data-line-number="76"></a>
+<a class="sourceLine" id="cb327-77" data-line-number="77"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb328"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb328-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a tight definition list:</p>
+<p><strong>Coffee</strong></p>
+<ul>
+<li>black hot drink,</li>
+<li>prepared from roasted coffee beans, and</li>
+<li>one of the most traded agricultural commodities in the world.</li>
+</ul>
+<p><strong>Milk</strong></p>
+<ul>
+<li>white cold drink,</li>
+<li>nutrient-rich, and</li>
+<li>produced on an industrial scale.</li>
+</ul>
+<p>This is a loose definition list. Coffee is a black hot drink, prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.</p>
+</blockquote>
+<h4 id="emphasis-renderers"><span class="header-section-number">2.3.1.13</span> Emphasis Renderers</h4>
+<p>The <code>\markdownRendererEmphasis</code> macro represents an emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.</p>
+<h5 id="plain-tex-example-22" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb329"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb329-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb329-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEmphasis#1{{\it#1}}</a>
+<a class="sourceLine" id="cb329-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererStrongEmphasis#1{{\bf#1}}</a>
+<a class="sourceLine" id="cb329-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb329-5" data-line-number="5">This is *emphasis*.</a>
+<a class="sourceLine" id="cb329-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb329-7" data-line-number="7">This is **strong emphasis**.</a>
+<a class="sourceLine" id="cb329-8" data-line-number="8"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb329-9" data-line-number="9"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb330"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb330-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <em>emphasis</em>.</p>
+<p>This is <strong>strong emphasis</strong>.</p>
+</blockquote>
+<h5 id="latex-example-37" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb331"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb331-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb331-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb331-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb331-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb331-5" data-line-number="5"> emphasis = {<span class="fu">\emph</span>{#1}},</a>
+<a class="sourceLine" id="cb331-6" data-line-number="6"> strongEmphasis = {<span class="fu">\textbf</span>{#1}},</a>
+<a class="sourceLine" id="cb331-7" data-line-number="7"> },</a>
+<a class="sourceLine" id="cb331-8" data-line-number="8">}</a>
+<a class="sourceLine" id="cb331-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb331-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb331-11" data-line-number="11">This is *emphasis*.</a>
+<a class="sourceLine" id="cb331-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb331-13" data-line-number="13">This is **strong emphasis**.</a>
+<a class="sourceLine" id="cb331-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb331-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb332"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb332-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <em>emphasis</em>.</p>
+<p>This is <strong>strong emphasis</strong>.</p>
+</blockquote>
+<h5 id="context-example-32" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb333"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb333-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb333-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEmphasis#1{\emph{#1}}</a>
+<a class="sourceLine" id="cb333-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererStrongEmphasis#1{\bold{#1}}</a>
+<a class="sourceLine" id="cb333-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb333-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb333-6" data-line-number="6">This is *emphasis*.</a>
+<a class="sourceLine" id="cb333-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb333-8" data-line-number="8">This is **strong emphasis**.</a>
+<a class="sourceLine" id="cb333-9" data-line-number="9"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb333-10" data-line-number="10"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb334"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb334-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is <em>emphasis</em>.</p>
+<p>This is <strong>strong emphasis</strong>.</p>
+</blockquote>
+<p>The <code>\markdownRendererStrongEmphasis</code> macro represents a strongly emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.</p>
+<h4 id="block-quote-renderers"><span class="header-section-number">2.3.1.14</span> Block Quote Renderers</h4>
+<p>The <code>\markdownRendererBlockQuoteBegin</code> macro represents the beginning of a block quote. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-23" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb335"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb335-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb335-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererBlockQuoteBegin{<span class="co">%</span></a>
+<a class="sourceLine" id="cb335-3" data-line-number="3"> \begingroup</a>
+<a class="sourceLine" id="cb335-4" data-line-number="4"> \vskip\parindent</a>
+<a class="sourceLine" id="cb335-5" data-line-number="5"> \leftskip=2\parindent</a>
+<a class="sourceLine" id="cb335-6" data-line-number="6"> \parindent=0pt</a>
+<a class="sourceLine" id="cb335-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb335-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererBlockQuoteEnd{<span class="co">%</span></a>
+<a class="sourceLine" id="cb335-9" data-line-number="9"> \par</a>
+<a class="sourceLine" id="cb335-10" data-line-number="10"> \vskip\parindent</a>
+<a class="sourceLine" id="cb335-11" data-line-number="11"> \endgroup</a>
+<a class="sourceLine" id="cb335-12" data-line-number="12">}</a>
+<a class="sourceLine" id="cb335-13" data-line-number="13"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb335-14" data-line-number="14">A quote from William Shakespeare&#39;s King Lear:</a>
+<a class="sourceLine" id="cb335-15" data-line-number="15"></a>
+<a class="sourceLine" id="cb335-16" data-line-number="16">&gt; This is the excellent foppery of the world that when we are</a>
+<a class="sourceLine" id="cb335-17" data-line-number="17">&gt; sick in fortune---often the surfeit of our own behavior---we</a>
+<a class="sourceLine" id="cb335-18" data-line-number="18">&gt; make guilty of our disasters the sun, the moon, and the</a>
+<a class="sourceLine" id="cb335-19" data-line-number="19">&gt; stars [...]</a>
+<a class="sourceLine" id="cb335-20" data-line-number="20"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb335-21" data-line-number="21"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb336"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb336-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A quote from William Shakespeare’s King Lear:</p>
+<blockquote>
+<p>This is the excellent foppery of the world that when we are sick in fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]</p>
+</blockquote>
+</blockquote>
+<h5 id="latex-example-38" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb337"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb337-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb337-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb337-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb337-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb337-5" data-line-number="5"> blockQuoteBegin = {<span class="kw">\begin</span>{<span class="ex">quote</span>}},</a>
+<a class="sourceLine" id="cb337-6" data-line-number="6"> blockQuoteEnd = {<span class="kw">\end</span>{<span class="ex">quote</span>}},</a>
+<a class="sourceLine" id="cb337-7" data-line-number="7"> },</a>
+<a class="sourceLine" id="cb337-8" data-line-number="8">}</a>
+<a class="sourceLine" id="cb337-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb337-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb337-11" data-line-number="11">A quote from William Shakespeare&#39;s King Lear:</a>
+<a class="sourceLine" id="cb337-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb337-13" data-line-number="13">&gt; This is the excellent foppery of the world that when we are</a>
+<a class="sourceLine" id="cb337-14" data-line-number="14">&gt; sick in fortune---often the surfeit of our own behavior---we</a>
+<a class="sourceLine" id="cb337-15" data-line-number="15">&gt; make guilty of our disasters the sun, the moon, and the</a>
+<a class="sourceLine" id="cb337-16" data-line-number="16">&gt; stars [...]</a>
+<a class="sourceLine" id="cb337-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb337-18" data-line-number="18"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb338"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb338-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A quote from William Shakespeare’s King Lear:</p>
+<blockquote>
+<p>This is the excellent foppery of the world that when we are sick in fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]</p>
+</blockquote>
+</blockquote>
+<h5 id="context-example-33" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb339"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb339-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb339-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererBlockQuoteBegin{\startquotation}</a>
+<a class="sourceLine" id="cb339-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererBlockQuoteEnd{\stopquotation}</a>
+<a class="sourceLine" id="cb339-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb339-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb339-6" data-line-number="6">A quote from William Shakespeare&#39;s King Lear:</a>
+<a class="sourceLine" id="cb339-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb339-8" data-line-number="8">&gt; This is the excellent foppery of the world that when we are</a>
+<a class="sourceLine" id="cb339-9" data-line-number="9">&gt; sick in fortune---often the surfeit of our own behavior---we</a>
+<a class="sourceLine" id="cb339-10" data-line-number="10">&gt; make guilty of our disasters the sun, the moon, and the</a>
+<a class="sourceLine" id="cb339-11" data-line-number="11">&gt; stars [...]</a>
+<a class="sourceLine" id="cb339-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb339-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb340"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb340-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>A quote from William Shakespeare’s King Lear:</p>
+<blockquote>
+<p>This is the excellent foppery of the world that when we are sick in fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]</p>
+</blockquote>
+</blockquote>
+<p>The <code>\markdownRendererBlockQuoteEnd</code> macro represents the end of a block quote. The macro receives no arguments.</p>
+<h4 id="code-block-renderers"><span class="header-section-number">2.3.1.15</span> Code Block Renderers</h4>
+<p>The <code>\markdownRendererInputVerbatim</code> macro represents a code block. The macro receives a single argument that corresponds to the filename of a file contaning the code block contents.</p>
+<p>The <code>\markdownRendererInputFencedCode</code> macro represents a fenced code block. This macro will only be produced, when the <strong><code>fencedCode</code></strong> option is <code>true</code>. The macro receives two arguments that correspond to the filename of a file contaning the code block contents and to the code fence infostring.</p>
+<h5 id="latex-example-39" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb341"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb341-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb341-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">verbatim</span>}</a>
+<a class="sourceLine" id="cb341-3" data-line-number="3"><span class="bu">\usepackage</span>[hyphens]{<span class="ex">url</span>}</a>
+<a class="sourceLine" id="cb341-4" data-line-number="4"><span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb341-5" data-line-number="5"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb341-6" data-line-number="6"> renderers = {</a>
+<a class="sourceLine" id="cb341-7" data-line-number="7"> interblockSeparator = {</a>
+<a class="sourceLine" id="cb341-8" data-line-number="8"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-9" data-line-number="9"> \par</a>
+<a class="sourceLine" id="cb341-10" data-line-number="10"> \def\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-11" data-line-number="11"> \def\markdownRendererInterblockSeparator{<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-12" data-line-number="12"> \par</a>
+<a class="sourceLine" id="cb341-13" data-line-number="13"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-14" data-line-number="14"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-15" data-line-number="15"> }<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-16" data-line-number="16"> },</a>
+<a class="sourceLine" id="cb341-17" data-line-number="17"> inputVerbatim = {</a>
+<a class="sourceLine" id="cb341-18" data-line-number="18"> is contained in file <span class="fu">\url</span>{#1}:<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-19" data-line-number="19"> <span class="fu">\verbatiminput</span>{#1}<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-20" data-line-number="20"> },</a>
+<a class="sourceLine" id="cb341-21" data-line-number="21"> inputFencedCode = {</a>
+<a class="sourceLine" id="cb341-22" data-line-number="22"> in #2 <span class="fu">\markdownRendererInputVerbatim</span>{#1}<span class="co">%</span></a>
+<a class="sourceLine" id="cb341-23" data-line-number="23"> },</a>
+<a class="sourceLine" id="cb341-24" data-line-number="24"> },</a>
+<a class="sourceLine" id="cb341-25" data-line-number="25">}</a>
+<a class="sourceLine" id="cb341-26" data-line-number="26"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb341-27" data-line-number="27"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb341-28" data-line-number="28">The following code</a>
+<a class="sourceLine" id="cb341-29" data-line-number="29"></a>
+<a class="sourceLine" id="cb341-30" data-line-number="30"> def foo(bar):</a>
+<a class="sourceLine" id="cb341-31" data-line-number="31"> if len(bar) &lt;= 1:</a>
+<a class="sourceLine" id="cb341-32" data-line-number="32"> return bar[0]</a>
+<a class="sourceLine" id="cb341-33" data-line-number="33"> elif len(bar) == 2:</a>
+<a class="sourceLine" id="cb341-34" data-line-number="34"> return sorted(bar)</a>
+<a class="sourceLine" id="cb341-35" data-line-number="35"> else:</a>
+<a class="sourceLine" id="cb341-36" data-line-number="36"> baz = len(bar) // 2</a>
+<a class="sourceLine" id="cb341-37" data-line-number="37"> return foo(bar[baz:], bar[:baz])</a>
+<a class="sourceLine" id="cb341-38" data-line-number="38"></a>
+<a class="sourceLine" id="cb341-39" data-line-number="39">The following code</a>
+<a class="sourceLine" id="cb341-40" data-line-number="40"></a>
+<a class="sourceLine" id="cb341-41" data-line-number="41">~~~ Python</a>
+<a class="sourceLine" id="cb341-42" data-line-number="42">&gt;&gt;&gt; foo([4, 2, 1, 3])</a>
+<a class="sourceLine" id="cb341-43" data-line-number="43">[1, 2, 3, 4]</a>
+<a class="sourceLine" id="cb341-44" data-line-number="44">~~~~~~~~~~</a>
+<a class="sourceLine" id="cb341-45" data-line-number="45"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb341-46" data-line-number="46"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb342"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb342-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text except for the filename, which may differ:</p>
+<blockquote>
+<p>The following code is contained in file <code>./_markdown_document/882453149edcf288976647f6fe147ada.verbatim</code>:</p>
+<div class="sourceCode" id="cb343"><pre class="sourceCode py"><code class="sourceCode python"><a class="sourceLine" id="cb343-1" data-line-number="1"><span class="kw">def</span> foo(bar):</a>
+<a class="sourceLine" id="cb343-2" data-line-number="2"> <span class="cf">if</span> <span class="bu">len</span>(bar) <span class="op">&lt;=</span> <span class="dv">1</span>:</a>
+<a class="sourceLine" id="cb343-3" data-line-number="3"> <span class="cf">return</span> bar[:<span class="dv">1</span>]</a>
+<a class="sourceLine" id="cb343-4" data-line-number="4"> <span class="cf">elif</span> <span class="bu">len</span>(bar) <span class="op">==</span> <span class="dv">2</span>:</a>
+<a class="sourceLine" id="cb343-5" data-line-number="5"> <span class="cf">return</span> <span class="bu">sorted</span>(bar)</a>
+<a class="sourceLine" id="cb343-6" data-line-number="6"> <span class="cf">else</span>:</a>
+<a class="sourceLine" id="cb343-7" data-line-number="7"> baz <span class="op">=</span> bar[<span class="bu">len</span>(bar) <span class="op">//</span> <span class="dv">2</span>]</a>
+<a class="sourceLine" id="cb343-8" data-line-number="8"> <span class="cf">return</span> (</a>
+<a class="sourceLine" id="cb343-9" data-line-number="9"> foo([qux <span class="cf">for</span> qux <span class="kw">in</span> bar <span class="cf">if</span> qux <span class="op">&lt;</span> baz]) <span class="op">+</span> [baz] <span class="op">+</span></a>
+<a class="sourceLine" id="cb343-10" data-line-number="10"> foo([qux <span class="cf">for</span> qux <span class="kw">in</span> bar <span class="cf">if</span> qux <span class="op">&gt;</span> baz])</a>
+<a class="sourceLine" id="cb343-11" data-line-number="11"> )</a></code></pre></div>
+<p>The following code in Python contained in file <code>./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim</code>:</p>
+<div class="sourceCode" id="cb344"><pre class="sourceCode py"><code class="sourceCode python"><a class="sourceLine" id="cb344-1" data-line-number="1"><span class="op">&gt;&gt;&gt;</span> foo([<span class="dv">4</span>, <span class="dv">2</span>, <span class="dv">1</span>, <span class="dv">3</span>])</a>
+<a class="sourceLine" id="cb344-2" data-line-number="2">[<span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>]</a></code></pre></div>
+</blockquote>
+<h4 id="heading-renderers"><span class="header-section-number">2.3.1.16</span> Heading Renderers</h4>
+<p>The <code>\markdownRendererHeadingOne</code> macro represents a first level heading. The macro receives a single argument that corresponds to the heading text.</p>
+<p>The <code>\markdownRendererHeadingTwo</code> macro represents a second level heading. The macro receives a single argument that corresponds to the heading text.</p>
+<p>The <code>\markdownRendererHeadingThree</code> macro represents a third level heading. The macro receives a single argument that corresponds to the heading text.</p>
+<p>The <code>\markdownRendererHeadingFour</code> macro represents a fourth level heading. The macro receives a single argument that corresponds to the heading text.</p>
+<p>The <code>\markdownRendererHeadingFive</code> macro represents a fifth level heading. The macro receives a single argument that corresponds to the heading text.</p>
+<p>The <code>\markdownRendererHeadingSix</code> macro represents a sixth level heading. The macro receives a single argument that corresponds to the heading text.</p>
+<h5 id="plain-tex-example-24" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb345"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb345-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb345-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a>
+<a class="sourceLine" id="cb345-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne{1}</a>
+<a class="sourceLine" id="cb345-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererHeadingTwo{2}</a>
+<a class="sourceLine" id="cb345-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererHeadingThree{3}</a>
+<a class="sourceLine" id="cb345-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererHeadingFour{4}</a>
+<a class="sourceLine" id="cb345-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererHeadingFive{5}</a>
+<a class="sourceLine" id="cb345-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererHeadingSix{6}</a>
+<a class="sourceLine" id="cb345-9" data-line-number="9"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb345-10" data-line-number="10">######</a>
+<a class="sourceLine" id="cb345-11" data-line-number="11">#####</a>
+<a class="sourceLine" id="cb345-12" data-line-number="12">#####</a>
+<a class="sourceLine" id="cb345-13" data-line-number="13">###</a>
+<a class="sourceLine" id="cb345-14" data-line-number="14">######</a>
+<a class="sourceLine" id="cb345-15" data-line-number="15"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb345-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb346"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb346-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>65536</p>
+</blockquote>
+<h5 id="latex-example-40" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb347"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb347-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb347-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb347-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb347-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb347-5" data-line-number="5"> interblockSeparator = {},</a>
+<a class="sourceLine" id="cb347-6" data-line-number="6"> headingOne = 1,</a>
+<a class="sourceLine" id="cb347-7" data-line-number="7"> headingTwo = 2,</a>
+<a class="sourceLine" id="cb347-8" data-line-number="8"> headingThree = 3,</a>
+<a class="sourceLine" id="cb347-9" data-line-number="9"> headingFour = 4,</a>
+<a class="sourceLine" id="cb347-10" data-line-number="10"> headingFive = 5,</a>
+<a class="sourceLine" id="cb347-11" data-line-number="11"> headingSix = 6,</a>
+<a class="sourceLine" id="cb347-12" data-line-number="12"> },</a>
+<a class="sourceLine" id="cb347-13" data-line-number="13">}</a>
+<a class="sourceLine" id="cb347-14" data-line-number="14"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb347-15" data-line-number="15"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb347-16" data-line-number="16">######</a>
+<a class="sourceLine" id="cb347-17" data-line-number="17">#####</a>
+<a class="sourceLine" id="cb347-18" data-line-number="18">#####</a>
+<a class="sourceLine" id="cb347-19" data-line-number="19">###</a>
+<a class="sourceLine" id="cb347-20" data-line-number="20">######</a>
+<a class="sourceLine" id="cb347-21" data-line-number="21"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb347-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb348"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb348-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>65536</p>
+</blockquote>
+<h5 id="context-example-34" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb349"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb349-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb349-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a>
+<a class="sourceLine" id="cb349-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne{1}</a>
+<a class="sourceLine" id="cb349-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererHeadingTwo{2}</a>
+<a class="sourceLine" id="cb349-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererHeadingThree{3}</a>
+<a class="sourceLine" id="cb349-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererHeadingFour{4}</a>
+<a class="sourceLine" id="cb349-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererHeadingFive{5}</a>
+<a class="sourceLine" id="cb349-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererHeadingSix{6}</a>
+<a class="sourceLine" id="cb349-9" data-line-number="9"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb349-10" data-line-number="10"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb349-11" data-line-number="11">######</a>
+<a class="sourceLine" id="cb349-12" data-line-number="12">#####</a>
+<a class="sourceLine" id="cb349-13" data-line-number="13">#####</a>
+<a class="sourceLine" id="cb349-14" data-line-number="14">###</a>
+<a class="sourceLine" id="cb349-15" data-line-number="15">######</a>
+<a class="sourceLine" id="cb349-16" data-line-number="16"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb349-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb350"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb350-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>65536</p>
+</blockquote>
+<h4 id="horizontal-rule-renderer"><span class="header-section-number">2.3.1.17</span> Horizontal Rule Renderer</h4>
+<p>The <code>\markdownRendererHorizontalRule</code> macro represents a horizontal rule. The macro receives no arguments.</p>
+<h5 id="plain-tex-example-25" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb351"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb351-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb351-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererHorizontalRule{\vfil\break}</a>
+<a class="sourceLine" id="cb351-3" data-line-number="3"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb351-4" data-line-number="4">This is the first page.</a>
+<a class="sourceLine" id="cb351-5" data-line-number="5"></a>
+<a class="sourceLine" id="cb351-6" data-line-number="6">***</a>
+<a class="sourceLine" id="cb351-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb351-8" data-line-number="8">This is the second page.</a>
+<a class="sourceLine" id="cb351-9" data-line-number="9"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb351-10" data-line-number="10"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb352"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb352-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is the first page.</p>
+<hr />
+<p>This is the second page.</p>
+</blockquote>
+<h5 id="latex-example-41" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb353"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb353-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb353-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb353-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb353-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb353-5" data-line-number="5"> horizontalRule = <span class="fu">\newpage</span>,</a>
+<a class="sourceLine" id="cb353-6" data-line-number="6"> },</a>
+<a class="sourceLine" id="cb353-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb353-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb353-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb353-10" data-line-number="10">This is the first page.</a>
+<a class="sourceLine" id="cb353-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb353-12" data-line-number="12">***</a>
+<a class="sourceLine" id="cb353-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb353-14" data-line-number="14">This is the second page.</a>
+<a class="sourceLine" id="cb353-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb353-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb354"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb354-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is the first page.</p>
+<hr />
+<p>This is the second page.</p>
+</blockquote>
+<h5 id="context-example-35" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb355"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb355-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb355-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererHorizontalRule{\page[yes]}</a>
+<a class="sourceLine" id="cb355-3" data-line-number="3"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb355-4" data-line-number="4"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb355-5" data-line-number="5">This is the first page.</a>
+<a class="sourceLine" id="cb355-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb355-7" data-line-number="7">***</a>
+<a class="sourceLine" id="cb355-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb355-9" data-line-number="9">This is the second page.</a>
+<a class="sourceLine" id="cb355-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb355-11" data-line-number="11"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb356"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb356-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is the first page.</p>
+<hr />
+<p>This is the second page.</p>
+</blockquote>
+<h4 id="footnote-renderer"><span class="header-section-number">2.3.1.18</span> Footnote Renderer</h4>
+<p>The <code>\markdownRendererFootnote</code> macro represents a footnote. This macro will only be produced, when the <strong><code>footnotes</code></strong> option is <code>true</code>. The macro receives a single argument that corresponds to the footnote text.</p>
+<h5 id="plain-tex-example-26" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb357"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb357-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb357-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a>
+<a class="sourceLine" id="cb357-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererFootnote#1{ (and \lowercase{#1})}</a>
+<a class="sourceLine" id="cb357-4" data-line-number="4"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb357-5" data-line-number="5">This is some text[^1] and this is some other text[^2].</a>
+<a class="sourceLine" id="cb357-6" data-line-number="6"></a>
+<a class="sourceLine" id="cb357-7" data-line-number="7"> [^1]: this is a footnote</a>
+<a class="sourceLine" id="cb357-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb357-9" data-line-number="9"> [^2]: this is some other footnote</a>
+<a class="sourceLine" id="cb357-10" data-line-number="10"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb357-11" data-line-number="11"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb358"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb358-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is some text (and this is a footnote) and this is some other text (and this is some other footnote).</p>
+</blockquote>
+<h5 id="latex-example-42" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb359"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb359-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb359-2" data-line-number="2"><span class="bu">\usepackage</span>[footnotes]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb359-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb359-4" data-line-number="4"> renderers = {</a>
+<a class="sourceLine" id="cb359-5" data-line-number="5"> footnote = { (and <span class="fu">\MakeLowercase</span>{#1})},</a>
+<a class="sourceLine" id="cb359-6" data-line-number="6"> },</a>
+<a class="sourceLine" id="cb359-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb359-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb359-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb359-10" data-line-number="10">This is some text[^1] and this is some other text[^2].</a>
+<a class="sourceLine" id="cb359-11" data-line-number="11"></a>
+<a class="sourceLine" id="cb359-12" data-line-number="12"> [^1]: this is a footnote</a>
+<a class="sourceLine" id="cb359-13" data-line-number="13"></a>
+<a class="sourceLine" id="cb359-14" data-line-number="14"> [^2]: this is some other footnote</a>
+<a class="sourceLine" id="cb359-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb359-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb360"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb360-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is some text (and this is a footnote) and this is some other text (and this is some other footnote).</p>
+</blockquote>
+<h5 id="context-example-36" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb361"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb361-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb361-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a>
+<a class="sourceLine" id="cb361-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererFootnote#1{ (and \lowercase{#1})}</a>
+<a class="sourceLine" id="cb361-4" data-line-number="4"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb361-5" data-line-number="5"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb361-6" data-line-number="6">This is some text[^1] and this is some other text[^2].</a>
+<a class="sourceLine" id="cb361-7" data-line-number="7"></a>
+<a class="sourceLine" id="cb361-8" data-line-number="8"> [^1]: this is a footnote</a>
+<a class="sourceLine" id="cb361-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb361-10" data-line-number="10"> [^2]: this is some other footnote</a>
+<a class="sourceLine" id="cb361-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb361-12" data-line-number="12"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb362"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb362-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is some text (and this is a footnote) and this is some other text (and this is some other footnote).</p>
+</blockquote>
+<h4 id="parenthesized-citations-renderer"><span class="header-section-number">2.3.1.19</span> Parenthesized Citations Renderer</h4>
+<p>The <code>\markdownRendererCite</code> macro represents a string of one or more parenthetical citations. This macro will only be produced, when the <strong><code>citations</code></strong> option is <code>true</code>. The macro receives the parameter <code>{</code>⟨<em>number of citations</em>⟩<code>}</code> followed by <code>{</code>⟨<em>prenote</em>⟩<code>}{</code>⟨<em>postnote</em>⟩<code>}{</code>⟨<em>name</em>⟩<code>}</code> repeated ⟨<em>number of citations</em>⟩ times. The ⟨<em>suppress author</em>⟩ parameter is either the token <code>-</code>, when the author’s name is to be suppressed, or <code>+</code> otherwise.</p>
+<h5 id="latex-example-43" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb363"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb363-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb363-2" data-line-number="2"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb363-3" data-line-number="3"><span class="fu">\newcount\citationsCounter</span></a>
+<a class="sourceLine" id="cb363-4" data-line-number="4"><span class="fu">\newcount\citationsTotal</span></a>
+<a class="sourceLine" id="cb363-5" data-line-number="5"><span class="fu">\makeatletter</span></a>
+<a class="sourceLine" id="cb363-6" data-line-number="6"><span class="fu">\def</span>\citations#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-7" data-line-number="7"> a parenthesized citation \emph{#4}</a>
+<a class="sourceLine" id="cb363-8" data-line-number="8"> \advance\citationsCounter by 1\relax</a>
+<a class="sourceLine" id="cb363-9" data-line-number="9"> \ifx\relax#2\relax</a>
+<a class="sourceLine" id="cb363-10" data-line-number="10"> \ifx\relax#3\relax\else</a>
+<a class="sourceLine" id="cb363-11" data-line-number="11"> with a postfix \emph{#3}<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-12" data-line-number="12"> \fi</a>
+<a class="sourceLine" id="cb363-13" data-line-number="13"> \else</a>
+<a class="sourceLine" id="cb363-14" data-line-number="14"> with a prefix \emph{#2}<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-15" data-line-number="15"> \ifx\relax#3\relax\else</a>
+<a class="sourceLine" id="cb363-16" data-line-number="16"> \ and a postfix \emph{#3}<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-17" data-line-number="17"> \fi</a>
+<a class="sourceLine" id="cb363-18" data-line-number="18"> \fi</a>
+<a class="sourceLine" id="cb363-19" data-line-number="19"> \ifnum\citationsCounter&gt;\citationsTotal\relax</a>
+<a class="sourceLine" id="cb363-20" data-line-number="20"> .<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-21" data-line-number="21"> \expandafter\@gobble</a>
+<a class="sourceLine" id="cb363-22" data-line-number="22"> \else</a>
+<a class="sourceLine" id="cb363-23" data-line-number="23"> , and</a>
+<a class="sourceLine" id="cb363-24" data-line-number="24"> \fi\citations}</a>
+<a class="sourceLine" id="cb363-25" data-line-number="25"><span class="fu">\makeatother</span></a>
+<a class="sourceLine" id="cb363-26" data-line-number="26"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb363-27" data-line-number="27"> renderers = {</a>
+<a class="sourceLine" id="cb363-28" data-line-number="28"> cite = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-29" data-line-number="29"> <span class="fu">\citationsCounter</span>=1<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-30" data-line-number="30"> <span class="fu">\citationsTotal</span>=#1<span class="co">%</span></a>
+<a class="sourceLine" id="cb363-31" data-line-number="31"> This is</a>
+<a class="sourceLine" id="cb363-32" data-line-number="32"> <span class="fu">\expandafter\citations</span></a>
+<a class="sourceLine" id="cb363-33" data-line-number="33"> },</a>
+<a class="sourceLine" id="cb363-34" data-line-number="34"> },</a>
+<a class="sourceLine" id="cb363-35" data-line-number="35">}</a>
+<a class="sourceLine" id="cb363-36" data-line-number="36"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb363-37" data-line-number="37"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb363-38" data-line-number="38">[see @abrahams90, pp. 12; @eijkhout91, pp. 34]</a>
+<a class="sourceLine" id="cb363-39" data-line-number="39"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb363-40" data-line-number="40"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb364"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb364-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a parenthesized citation <em>abrahams90</em> with a prefix see and a postfix <em>pp. &gt; 12</em>, and a citation <em>eijkhout91</em> with a postfix <em>pp. 34</em>.</p>
+</blockquote>
+<h4 id="text-citations-renderer"><span class="header-section-number">2.3.1.20</span> Text Citations Renderer</h4>
+<p>The <code>\markdownRendererTextCite</code> macro represents a string of one or more text citations. This macro will only be produced, when the <strong><code>citations</code></strong> option is <code>true</code>. The macro receives parameters in the same format as the <code>\markdownRendererCite</code> macro.</p>
+<h5 id="latex-example-44" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb365"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb365-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb365-2" data-line-number="2"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb365-3" data-line-number="3"><span class="fu">\newcount\citationsCounter</span></a>
+<a class="sourceLine" id="cb365-4" data-line-number="4"><span class="fu">\newcount\citationsTotal</span></a>
+<a class="sourceLine" id="cb365-5" data-line-number="5"><span class="fu">\makeatletter</span></a>
+<a class="sourceLine" id="cb365-6" data-line-number="6"><span class="fu">\def</span>\citations#1#2#3#4{<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-7" data-line-number="7"> a text citation \emph{#4}</a>
+<a class="sourceLine" id="cb365-8" data-line-number="8"> \advance\citationsCounter by 1\relax</a>
+<a class="sourceLine" id="cb365-9" data-line-number="9"> \ifx\relax#2\relax</a>
+<a class="sourceLine" id="cb365-10" data-line-number="10"> \ifx\relax#3\relax\else</a>
+<a class="sourceLine" id="cb365-11" data-line-number="11"> with a postfix \emph{#3}<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-12" data-line-number="12"> \fi</a>
+<a class="sourceLine" id="cb365-13" data-line-number="13"> \else</a>
+<a class="sourceLine" id="cb365-14" data-line-number="14"> with a prefix \emph{#2}<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-15" data-line-number="15"> \ifx\relax#3\relax\else</a>
+<a class="sourceLine" id="cb365-16" data-line-number="16"> \ and a postfix \emph{#3}<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-17" data-line-number="17"> \fi</a>
+<a class="sourceLine" id="cb365-18" data-line-number="18"> \fi</a>
+<a class="sourceLine" id="cb365-19" data-line-number="19"> \ifnum\citationsCounter&gt;\citationsTotal\relax</a>
+<a class="sourceLine" id="cb365-20" data-line-number="20"> .<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-21" data-line-number="21"> \expandafter\@gobble</a>
+<a class="sourceLine" id="cb365-22" data-line-number="22"> \else</a>
+<a class="sourceLine" id="cb365-23" data-line-number="23"> , and</a>
+<a class="sourceLine" id="cb365-24" data-line-number="24"> \fi\citations}</a>
+<a class="sourceLine" id="cb365-25" data-line-number="25"><span class="fu">\makeatother</span></a>
+<a class="sourceLine" id="cb365-26" data-line-number="26"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb365-27" data-line-number="27"> renderers = {</a>
+<a class="sourceLine" id="cb365-28" data-line-number="28"> textCite = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-29" data-line-number="29"> <span class="fu">\citationsCounter</span>=1<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-30" data-line-number="30"> <span class="fu">\citationsTotal</span>=#1<span class="co">%</span></a>
+<a class="sourceLine" id="cb365-31" data-line-number="31"> This is</a>
+<a class="sourceLine" id="cb365-32" data-line-number="32"> <span class="fu">\expandafter\citations</span></a>
+<a class="sourceLine" id="cb365-33" data-line-number="33"> },</a>
+<a class="sourceLine" id="cb365-34" data-line-number="34"> },</a>
+<a class="sourceLine" id="cb365-35" data-line-number="35">}</a>
+<a class="sourceLine" id="cb365-36" data-line-number="36"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb365-37" data-line-number="37"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb365-38" data-line-number="38">@abrahams90 [pp. 12; also @eijkhout91]</a>
+<a class="sourceLine" id="cb365-39" data-line-number="39"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb365-40" data-line-number="40"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb366"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb366-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a text citation <em>abrahams90</em> with a postfix <em>pp. 12</em>, and a citation <em>eijkhout91</em> with a prefix <em>also</em>.</p>
+</blockquote>
+<h4 id="table-renderer"><span class="header-section-number">2.3.1.21</span> Table Renderer</h4>
+<p>The <code>\markdownRendererTable</code> macro represents a table. This macro will only be produced, when the <strong><code>pipeTables</code></strong> option is <code>true</code>. The macro receives the parameters <code>{</code>⟨<em>caption</em>⟩<code>}{</code>⟨<em>number of rows</em>⟩<code>}{</code>⟨<em>number of columns</em>⟩<code>}</code> followed by <code>{</code>⟨<em>alignments</em>⟩<code>}</code> and then by <code>{</code>⟨<em>row</em>⟩<code>}</code> repeated ⟨<em>number of rows</em>⟩ times, where ⟨<em>row</em>⟩ is <code>{</code>⟨<em>column</em>⟩<code>}</code> repeated ⟨<em>number of columns</em>⟩ times, ⟨<em>alignments</em>⟩ is ⟨<em>alignment</em>⟩ repeated ⟨<em>number of columns</em>⟩ times, and ⟨<em>alignment</em>⟩ is one of the following:</p>
+<ul>
+<li><code>d</code> – The corresponding column has an unspecified (default) alignment.</li>
+<li><code>l</code> – The corresponding column is left-aligned.</li>
+<li><code>c</code> – The corresponding column is centered.</li>
+<li><code>r</code> – The corresponding column is right-aligned.</li>
+</ul>
+<h5 id="latex-example-45" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb367"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb367-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb367-2" data-line-number="2"><span class="bu">\usepackage</span>[pipeTables, tableCaptions]{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb367-3" data-line-number="3"><span class="fu">\newcount\rowCounter</span></a>
+<a class="sourceLine" id="cb367-4" data-line-number="4"><span class="fu">\newcount\columnCounter</span></a>
+<a class="sourceLine" id="cb367-5" data-line-number="5"><span class="fu">\makeatletter</span></a>
+<a class="sourceLine" id="cb367-6" data-line-number="6"><span class="fu">\def</span>\processRow#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-7" data-line-number="7"> \columnCounter=1<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-8" data-line-number="8"> \ifnum\rowCounter=0\relax</a>
+<a class="sourceLine" id="cb367-9" data-line-number="9"> As for the alignment,</a>
+<a class="sourceLine" id="cb367-10" data-line-number="10"> \else</a>
+<a class="sourceLine" id="cb367-11" data-line-number="11"> In row \the\rowCounter,</a>
+<a class="sourceLine" id="cb367-12" data-line-number="12"> \fi</a>
+<a class="sourceLine" id="cb367-13" data-line-number="13"> \processColumn#1</a>
+<a class="sourceLine" id="cb367-14" data-line-number="14"> \advance\rowCounter by 1\relax</a>
+<a class="sourceLine" id="cb367-15" data-line-number="15"> \ifnum\rowCounter&gt;\rowTotal\relax</a>
+<a class="sourceLine" id="cb367-16" data-line-number="16"> \expandafter\@gobble</a>
+<a class="sourceLine" id="cb367-17" data-line-number="17"> \fi\processRow}<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-18" data-line-number="18"><span class="fu">\def</span>\processColumn#1{<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-19" data-line-number="19"> column number \the\columnCounter{}</a>
+<a class="sourceLine" id="cb367-20" data-line-number="20"> \ifnum\rowCounter=0\relax</a>
+<a class="sourceLine" id="cb367-21" data-line-number="21"> \if#1d{}has default alignment\fi</a>
+<a class="sourceLine" id="cb367-22" data-line-number="22"> \if#1l{}is left-aligned\fi</a>
+<a class="sourceLine" id="cb367-23" data-line-number="23"> \if#1c{}is centered\fi</a>
+<a class="sourceLine" id="cb367-24" data-line-number="24"> \if#1r{}is right-aligned\fi</a>
+<a class="sourceLine" id="cb367-25" data-line-number="25"> \else</a>
+<a class="sourceLine" id="cb367-26" data-line-number="26"> says \emph{#1}<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-27" data-line-number="27"> \fi</a>
+<a class="sourceLine" id="cb367-28" data-line-number="28"> \advance\columnCounter by 1\relax</a>
+<a class="sourceLine" id="cb367-29" data-line-number="29"> \ifnum\columnCounter&lt;\columnTotal\relax, \fi</a>
+<a class="sourceLine" id="cb367-30" data-line-number="30"> \ifnum\columnCounter=\columnTotal\relax, and \fi</a>
+<a class="sourceLine" id="cb367-31" data-line-number="31"> \ifnum\columnCounter&gt;\columnTotal\relax</a>
+<a class="sourceLine" id="cb367-32" data-line-number="32"> .\expandafter\@gobble</a>
+<a class="sourceLine" id="cb367-33" data-line-number="33"> \fi\processColumn}<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-34" data-line-number="34"><span class="fu">\makeatother</span></a>
+<a class="sourceLine" id="cb367-35" data-line-number="35"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb367-36" data-line-number="36"> renderers = {</a>
+<a class="sourceLine" id="cb367-37" data-line-number="37"> table = {<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-38" data-line-number="38"> This is a table with caption <span class="fu">\emph</span>{#1} that is #3 colums wide</a>
+<a class="sourceLine" id="cb367-39" data-line-number="39"> and #2 rows long.</a>
+<a class="sourceLine" id="cb367-40" data-line-number="40"> <span class="fu">\rowCounter</span>=0<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-41" data-line-number="41"> <span class="fu">\def</span>\rowTotal{#2}<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-42" data-line-number="42"> <span class="fu">\def</span>\columnTotal{#3}<span class="co">%</span></a>
+<a class="sourceLine" id="cb367-43" data-line-number="43"> <span class="fu">\processRow</span></a>
+<a class="sourceLine" id="cb367-44" data-line-number="44"> },</a>
+<a class="sourceLine" id="cb367-45" data-line-number="45"> },</a>
+<a class="sourceLine" id="cb367-46" data-line-number="46">}</a>
+<a class="sourceLine" id="cb367-47" data-line-number="47"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb367-48" data-line-number="48"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb367-49" data-line-number="49">| Right | Left | Default | Center |</a>
+<a class="sourceLine" id="cb367-50" data-line-number="50">|------:|:-----|---------|:------:|</a>
+<a class="sourceLine" id="cb367-51" data-line-number="51">| 12 | 12 | 12 | 12 |</a>
+<a class="sourceLine" id="cb367-52" data-line-number="52">| 123 | 123 | 123 | 123 |</a>
+<a class="sourceLine" id="cb367-53" data-line-number="53">| 1 | 1 | 1 | 1 |</a>
+<a class="sourceLine" id="cb367-54" data-line-number="54"></a>
+<a class="sourceLine" id="cb367-55" data-line-number="55"> : Demonstration of pipe table syntax</a>
+<a class="sourceLine" id="cb367-56" data-line-number="56"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb367-57" data-line-number="57"><span class="kw">\end</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb367-58" data-line-number="58"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb367-59" data-line-number="59"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb368"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb368-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>This is a table with caption <em>Demonstration of pipe table syntax</em> that is 4 colums wide and 4 rows long. As for the alignment, column number 1 is right-aligned, column number 2 is left-aligned, column number 3 has default alignment, and column number 4 is centered. In row 1, column number 1 says <em>Right</em>, column number 2 says <em>Left</em>, column number 3 says <em>Default</em>, and column number 4 says <em>Center</em>. In row 2, column number 1 says <em>12</em>, column number 2 says <em>12</em>, column number 3 says <em>12</em>, and column number 4 says <em>12</em>. In row 3, column number 1 says <em>123</em>, column number 2 says <em>123</em>, column number 3 says <em>123</em>, and column number 4 says <em>123</em>. In row 4, column number 1 says <em>1</em>, column number 2 says <em>1</em>, column number 3 says <em>1</em>, and column number 4 says <em>1</em>.</p>
+</blockquote>
+<h3 id="token-renderer-prototypes"><span class="header-section-number">2.3.2</span> Token Renderer Prototypes</h3>
+<p>By default, token renderers point to package-defined <span class="tex">T<sub>e</sub>X</span> macros, further referred to as <em>prototypes</em>, which provide useful default definitions.</p>
+<h5 id="plain-tex-example-27" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb369"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb369-1" data-line-number="1"><span class="fu">\input</span> markdown</a>
+<a class="sourceLine" id="cb369-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTildePrototype{<span class="co">%</span></a>
+<a class="sourceLine" id="cb369-3" data-line-number="3"> Packages can specify token renderer prototypes.<span class="co">%</span></a>
+<a class="sourceLine" id="cb369-4" data-line-number="4">}</a>
+<a class="sourceLine" id="cb369-5" data-line-number="5"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb369-6" data-line-number="6">~</a>
+<a class="sourceLine" id="cb369-7" data-line-number="7"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb369-8" data-line-number="8"></a>
+<a class="sourceLine" id="cb369-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererTilde{<span class="co">%</span></a>
+<a class="sourceLine" id="cb369-10" data-line-number="10"> User-defined token renderers take precedence.<span class="co">%</span></a>
+<a class="sourceLine" id="cb369-11" data-line-number="11">}</a>
+<a class="sourceLine" id="cb369-12" data-line-number="12"><span class="fu">\markdownBegin</span></a>
+<a class="sourceLine" id="cb369-13" data-line-number="13">~</a>
+<a class="sourceLine" id="cb369-14" data-line-number="14"><span class="fu">\markdownEnd</span></a>
+<a class="sourceLine" id="cb369-15" data-line-number="15"><span class="fu">\bye</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb370"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb370-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Packages can specify token renderer prototypes.</p>
+<p>User-defined token renderers take precedence.</p>
+</blockquote>
+<h5 id="latex-example-46" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb371"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb371-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a>
+<a class="sourceLine" id="cb371-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb371-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a>
+<a class="sourceLine" id="cb371-4" data-line-number="4"> rendererPrototypes = {</a>
+<a class="sourceLine" id="cb371-5" data-line-number="5"> tilde = {Packages can specify token renderer prototypes.},</a>
+<a class="sourceLine" id="cb371-6" data-line-number="6"> },</a>
+<a class="sourceLine" id="cb371-7" data-line-number="7">}</a>
+<a class="sourceLine" id="cb371-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a>
+<a class="sourceLine" id="cb371-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb371-10" data-line-number="10">~</a>
+<a class="sourceLine" id="cb371-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a>
+<a class="sourceLine" id="cb371-12" data-line-number="12"></a>
+<a class="sourceLine" id="cb371-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a>
+<a class="sourceLine" id="cb371-14" data-line-number="14"> renderers = {</a>
+<a class="sourceLine" id="cb371-15" data-line-number="15"> tilde = {User-defined token renderers take precedence.},</a>
+<a class="sourceLine" id="cb371-16" data-line-number="16"> },</a>
+<a class="sourceLine" id="cb371-17" data-line-number="17">}</a>
+<a class="sourceLine" id="cb371-18" data-line-number="18">~</a>
+<a class="sourceLine" id="cb371-19" data-line-number="19"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a>
+<a class="sourceLine" id="cb371-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb372"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb372-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Packages can specify token renderer prototypes.</p>
+<p>User-defined token renderers take precedence.</p>
+</blockquote>
+<h5 id="context-example-37" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5>
+<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p>
+<div class="sourceCode" id="cb373"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb373-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a>
+<a class="sourceLine" id="cb373-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTildePrototype{<span class="co">%</span></a>
+<a class="sourceLine" id="cb373-3" data-line-number="3"> Packages can specify token renderer prototypes.<span class="co">%</span></a>
+<a class="sourceLine" id="cb373-4" data-line-number="4">}</a>
+<a class="sourceLine" id="cb373-5" data-line-number="5"><span class="fu">\starttext</span></a>
+<a class="sourceLine" id="cb373-6" data-line-number="6"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb373-7" data-line-number="7">~</a>
+<a class="sourceLine" id="cb373-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb373-9" data-line-number="9"></a>
+<a class="sourceLine" id="cb373-10" data-line-number="10"><span class="fu">\def</span>\markdownRendererTilde{<span class="co">%</span></a>
+<a class="sourceLine" id="cb373-11" data-line-number="11"> User-defined token renderers take precedence.<span class="co">%</span></a>
+<a class="sourceLine" id="cb373-12" data-line-number="12">}</a>
+<a class="sourceLine" id="cb373-13" data-line-number="13"><span class="fu">\startmarkdown</span></a>
+<a class="sourceLine" id="cb373-14" data-line-number="14">~</a>
+<a class="sourceLine" id="cb373-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a>
+<a class="sourceLine" id="cb373-16" data-line-number="16"><span class="fu">\stoptext</span></a></code></pre></div>
+<p>Next, invoke LuaTeX from the terminal:</p>
+<div class="sourceCode" id="cb374"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb374-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div>
+<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p>
+<blockquote>
+<p>Packages can specify token renderer prototypes.</p>
+<p>User-defined token renderers take precedence.</p>
+</blockquote>
+<section class="footnotes">
+<hr />
+<ol>
+<li id="fn1"><p>Here is the footnote.<a href="#fnref1" class="footnote-back">↩</a></p></li>
+<li id="fn2"><p>Here’s one with multiple blocks.</p>
+<p>Subsequent paragraphs are indented to show that they belong to the previous footnote.</p>
+<pre><code>{ some.code }</code></pre>
+<p>The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref2" class="footnote-back">↩</a></p></li>
+<li id="fn3"><p>Here is the footnote.<a href="#fnref3" class="footnote-back">↩</a></p></li>
+<li id="fn4"><p>Here’s one with multiple blocks.</p>
+<p>Subsequent paragraphs are indented to show that they belong to the previous footnote.</p>
+<pre><code>{ some.code }</code></pre>
+<p>The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref4" class="footnote-back">↩</a></p></li>
+<li id="fn5"><p>Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note.<a href="#fnref5" class="footnote-back">↩</a></p></li>
+<li id="fn6"><p>Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note.<a href="#fnref6" class="footnote-back">↩</a></p></li>
+</ol>
+</section>
+</body>
+</html>
diff --git a/macros/generic/markdown/markdown.ins b/macros/generic/markdown/markdown.ins
new file mode 100644
index 0000000000..b7436c37fc
--- /dev/null
+++ b/macros/generic/markdown/markdown.ins
@@ -0,0 +1,15 @@
+\input docstrip.tex
+\generate{\usepreamble\luapreamble\usepostamble\luapostamble
+ \file{markdown.lua}{\from{markdown.dtx}{lua}}
+ \file{markdown-cli.lua}{\from{markdown.dtx}{lua-cli}}
+ \usepreamble\texpreamble\usepostamble\texpostamble
+ \file{markdown.tex}{\from{markdown.dtx}{tex}}
+ \file{markdown.sty}{\from{markdown.dtx}{latex}}
+ \file{t-markdown.tex}{\from{markdown.dtx}{context}}
+ \usepreamble\empty\usepostamble\empty
+ \file{markdown.md}{\from{markdown.dtx}{manual}}
+ \file{markdown-interfaces.md}{\from{markdown.dtx}{manual-interfaces}}
+ \file{markdown-options.md}{\from{markdown.dtx}{manual-options}}
+ \file{markdown-tokens.md}{\from{markdown.dtx}{manual-tokens}}
+ \file{markdown.css}{\from{markdown.dtx}{manual-css}}}
+\endbatchfile
diff --git a/macros/generic/markdown/markdown.md b/macros/generic/markdown/markdown.md
new file mode 100644
index 0000000000..ddd8c67dcd
--- /dev/null
+++ b/macros/generic/markdown/markdown.md
@@ -0,0 +1,278 @@
+
+---
+title: Markdown Package User Manual
+author: Vít Novotný
+date: v\markdownVersion{} (\markdownLastModified{})
+---
+
+
+<link href="https://afeld.github.io/emoji-css/emoji.css" rel="stylesheet" />
+
+Introduction
+============
+The [Markdown package][pkg] converts [markdown][] markup to \TeX{} commands. The
+functionality is provided both as a Lua module and as plain \TeX{}, \LaTeX{}, and
+\Hologo{ConTeXt} macro packages that can be used to directly typeset \TeX documents
+containing markdown markup. Unlike other convertors, the Markdown package
+makes it easy to redefine how each and every markdown element is rendered.
+Creative abuse of the markdown syntax is encouraged. ;-)
+
+ [markdown]: https://daringfireball.net/projects/markdown/basics/
+ (Daring Fireball: Markdown Basics)
+ [pkg]: https://ctan.org/pkg/markdown
+ (CTAN: Package markdown)
+
+
+This document is a user manual for the [Markdown package][pkg]. It provides
+tutorials and code examples. For an in-depth description of the package
+requirements, interfaces, and implementation, please refer to the [technical
+documentation][techdoc].
+
+ [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf
+ (A Markdown Interpreter for TeX)
+
+
+Requirements
+------------
+
+The package requires a working \TeX{} distribution. [\TeX{} Live][tl] ≥ 2013 is
+known to work and so are recent installation of [Mik\TeX{}][mik]. If you are
+using a minimal installation of a \TeX{} distribution, please consult the
+[technical documentation][techdoc] for a detailed list of required packages.
+
+ [tl]: https://www.tug.org/texlive/ (TeX Live - TeX Users Group)
+ [mik]: https://miktex.org/ (Home - MiKTeXorg)
+
+Installation
+------------
+
+The package comes pre-installed with [\TeX{} Live][tl] ≥ 2016 and with recent
+installations of [MikTeX][mik]. Unless you explicitly wish to use the latest
+version of the package, you are encouraged to skip this step.
+
+To install the package, first download the package from the repository
+using Git:
+``` sh
+git clone https://github.com/witiko/markdown
+``````
+Next, enter the directory named `markdown` and interpret the file named
+`markdown.ins` file using a Unicode-aware \TeX{} engine, such as XeTeX or
+LuaTeX:
+``` sh
+cd markdown
+luatex markdown.ins
+``````
+This should produce the following files:
+
+ * `markdown.lua`, the Lua module,
+ * `markdown-cli.lua`, the Lua command-line interface,
+ * `markdown.tex`, the plain \TeX{} macro package,
+ * `markdown.sty`, the \LaTeX{} package, and
+ * `t-markdown.tex`, the \Hologo{ConTeXt} module.
+
+### Local Installation
+
+To perform a local installation, place the above files into your \TeX{}
+directory structure. This is generally where the individual files should be
+placed:
+
+ * `<TEXMF>/tex/luatex/markdown/markdown.lua`
+ * `<TEXMF>/scripts/markdown/markdown-cli.lua`
+ * `<TEXMF>/tex/generic/markdown/markdown.tex`
+ * `<TEXMF>/tex/latex/markdown/markdown.sty`
+ * `<TEXMF>/tex/context/third/markdown/t-markdown.tex`
+
+where `<TEXMF>` corresponds to a root of your \TeX{} distribution, such as
+`/usr/share/texmf` and `~/texmf` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf` on Windows systems. When in doubt,
+consult the manual of your \TeX{} distribution.
+
+### Portable Installation
+
+Alternatively, you can also store the above files in the same folder as your
+\TeX{} document and distribute them together. This way your document can be
+portably typeset on legacy \TeX{} distributions.
+
+
+First Document
+--------------
+
+In this section, we will take the necessary steps to typeset our first markdown
+document in \TeX{}. This will serve as our first hands-on experience with the
+package and also as a reassurance that the package has been correctly installed.
+
+### Using Lua
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\input hello
+\bye
+```````
+
+#### Using the Lua Module
+
+Using a text editor, create a text document named `hello.lua` with the
+following content:
+``` lua
+#!/usr/bin/env texlua
+local kpse = require("kpse")
+kpse.set_program_name("luatex")
+local markdown = require("markdown")
+local convert = markdown.new()
+print(convert("Hello *world*!"))
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua hello.lua > hello.tex
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!” Invoking pdfTeX should have the same effect:
+``` sh
+texlua hello.lua > hello.tex
+pdftex document.tex
+``````
+
+#### Using the Lua Command-Line Interface
+
+Using a text editor, create a text document named `hello.md` with the
+following content:
+``` md
+Hello *world*!
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+texlua ⟨CLI pathname⟩ -- hello.md hello.tex
+luatex document.tex
+``````
+where \meta{CLI pathname} corresponds to the location of the Lua CLI script file,
+such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
+`C:\Users\`\meta{Your username}`\texmf\scripts\markdown\markdown-cli.lua` on Windows
+systems. Use the command `kpsewhich markdown-cli.lua` to locate the Lua CLI
+script file using [Kpathsea][].
+
+ [Kpathsea]: https://tug.org/kpathsea/ (Kpathsea - TeX Users Group)
+
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” Invoking pdfTeX should have the same effect:
+``` sh
+texlua ⟨CLI pathname⟩ -- hello.md hello.tex
+pdftex document.tex
+``````
+
+### Using Plain \TeX{}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text
+“Hello *world*!” Invoking pdfTeX should have the same effect:
+``` sh
+pdftex --shell-escape document.tex
+```````
+
+### Using \LaTeX{}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+Hello *world*!
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” Invoking pdfTeX should have the same effect:
+``` sh
+pdflatex --shell-escape document.tex
+``````
+
+***
+
+As the next step, try typesetting the example documents distributed along with
+the Markdown package:
+``` sh
+git clone https://github.com/witiko/markdown
+cd markdown/examples
+lualatex latex.tex
+``````
+A PDF document named `latex.pdf` should be produced. Open the text documents
+`latex.tex` and `example.md` in a text editor to see how the example documents
+are structured. Try changing the documents and typesetting them as follows:
+``` sh
+lualatex latex.tex
+``````
+to see the effect of your changes.
+
+### Using \Hologo{ConTeXt}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\starttext
+\startmarkdown
+Hello *world*!
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the text “Hello
+*world*!” Invoking pdfTeX should have the same effect:
+``` sh
+texexec --passon=--shell-escape document.tex
+``````
+
+***
+
+As the next step, try typesetting the example documents distributed along with
+the Markdown package:
+``` sh
+git clone https://github.com/witiko/markdown
+cd markdown/examples
+context context.tex
+``````
+A PDF document named `context.pdf` should be produced. Open the text documents
+`context.tex` and `example.md` in a text editor to see how the example documents
+are structured. Try changing the documents and typesetting them as follows:
+``` sh
+context context.tex
+``````
+to see the effect of your changes.
+
+Examples
+========
+
+In this section, I will describe the individual parts of the Markdown package.
+Each part will be shown by example, leaving the implementation details to the
+[technical documentation][techdoc].
+
+ [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf
+ (A Markdown Interpreter for \TeX{})
+
+/markdown-interfaces.md
+/markdown-options.md
+/markdown-tokens.md
+
diff --git a/macros/generic/markdown/markdown.pdf b/macros/generic/markdown/markdown.pdf
new file mode 100644
index 0000000000..d166468833
--- /dev/null
+++ b/macros/generic/markdown/markdown.pdf
Binary files differ
diff --git a/macros/generic/markdown/tests/README.md b/macros/generic/markdown/tests/README.md
new file mode 100644
index 0000000000..53db58776b
--- /dev/null
+++ b/macros/generic/markdown/tests/README.md
@@ -0,0 +1,17 @@
+This directory contains the testing framework of the Markdown package. Tests
+act as an ensurance that changes to the package did not introduce new bugs.
+
+The `test.sh` shell script is used to run the individual tests. To run one or
+more tests, execute the `test.sh` script with the pathnames of one or more test
+files as the arguments. Test files can be recognized by the `.test` suffix and
+reside inside the `testfiles/` directory. The Markdown package needs to be
+[installed][install] before running the tests.
+
+ [install]: http://mirrors.ctan.org/macros/generic/markdown/markdown.html#installation "Markdown Package User Manual"
+
+Each time a commit is made to the Git repository of the project, this test
+suite is ran by a continuous integration service.
+The current status is:
+[![CircleCI](https://circleci.com/gh/Witiko/markdown/tree/master.svg)][CircleCI]
+
+ [CircleCI]: https://circleci.com/gh/Witiko/markdown/tree/master (CircleCI)
diff --git a/macros/generic/markdown/tests/support/README.md b/macros/generic/markdown/tests/support/README.md
new file mode 100644
index 0000000000..d06e40a921
--- /dev/null
+++ b/macros/generic/markdown/tests/support/README.md
@@ -0,0 +1,4 @@
+This directory contains support files. Support files should be available to the
+TeX source code that is being typeset during a test. These are mainly files
+containing TeX source code that is common for all the TeX source code
+templates.
diff --git a/macros/generic/markdown/tests/support/latex-setup.tex b/macros/generic/markdown/tests/support/latex-setup.tex
new file mode 100644
index 0000000000..be002d6ec8
--- /dev/null
+++ b/macros/generic/markdown/tests/support/latex-setup.tex
@@ -0,0 +1,162 @@
+renderers = {%
+ interblockSeparator = {%
+ \TYPE{interblockSeparator}%
+ \GOBBLE},
+ lineBreak = {%
+ \TYPE{lineBreak}%
+ \GOBBLE},
+ ellipsis = {%
+ \TYPE{ellipsis}%
+ \GOBBLE},
+ nbsp = {%
+ \TYPE{nbsp}%
+ \GOBBLE},
+ leftBrace = {%
+ \TYPE{leftBrace}%
+ \GOBBLE},
+ rightBrace = {%
+ \TYPE{rightBrace}%
+ \GOBBLE},
+ dollarSign = {%
+ \TYPE{dollarSign}%
+ \GOBBLE},
+ percentSign = {%
+ \TYPE{percentSign}%
+ \GOBBLE},
+ ampersand = {%
+ \TYPE{ampersand}%
+ \GOBBLE},
+ underscore = {%
+ \TYPE{underscore}%
+ \GOBBLE},
+ hash = {%
+ \TYPE{hash}%
+ \GOBBLE},
+ circumflex = {%
+ \TYPE{circumflex}%
+ \GOBBLE},
+ backslash = {%
+ \TYPE{backslash}%
+ \GOBBLE},
+ tilde = {%
+ \TYPE{tilde}%
+ \GOBBLE},
+ pipe = {%
+ \TYPE{pipe}%
+ \GOBBLE},
+ codeSpan = {%
+ \TYPE{codeSpan: #1}},
+ link = {%
+ \TYPE{BEGIN link}%
+ \TYPE{- label: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END link}},
+ image = {%
+ \TYPE{BEGIN image}%
+ \TYPE{- label: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END image}},
+ contentBlock = {%
+ \TYPE{BEGIN contentBlock}%
+ \TYPE{- suffix: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END contentBlock}%
+ },
+ contentBlockOnlineImage = {%
+ \TYPE{BEGIN contentBlockOnlineImage}%
+ \TYPE{- suffix: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END contentBlockOnlineImage}%
+ },
+ contentBlockCode = {%
+ \TYPE{BEGIN contentBlockCode}%
+ \TYPE{- suffix: #1}%
+ \TYPE{- language: #2}%
+ \TYPE{- URI: #3}%
+ \TYPE{- title: #5}%
+ \TYPE{END contentBlockCode}%
+ },
+ ulBegin = {%
+ \TYPE{ulBegin}},
+ ulBeginTight = {%
+ \TYPE{ulBeginTight}},
+ ulItem = {%
+ \TYPE{ulItem}},
+ ulItemEnd = {%
+ \TYPE{ulItemEnd}},
+ ulEnd = {%
+ \TYPE{ulEnd}},
+ ulEndTight = {%
+ \TYPE{ulEndTight}},
+ olBegin = {%
+ \TYPE{olBegin}},
+ olBeginTight = {%
+ \TYPE{olBeginTight}},
+ olItem = {%
+ \TYPE{olItem}},
+ olItemEnd = {%
+ \TYPE{olItemEnd}},
+ olItemWithNumber = {%
+ \TYPE{olItemWithNumber: #1}},
+ olEnd = {%
+ \TYPE{olEnd}},
+ olEndTight = {%
+ \TYPE{olEndTight}},
+ dlBegin = {%
+ \TYPE{dlBegin}},
+ dlBeginTight = {%
+ \TYPE{dlBeginTight}},
+ dlItem = {%
+ \TYPE{dlItem: #1}},
+ dlItemEnd = {%
+ \TYPE{dlItemEnd}},
+ dlDefinitionBegin = {%
+ \TYPE{dlDefinitionBegin}},
+ dlDefinitionEnd = {%
+ \TYPE{dlDefinitionEnd}},
+ dlEnd = {%
+ \TYPE{dlEnd}},
+ dlEndTight = {%
+ \TYPE{dlEndTight}},
+ emphasis = {%
+ \TYPE{emphasis: #1}},
+ strongEmphasis = {%
+ \TYPE{strongEmphasis: #1}},
+ blockQuoteBegin = {%
+ \TYPE{blockQuoteBegin}},
+ blockQuoteEnd = {%
+ \TYPE{blockQuoteEnd}},
+ inputVerbatim = {%
+ \TYPE{inputVerbatim: #1}},
+ inputFencedCode = {%
+ \TYPE{BEGIN fencedCode}%
+ \TYPE{- src: #1}%
+ \TYPE{- infostring: #2}%
+ \TYPE{END fencedCode}},
+ headingOne = {%
+ \TYPE{headingOne: #1}},
+ headingTwo = {%
+ \TYPE{headingTwo: #1}},
+ headingThree = {%
+ \TYPE{headingThree: #1}},
+ headingFour = {%
+ \TYPE{headingFour: #1}},
+ headingFive = {%
+ \TYPE{headingFive: #1}},
+ headingSix = {%
+ \TYPE{headingSix: #1}},
+ horizontalRule = {%
+ \TYPE{horizontalRule}},
+ footnote = {%
+ \TYPE{footnote: #1}},
+ cite = {%
+ \CITATIONS{#1}},
+ textCite = {%
+ \TEXTCITATIONS{#1}},
+ table = {%
+ \TABLE{#1}{#2}{#3}}
+}
diff --git a/macros/generic/markdown/tests/support/plain-setup.tex b/macros/generic/markdown/tests/support/plain-setup.tex
new file mode 100644
index 0000000000..1c163781e7
--- /dev/null
+++ b/macros/generic/markdown/tests/support/plain-setup.tex
@@ -0,0 +1,142 @@
+\def\markdownRendererInterblockSeparator#1{%
+ \TYPE{interblockSeparator}}%
+\def\markdownRendererLineBreak#1{%
+ \TYPE{lineBreak}}%
+\def\markdownRendererEllipsis#1{%
+ \TYPE{ellipsis}}%
+\def\markdownRendererNbsp#1{%
+ \TYPE{nbsp}}%
+\def\markdownRendererLeftBrace#1{%
+ \TYPE{leftBrace}}%
+\def\markdownRendererRightBrace#1{%
+ \TYPE{rightBrace}}%
+\def\markdownRendererDollarSign#1{%
+ \TYPE{dollarSign}}%
+\def\markdownRendererPercentSign#1{%
+ \TYPE{percentSign}}%
+\def\markdownRendererAmpersand#1{%
+ \TYPE{ampersand}}%
+\def\markdownRendererUnderscore#1{%
+ \TYPE{underscore}}%
+\def\markdownRendererHash#1{%
+ \TYPE{hash}}%
+\def\markdownRendererCircumflex#1{%
+ \TYPE{circumflex}}%
+\def\markdownRendererBackslash#1{%
+ \TYPE{backslash}}%
+\def\markdownRendererTilde#1{%
+ \TYPE{tilde}}%
+\def\markdownRendererPipe#1{%
+ \TYPE{pipe}}%
+\def\markdownRendererCodeSpan#1{%
+ \TYPE{codeSpan: #1}}%
+\def\markdownRendererLink#1#2#3#4{%
+ \TYPE{BEGIN link}%
+ \TYPE{- label: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END link}}%
+\def\markdownRendererImage#1#2#3#4{%
+ \TYPE{BEGIN image}%
+ \TYPE{- label: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END image}}%
+\def\markdownRendererContentBlock#1#2#3#4{%
+ \TYPE{BEGIN contentBlock}%
+ \TYPE{- suffix: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END contentBlock}}%
+\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
+ \TYPE{BEGIN contentBlockOnlineImage}%
+ \TYPE{- suffix: #1}%
+ \TYPE{- URI: #2}%
+ \TYPE{- title: #4}%
+ \TYPE{END contentBlockOnlineImage}}%
+\def\markdownRendererContentBlockCode#1#2#3#4#5{%
+ \TYPE{BEGIN contentBlockCode}%
+ \TYPE{- suffix: #1}%
+ \TYPE{- language: #2}%
+ \TYPE{- URI: #3}%
+ \TYPE{- title: #5}%
+ \TYPE{END contentBlockCode}}%
+\def\markdownRendererUlBegin{%
+ \TYPE{ulBegin}}%
+\def\markdownRendererUlBeginTight{%
+ \TYPE{ulBeginTight}}%
+\def\markdownRendererUlItem{%
+ \TYPE{ulItem}}%
+\def\markdownRendererUlItemEnd{%
+ \TYPE{ulItemEnd}}%
+\def\markdownRendererUlEnd{%
+ \TYPE{ulEnd}}%
+\def\markdownRendererUlEndTight{%
+ \TYPE{ulEndTight}}%
+\def\markdownRendererOlBegin{%
+ \TYPE{olBegin}}%
+\def\markdownRendererOlBeginTight{%
+ \TYPE{olBeginTight}}%
+\def\markdownRendererOlItem{%
+ \TYPE{olItem}}%
+\def\markdownRendererOlItemEnd{%
+ \TYPE{olItemEnd}}%
+\def\markdownRendererOlItemWithNumber#1{%
+ \TYPE{olItemWithNumber: #1}}%
+\def\markdownRendererOlEnd{%
+ \TYPE{olEnd}}%
+\def\markdownRendererOlEndTight{%
+ \TYPE{olEndTight}}%
+\def\markdownRendererDlBegin{%
+ \TYPE{dlBegin}}%
+\def\markdownRendererDlBeginTight{%
+ \TYPE{dlBeginTight}}%
+\def\markdownRendererDlItem#1{%
+ \TYPE{dlItem: #1}}%
+\def\markdownRendererDlItemEnd{%
+ \TYPE{dlItemEnd}}%
+\def\markdownRendererDlDefinitionBegin{%
+ \TYPE{dlDefinitionBegin}}%
+\def\markdownRendererDlDefinitionEnd{%
+ \TYPE{dlDefinitionEnd}}%
+\def\markdownRendererDlEnd{%
+ \TYPE{dlEnd}}%
+\def\markdownRendererDlEndTight{%
+ \TYPE{dlEndTight}}%
+\def\markdownRendererEmphasis#1{%
+ \TYPE{emphasis: #1}}%
+\def\markdownRendererStrongEmphasis#1{%
+ \TYPE{strongEmphasis: #1}}%
+\def\markdownRendererBlockQuoteBegin{%
+ \TYPE{blockQuoteBegin}}%
+\def\markdownRendererBlockQuoteEnd{%
+ \TYPE{blockQuoteEnd}}%
+\def\markdownRendererInputVerbatim#1{%
+ \TYPE{inputVerbatim: #1}}%
+\def\markdownRendererInputFencedCode#1#2{%
+ \TYPE{BEGIN fencedCode}%
+ \TYPE{- src: #1}%
+ \TYPE{- infostring: #2}%
+ \TYPE{END fencedCode}}%
+\def\markdownRendererHeadingOne#1{%
+ \TYPE{headingOne: #1}}%
+\def\markdownRendererHeadingTwo#1{%
+ \TYPE{headingTwo: #1}}%
+\def\markdownRendererHeadingThree#1{%
+ \TYPE{headingThree: #1}}%
+\def\markdownRendererHeadingFour#1{%
+ \TYPE{headingFour: #1}}%
+\def\markdownRendererHeadingFive#1{%
+ \TYPE{headingFive: #1}}%
+\def\markdownRendererHeadingSix#1{%
+ \TYPE{headingSix: #1}}%
+\def\markdownRendererHorizontalRule{%
+ \TYPE{horizontalRule}}%
+\def\markdownRendererFootnote#1{%
+ \TYPE{footnote: #1}}%
+\def\markdownRendererCite#1{%
+ \CITATIONS{#1}}%
+\def\markdownRendererTextCite#1{%
+ \TEXTCITATIONS{#1}}%
+\def\markdownRendererTable#1#2#3{%
+ \TABLE{#1}{#2}{#3}}%
diff --git a/macros/generic/markdown/tests/support/setup.tex b/macros/generic/markdown/tests/support/setup.tex
new file mode 100644
index 0000000000..60a943d2ac
--- /dev/null
+++ b/macros/generic/markdown/tests/support/setup.tex
@@ -0,0 +1,79 @@
+\long\def\TYPE#1{%
+ \begingroup
+ \long\def\TYPE##1{(##1)}%
+ \immediate\write128{TEST INPUT BEGIN}%
+ \immediate\write128{#1}%
+ \immediate\write128{TEST INPUT END}%
+ \endgroup}%
+\def\GOBBLE#1{}%
+
+% Table parsing
+\newcount\ROWCOUNTER
+\newcount\COLCOUNTER
+
+\def\DOROW#1{%
+ \COLCOUNTER=1%
+ \DOCOL#1
+ \advance\ROWCOUNTER by 1\relax
+ \ifnum\ROWCOUNTER>\ROWTOTAL\relax
+ \TYPE{END table}%
+ \expandafter\GOBBLE
+ \fi\DOROW}%
+\def\DOCOL#1{%
+ \ifnum\ROWCOUNTER=0
+ \TYPE{- alignment of column \the\COLCOUNTER: #1}%
+ \else
+ \TYPE{- row \the\ROWCOUNTER, column \the\COLCOUNTER: #1}%
+ \fi
+ \advance\COLCOUNTER by 1\relax
+ \ifnum\COLCOUNTER>\COLTOTAL\relax
+ \expandafter\GOBBLE
+ \fi\DOCOL}%
+\def\TABLE#1#2#3{%
+ \ROWCOUNTER=0%
+ \def\ROWTOTAL{#2}%
+ \def\COLTOTAL{#3}%
+ \TYPE{BEGIN table (#2 rows, #3 columns)}%
+ \TYPE{- caption: #1}%
+ \DOROW}%
+
+% Citations parsing
+\newcount\CITATIONSCOUNTER
+
+%% Regular citations
+\def\DOCITATIONS#1#2#3#4{%
+ \advance\CITATIONSCOUNTER by 1\relax
+ \CITE{#1}{#2}{#3}{#4}%
+ \ifnum\CITATIONSCOUNTER>\CITATIONSTOTAL\relax
+ \expandafter\GOBBLE
+ \fi\DOCITATIONS}%
+\def\CITE#1#2#3#4{%
+ \TYPE{BEGIN cite}%
+ \TYPE{- suppressAuthor: \if#1+false\else true\fi}%
+ \TYPE{- prenote: #2}%
+ \TYPE{- postnote: #3}%
+ \TYPE{- name: #4}%
+ \TYPE{END cite}}%
+\def\CITATIONS#1{%
+ \CITATIONSCOUNTER=1%
+ \def\CITATIONSTOTAL{#1}%
+ \DOCITATIONS}%
+
+%% Text citations
+\def\DOTEXTCITATIONS#1#2#3#4{%
+ \advance\CITATIONSCOUNTER by 1\relax
+ \TEXTCITE{#1}{#2}{#3}{#4}%
+ \ifnum\CITATIONSCOUNTER>\CITATIONSTOTAL\relax
+ \expandafter\GOBBLE
+ \fi\DOTEXTCITATIONS}%
+\def\TEXTCITE#1#2#3#4{%
+ \TYPE{BEGIN textCite}%
+ \TYPE{- suppressAuthor: \if#1+false\else true\fi}%
+ \TYPE{- prenote: #2}%
+ \TYPE{- postnote: #3}%
+ \TYPE{- name: #4}%
+ \TYPE{END textCite}}%
+\def\TEXTCITATIONS#1{%
+ \CITATIONSCOUNTER=1%
+ \def\CITATIONSTOTAL{#1}%
+ \DOTEXTCITATIONS}%
diff --git a/macros/generic/markdown/tests/templates/README.md b/macros/generic/markdown/tests/templates/README.md
new file mode 100644
index 0000000000..f56802cf7b
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/README.md
@@ -0,0 +1,20 @@
+This directory contains subdirectories, which correspond to individual TeX
+formats. These subdirectories contain TeX source code templates, which
+can be recognized by the `.tex.m4` suffix, and a file named `COMMANDS.m4`.
+
+The TeX source code templates are documents that will be typeset as a part of
+every test. Before being typeset, the TeX source code templates will be
+pre-processed using the m4 macro preprocessor with the following macro
+definitions:
+
+ 1. `TEST_SETUP_FILENAME` corresponds to the name of the file containing the
+ test setup TeX source code.
+ 2. `TEST_INPUT_FILENAME` corresponds to the name of the file containing the
+ test markdown source code.
+
+The `COMMANDS.m4` file contains a newline-separated list of commands that will
+be used to typeset the pre-processed TeX source code templates. Before use,
+the commands will preprocessed with the following macro definitions:
+
+ 1. `TEST_FILENAME` corresponds to the name of the pre-processed TeX source
+ code template that is being typeset.
diff --git a/macros/generic/markdown/tests/templates/context/COMMANDS.m4 b/macros/generic/markdown/tests/templates/context/COMMANDS.m4
new file mode 100644
index 0000000000..d427cd3513
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/context/COMMANDS.m4
@@ -0,0 +1,2 @@
+texexec --passon="--shell-escape --8bit --interaction=nonstopmode" TEST_FILENAME
+context --nonstopmode TEST_FILENAME
diff --git a/macros/generic/markdown/tests/templates/context/README.md b/macros/generic/markdown/tests/templates/context/README.md
new file mode 100644
index 0000000000..5acb21c88f
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/context/README.md
@@ -0,0 +1,2 @@
+This directory contains TeX source code templates for the ConTeXt Mark II and
+ConteXt Mark IV formats.
diff --git a/macros/generic/markdown/tests/templates/context/input.tex.m4 b/macros/generic/markdown/tests/templates/context/input.tex.m4
new file mode 100644
index 0000000000..527b73cf9f
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/context/input.tex.m4
@@ -0,0 +1,11 @@
+% Load the package.
+\usemodule[t][markdown]
+% Load the support files.
+\input setup\relax
+\input plain-setup\relax
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+% Perform the test.
+\starttext
+ \markdownInput{TEST_INPUT_FILENAME}%
+\stoptext
diff --git a/macros/generic/markdown/tests/templates/context/verbatim.tex.m4 b/macros/generic/markdown/tests/templates/context/verbatim.tex.m4
new file mode 100644
index 0000000000..6d19154972
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/context/verbatim.tex.m4
@@ -0,0 +1,13 @@
+% Load the package.
+\usemodule[t][markdown]
+% Load the support files.
+\input setup\relax
+\input plain-setup\relax
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+% Perform the test.
+\starttext
+ \startmarkdown
+undivert(TEST_INPUT_FILENAME)dnl
+ \stopmarkdown
+\stoptext
diff --git a/macros/generic/markdown/tests/templates/latex/COMMANDS.m4 b/macros/generic/markdown/tests/templates/latex/COMMANDS.m4
new file mode 100644
index 0000000000..767145adc5
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/latex/COMMANDS.m4
@@ -0,0 +1,3 @@
+pdflatex --shell-escape --interaction=nonstopmode TEST_FILENAME
+xelatex --shell-escape --8bit --interaction=nonstopmode TEST_FILENAME
+lualatex --interaction=nonstopmode TEST_FILENAME
diff --git a/macros/generic/markdown/tests/templates/latex/README.md b/macros/generic/markdown/tests/templates/latex/README.md
new file mode 100644
index 0000000000..e62b4a40fa
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/latex/README.md
@@ -0,0 +1 @@
+This directory contains TeX source code templates for the LaTeX format.
diff --git a/macros/generic/markdown/tests/templates/latex/input.tex.m4 b/macros/generic/markdown/tests/templates/latex/input.tex.m4
new file mode 100644
index 0000000000..324f4e7bf1
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/latex/input.tex.m4
@@ -0,0 +1,14 @@
+\documentclass{minimal}
+\csname UseRawInputEncoding\endcsname
+% Load the package.
+\usepackage{markdown}
+% Load the support files.
+\input setup\relax
+\usepackage{catchfile}
+\CatchFileDef{\LATEXOPTIONS}{latex-setup}\relax
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+\begin{document}
+% Perform the test.
+\expandafter\markdownInput\expandafter[\LATEXOPTIONS]{TEST_INPUT_FILENAME}%
+\end{document}
diff --git a/macros/generic/markdown/tests/templates/latex/verbatim-starred.tex.m4 b/macros/generic/markdown/tests/templates/latex/verbatim-starred.tex.m4
new file mode 100644
index 0000000000..5f1434869f
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/latex/verbatim-starred.tex.m4
@@ -0,0 +1,17 @@
+\documentclass{minimal}
+\csname UseRawInputEncoding\endcsname
+% Load the package.
+\usepackage{markdown}
+% Load the support files.
+\input setup\relax
+\usepackage{catchfile}
+\CatchFileDef{\LATEXOPTIONS}{latex-setup}\relax
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+\begin{document}
+% Perform the test.
+\let\ea\expandafter
+\ea\begin\ea{\ea m\ea a\ea r\ea k\ea d\ea o\ea w\ea n\ea *\ea}\ea{\LATEXOPTIONS}
+undivert(TEST_INPUT_FILENAME)dnl
+\end{markdown*}
+\end{document}
diff --git a/macros/generic/markdown/tests/templates/latex/verbatim.tex.m4 b/macros/generic/markdown/tests/templates/latex/verbatim.tex.m4
new file mode 100644
index 0000000000..737d49def7
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/latex/verbatim.tex.m4
@@ -0,0 +1,17 @@
+\documentclass{minimal}
+\csname UseRawInputEncoding\endcsname
+% Load the package.
+\usepackage{markdown}
+% Load the support files.
+\input setup\relax
+\usepackage{catchfile}
+\CatchFileDef{\LATEXOPTIONS}{latex-setup}\relax
+\expandafter\markdownSetup\expandafter{\LATEXOPTIONS}
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+\begin{document}
+% Perform the test.
+\begin{markdown}
+undivert(TEST_INPUT_FILENAME)dnl
+\end{markdown}
+\end{document}
diff --git a/macros/generic/markdown/tests/templates/plain/COMMANDS.m4 b/macros/generic/markdown/tests/templates/plain/COMMANDS.m4
new file mode 100644
index 0000000000..50745b8a63
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/plain/COMMANDS.m4
@@ -0,0 +1,3 @@
+pdftex --shell-escape --interaction=nonstopmode TEST_FILENAME
+xetex --shell-escape --8bit --interaction=nonstopmode TEST_FILENAME
+luatex --interaction=nonstopmode TEST_FILENAME
diff --git a/macros/generic/markdown/tests/templates/plain/README.md b/macros/generic/markdown/tests/templates/plain/README.md
new file mode 100644
index 0000000000..779102ed26
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/plain/README.md
@@ -0,0 +1 @@
+This directory contains TeX source code templates for the plain TeX format.
diff --git a/macros/generic/markdown/tests/templates/plain/input.tex.m4 b/macros/generic/markdown/tests/templates/plain/input.tex.m4
new file mode 100644
index 0000000000..b2ef1b560d
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/plain/input.tex.m4
@@ -0,0 +1,10 @@
+% Load the package.
+\input markdown\relax
+% Load the support files.
+\input setup\relax
+\input plain-setup\relax
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+% Perform the test.
+\markdownInput{TEST_INPUT_FILENAME}%
+\bye
diff --git a/macros/generic/markdown/tests/templates/plain/verbatim.tex.m4 b/macros/generic/markdown/tests/templates/plain/verbatim.tex.m4
new file mode 100644
index 0000000000..fd87725c06
--- /dev/null
+++ b/macros/generic/markdown/tests/templates/plain/verbatim.tex.m4
@@ -0,0 +1,12 @@
+% Load the package.
+\input markdown\relax
+% Load the support files.
+\input setup\relax
+\input plain-setup\relax
+% Load the test-specific setup.
+\input TEST_SETUP_FILENAME\relax
+% Perform the test.
+\markdownBegin
+undivert(TEST_INPUT_FILENAME)dnl
+\markdownEnd
+\bye
diff --git a/macros/generic/markdown/tests/test.sh b/macros/generic/markdown/tests/test.sh
new file mode 100755
index 0000000000..c32b8274a2
--- /dev/null
+++ b/macros/generic/markdown/tests/test.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+# Run a test for each testfile passed as an argument. If a testfile does not
+# contain the expected test result, generate one.
+set -e
+BUILDDIR=`mktemp -d`
+trap 'rm -rf $BUILDDIR' INT TERM
+for TESTFILE; do
+ printf 'Testfile %s\n' $TESTFILE
+ for FORMAT in templates/*/; do
+ printf ' Format %s\n' $FORMAT
+ for TEMPLATE in ${FORMAT}*.tex.m4; do
+ printf ' Template %s\n' $TEMPLATE
+ m4 -DTEST_FILENAME=test.tex <$FORMAT/COMMANDS.m4 |
+ (while read COMMAND; do
+ printf ' Command %s\n' "$COMMAND"
+
+ # Set up the testing directory.
+ cp support/* $TESTFILE $BUILDDIR
+ cd $BUILDDIR
+ sed -r '/^\s*<<<\s*$/{x;q}' \
+ <${TESTFILE##*/} >test-setup.tex
+ sed -rn '/^\s*<<<\s*$/,/^\s*>>>\s*$/{/^\s*(<<<|>>>)\s*$/!p}' \
+ <${TESTFILE##*/} >test-input.md
+ sed -n '/^\s*>>>\s*$/,${/^\s*>>>\s*$/!p}' \
+ <${TESTFILE##*/} >test-expected.log
+ m4 -DTEST_SETUP_FILENAME=test-setup.tex \
+ -DTEST_INPUT_FILENAME=test-input.md <"$OLDPWD"/$TEMPLATE >test.tex
+
+ # Run the test, filter the output and concatenate adjacent lines.
+ eval $COMMAND >/dev/null 2>&1 ||
+ { cat test.markdown.err 1>&2 2>/dev/null; exit 1; }
+ sed -nr '/^\s*TEST INPUT BEGIN\s*$/,/^\s*TEST INPUT END\s*$/{
+ /^\s*TEST INPUT (BEGIN|END)\s*$/!H
+ /^\s*TEST INPUT END\s*$/{s/.*//;x;s/\n//g;p}
+ }' <test.log >test-actual.log
+
+ # If the testfile does not contain an expected outcome, use the current
+ # outcome and update the testfile.
+ if ! grep -q '^\s*>>>\s*$' <${TESTFILE##*/}; then
+ cp test-actual.log test-expected.log
+ (cat ${TESTFILE##*/} && printf '>>>\n'
+ cat test-expected.log) >"$OLDPWD"/$TESTFILE
+ printf ' Added the expected test outcome to the testfile.\n'
+ fi
+
+ # Compare the expected outcome against the actual outcome.
+ diff -c $BUILDDIR/test-expected.log $BUILDDIR/test-actual.log # ||
+# (sed -n '1,/^\s*>>>\s*$/p' <${TESTFILE##*/} &&
+# cat test-actual.log) >"$OLDPWD"/$TESTFILE
+
+ # Clean up the testing directory.
+ cd "$OLDPWD"
+ find $BUILDDIR -mindepth 1 -exec rm -rf {} + # && break
+ done) # && break
+ done # && break
+ done
+done
+rm -rf $BUILDDIR
diff --git a/macros/generic/markdown/tests/testfiles/CommonMark_0.26/README.md b/macros/generic/markdown/tests/testfiles/CommonMark_0.26/README.md
new file mode 100644
index 0000000000..7ae2191762
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/CommonMark_0.26/README.md
@@ -0,0 +1,2 @@
+This directory contains test files that were taken from the
+CommonMark project specification.
diff --git a/macros/generic/markdown/tests/testfiles/CommonMark_0.26/fenced-code.test b/macros/generic/markdown/tests/testfiles/CommonMark_0.26/fenced-code.test
new file mode 100644
index 0000000000..98cb973956
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/CommonMark_0.26/fenced-code.test
@@ -0,0 +1,315 @@
+\def\markdownOptionFencedCode{true}
+<<<
+Here is a simple example with backticks:
+
+```
+<
+ >
+```
+
+With tildes:
+
+~~~
+<
+ >
+~~~
+
+The closing code fence must use the same character as the opening fence:
+
+```
+aaa
+~~~
+```
+
+~~~
+aaa
+```
+~~~
+
+The closing code fence must be at least as long as the opening fence:
+
+````
+aaa
+```
+``````
+
+~~~~
+aaa
+~~~
+~~~~
+
+Unclosed code blocks are closed by the end of the document (or the enclosing block quote or list item):
+
+> ```
+> aaa
+
+bbb
+
+A code block can have all empty lines as its content
+
+```
+
+
+```
+
+A code block can be empty:
+```
+```
+
+Fences can be indented. If the opening fence is indented, content lines will have equivalent opening indentation removed, if present:
+ ```
+ aaa
+aaa
+```
+
+ ```
+aaa
+ aaa
+aaa
+ ```
+
+ ```
+ aaa
+ aaa
+ aaa
+ ```
+
+Four spaces indentation produces an indented code block:
+
+ ```
+ aaa
+ ```
+
+Closing fences may be indented by 0-3 spaces, and their indentation need not match that of the opening fence:
+
+```
+aaa
+ ```
+
+ ```
+aaa
+ ```
+
+This is not a closing fence, because it is indented 4 spaces:
+
+```
+aaa
+ ```
+```
+
+Code fences (opening and closing) cannot contain internal spaces:
+
+``` ```
+aaa
+
+```
+aaa
+``` ```
+```
+
+~~~~~~
+aaa
+~~~ ~~
+~~~~~~
+
+foo
+```
+bar
+```
+baz
+
+Other blocks can also occur before and after fenced code blocks without an intervening blank line:
+
+foo
+---
+~~~
+bar
+~~~
+# baz
+
+An info string can be provided after the opening code fence. Opening and closing spaces will be stripped, and the first word, prefixed with language-, is used as the value for the class attribute of the code element within the enclosing pre element.
+
+```ruby
+def foo(x)
+ return 3
+end
+```
+
+~~~~ ruby startline=3 $%@#$
+def foo(x)
+ return 3
+end
+~~~~~~~
+
+````;
+````
+
+Info strings for backtick code blocks cannot contain backticks:
+
+``` aa ```
+foo
+
+Closing code fences cannot have info strings:
+
+```
+``` aaa
+```
+
+Unclosed code blocks are closed by the end of the document (or the enclosing block quote or list item):
+
+`````
+
+```
+aaa
+>>>
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/40aeb3c06faa194425865c43b0818cf3.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/40aeb3c06faa194425865c43b0818cf3.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/162c3a1e89dc98bb7c0e223462144172.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/a109a04c348f12d1fc1e55dc6cd3153d.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/a109a04c348f12d1fc1e55dc6cd3153d.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/162c3a1e89dc98bb7c0e223462144172.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+blockQuoteBegin
+BEGIN fencedCode
+- src: ./_markdown_test/5c9597f3c8245907ea71a89d9d39d08e.verbatim
+- infostring:
+END fencedCode
+blockQuoteEnd
+interblockSeparator
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/e1c06d85ae7b8b032bef47e42e4c08f9.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/d41d8cd98f00b204e9800998ecf8427e.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/4b44563cc9886576b6589dd730cbc397.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/f084b3953e4a48b5425a11074ae99e3c.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/8a70ce8c35179c24412d9271f69da1fd.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/04338967b57abaf5489d4de2ca3d5d75.verbatim
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/5c9597f3c8245907ea71a89d9d39d08e.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/5c9597f3c8245907ea71a89d9d39d08e.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/5fcf96d052f67d3d8a648cb90cc39193.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+codeSpan:
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/baeea0ffee491579d17a52cb85675edf.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/42935760431e4eb4ddd8a8bcc5e54a23.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+interblockSeparator
+headingTwo: foo
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+headingOne: baz
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/22bc2a65d877cb1e2a14deece6005742.verbatim
+- infostring: ruby
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/22bc2a65d877cb1e2a14deece6005742.verbatim
+- infostring: ruby startline=3 (dollarSign)(percentSign)@(hash)(dollarSign)
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/d41d8cd98f00b204e9800998ecf8427e.verbatim
+- infostring: ;
+END fencedCode
+interblockSeparator
+interblockSeparator
+codeSpan: aa
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/e1ff8c7886d18f6b5499b096584e13bf.verbatim
+- infostring:
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/ab4c9bee663124ac417409b22e2af252.verbatim
+- infostring:
+END fencedCode
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/README.md b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/README.md
new file mode 100644
index 0000000000..1a8fd15a48
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/README.md
@@ -0,0 +1,2 @@
+This directory contains test files that were inherited from the
+`tests/Markdown_1.0.3/` directory in the lunamark project.
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/amps-encoding.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/amps-encoding.test
new file mode 100644
index 0000000000..da079fc68f
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/amps-encoding.test
@@ -0,0 +1,36 @@
+<<<
+Here's a [link] [1] with an ampersand in the URL.
+
+Here's a link with an amersand in the link text: [AT&T] [2].
+
+Here's an inline [link](/script?foo=1&bar=2).
+
+Here's an inline [link](</script?foo=1&bar=2>).
+
+
+[1]: http://example.com/?foo=1&bar=2
+[2]: http://att.com/ "AT&T"
+>>>
+BEGIN link
+- label: link
+- URI: http://example.com/?foo=1(ampersand)bar=2
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: AT(ampersand)T
+- URI: http://att.com/
+- title: AT(ampersand)T
+END link
+interblockSeparator
+BEGIN link
+- label: link
+- URI: /script?foo=1(ampersand)bar=2
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: link
+- URI: /script?foo=1(ampersand)bar=2
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/auto-links.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/auto-links.test
new file mode 100644
index 0000000000..765a85d3e2
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/auto-links.test
@@ -0,0 +1,52 @@
+<<<
+Link: <http://example.com/>.
+
+With an ampersand: <http://example.com/?foo=1&bar=2>
+
+* In a list?
+* <http://example.com/>
+* It should.
+
+> Blockquoted: <http://example.com/>
+
+Auto-links should not occur here: `<http://example.com/>`
+
+ or here: <http://example.com/>
+>>>
+BEGIN link
+- label: http://example.com/
+- URI: http://example.com/
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: http://example.com/?foo=1(ampersand)bar=2
+- URI: http://example.com/?foo=1(ampersand)bar=2
+- title:
+END link
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+BEGIN link
+- label: http://example.com/
+- URI: http://example.com/
+- title:
+END link
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+blockQuoteBegin
+BEGIN link
+- label: http://example.com/
+- URI: http://example.com/
+- title:
+END link
+blockQuoteEnd
+interblockSeparator
+codeSpan: <http://example.com/>
+interblockSeparator
+inputVerbatim: ./_markdown_test/d65b41d110c17fbc771809f553258ff5.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/backslash-escapes.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/backslash-escapes.test
new file mode 100644
index 0000000000..182a63747c
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/backslash-escapes.test
@@ -0,0 +1,192 @@
+<<<
+These should all get escaped:
+
+Backslash: \\
+
+Backtick: \`
+
+Asterisk: \*
+
+Underscore: \_
+
+Left brace: \{
+
+Right brace: \}
+
+Left bracket: \[
+
+Right bracket: \]
+
+Left paren: \(
+
+Right paren: \)
+
+Greater-than: \>
+
+Hash: \#
+
+Period: \.
+
+Bang: \!
+
+Plus: \+
+
+Minus: \-
+
+
+
+These should not, because they occur within a code block:
+
+ Backslash: \\
+
+ Backtick: \`
+
+ Asterisk: \*
+
+ Underscore: \_
+
+ Left brace: \{
+
+ Right brace: \}
+
+ Left bracket: \[
+
+ Right bracket: \]
+
+ Left paren: \(
+
+ Right paren: \)
+
+ Greater-than: \>
+
+ Hash: \#
+
+ Period: \.
+
+ Bang: \!
+
+ Plus: \+
+
+ Minus: \-
+
+
+Nor should these, which occur in code spans:
+
+Backslash: `\\`
+
+Backtick: `` \` ``
+
+Asterisk: `\*`
+
+Underscore: `\_`
+
+Left brace: `\{`
+
+Right brace: `\}`
+
+Left bracket: `\[`
+
+Right bracket: `\]`
+
+Left paren: `\(`
+
+Right paren: `\)`
+
+Greater-than: `\>`
+
+Hash: `\#`
+
+Period: `\.`
+
+Bang: `\!`
+
+Plus: `\+`
+
+Minus: `\-`
+
+
+These should get escaped, even though they're matching pairs for
+other Markdown constructs:
+
+\*asterisks\*
+
+\_underscores\_
+
+\`backticks\`
+
+This is a code span with a literal backslash-backtick sequence: `` \` ``
+
+This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.
+
+This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.
+>>>
+interblockSeparator
+backslash
+interblockSeparator
+interblockSeparator
+interblockSeparator
+underscore
+interblockSeparator
+leftBrace
+interblockSeparator
+rightBrace
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+hash
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/127bce8785d826a9ba07a20f6ca866c9.verbatim
+interblockSeparator
+interblockSeparator
+codeSpan: (backslash)(backslash)
+interblockSeparator
+codeSpan: (backslash)`
+interblockSeparator
+codeSpan: (backslash)*
+interblockSeparator
+codeSpan: (backslash)(underscore)
+interblockSeparator
+codeSpan: (backslash)(leftBrace)
+interblockSeparator
+codeSpan: (backslash)(rightBrace)
+interblockSeparator
+codeSpan: (backslash)[
+interblockSeparator
+codeSpan: (backslash)]
+interblockSeparator
+codeSpan: (backslash)(
+interblockSeparator
+codeSpan: (backslash))
+interblockSeparator
+codeSpan: (backslash)>
+interblockSeparator
+codeSpan: (backslash)(hash)
+interblockSeparator
+codeSpan: (backslash).
+interblockSeparator
+codeSpan: (backslash)!
+interblockSeparator
+codeSpan: (backslash)+
+interblockSeparator
+codeSpan: (backslash)-
+interblockSeparator
+interblockSeparator
+interblockSeparator
+underscore
+underscore
+interblockSeparator
+interblockSeparator
+codeSpan: (backslash)`
+interblockSeparator
+codeSpan: ticks
+interblockSeparator
+backslash
+backslash
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/blockquotes-with-code-blocks.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/blockquotes-with-code-blocks.test
new file mode 100644
index 0000000000..1fa09a34de
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/blockquotes-with-code-blocks.test
@@ -0,0 +1,21 @@
+<<<
+> Example:
+>
+> sub status {
+> print "working";
+> }
+>
+> Or:
+>
+> sub status {
+> return "working";
+> }
+
+>>>
+blockQuoteBegin
+interblockSeparator
+inputVerbatim: ./_markdown_test/702e5d3a17f709c02cee3a2b5e106619.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/9d7d6b4bdbb0a57a705dc70e6c7f5612.verbatim
+blockQuoteEnd
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-blocks.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-blocks.test
new file mode 100644
index 0000000000..5f4a0bb137
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-blocks.test
@@ -0,0 +1,18 @@
+<<<
+ code block on the first line
+
+Regular text.
+
+ code block indented by spaces
+
+Regular Text.
+
+ code block on the last line
+>>>
+inputVerbatim: ./_markdown_test/757353c94a464c718394adbe349d6771.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/84469dcb7c065e457fc00040f5c96d8f.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/e0bb27efcfecc25309f165e0092a7434.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-spans.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-spans.test
new file mode 100644
index 0000000000..94aab36b56
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/code-spans.test
@@ -0,0 +1,4 @@
+<<<
+Here's how you put `` `backticks` `` in a code span.
+>>>
+codeSpan: `backticks`
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/hard-wrapped-paragraphs-with-list-like-lines.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/hard-wrapped-paragraphs-with-list-like-lines.test
new file mode 100644
index 0000000000..6c6690877d
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/hard-wrapped-paragraphs-with-list-like-lines.test
@@ -0,0 +1,12 @@
+<<<
+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 item.
+
+Here's one with a bullet.
+* criminey.
+
+>>>
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/horizontal-rules.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/horizontal-rules.test
new file mode 100644
index 0000000000..e5d45d9dde
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/horizontal-rules.test
@@ -0,0 +1,132 @@
+<<<
+Dashes:
+
+---
+
+ ---
+
+ ---
+
+ ---
+
+ ---
+
+- - -
+
+ - - -
+
+ - - -
+
+ - - -
+
+ - - -
+
+
+Asterisks:
+
+***
+
+ ***
+
+ ***
+
+ ***
+
+ ***
+
+* * *
+
+ * * *
+
+ * * *
+
+ * * *
+
+ * * *
+
+
+Underscores:
+
+___
+
+ ___
+
+ ___
+
+ ___
+
+ ___
+
+_ _ _
+
+ _ _ _
+
+ _ _ _
+
+ _ _ _
+
+ _ _ _
+
+>>>
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+inputVerbatim: ./_markdown_test/6105347ebb9825ac754615ca55ff3b0c.verbatim
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+inputVerbatim: ./_markdown_test/162bbc959948880b7b81a0fe05afbe29.verbatim
+interblockSeparator
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+inputVerbatim: ./_markdown_test/2bb6aed5111ef9726bcf6eef982ff32b.verbatim
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+inputVerbatim: ./_markdown_test/11de6126af81e6dc22594955105d9180.verbatim
+interblockSeparator
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+inputVerbatim: ./_markdown_test/926225b865393c08438ddbfd89ff3d40.verbatim
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+inputVerbatim: ./_markdown_test/c4775559353a17841cc9cde2eae040b2.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-inline-style.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-inline-style.test
new file mode 100644
index 0000000000..d956be1ede
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-inline-style.test
@@ -0,0 +1,50 @@
+<<<
+Just a [URL](/url/).
+
+[URL and title](/url/ "title").
+
+[URL and title](/url/ "title preceded by two spaces").
+
+[URL and title](/url/ "title preceded by a tab").
+
+[URL and title](/url/ "title has spaces afterward" ).
+
+
+[Empty]().
+
+>>>
+BEGIN link
+- label: URL
+- URI: /url/
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: URL and title
+- URI: /url/
+- title: title
+END link
+interblockSeparator
+BEGIN link
+- label: URL and title
+- URI: /url/
+- title: title preceded by two spaces
+END link
+interblockSeparator
+BEGIN link
+- label: URL and title
+- URI: /url/
+- title: title preceded by a tab
+END link
+interblockSeparator
+BEGIN link
+- label: URL and title
+- URI: /url/
+- title: title has spaces afterward
+END link
+interblockSeparator
+BEGIN link
+- label: Empty
+- URI:
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-reference-style.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-reference-style.test
new file mode 100644
index 0000000000..793ea37dca
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-reference-style.test
@@ -0,0 +1,176 @@
+<<<
+Foo [bar] [1].
+
+Foo [bar][1].
+
+Foo [bar]
+[1].
+
+[1]: /url/ "Title"
+
+
+With [embedded [brackets]] [b].
+
+
+Indented [once][].
+
+Indented [twice][].
+
+Indented [thrice][].
+
+Indented [four][] times.
+
+ [once]: /url
+
+ [twice]: /url
+
+ [thrice]: /url
+
+ [four]: /url
+
+
+[b]: /url/
+
+* * *
+
+[this] [this] should work
+
+So should [this][this].
+
+And [this] [].
+
+And [this][].
+
+And [this].
+
+But not [that] [].
+
+Nor [that][].
+
+Nor [that].
+
+[Something in brackets like [this][] should work]
+
+[Same with [this].]
+
+In this case, [this](/somethingelse/) points to something else.
+
+Backslashing should suppress \[this] and [this\].
+
+[this]: foo
+
+
+* * *
+
+Here's one where the [link
+breaks] across lines.
+
+[link breaks]: /url/
+
+>>>
+BEGIN link
+- label: bar
+- URI: /url/
+- title: Title
+END link
+interblockSeparator
+BEGIN link
+- label: bar
+- URI: /url/
+- title: Title
+END link
+interblockSeparator
+BEGIN link
+- label: bar
+- URI: /url/
+- title: Title
+END link
+interblockSeparator
+BEGIN link
+- label: embedded [brackets]
+- URI: /url/
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: once
+- URI: /url
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: twice
+- URI: /url
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: thrice
+- URI: /url
+- title:
+END link
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/b0cba64633d2a9eac28ca9e3fa500018.verbatim
+interblockSeparator
+horizontalRule
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: /somethingelse/
+- title:
+END link
+interblockSeparator
+interblockSeparator
+horizontalRule
+interblockSeparator
+BEGIN link
+- label: link breaks
+- URI: /url/
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-shortcut-references.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-shortcut-references.test
new file mode 100644
index 0000000000..24b189d7c9
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/links-shortcut-references.test
@@ -0,0 +1,42 @@
+<<<
+This is the [simple case].
+
+[simple case]: /simple
+
+
+
+This one has a [line
+break].
+
+[line break]: /foo
+
+
+[this] [that] and the [other]
+
+[this]: /this
+[that]: /that
+[other]: /other
+
+>>>
+BEGIN link
+- label: simple case
+- URI: /simple
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: line break
+- URI: /foo
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: this
+- URI: /that
+- title:
+END link
+BEGIN link
+- label: other
+- URI: /other
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/literal-quotes-in-titles.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/literal-quotes-in-titles.test
new file mode 100644
index 0000000000..cd44028f8f
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/literal-quotes-in-titles.test
@@ -0,0 +1,21 @@
+<<<
+Foo [bar][].
+
+Foo [bar](/url/ "Title with "quotes" inside").
+
+
+ [bar]: /url/ "Title with "quotes" inside"
+
+
+>>>
+BEGIN link
+- label: bar
+- URI: /url/
+- title: Title with "quotes" inside
+END link
+interblockSeparator
+BEGIN link
+- label: bar
+- URI: /url/
+- title: Title with "quotes" inside
+END link
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-basics.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-basics.test
new file mode 100644
index 0000000000..4ce4b68028
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-basics.test
@@ -0,0 +1,436 @@
+<<<
+Markdown: Basics
+================
+
+Getting the Gist of Markdown's Formatting Syntax
+------------------------------------------------
+
+This page offers a brief overview of what it's like to use Markdown.
+The [syntax page] [s] provides complete, detailed documentation for
+every feature, but Markdown should be very easy to pick up simply by
+looking at a few examples of it in action. The examples on this page
+are written in a before/after style, showing example syntax and the
+HTML output produced by Markdown.
+
+It's also helpful to simply try Markdown out; the [Dingus] [d] is a
+web application that allows you type your own Markdown-formatted text
+and translate it to XHTML.
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL] [src].
+
+ [s]: /projects/markdown/syntax "Markdown Syntax"
+ [d]: /projects/markdown/dingus "Markdown Dingus"
+ [src]: /projects/markdown/basics.text
+
+
+## Paragraphs, Headers, Blockquotes ##
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.
+
+Markdown offers two styles of headers: *Setext* and *atx*.
+Setext-style headers for `<h1>` and `<h2>` are created by
+"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
+To create an atx-style header, you put 1-6 hash marks (`#`) at the
+beginning of the line -- the number of hashes equals the resulting
+HTML header level.
+
+Blockquotes are indicated using email-style '`>`' angle brackets.
+
+Markdown:
+
+ A First Level Header
+ ====================
+
+ A Second Level Header
+ ---------------------
+
+ Now is the time for all good men to come to
+ the aid of their country. This is just a
+ regular paragraph.
+
+ The quick brown fox jumped over the lazy
+ dog's back.
+
+ ### Header 3
+
+ > This is a blockquote.
+ >
+ > This is the second paragraph in the blockquote.
+ >
+ > ## This is an H2 in a blockquote
+
+
+Output:
+
+ <h1>A First Level Header</h1>
+
+ <h2>A Second Level Header</h2>
+
+ <p>Now is the time for all good men to come to
+ the aid of their country. This is just a
+ regular paragraph.</p>
+
+ <p>The quick brown fox jumped over the lazy
+ dog's back.</p>
+
+ <h3>Header 3</h3>
+
+ <blockquote>
+ <p>This is a blockquote.</p>
+
+ <p>This is the second paragraph in the blockquote.</p>
+
+ <h2>This is an H2 in a blockquote</h2>
+ </blockquote>
+
+
+
+### Phrase Emphasis ###
+
+Markdown uses asterisks and underscores to indicate spans of emphasis.
+
+Markdown:
+
+ Some of these words *are emphasized*.
+ Some of these words _are emphasized also_.
+
+ Use two asterisks for **strong emphasis**.
+ Or, if you prefer, __use two underscores instead__.
+
+Output:
+
+ <p>Some of these words <em>are emphasized</em>.
+ Some of these words <em>are emphasized also</em>.</p>
+
+ <p>Use two asterisks for <strong>strong emphasis</strong>.
+ Or, if you prefer, <strong>use two underscores instead</strong>.</p>
+
+
+
+## Lists ##
+
+Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
+`+`, and `-`) as list markers. These three markers are
+interchangable; this:
+
+ * Candy.
+ * Gum.
+ * Booze.
+
+this:
+
+ + Candy.
+ + Gum.
+ + Booze.
+
+and this:
+
+ - Candy.
+ - Gum.
+ - Booze.
+
+all produce the same output:
+
+ <ul>
+ <li>Candy.</li>
+ <li>Gum.</li>
+ <li>Booze.</li>
+ </ul>
+
+Ordered (numbered) lists use regular numbers, followed by periods, as
+list markers:
+
+ 1. Red
+ 2. Green
+ 3. Blue
+
+Output:
+
+ <ol>
+ <li>Red</li>
+ <li>Green</li>
+ <li>Blue</li>
+ </ol>
+
+If you put blank lines between items, you'll get `<p>` tags for the
+list item text. You can create multi-paragraph list items by indenting
+the paragraphs by 4 spaces or 1 tab:
+
+ * A list item.
+
+ With multiple paragraphs.
+
+ * Another item in the list.
+
+Output:
+
+ <ul>
+ <li><p>A list item.</p>
+ <p>With multiple paragraphs.</p></li>
+ <li><p>Another item in the list.</p></li>
+ </ul>
+
+
+
+### Links ###
+
+Markdown supports two styles for creating links: *inline* and
+*reference*. With both styles, you use square brackets to delimit the
+text you want to turn into a link.
+
+Inline-style links use parentheses immediately after the link text.
+For example:
+
+ This is an [example link](http://example.com/).
+
+Output:
+
+ <p>This is an <a href="http://example.com/">
+ example link</a>.</p>
+
+Optionally, you may include a title attribute in the parentheses:
+
+ This is an [example link](http://example.com/ "With a Title").
+
+Output:
+
+ <p>This is an <a href="http://example.com/" title="With a Title">
+ example link</a>.</p>
+
+Reference-style links allow you to refer to your links by names, which
+you define elsewhere in your document:
+
+ I get 10 times more traffic from [Google][1] than from
+ [Yahoo][2] or [MSN][3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+
+Output:
+
+ <p>I get 10 times more traffic from <a href="http://google.com/"
+ title="Google">Google</a> than from <a href="http://search.yahoo.com/"
+ title="Yahoo Search">Yahoo</a> or <a href="http://search.msn.com/"
+ title="MSN Search">MSN</a>.</p>
+
+The title attribute is optional. Link names may contain letters,
+numbers and spaces, but are *not* case sensitive:
+
+ I start my morning with a cup of coffee and
+ [The New York Times][NY Times].
+
+ [ny times]: http://www.nytimes.com/
+
+Output:
+
+ <p>I start my morning with a cup of coffee and
+ <a href="http://www.nytimes.com/">The New York Times</a>.</p>
+
+
+### Images ###
+
+Image syntax is very much like link syntax.
+
+Inline (titles are optional):
+
+ ![alt text](/path/to/img.jpg "Title")
+
+Reference-style:
+
+ ![alt text][id]
+
+ [id]: /path/to/img.jpg "Title"
+
+Both of the above examples produce the same output:
+
+ <img src="/path/to/img.jpg" alt="alt text" title="Title" />
+
+
+
+### Code ###
+
+In a regular paragraph, you can create code span by wrapping text in
+backtick quotes. Any ampersands (`&`) and angle brackets (`<` or
+`>`) will automatically be translated into HTML entities. This makes
+it easy to use Markdown to write about HTML example code:
+
+ I strongly recommend against using any `<blink>` tags.
+
+Output:
+
+ <p>I strongly recommend against using any
+ <code>&lt;blink&gt;</code> tags.</p>
+
+
+To specify an entire block of pre-formatted code, indent every line of
+the block by 4 spaces or 1 tab. Just like with code spans, `&`, `<`,
+and `>` characters will be escaped automatically.
+
+Markdown:
+
+ If you want your page to validate under XHTML 1.0 Strict,
+ you've got to put paragraph tags in your blockquotes:
+
+ <blockquote>
+ <p>For example.</p>
+ </blockquote>
+
+Output:
+
+ <p>If you want your page to validate under XHTML 1.0 Strict,
+ you've got to put paragraph tags in your blockquotes:</p>
+
+ <pre><code>&lt;blockquote&gt;
+ &lt;p&gt;For example.&lt;/p&gt;
+ &lt;/blockquote&gt;
+ </code></pre>
+
+>>>
+headingOne: Markdown: Basics
+interblockSeparator
+headingTwo: Getting the Gist of Markdown's Formatting Syntax
+interblockSeparator
+BEGIN link
+- label: syntax page
+- URI: /projects/markdown/syntax
+- title: Markdown Syntax
+END link
+interblockSeparator
+BEGIN link
+- label: Dingus
+- URI: /projects/markdown/dingus
+- title: Markdown Dingus
+END link
+interblockSeparator
+strongEmphasis: Note:
+BEGIN link
+- label: see the source for it by adding '.text' to the URL
+- URI: /projects/markdown/basics.text
+- title:
+END link
+interblockSeparator
+headingTwo: Paragraphs, Headers, Blockquotes
+interblockSeparator
+interblockSeparator
+emphasis: Setext
+emphasis: atx
+codeSpan: <h1>
+codeSpan: <h2>
+codeSpan: =
+codeSpan: -
+codeSpan: (hash)
+interblockSeparator
+codeSpan: >
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/5ebdf3631f626dba5ee92ee773e97a8f.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/9347d3cfacf328e3d73c4fe1b4f76524.verbatim
+interblockSeparator
+headingThree: Phrase Emphasis
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/495d205391f56da33d355c43c81daa64.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/60195f0a7c825159eb9156947e6fb71b.verbatim
+interblockSeparator
+headingTwo: Lists
+interblockSeparator
+codeSpan: *
+codeSpan: +
+codeSpan: -
+interblockSeparator
+inputVerbatim: ./_markdown_test/30a921ea3110056dc221ed257b3c883b.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/674e077aa8994de8bf541093168d2e29.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/7ae61eceff910c380dbe3ee9af7b6c4a.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/b84dd49773de7abaeec71bfa32680045.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/2a1d33d66339f281e4a171d1eb084b07.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/430a75a1628ba89cc2b1005bb1e5d932.verbatim
+interblockSeparator
+codeSpan: <p>
+interblockSeparator
+inputVerbatim: ./_markdown_test/e6108616b0422dd64f485971e61ac69c.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/0bd4d7d78b1cd0e46e78a522f613a6a3.verbatim
+interblockSeparator
+headingThree: Links
+interblockSeparator
+emphasis: inline
+emphasis: reference
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/20cfebed5272ba2f01c1aee798509f18.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/46124210265b51c9d470c0c70a598037.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/d56162c63107aadd63a5b6ca05f491e9.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/c62653fbfcf155bfe2912f066f242885.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/b996f30ba094126a05b4797a048ff2d2.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/0b1519420e84d1c754b52b25170d7213.verbatim
+interblockSeparator
+emphasis: not
+interblockSeparator
+inputVerbatim: ./_markdown_test/15e1c1abc08ec60d9181f9578c6cf172.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/440c1e901154984bf647fc152cb0971b.verbatim
+interblockSeparator
+headingThree: Images
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/602bb0e325271b2b4dce9175eaed15b1.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/e5b369214c819b9d9b476b7bb1f5aa53.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/885cbee5cc0e1fac9ce25c3a9d30034e.verbatim
+interblockSeparator
+headingThree: Code
+interblockSeparator
+codeSpan: (ampersand)
+codeSpan: <
+codeSpan: >
+interblockSeparator
+inputVerbatim: ./_markdown_test/fbcaafb68ad6405619da77e413788d6e.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/cfc57312a789ed7b4e14f3f56c88381a.verbatim
+interblockSeparator
+codeSpan: (ampersand)
+codeSpan: <
+codeSpan: >
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/fe59314852dc8de3165464ab451f44a0.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/3f58f44c2de7257eb42c24e7aee621c5.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-syntax.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-syntax.test
new file mode 100644
index 0000000000..2942add07e
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/markdown-documentation-syntax.test
@@ -0,0 +1,1518 @@
+<<<
+Markdown: Syntax
+================
+
+* [Overview](#overview)
+ * [Philosophy](#philosophy)
+ * [Inline HTML](#html)
+ * [Automatic Escaping for Special Characters](#autoescape)
+* [Block Elements](#block)
+ * [Paragraphs and Line Breaks](#p)
+ * [Headers](#header)
+ * [Blockquotes](#blockquote)
+ * [Lists](#list)
+ * [Code Blocks](#precode)
+ * [Horizontal Rules](#hr)
+* [Span Elements](#span)
+ * [Links](#link)
+ * [Emphasis](#em)
+ * [Code](#code)
+ * [Images](#img)
+* [Miscellaneous](#misc)
+ * [Backslash Escapes](#backslash)
+ * [Automatic Links](#autolink)
+
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL][src].
+
+ [src]: /projects/markdown/syntax.text
+
+* * *
+
+## Overview
+
+### Philosophy
+
+Markdown is intended to be as easy-to-read and easy-to-write as is feasible.
+
+Readability, however, is emphasized above all else. A Markdown-formatted
+document should be publishable as-is, as plain text, without looking
+like it's been marked up with tags or formatting instructions. While
+Markdown's syntax has been influenced by several existing text-to-HTML
+filters -- including [Setext] [1], [atx] [2], [Textile] [3], [reStructuredText] [4],
+[Grutatext] [5], and [EtText] [6] -- the single biggest source of
+inspiration for Markdown's syntax is the format of plain text email.
+
+ [1]: http://docutils.sourceforge.net/mirror/setext.html
+ [2]: http://www.aaronsw.com/2002/atx/
+ [3]: http://textism.com/tools/textile/
+ [4]: http://docutils.sourceforge.net/rst.html
+ [5]: http://www.triptico.com/software/grutatxt.html
+ [6]: http://ettext.taint.org/doc/
+
+To this end, Markdown's syntax is comprised entirely of punctuation
+characters, which punctuation characters have been carefully chosen so
+as to look like what they mean. E.g., asterisks around a word actually
+look like \*emphasis\*. Markdown lists look like, well, lists. Even
+blockquotes look like quoted passages of text, assuming you've ever
+used email.
+
+
+
+### Inline HTML
+
+Markdown's syntax is intended for one purpose: to be used as a
+format for *writing* for the web.
+
+Markdown is not a replacement for HTML, or even close to it. Its
+syntax is very small, corresponding only to a very small subset of
+HTML tags. The idea is *not* to create a syntax that makes it easier
+to insert HTML tags. In my opinion, HTML tags are already easy to
+insert. The idea for Markdown is to make it easy to read, write, and
+edit prose. HTML is a *publishing* format; Markdown is a *writing*
+format. Thus, Markdown's formatting syntax only addresses issues that
+can be conveyed in plain text.
+
+For any markup that is not covered by Markdown's syntax, you simply
+use HTML itself. There's no need to preface it or delimit it to
+indicate that you're switching from Markdown to HTML; you just use
+the tags.
+
+The only restrictions are that block-level HTML elements -- e.g. `<div>`,
+`<table>`, `<pre>`, `<p>`, etc. -- must be separated from surrounding
+content by blank lines, and the start and end tags of the block should
+not be indented with tabs or spaces. Markdown is smart enough not
+to add extra (unwanted) `<p>` tags around HTML block-level tags.
+
+For example, to add an HTML table to a Markdown article:
+
+ This is a regular paragraph.
+
+ <table>
+ <tr>
+ <td>Foo</td>
+ </tr>
+ </table>
+
+ This is another regular paragraph.
+
+Note that Markdown formatting syntax is not processed within block-level
+HTML tags. E.g., you can't use Markdown-style `*emphasis*` inside an
+HTML block.
+
+Span-level HTML tags -- e.g. `<span>`, `<cite>`, or `<del>` -- can be
+used anywhere in a Markdown paragraph, list item, or header. If you
+want, you can even use HTML tags instead of Markdown formatting; e.g. if
+you'd prefer to use HTML `<a>` or `<img>` tags instead of Markdown's
+link or image syntax, go right ahead.
+
+Unlike block-level HTML tags, Markdown syntax *is* processed within
+span-level tags.
+
+
+### Automatic Escaping for Special Characters
+
+In HTML, there are two characters that demand special treatment: `<`
+and `&`. Left angle brackets are used to start tags; ampersands are
+used to denote HTML entities. If you want to use them as literal
+characters, you must escape them as entities, e.g. `&lt;`, and
+`&amp;`.
+
+Ampersands in particular are bedeviling for web writers. If you want to
+write about 'AT&T', you need to write '`AT&amp;T`'. You even need to
+escape ampersands within URLs. Thus, if you want to link to:
+
+ http://images.google.com/images?num=30&q=larry+bird
+
+you need to encode the URL as:
+
+ http://images.google.com/images?num=30&amp;q=larry+bird
+
+in your anchor tag `href` attribute. Needless to say, this is easy to
+forget, and is probably the single most common source of HTML validation
+errors in otherwise well-marked-up web sites.
+
+Markdown allows you to use these characters naturally, taking care of
+all the necessary escaping for you. If you use an ampersand as part of
+an HTML entity, it remains unchanged; otherwise it will be translated
+into `&amp;`.
+
+So, if you want to include a copyright symbol in your article, you can write:
+
+ &copy;
+
+and Markdown will leave it alone. But if you write:
+
+ AT&T
+
+Markdown will translate it to:
+
+ AT&amp;T
+
+Similarly, because Markdown supports [inline HTML](#html), if you use
+angle brackets as delimiters for HTML tags, Markdown will treat them as
+such. But if you write:
+
+ 4 < 5
+
+Markdown will translate it to:
+
+ 4 &lt; 5
+
+However, inside Markdown code spans and blocks, angle brackets and
+ampersands are *always* encoded automatically. This makes it easy to use
+Markdown to write about HTML code. (As opposed to raw HTML, which is a
+terrible format for writing about HTML syntax, because every single `<`
+and `&` in your example code needs to be escaped.)
+
+
+* * *
+
+
+## Block Elements
+
+
+### Paragraphs and Line Breaks
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like a
+blank line -- a line containing nothing but spaces or tabs is considered
+blank.) Normal paragraphs should not be intended with spaces or tabs.
+
+The implication of the "one or more consecutive lines of text" rule is
+that Markdown supports "hard-wrapped" text paragraphs. This differs
+significantly from most other text-to-HTML formatters (including Movable
+Type's "Convert Line Breaks" option) which translate every line break
+character in a paragraph into a `<br />` tag.
+
+When you *do* want to insert a `<br />` break tag using Markdown, you
+end a line with two or more spaces, then type return.
+
+Yes, this takes a tad more effort to create a `<br />`, but a simplistic
+"every line break is a `<br />`" rule wouldn't work for Markdown.
+Markdown's email-style [blockquoting][bq] and multi-paragraph [list items][l]
+work best -- and look better -- when you format them with hard breaks.
+
+ [bq]: #blockquote
+ [l]: #list
+
+
+
+### Headers
+
+Markdown supports two styles of headers, [Setext] [1] and [atx] [2].
+
+Setext-style headers are "underlined" using equal signs (for first-level
+headers) and dashes (for second-level headers). For example:
+
+ This is an H1
+ =============
+
+ This is an H2
+ -------------
+
+Any number of underlining `=`'s or `-`'s will work.
+
+Atx-style headers use 1-6 hash characters at the start of the line,
+corresponding to header levels 1-6. For example:
+
+ # This is an H1
+
+ ## This is an H2
+
+ ###### This is an H6
+
+Optionally, you may "close" atx-style headers. This is purely
+cosmetic -- you can use this if you think it looks better. The
+closing hashes don't even need to match the number of hashes
+used to open the header. (The number of opening hashes
+determines the header level.) :
+
+ # This is an H1 #
+
+ ## This is an H2 ##
+
+ ### This is an H3 ######
+
+
+### Blockquotes
+
+Markdown uses email-style `>` characters for blockquoting. If you're
+familiar with quoting passages of text in an email message, then you
+know how to create a blockquote in Markdown. It looks best if you hard
+wrap the text and put a `>` before every line:
+
+ > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+ > consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+ > Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+ >
+ > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+ > id sem consectetuer libero luctus adipiscing.
+
+Markdown allows you to be lazy and only put the `>` before the first
+line of a hard-wrapped paragraph:
+
+ > This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
+ consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
+
+ > Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
+ id sem consectetuer libero luctus adipiscing.
+
+Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
+adding additional levels of `>`:
+
+ > This is the first level of quoting.
+ >
+ > > This is nested blockquote.
+ >
+ > Back to the first level.
+
+Blockquotes can contain other Markdown elements, including headers, lists,
+and code blocks:
+
+ > ## This is a header.
+ >
+ > 1. This is the first list item.
+ > 2. This is the second list item.
+ >
+ > Here's some example code:
+ >
+ > return shell_exec("echo $input | $markdown_script");
+
+Any decent text editor should make email-style quoting easy. For
+example, with BBEdit, you can make a selection and choose Increase
+Quote Level from the Text menu.
+
+
+### Lists
+
+Markdown supports ordered (numbered) and unordered (bulleted) lists.
+
+Unordered lists use asterisks, pluses, and hyphens -- interchangably
+-- as list markers:
+
+ * Red
+ * Green
+ * Blue
+
+is equivalent to:
+
+ + Red
+ + Green
+ + Blue
+
+and:
+
+ - Red
+ - Green
+ - Blue
+
+Ordered lists use numbers followed by periods:
+
+ 1. Bird
+ 2. McHale
+ 3. Parish
+
+It's important to note that the actual numbers you use to mark the
+list have no effect on the HTML output Markdown produces. The HTML
+Markdown produces from the above list is:
+
+ <ol>
+ <li>Bird</li>
+ <li>McHale</li>
+ <li>Parish</li>
+ </ol>
+
+If you instead wrote the list in Markdown like this:
+
+ 1. Bird
+ 1. McHale
+ 1. Parish
+
+or even:
+
+ 3. Bird
+ 1. McHale
+ 8. Parish
+
+you'd get the exact same HTML output. The point is, if you want to,
+you can use ordinal numbers in your ordered Markdown lists, so that
+the numbers in your source match the numbers in your published HTML.
+But if you want to be lazy, you don't have to.
+
+If you do use lazy list numbering, however, you should still start the
+list with the number 1. At some point in the future, Markdown may support
+starting ordered lists at an arbitrary number.
+
+List markers typically start at the left margin, but may be indented by
+up to three spaces. List markers must be followed by one or more spaces
+or a tab.
+
+To make lists look nice, you can wrap items with hanging indents:
+
+ * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+
+But if you want to be lazy, you don't have to:
+
+ * Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+ Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
+ viverra nec, fringilla in, laoreet vitae, risus.
+ * Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
+ Suspendisse id sem consectetuer libero luctus adipiscing.
+
+If list items are separated by blank lines, Markdown will wrap the
+items in `<p>` tags in the HTML output. For example, this input:
+
+ * Bird
+ * Magic
+
+will turn into:
+
+ <ul>
+ <li>Bird</li>
+ <li>Magic</li>
+ </ul>
+
+But this:
+
+ * Bird
+
+ * Magic
+
+will turn into:
+
+ <ul>
+ <li><p>Bird</p></li>
+ <li><p>Magic</p></li>
+ </ul>
+
+List items may consist of multiple paragraphs. Each subsequent
+paragraph in a list item must be intended by either 4 spaces
+or one tab:
+
+ 1. This is a list item with two paragraphs. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit. Aliquam hendrerit
+ mi posuere lectus.
+
+ Vestibulum enim wisi, viverra nec, fringilla in, laoreet
+ vitae, risus. Donec sit amet nisl. Aliquam semper ipsum
+ sit amet velit.
+
+ 2. Suspendisse id sem consectetuer libero luctus adipiscing.
+
+It looks nice if you indent every line of the subsequent
+paragraphs, but here again, Markdown will allow you to be
+lazy:
+
+ * This is a list item with two paragraphs.
+
+ This is the second paragraph in the list item. You're
+ only required to indent the first line. Lorem ipsum dolor
+ sit amet, consectetuer adipiscing elit.
+
+ * Another item in the same list.
+
+To put a blockquote within a list item, the blockquote's `>`
+delimiters need to be indented:
+
+ * A list item with a blockquote:
+
+ > This is a blockquote
+ > inside a list item.
+
+To put a code block within a list item, the code block needs
+to be indented *twice* -- 8 spaces or two tabs:
+
+ * A list item with a code block:
+
+ <code goes here>
+
+
+It's worth noting that it's possible to trigger an ordered list by
+accident, by writing something like this:
+
+ 1986. What a great season.
+
+In other words, a *number-period-space* sequence at the beginning of a
+line. To avoid this, you can backslash-escape the period:
+
+ 1986\. What a great season.
+
+
+
+### Code Blocks
+
+Pre-formatted code blocks are used for writing about programming or
+markup source code. Rather than forming normal paragraphs, the lines
+of a code block are interpreted literally. Markdown wraps a code block
+in both `<pre>` and `<code>` tags.
+
+To produce a code block in Markdown, simply indent every line of the
+block by at least 4 spaces or 1 tab. For example, given this input:
+
+ This is a normal paragraph:
+
+ This is a code block.
+
+Markdown will generate:
+
+ <p>This is a normal paragraph:</p>
+
+ <pre><code>This is a code block.
+ </code></pre>
+
+One level of indentation -- 4 spaces or 1 tab -- is removed from each
+line of the code block. For example, this:
+
+ Here is an example of AppleScript:
+
+ tell application "Foo"
+ beep
+ end tell
+
+will turn into:
+
+ <p>Here is an example of AppleScript:</p>
+
+ <pre><code>tell application "Foo"
+ beep
+ end tell
+ </code></pre>
+
+A code block continues until it reaches a line that is not indented
+(or the end of the article).
+
+Within a code block, ampersands (`&`) and angle brackets (`<` and `>`)
+are automatically converted into HTML entities. This makes it very
+easy to include example HTML source code using Markdown -- just paste
+it and indent it, and Markdown will handle the hassle of encoding the
+ampersands and angle brackets. For example, this:
+
+ <div class="footer">
+ &copy; 2004 Foo Corporation
+ </div>
+
+will turn into:
+
+ <pre><code>&lt;div class="footer"&gt;
+ &amp;copy; 2004 Foo Corporation
+ &lt;/div&gt;
+ </code></pre>
+
+Regular Markdown syntax is not processed within code blocks. E.g.,
+asterisks are just literal asterisks within a code block. This means
+it's also easy to use Markdown to write about Markdown's own syntax.
+
+
+
+### Horizontal Rules
+
+You can produce a horizontal rule tag (`<hr />`) by placing three or
+more hyphens, asterisks, or underscores on a line by themselves. If you
+wish, you may use spaces between the hyphens or asterisks. Each of the
+following lines will produce a horizontal rule:
+
+ * * *
+
+ ***
+
+ *****
+
+ - - -
+
+ ---------------------------------------
+
+ _ _ _
+
+
+* * *
+
+## Span Elements
+
+### Links
+
+Markdown supports two style of links: *inline* and *reference*.
+
+In both styles, the link text is delimited by [square brackets].
+
+To create an inline link, use a set of regular parentheses immediately
+after the link text's closing square bracket. Inside the parentheses,
+put the URL where you want the link to point, along with an *optional*
+title for the link, surrounded in quotes. For example:
+
+ This is [an example](http://example.com/ "Title") inline link.
+
+ [This link](http://example.net/) has no title attribute.
+
+Will produce:
+
+ <p>This is <a href="http://example.com/" title="Title">
+ an example</a> inline link.</p>
+
+ <p><a href="http://example.net/">This link</a> has no
+ title attribute.</p>
+
+If you're referring to a local resource on the same server, you can
+use relative paths:
+
+ See my [About](/about/) page for details.
+
+Reference-style links use a second set of square brackets, inside
+which you place a label of your choosing to identify the link:
+
+ This is [an example][id] reference-style link.
+
+You can optionally use a space to separate the sets of brackets:
+
+ This is [an example] [id] reference-style link.
+
+Then, anywhere in the document, you define your link label like this,
+on a line by itself:
+
+ [id]: http://example.com/ "Optional Title Here"
+
+That is:
+
+* Square brackets containing the link identifier (optionally
+ indented from the left margin using up to three spaces);
+* followed by a colon;
+* followed by one or more spaces (or tabs);
+* followed by the URL for the link;
+* optionally followed by a title attribute for the link, enclosed
+ in double or single quotes.
+
+The link URL may, optionally, be surrounded by angle brackets:
+
+ [id]: <http://example.com/> "Optional Title Here"
+
+You can put the title attribute on the next line and use extra spaces
+or tabs for padding, which tends to look better with longer URLs:
+
+ [id]: http://example.com/longish/path/to/resource/here
+ "Optional Title Here"
+
+Link definitions are only used for creating links during Markdown
+processing, and are stripped from your document in the HTML output.
+
+Link definition names may constist of letters, numbers, spaces, and punctuation -- but they are *not* case sensitive. E.g. these two links:
+
+ [link text][a]
+ [link text][A]
+
+are equivalent.
+
+The *implicit link name* shortcut allows you to omit the name of the
+link, in which case the link text itself is used as the name.
+Just use an empty set of square brackets -- e.g., to link the word
+"Google" to the google.com web site, you could simply write:
+
+ [Google][]
+
+And then define the link:
+
+ [Google]: http://google.com/
+
+Because link names may contain spaces, this shortcut even works for
+multiple words in the link text:
+
+ Visit [Daring Fireball][] for more information.
+
+And then define the link:
+
+ [Daring Fireball]: http://daringfireball.net/
+
+Link definitions can be placed anywhere in your Markdown document. I
+tend to put them immediately after each paragraph in which they're
+used, but if you want, you can put them all at the end of your
+document, sort of like footnotes.
+
+Here's an example of reference links in action:
+
+ I get 10 times more traffic from [Google] [1] than from
+ [Yahoo] [2] or [MSN] [3].
+
+ [1]: http://google.com/ "Google"
+ [2]: http://search.yahoo.com/ "Yahoo Search"
+ [3]: http://search.msn.com/ "MSN Search"
+
+Using the implicit link name shortcut, you could instead write:
+
+ I get 10 times more traffic from [Google][] than from
+ [Yahoo][] or [MSN][].
+
+ [google]: http://google.com/ "Google"
+ [yahoo]: http://search.yahoo.com/ "Yahoo Search"
+ [msn]: http://search.msn.com/ "MSN Search"
+
+Both of the above examples will produce the following HTML output:
+
+ <p>I get 10 times more traffic from <a href="http://google.com/"
+ title="Google">Google</a> than from
+ <a href="http://search.yahoo.com/" title="Yahoo Search">Yahoo</a>
+ or <a href="http://search.msn.com/" title="MSN Search">MSN</a>.</p>
+
+For comparison, here is the same paragraph written using
+Markdown's inline link style:
+
+ I get 10 times more traffic from [Google](http://google.com/ "Google")
+ than from [Yahoo](http://search.yahoo.com/ "Yahoo Search") or
+ [MSN](http://search.msn.com/ "MSN Search").
+
+The point of reference-style links is not that they're easier to
+write. The point is that with reference-style links, your document
+source is vastly more readable. Compare the above examples: using
+reference-style links, the paragraph itself is only 81 characters
+long; with inline-style links, it's 176 characters; and as raw HTML,
+it's 234 characters. In the raw HTML, there's more markup than there
+is text.
+
+With Markdown's reference-style links, a source document much more
+closely resembles the final output, as rendered in a browser. By
+allowing you to move the markup-related metadata out of the paragraph,
+you can add links without interrupting the narrative flow of your
+prose.
+
+
+### Emphasis
+
+Markdown treats asterisks (`*`) and underscores (`_`) as indicators of
+emphasis. Text wrapped with one `*` or `_` will be wrapped with an
+HTML `<em>` tag; double `*`'s or `_`'s will be wrapped with an HTML
+`<strong>` tag. E.g., this input:
+
+ *single asterisks*
+
+ _single underscores_
+
+ **double asterisks**
+
+ __double underscores__
+
+will produce:
+
+ <em>single asterisks</em>
+
+ <em>single underscores</em>
+
+ <strong>double asterisks</strong>
+
+ <strong>double underscores</strong>
+
+You can use whichever style you prefer; the lone restriction is that
+the same character must be used to open and close an emphasis span.
+
+Emphasis can be used in the middle of a word:
+
+ un*fucking*believable
+
+But if you surround an `*` or `_` with spaces, it'll be treated as a
+literal asterisk or underscore.
+
+To produce a literal asterisk or underscore at a position where it
+would otherwise be used as an emphasis delimiter, you can backslash
+escape it:
+
+ \*this text is surrounded by literal asterisks\*
+
+
+
+### Code
+
+To indicate a span of code, wrap it with backtick quotes (`` ` ``).
+Unlike a pre-formatted code block, a code span indicates code within a
+normal paragraph. For example:
+
+ Use the `printf()` function.
+
+will produce:
+
+ <p>Use the <code>printf()</code> function.</p>
+
+To include a literal backtick character within a code span, you can use
+multiple backticks as the opening and closing delimiters:
+
+ ``There is a literal backtick (`) here.``
+
+which will produce this:
+
+ <p><code>There is a literal backtick (`) here.</code></p>
+
+The backtick delimiters surrounding a code span may include spaces --
+one after the opening, one before the closing. This allows you to place
+literal backtick characters at the beginning or end of a code span:
+
+ A single backtick in a code span: `` ` ``
+
+ A backtick-delimited string in a code span: `` `foo` ``
+
+will produce:
+
+ <p>A single backtick in a code span: <code>`</code></p>
+
+ <p>A backtick-delimited string in a code span: <code>`foo`</code></p>
+
+With a code span, ampersands and angle brackets are encoded as HTML
+entities automatically, which makes it easy to include example HTML
+tags. Markdown will turn this:
+
+ Please don't use any `<blink>` tags.
+
+into:
+
+ <p>Please don't use any <code>&lt;blink&gt;</code> tags.</p>
+
+You can write this:
+
+ `&#8212;` is the decimal-encoded equivalent of `&mdash;`.
+
+to produce:
+
+ <p><code>&amp;#8212;</code> is the decimal-encoded
+ equivalent of <code>&amp;mdash;</code>.</p>
+
+
+
+### Images
+
+Admittedly, it's fairly difficult to devise a "natural" syntax for
+placing images into a plain text document format.
+
+Markdown uses an image syntax that is intended to resemble the syntax
+for links, allowing for two styles: *inline* and *reference*.
+
+Inline image syntax looks like this:
+
+ ![Alt text](/path/to/img.jpg)
+
+ ![Alt text](/path/to/img.jpg "Optional title")
+
+That is:
+
+* An exclamation mark: `!`;
+* followed by a set of square brackets, containing the `alt`
+ attribute text for the image;
+* followed by a set of parentheses, containing the URL or path to
+ the image, and an optional `title` attribute enclosed in double
+ or single quotes.
+
+Reference-style image syntax looks like this:
+
+ ![Alt text][id]
+
+Where "id" is the name of a defined image reference. Image references
+are defined using syntax identical to link references:
+
+ [id]: url/to/image "Optional title attribute"
+
+As of this writing, Markdown has no syntax for specifying the
+dimensions of an image; if this is important to you, you can simply
+use regular HTML `<img>` tags.
+
+
+* * *
+
+
+## Miscellaneous
+
+### Automatic Links
+
+Markdown supports a shortcut style for creating "automatic" links for URLs and email addresses: simply surround the URL or email address with angle brackets. What this means is that if you want to show the actual text of a URL or email address, and also have it be a clickable link, you can do this:
+
+ <http://example.com/>
+
+Markdown will turn this into:
+
+ <a href="http://example.com/">http://example.com/</a>
+
+Automatic links for email addresses work similarly, except that
+Markdown will also perform a bit of randomized decimal and hex
+entity-encoding to help obscure your address from address-harvesting
+spambots. For example, Markdown will turn this:
+
+ <address@example.com>
+
+into something like this:
+
+ <a href="&#x6D;&#x61;i&#x6C;&#x74;&#x6F;:&#x61;&#x64;&#x64;&#x72;&#x65;
+ &#115;&#115;&#64;&#101;&#120;&#x61;&#109;&#x70;&#x6C;e&#x2E;&#99;&#111;
+ &#109;">&#x61;&#x64;&#x64;&#x72;&#x65;&#115;&#115;&#64;&#101;&#120;&#x61;
+ &#109;&#x70;&#x6C;e&#x2E;&#99;&#111;&#109;</a>
+
+which will render in a browser as a clickable link to "address@example.com".
+
+(This sort of entity-encoding trick will indeed fool many, if not
+most, address-harvesting bots, but it definitely won't fool all of
+them. It's better than nothing, but an address published in this way
+will probably eventually start receiving spam.)
+
+
+
+### Backslash Escapes
+
+Markdown allows you to use backslash escapes to generate literal
+characters which would otherwise have special meaning in Markdown's
+formatting syntax. For example, if you wanted to surround a word with
+literal asterisks (instead of an HTML `<em>` tag), you can backslashes
+before the asterisks, like this:
+
+ \*literal asterisks\*
+
+Markdown provides backslash escapes for the following characters:
+
+ \ backslash
+ ` backtick
+ * asterisk
+ _ underscore
+ {} curly braces
+ [] square brackets
+ () parentheses
+ # hash mark
+ + plus sign
+ - minus sign (hyphen)
+ . dot
+ ! exclamation mark
+
+>>>
+headingOne: Markdown: Syntax
+interblockSeparator
+ulBeginTight
+ulItem
+BEGIN link
+- label: Overview
+- URI: (hash)overview
+- title:
+END link
+interblockSeparator
+ulBeginTight
+ulItem
+BEGIN link
+- label: Philosophy
+- URI: (hash)philosophy
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Inline HTML
+- URI: (hash)html
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Automatic Escaping for Special Characters
+- URI: (hash)autoescape
+- title:
+END link
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulItem
+BEGIN link
+- label: Block Elements
+- URI: (hash)block
+- title:
+END link
+interblockSeparator
+ulBeginTight
+ulItem
+BEGIN link
+- label: Paragraphs and Line Breaks
+- URI: (hash)p
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Headers
+- URI: (hash)header
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Blockquotes
+- URI: (hash)blockquote
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Lists
+- URI: (hash)list
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Code Blocks
+- URI: (hash)precode
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Horizontal Rules
+- URI: (hash)hr
+- title:
+END link
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulItem
+BEGIN link
+- label: Span Elements
+- URI: (hash)span
+- title:
+END link
+interblockSeparator
+ulBeginTight
+ulItem
+BEGIN link
+- label: Links
+- URI: (hash)link
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Emphasis
+- URI: (hash)em
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Code
+- URI: (hash)code
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Images
+- URI: (hash)img
+- title:
+END link
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulItem
+BEGIN link
+- label: Miscellaneous
+- URI: (hash)misc
+- title:
+END link
+interblockSeparator
+ulBeginTight
+ulItem
+BEGIN link
+- label: Backslash Escapes
+- URI: (hash)backslash
+- title:
+END link
+ulItemEnd
+ulItem
+BEGIN link
+- label: Automatic Links
+- URI: (hash)autolink
+- title:
+END link
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulEndTight
+interblockSeparator
+strongEmphasis: Note:
+BEGIN link
+- label: see the source for it by adding '.text' to the URL
+- URI: /projects/markdown/syntax.text
+- title:
+END link
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingTwo: Overview
+interblockSeparator
+headingThree: Philosophy
+interblockSeparator
+interblockSeparator
+BEGIN link
+- label: Setext
+- URI: http://docutils.sourceforge.net/mirror/setext.html
+- title:
+END link
+BEGIN link
+- label: atx
+- URI: http://www.aaronsw.com/2002/atx/
+- title:
+END link
+BEGIN link
+- label: Textile
+- URI: http://textism.com/tools/textile/
+- title:
+END link
+BEGIN link
+- label: reStructuredText
+- URI: http://docutils.sourceforge.net/rst.html
+- title:
+END link
+BEGIN link
+- label: Grutatext
+- URI: http://www.triptico.com/software/grutatxt.html
+- title:
+END link
+BEGIN link
+- label: EtText
+- URI: http://ettext.taint.org/doc/
+- title:
+END link
+interblockSeparator
+interblockSeparator
+headingThree: Inline HTML
+interblockSeparator
+emphasis: writing
+interblockSeparator
+emphasis: not
+emphasis: publishing
+emphasis: writing
+interblockSeparator
+interblockSeparator
+codeSpan: <div>
+codeSpan: <table>
+codeSpan: <pre>
+codeSpan: <p>
+codeSpan: <p>
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/6c0e67934e0358fd4071cf4247bcf221.verbatim
+interblockSeparator
+codeSpan: *emphasis*
+interblockSeparator
+codeSpan: <span>
+codeSpan: <cite>
+codeSpan: <del>
+codeSpan: <a>
+codeSpan: <img>
+interblockSeparator
+emphasis: is
+interblockSeparator
+headingThree: Automatic Escaping for Special Characters
+interblockSeparator
+codeSpan: <
+codeSpan: (ampersand)
+codeSpan: (ampersand)lt;
+codeSpan: (ampersand)amp;
+interblockSeparator
+ampersand
+codeSpan: AT(ampersand)amp;T
+interblockSeparator
+inputVerbatim: ./_markdown_test/01abe6d069cf62de251cf21f8df1d11f.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/3bb5e0b18bdd7c9688b9f5df139967f3.verbatim
+interblockSeparator
+codeSpan: href
+interblockSeparator
+codeSpan: (ampersand)amp;
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/9f3cb292eb01028cce569a08ef6f975b.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/7cdba89e6cc34bd4841c7c6a41bb4156.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/c79c1d6af747ea457d80ff723101137a.verbatim
+interblockSeparator
+BEGIN link
+- label: inline HTML
+- URI: (hash)html
+- title:
+END link
+interblockSeparator
+inputVerbatim: ./_markdown_test/e76bfed335c678dbe01b3982b9b46fdc.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/cc7bb6b7c24a66c62c969328036e8f7b.verbatim
+interblockSeparator
+emphasis: always
+codeSpan: <
+codeSpan: (ampersand)
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingTwo: Block Elements
+interblockSeparator
+headingThree: Paragraphs and Line Breaks
+interblockSeparator
+interblockSeparator
+codeSpan: <br />
+interblockSeparator
+emphasis: do
+codeSpan: <br />
+interblockSeparator
+codeSpan: <br />
+codeSpan: <br />
+BEGIN link
+- label: blockquoting
+- URI: (hash)blockquote
+- title:
+END link
+BEGIN link
+- label: list items
+- URI: (hash)list
+- title:
+END link
+interblockSeparator
+headingThree: Headers
+interblockSeparator
+BEGIN link
+- label: Setext
+- URI: http://docutils.sourceforge.net/mirror/setext.html
+- title:
+END link
+BEGIN link
+- label: atx
+- URI: http://www.aaronsw.com/2002/atx/
+- title:
+END link
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/4f59d4e23ef758fd94bd2324643e2f2b.verbatim
+interblockSeparator
+codeSpan: =
+codeSpan: -
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/48058b850bf198c75e9571ef25b4174e.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/37d9f30690dba801bda9a65ec7cfd1be.verbatim
+interblockSeparator
+headingThree: Blockquotes
+interblockSeparator
+codeSpan: >
+codeSpan: >
+interblockSeparator
+inputVerbatim: ./_markdown_test/a89055d359469d454a801830954a9c6f.verbatim
+interblockSeparator
+codeSpan: >
+interblockSeparator
+inputVerbatim: ./_markdown_test/944cb176339d03ac7508f0f66090979f.verbatim
+interblockSeparator
+codeSpan: >
+interblockSeparator
+inputVerbatim: ./_markdown_test/2a3331ca2a955f6ad7da2480f9cda089.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/539f94bbd698cb75fb0cd1ba51d297b2.verbatim
+interblockSeparator
+interblockSeparator
+headingThree: Lists
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/7667e2408d637a1e3ca69ccc1ce50809.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/f9c93344b256fc419363b5137a49888e.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/0ae7b8161204fb8d79d287ece754d868.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/5159786425bde2cec7e20b79500dde54.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/9679de8f4110a0e2906694aa1804cbf0.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/68c7899020501a169d9e9ca810aff930.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/733b6752776567144548322ef66d67e6.verbatim
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/3915e80c9e2b1a87599797fb217c295b.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/35441140ac44d3c2c7b9611d18c6dca4.verbatim
+interblockSeparator
+codeSpan: <p>
+interblockSeparator
+inputVerbatim: ./_markdown_test/92f4628c14a10b92aead4a4ebd01936a.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/02afc9ab8392711baf578d89e8b624a8.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/ec0f57523c3541a14df8f17f3c822039.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/197c8667c0c0307c8174e6a6e07c2a48.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/a07ba2a71f8cd42180768463fa2e5dad.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/d56908f0f6e2476a6146ece0fa7e2f32.verbatim
+interblockSeparator
+codeSpan: >
+interblockSeparator
+inputVerbatim: ./_markdown_test/4c06d5a765803dd6f15378765020443c.verbatim
+interblockSeparator
+emphasis: twice
+interblockSeparator
+inputVerbatim: ./_markdown_test/d3f24a5ba4f9ebe7c97b690753fef199.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/d87e20aae0facc7fbbc293f790178cf4.verbatim
+interblockSeparator
+emphasis: number-period-space
+interblockSeparator
+inputVerbatim: ./_markdown_test/ea5e5fa61236c2e31ecb34d484caed78.verbatim
+interblockSeparator
+headingThree: Code Blocks
+interblockSeparator
+codeSpan: <pre>
+codeSpan: <code>
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/80158a498770adf4d0617503ae558414.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/35dd5e3b1d316dec464fafbedf53439e.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/992aa3a21cc79d1a6a7b273173e1cc48.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/d37edcee91241df6034067902bf7ff5f.verbatim
+interblockSeparator
+interblockSeparator
+codeSpan: (ampersand)
+codeSpan: <
+codeSpan: >
+interblockSeparator
+inputVerbatim: ./_markdown_test/bfd3b2e8e47a22fe0914d55781a73b7c.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/6a14fbcefad86826e777c27a9000b94a.verbatim
+interblockSeparator
+interblockSeparator
+headingThree: Horizontal Rules
+interblockSeparator
+codeSpan: <hr />
+interblockSeparator
+inputVerbatim: ./_markdown_test/b3a754721670b6236c8eb8159555f38b.verbatim
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingTwo: Span Elements
+interblockSeparator
+headingThree: Links
+interblockSeparator
+emphasis: inline
+emphasis: reference
+interblockSeparator
+interblockSeparator
+emphasis: optional
+interblockSeparator
+inputVerbatim: ./_markdown_test/1414e8798e8df1116073e37e18480580.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/fee0581724d177221ef58d9e6a498b35.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/be45edb9cb5e6fb760f9805ffc37b64b.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/00842bca924b6e825c555a0866ba0488.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/525e6727b97cbbb73ce96c0ba62e8eb6.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/a35af952f6f3a307982ea5250cfb72de.verbatim
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/59be3295fa322e809f4138ef7500798a.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/a39ca11b40fca9daced4a3b44b1fc1a3.verbatim
+interblockSeparator
+interblockSeparator
+emphasis: not
+interblockSeparator
+inputVerbatim: ./_markdown_test/a943d1cc49e6963c7bcb45acfebf321f.verbatim
+interblockSeparator
+interblockSeparator
+emphasis: implicit link name
+interblockSeparator
+inputVerbatim: ./_markdown_test/c2c38dc7e1a41ddb3d50c965e569aab4.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/17194fe133f07ed35b959c9108de4cec.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/1a7658c341b463a9232093771a413acc.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/65aaecc2b48f0d27de8de608c27ed6e7.verbatim
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/31285fcec3a6ea99b4694d3e6750fc60.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/0810a7510b5a42a7ec77fd3d55be870e.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/28d0c5764a38e6b58409f9967ef91bcc.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/f39ac74789b190c9c1460bd06b2e5f66.verbatim
+interblockSeparator
+interblockSeparator
+interblockSeparator
+headingThree: Emphasis
+interblockSeparator
+codeSpan: *
+codeSpan: (underscore)
+codeSpan: *
+codeSpan: (underscore)
+codeSpan: <em>
+codeSpan: *
+codeSpan: (underscore)
+codeSpan: <strong>
+interblockSeparator
+inputVerbatim: ./_markdown_test/ad2981010cf94e370ccb06c7233f0989.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/451a1d0edf74505402610a4bae7997d0.verbatim
+interblockSeparator
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/3f3996b979db4e11ec6fd9b0232b3d83.verbatim
+interblockSeparator
+codeSpan: *
+codeSpan: (underscore)
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/85d79dd13f594a1dc7dc5b2be403366a.verbatim
+interblockSeparator
+headingThree: Code
+interblockSeparator
+codeSpan: `
+interblockSeparator
+inputVerbatim: ./_markdown_test/3013bb705f116d1bf7d7506a827cd6f1.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/0d572dc866bb6649bdedef400a32f2ee.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/000c6f567a8ecf3820cf43f6b248b303.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/a499280e33397f3bd9ec1415835a1c04.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/56cb72e47c0ff4e11b252117ed9d7c15.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/2624fb4324d31d847556b8cf06cc71a3.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/7e31b58c38fbe808c13ae0c21943fdbb.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/775e317bc6e9bac7e3a3a3f44dade6d1.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/b71470703a2237b352df145a688666b9.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/c7d2bf55eba7aa8ecd26cc75c0116ecd.verbatim
+interblockSeparator
+headingThree: Images
+interblockSeparator
+interblockSeparator
+emphasis: inline
+emphasis: reference
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/95e477e08806ad17333ef8c62ab1a9bf.verbatim
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+codeSpan: !
+ulItemEnd
+ulItem
+codeSpan: alt
+ulItemEnd
+ulItem
+codeSpan: title
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/90c3fb2e48c6bc6b5139b7d9fefe33eb.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/a5bd86aacaa065512fabab353b4646b5.verbatim
+interblockSeparator
+codeSpan: <img>
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingTwo: Miscellaneous
+interblockSeparator
+headingThree: Automatic Links
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/ba84105470e6c3ca4640b0165ba73e28.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/3d59db9474543617b421ad8938c9ad5f.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/7c01c9510936100673897e413a694f95.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/57dc30d4baafa58ac03c967e1ffe882b.verbatim
+interblockSeparator
+interblockSeparator
+interblockSeparator
+headingThree: Backslash Escapes
+interblockSeparator
+codeSpan: <em>
+interblockSeparator
+inputVerbatim: ./_markdown_test/ee5b9bd27735fe320e0eb1cd9218539d.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/4f5715933ffa8d2f20d0360598a68dbb.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/nested-blockquotes.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/nested-blockquotes.test
new file mode 100644
index 0000000000..bbc0f7e4c5
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/nested-blockquotes.test
@@ -0,0 +1,14 @@
+<<<
+> foo
+>
+> > bar
+>
+> foo
+
+>>>
+blockQuoteBegin
+interblockSeparator
+blockQuoteBegin
+blockQuoteEnd
+interblockSeparator
+blockQuoteEnd
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/ordered-and-unordered-lists.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/ordered-and-unordered-lists.test
new file mode 100644
index 0000000000..6a88122d16
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/ordered-and-unordered-lists.test
@@ -0,0 +1,323 @@
+<<<
+## Unordered
+
+Asterisks tight:
+
+* asterisk 1
+* asterisk 2
+* asterisk 3
+
+
+Asterisks loose:
+
+* asterisk 1
+
+* asterisk 2
+
+* asterisk 3
+
+* * *
+
+Pluses tight:
+
++ Plus 1
++ Plus 2
++ Plus 3
+
+
+Pluses loose:
+
++ Plus 1
+
++ Plus 2
+
++ Plus 3
+
+* * *
+
+
+Minuses tight:
+
+- Minus 1
+- Minus 2
+- Minus 3
+
+
+Minuses loose:
+
+- Minus 1
+
+- Minus 2
+
+- Minus 3
+
+
+## Ordered
+
+Tight:
+
+1. First
+2. Second
+3. Third
+
+and:
+
+1. One
+2. Two
+3. Three
+
+
+Loose using tabs:
+
+1. First
+
+2. Second
+
+3. Third
+
+and using spaces:
+
+1. One
+
+2. Two
+
+3. Three
+
+Multiple paragraphs:
+
+1. Item 1, graf one.
+
+ Item 2. graf two. The quick brown fox jumped over the lazy dog&#39;s
+ back.
+
+2. Item 2.
+
+3. Item 3.
+
+
+
+## Nested
+
+* Tab
+ * Tab
+ * Tab
+
+Here&#39;s another:
+
+1. First
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+3. Third
+
+Same thing but with paragraphs:
+
+1. First
+
+2. Second:
+ * Fee
+ * Fie
+ * Foe
+
+3. Third
+
+
+This was an error in Markdown 1.0.1:
+
+* this
+
+ * sub
+
+ that
+
+>>>
+headingTwo: Unordered
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+ulBegin
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEnd
+interblockSeparator
+horizontalRule
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+ulBegin
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEnd
+interblockSeparator
+horizontalRule
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+ulBegin
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEnd
+interblockSeparator
+headingTwo: Ordered
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEnd
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEnd
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 1
+interblockSeparator
+ampersand
+hash
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEnd
+interblockSeparator
+headingTwo: Nested
+interblockSeparator
+ulBeginTight
+ulItem
+interblockSeparator
+ulBeginTight
+ulItem
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulEndTight
+interblockSeparator
+ampersand
+hash
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEnd
+interblockSeparator
+interblockSeparator
+ulBegin
+ulItem
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+ulItemEnd
+ulEnd
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/strong-and-em-together.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/strong-and-em-together.test
new file mode 100644
index 0000000000..44c84cd6d1
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/strong-and-em-together.test
@@ -0,0 +1,17 @@
+<<<
+***This is strong and em.***
+
+So is ***this*** word.
+
+___This is strong and em.___
+
+So is ___this___ word.
+
+>>>
+strongEmphasis: (emphasis: This is strong and em.)
+interblockSeparator
+strongEmphasis: (emphasis: this)
+interblockSeparator
+strongEmphasis: (emphasis: This is strong and em.)
+interblockSeparator
+strongEmphasis: (emphasis: this)
diff --git a/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/tabs.test b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/tabs.test
new file mode 100644
index 0000000000..4737ab75e8
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/Markdown_1.0.3/tabs.test
@@ -0,0 +1,39 @@
+<<<
++ this is a list item
+ indented with tabs
+
++ this is a list item
+ indented with spaces
+
+Code:
+
+ this code block is indented by one tab
+
+And:
+
+ this code block is indented by two tabs
+
+And:
+
+ + this is an example list item
+ indented with tabs
+
+ + this is an example list item
+ indented with spaces
+
+>>>
+ulBegin
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEnd
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/07112549a31e78f7efb64c16f22570db.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/385fbae90889669b105262d12987e9da.verbatim
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/ce062b920c62d9e77aae68da221de295.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/README.md b/macros/generic/markdown/tests/testfiles/PHP_Markdown/README.md
new file mode 100644
index 0000000000..8ceeb21dec
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/README.md
@@ -0,0 +1,2 @@
+This directory contains test files that were inherited from the
+`tests/PHP_Markdown` directory in the lunamark project.
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/auto-links.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/auto-links.test
new file mode 100644
index 0000000000..ba3ee16d9a
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/auto-links.test
@@ -0,0 +1,16 @@
+<<<
+<HTTP://WWW.SOMEURL.COM>
+
+<hr@company.com>
+>>>
+BEGIN link
+- label: HTTP://WWW.SOMEURL.COM
+- URI: HTTP://WWW.SOMEURL.COM
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: hr@company.com
+- URI: mailto:hr@company.com
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/backslash-escapes.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/backslash-escapes.test
new file mode 100644
index 0000000000..a66cdefb8e
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/backslash-escapes.test
@@ -0,0 +1,19 @@
+<<<
+Tricky combinaisons:
+
+backslash with \\-- two dashes
+
+backslash with \\> greater than
+
+\\[test](not a link)
+
+\\\*no emphasis*
+>>>
+interblockSeparator
+backslash
+interblockSeparator
+backslash
+interblockSeparator
+backslash
+interblockSeparator
+backslash
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-in-a-list-item.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-in-a-list-item.test
new file mode 100644
index 0000000000..8ac52d287a
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-in-a-list-item.test
@@ -0,0 +1,31 @@
+<<<
+
+* List Item:
+
+ code block
+
+ with a blank line
+
+ within a list item.
+
+* code block
+ as first element of a list item
+
+* List Item:
+
+ code block with whitespace on preceding line
+>>>
+ulBegin
+ulItem
+interblockSeparator
+inputVerbatim: ./_markdown_test/3918bc9009f196cbcc980181827419e9.verbatim
+interblockSeparator
+ulItemEnd
+ulItem
+inputVerbatim: ./_markdown_test/2ecbe437956c71ad33b2efd354f11893.verbatim
+ulItemEnd
+ulItem
+interblockSeparator
+inputVerbatim: ./_markdown_test/89ad99c3052a342e765443409ef64797.verbatim
+ulItemEnd
+ulEnd
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-on-second-line.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-on-second-line.test
new file mode 100644
index 0000000000..7b402e3fa0
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/code-block-on-second-line.test
@@ -0,0 +1,6 @@
+<<<
+
+ Codeblock on second line
+
+>>>
+inputVerbatim: ./_markdown_test/722b6c7a40293698cf78b28fdb8623ff.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/email-auto-links.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/email-auto-links.test
new file mode 100644
index 0000000000..afda759ec7
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/email-auto-links.test
@@ -0,0 +1,16 @@
+<<<
+<michel.fortin@michelf.com>
+
+International domain names: <help@tūdaliņ.lv>
+>>>
+BEGIN link
+- label: michel.fortin@michelf.com
+- URI: mailto:michel.fortin@michelf.com
+- title:
+END link
+interblockSeparator
+BEGIN link
+- label: help@tūdaliņ.lv
+- URI: mailto:help@tūdaliņ.lv
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/emphasis.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/emphasis.test
new file mode 100644
index 0000000000..ed36492e09
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/emphasis.test
@@ -0,0 +1,272 @@
+<<<
+Combined emphasis:
+
+1. ***test test***
+2. ___test test___
+3. *test **test***
+4. **test *test***
+5. ***test* test**
+6. ***test** test*
+7. ***test* test**
+8. **test *test***
+9. *test **test***
+10. _test __test___
+11. __test _test___
+12. ___test_ test__
+13. ___test__ test_
+14. ___test_ test__
+15. __test _test___
+16. _test __test___
+
+
+Incorrect nesting:
+
+1. *test **test* test**
+2. _test __test_ test__
+3. **test *test** test*
+4. __test _test__ test_
+5. *test *test* test*
+6. _test _test_ test_
+7. **test **test** test**
+8. __test __test__ test__
+
+
+
+No emphasis:
+
+1. test* test *test
+2. test** test **test
+3. test_ test _test
+4. test__ test __test
+
+
+
+Middle-word emphasis (asterisks):
+
+1. *a*b
+2. a*b*
+3. a*b*c
+4. **a**b
+5. a**b**
+6. a**b**c
+
+
+Middle-word emphasis (underscore):
+
+1. _a_b
+2. a_b_
+3. a_b_c
+4. __a__b
+5. a__b__
+6. a__b__c
+
+my_precious_file.txt
+
+
+## Tricky Cases
+
+E**. **Test** TestTestTest
+
+E**. **Test** Test Test Test
+
+
+## Overlong emphasis
+
+Name: ____________
+Organization: ____
+Region/Country: __
+
+_____Cut here_____
+
+____Cut here____
+
+>>>
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+strongEmphasis: (emphasis: test test)
+olItemEnd
+olItemWithNumber: 2
+strongEmphasis: (emphasis: test test)
+olItemEnd
+olItemWithNumber: 3
+emphasis: test (strongEmphasis: test)
+olItemEnd
+olItemWithNumber: 4
+strongEmphasis: test (emphasis: test)
+olItemEnd
+olItemWithNumber: 5
+strongEmphasis: (emphasis: test) test
+olItemEnd
+olItemWithNumber: 6
+emphasis: (strongEmphasis: test) test
+olItemEnd
+olItemWithNumber: 7
+strongEmphasis: (emphasis: test) test
+olItemEnd
+olItemWithNumber: 8
+strongEmphasis: test (emphasis: test)
+olItemEnd
+olItemWithNumber: 9
+emphasis: test (strongEmphasis: test)
+olItemEnd
+olItemWithNumber: 10
+emphasis: test (strongEmphasis: test)
+olItemEnd
+olItemWithNumber: 11
+strongEmphasis: test (emphasis: test)
+olItemEnd
+olItemWithNumber: 12
+strongEmphasis: (emphasis: test) test
+olItemEnd
+olItemWithNumber: 13
+emphasis: (strongEmphasis: test) test
+olItemEnd
+olItemWithNumber: 14
+strongEmphasis: (emphasis: test) test
+olItemEnd
+olItemWithNumber: 15
+strongEmphasis: test (emphasis: test)
+olItemEnd
+olItemWithNumber: 16
+emphasis: test (strongEmphasis: test)
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+strongEmphasis: test* test
+olItemEnd
+olItemWithNumber: 2
+underscore
+strongEmphasis: test(underscore) test
+olItemEnd
+olItemWithNumber: 3
+emphasis: (emphasis: test (emphasis: test)) test
+olItemEnd
+olItemWithNumber: 4
+emphasis: (emphasis: test (emphasis: test)) test
+olItemEnd
+olItemWithNumber: 5
+emphasis: test (emphasis: test) test
+olItemEnd
+olItemWithNumber: 6
+emphasis: test (emphasis: test) test
+olItemEnd
+olItemWithNumber: 7
+strongEmphasis: test (strongEmphasis: test) test
+olItemEnd
+olItemWithNumber: 8
+strongEmphasis: test (strongEmphasis: test) test
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+emphasis: * test *
+olItemEnd
+olItemWithNumber: 3
+underscore
+underscore
+olItemEnd
+olItemWithNumber: 4
+emphasis: (underscore) test (underscore)
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+emphasis: a
+olItemEnd
+olItemWithNumber: 2
+emphasis: b
+olItemEnd
+olItemWithNumber: 3
+emphasis: b
+olItemEnd
+olItemWithNumber: 4
+strongEmphasis: a
+olItemEnd
+olItemWithNumber: 5
+strongEmphasis: b
+olItemEnd
+olItemWithNumber: 6
+strongEmphasis: b
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+emphasis: a
+olItemEnd
+olItemWithNumber: 2
+emphasis: b
+olItemEnd
+olItemWithNumber: 3
+emphasis: b
+olItemEnd
+olItemWithNumber: 4
+strongEmphasis: a
+olItemEnd
+olItemWithNumber: 5
+strongEmphasis: b
+olItemEnd
+olItemWithNumber: 6
+strongEmphasis: b
+olItemEnd
+olEndTight
+interblockSeparator
+emphasis: precious
+interblockSeparator
+headingTwo: Tricky Cases
+interblockSeparator
+strongEmphasis: Test
+interblockSeparator
+strongEmphasis: Test
+interblockSeparator
+headingTwo: Overlong emphasis
+interblockSeparator
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+interblockSeparator
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+interblockSeparator
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
+underscore
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/empty-list-item.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/empty-list-item.test
new file mode 100644
index 0000000000..a9fb47b84b
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/empty-list-item.test
@@ -0,0 +1,97 @@
+<<<
+With asterisks
+
+ * List item
+ *
+ * List item
+
+With numbers
+
+1. List item
+2.
+3. List item
+
+With hyphens
+
+- List item
+-
+- List item
+
+With asterisks
+
+ * List item
+ * List item
+ *
+
+With numbers
+
+1. List item
+2. List item
+3.
+
+With hyphens
+
+- List item
+- List item
+-
+
+>>>
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/headers.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/headers.test
new file mode 100644
index 0000000000..f068181502
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/headers.test
@@ -0,0 +1,18 @@
+<<<
+### Header
+
+ - - -
+
+Paragraphr
+
+ - - -
+
+Paragraph
+>>>
+headingThree: Header
+interblockSeparator
+horizontalRule
+interblockSeparator
+interblockSeparator
+horizontalRule
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/horizontal-rules.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/horizontal-rules.test
new file mode 100644
index 0000000000..634ad3db9c
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/horizontal-rules.test
@@ -0,0 +1,51 @@
+<<<
+Horizontal rules:
+
+- - -
+
+* * *
+
+***
+
+---
+
+___
+
+Not horizontal rules (testing for a bug in 1.0.1j):
+
++++
+
+,,,
+
+===
+
+???
+
+AAA
+
+jjj
+
+j j j
+
+n n n
+
+>>>
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+horizontalRule
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/links-inline-style.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/links-inline-style.test
new file mode 100644
index 0000000000..bb67b838d1
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/links-inline-style.test
@@ -0,0 +1,9 @@
+<<<
+[silly URL w/ angle brackets](<?}]*+|&)>).
+
+>>>
+BEGIN link
+- label: silly URL w/ angle brackets
+- URI: ?(rightBrace)]*+(pipe)(ampersand))
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/md5-hashes.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/md5-hashes.test
new file mode 100644
index 0000000000..b70a29c981
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/md5-hashes.test
@@ -0,0 +1,22 @@
+<<<
+# Character Escapes
+
+The MD5 value for `+` is "26b17225b626fb9238849fd60eabdf60".
+
+# HTML Blocks
+
+<p>test</p>
+
+The MD5 value for `<p>test</p>` is:
+
+6205333b793f34273d75379350b36826
+>>>
+headingOne: Character Escapes
+interblockSeparator
+codeSpan: +
+interblockSeparator
+headingOne: HTML Blocks
+interblockSeparator
+interblockSeparator
+codeSpan: <p>test</p>
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/mixed-ols-and-uls.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/mixed-ols-and-uls.test
new file mode 100644
index 0000000000..fddda61878
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/mixed-ols-and-uls.test
@@ -0,0 +1,47 @@
+<<<
+* test
++ test
+- test
+
+1. test
+2. test
+
+* test
++ test
+- test
+
+1. test
+2. test
+
+>>>
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olEndTight
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olEndTight
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/nesting.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/nesting.test
new file mode 100644
index 0000000000..f95ada9662
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/nesting.test
@@ -0,0 +1,30 @@
+<<<
+Valid nesting:
+
+**[Link](url)**
+
+[**Link**](url)
+
+**[**Link**](url)**
+
+Invalid nesting:
+
+[[Link](url)](url)
+>>>
+interblockSeparator
+strongEmphasis: (BEGIN link)(- label: Link)(- URI: url)(- title: )(END link)
+interblockSeparator
+BEGIN link
+- label: (strongEmphasis: Link)
+- URI: url
+- title:
+END link
+interblockSeparator
+strongEmphasis: (BEGIN link)(- label: (strongEmphasis: Link))(- URI: url)(- title: )(END link)
+interblockSeparator
+interblockSeparator
+BEGIN link
+- label: [Link](url)
+- URI: url
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/parens-in-url.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/parens-in-url.test
new file mode 100644
index 0000000000..7c7831220a
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/parens-in-url.test
@@ -0,0 +1,52 @@
+<<<
+[Inline link 1 with parens](/url\(test\) "title").
+
+[Inline link 2 with parens](</url\(test\)> "title").
+
+[Inline link 3 with non-escaped parens](/url(test) "title").
+
+[Inline link 4 with non-escaped parens](</url(test)> "title").
+
+[Reference link 1 with parens][1].
+
+[Reference link 2 with parens][2].
+
+ [1]: /url(test) "title"
+ [2]: </url(test)> "title"
+
+>>>
+BEGIN link
+- label: Inline link 1 with parens
+- URI: /url(test)
+- title: title
+END link
+interblockSeparator
+BEGIN link
+- label: Inline link 2 with parens
+- URI: /url(test)
+- title: title
+END link
+interblockSeparator
+BEGIN link
+- label: Inline link 3 with non-escaped parens
+- URI: /url(test)
+- title: title
+END link
+interblockSeparator
+BEGIN link
+- label: Inline link 4 with non-escaped parens
+- URI: /url(test)
+- title: title
+END link
+interblockSeparator
+BEGIN link
+- label: Reference link 1 with parens
+- URI: /url(test)
+- title: title
+END link
+interblockSeparator
+BEGIN link
+- label: Reference link 2 with parens
+- URI: /url(test)
+- title: title
+END link
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/php-specific-bugs.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/php-specific-bugs.test
new file mode 100644
index 0000000000..3f3db6c6ee
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/php-specific-bugs.test
@@ -0,0 +1,39 @@
+<<<
+This tests for a bug where quotes escaped by PHP when using
+`preg_replace` with the `/e` modifier must be correctly unescaped
+(hence the `_UnslashQuotes` function found only in PHP Markdown).
+
+
+
+Headers below should appear exactly as they are typed (no backslash
+added or removed).
+
+Header "quoted\" again \\""
+===========================
+
+Header "quoted\" again \\""
+---------------------------
+
+### Header "quoted\" again \\"" ###
+
+
+
+Test with tabs for `_Detab`:
+
+ Code 'block' with some "tabs" and "quotes"
+
+>>>
+codeSpan: preg(underscore)replace
+codeSpan: /e
+codeSpan: (underscore)UnslashQuotes
+interblockSeparator
+interblockSeparator
+headingOne: Header "quoted(backslash)" again (backslash)""
+interblockSeparator
+headingTwo: Header "quoted(backslash)" again (backslash)""
+interblockSeparator
+headingThree: Header "quoted(backslash)" again (backslash)""
+interblockSeparator
+codeSpan: (underscore)Detab
+interblockSeparator
+inputVerbatim: ./_markdown_test/58f5a43337a97a77594d067c159d772c.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/quotes-in-attributes.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/quotes-in-attributes.test
new file mode 100644
index 0000000000..75247fc7fd
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/quotes-in-attributes.test
@@ -0,0 +1,29 @@
+<<<
+[Test](/"style="color:red)
+[Test](/'style='color:red)
+
+![](/"style="border-color:red;border-size:1px;border-style:solid)
+![](/'style='border-color:red;border-size:1px;border-style:solid)
+
+>>>
+BEGIN link
+- label: Test
+- URI: /"style="color:red
+- title:
+END link
+BEGIN link
+- label: Test
+- URI: /'style='color:red
+- title:
+END link
+interblockSeparator
+BEGIN image
+- label:
+- URI: /"style="border-color:red;border-size:1px;border-style:solid
+- title:
+END image
+BEGIN image
+- label:
+- URI: /'style='border-color:red;border-size:1px;border-style:solid
+- title:
+END image
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/tables.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/tables.test
new file mode 100644
index 0000000000..9300123d19
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/tables.test
@@ -0,0 +1,327 @@
+\def\markdownOptionPipeTables{true}
+<<<
+Header 1 | Header 2
+--------- | ---------
+Cell 1 | Cell 2
+Cell 3 | Cell 4
+
+With leading pipes:
+
+| Header 1 | Header 2
+| --------- | ---------
+| Cell 1 | Cell 2
+| Cell 3 | Cell 4
+
+With tailing pipes:
+
+Header 1 | Header 2 |
+--------- | --------- |
+Cell 1 | Cell 2 |
+Cell 3 | Cell 4 |
+
+With leading and tailing pipes:
+
+| Header 1 | Header 2 |
+| --------- | --------- |
+| Cell 1 | Cell 2 |
+| Cell 3 | Cell 4 |
+
+* * *
+
+# One-column one-row table
+
+With leading pipes:
+
+| Header
+| -------
+| Cell
+
+With tailing pipes:
+
+Header |
+------- |
+Cell |
+
+With leading and tailing pipes:
+
+| Header |
+| ------- |
+| Cell |
+
+* * *
+
+Table alignement:
+
+| Default | Right | Center | Left |
+| --------- |:--------- |:---------:| ---------:|
+| Long Cell | Long Cell | Long Cell | Long Cell |
+| Cell | Cell | Cell | Cell |
+
+Table alignement (alternate spacing):
+
+| Default | Right | Center | Left |
+| --------- | :-------- | :-------: | --------: |
+| Long Cell | Long Cell | Long Cell | Long Cell |
+| Cell | Cell | Cell | Cell |
+
+* * *
+
+# Empty cells
+
+| Header 1 | Header 2 |
+| --------- | --------- |
+| A | B |
+| C | |
+
+Header 1 | Header 2
+--------- | ---------
+A | B
+ | D
+
+* * *
+
+# Missing tailing pipe
+
+Header 1 | Header 2
+--------- | --------- |
+Cell | Cell |
+Cell | Cell |
+
+Header 1 | Header 2 |
+--------- | ---------
+Cell | Cell |
+Cell | Cell |
+
+Header 1 | Header 2 |
+--------- | --------- |
+Cell | Cell
+Cell | Cell |
+
+Header 1 | Header 2 |
+--------- | --------- |
+Cell | Cell |
+Cell | Cell
+
+* * *
+
+# Too many pipes in rows
+
+| Header 1 | Header 2 |
+| ---------
+| Cell | Cell | Extra cell? |
+| Cell | Cell | Extra cell? |
+>>>
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell 1
+- row 2, column 2: Cell 2
+- row 3, column 1: Cell 3
+- row 3, column 2: Cell 4
+END table
+interblockSeparator
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell 1
+- row 2, column 2: Cell 2
+- row 3, column 1: Cell 3
+- row 3, column 2: Cell 4
+END table
+interblockSeparator
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell 1
+- row 2, column 2: Cell 2
+- row 3, column 1: Cell 3
+- row 3, column 2: Cell 4
+END table
+interblockSeparator
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell 1
+- row 2, column 2: Cell 2
+- row 3, column 1: Cell 3
+- row 3, column 2: Cell 4
+END table
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingOne: One-column one-row table
+interblockSeparator
+interblockSeparator
+BEGIN table (2 rows, 1 columns)
+- caption:
+- alignment of column 1: d
+- row 1, column 1: Header
+- row 2, column 1: Cell
+END table
+interblockSeparator
+interblockSeparator
+BEGIN table (2 rows, 1 columns)
+- caption:
+- alignment of column 1: d
+- row 1, column 1: Header
+- row 2, column 1: Cell
+END table
+interblockSeparator
+interblockSeparator
+BEGIN table (2 rows, 1 columns)
+- caption:
+- alignment of column 1: d
+- row 1, column 1: Header
+- row 2, column 1: Cell
+END table
+interblockSeparator
+horizontalRule
+interblockSeparator
+interblockSeparator
+BEGIN table (3 rows, 4 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: l
+- alignment of column 3: c
+- alignment of column 4: r
+- row 1, column 1: Default
+- row 1, column 2: Right
+- row 1, column 3: Center
+- row 1, column 4: Left
+- row 2, column 1: Long Cell
+- row 2, column 2: Long Cell
+- row 2, column 3: Long Cell
+- row 2, column 4: Long Cell
+- row 3, column 1: Cell
+- row 3, column 2: Cell
+- row 3, column 3: Cell
+- row 3, column 4: Cell
+END table
+interblockSeparator
+interblockSeparator
+BEGIN table (3 rows, 4 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: l
+- alignment of column 3: c
+- alignment of column 4: r
+- row 1, column 1: Default
+- row 1, column 2: Right
+- row 1, column 3: Center
+- row 1, column 4: Left
+- row 2, column 1: Long Cell
+- row 2, column 2: Long Cell
+- row 2, column 3: Long Cell
+- row 2, column 4: Long Cell
+- row 3, column 1: Cell
+- row 3, column 2: Cell
+- row 3, column 3: Cell
+- row 3, column 4: Cell
+END table
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingOne: Empty cells
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: A
+- row 2, column 2: B
+- row 3, column 1: C
+- row 3, column 2:
+END table
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: A
+- row 2, column 2: B
+- row 3, column 1:
+- row 3, column 2: D
+END table
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingOne: Missing tailing pipe
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell
+- row 2, column 2: Cell
+- row 3, column 1: Cell
+- row 3, column 2: Cell
+END table
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell
+- row 2, column 2: Cell
+- row 3, column 1: Cell
+- row 3, column 2: Cell
+END table
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell
+- row 2, column 2: Cell
+- row 3, column 1: Cell
+- row 3, column 2: Cell
+END table
+interblockSeparator
+BEGIN table (3 rows, 2 columns)
+- caption:
+- alignment of column 1: d
+- alignment of column 2: d
+- row 1, column 1: Header 1
+- row 1, column 2: Header 2
+- row 2, column 1: Cell
+- row 2, column 2: Cell
+- row 3, column 1: Cell
+- row 3, column 2: Cell
+END table
+interblockSeparator
+horizontalRule
+interblockSeparator
+headingOne: Too many pipes in rows
+interblockSeparator
+BEGIN table (3 rows, 1 columns)
+- caption:
+- alignment of column 1: d
+- row 1, column 1: Header 1
+- row 2, column 1: Cell
+- row 3, column 1: Cell
+END table
diff --git a/macros/generic/markdown/tests/testfiles/PHP_Markdown/tight-blocks.test b/macros/generic/markdown/tests/testfiles/PHP_Markdown/tight-blocks.test
new file mode 100644
index 0000000000..b8f0650113
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/PHP_Markdown/tight-blocks.test
@@ -0,0 +1,30 @@
+<<<
+Paragraph and no space:
+* ciao
+
+Paragraph and 1 space:
+ * ciao
+
+Paragraph and 3 spaces:
+ * ciao
+
+Paragraph and 4 spaces:
+ * ciao
+
+Paragraph before header:
+#Header
+
+Paragraph before blockquote:
+>Some quote.
+
+>>>
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+headingOne: Header
+interblockSeparator
+interblockSeparator
+blockQuoteBegin
+blockQuoteEnd
diff --git a/macros/generic/markdown/tests/testfiles/README.md b/macros/generic/markdown/tests/testfiles/README.md
new file mode 100644
index 0000000000..0f0168e787
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/README.md
@@ -0,0 +1,21 @@
+This directory contains subdirectories with test files, which can be recognized
+by the `.test` suffix. A test file has the following syntax:
+
+ The test setup TeX source code
+ <<<
+ The test markdown source code
+ >>>
+ The expected test output
+
+The test setup TeX source code can be used to configure the Markdown package
+through its plain TeX interface before the test markdown source code is
+processed.
+
+The test markdown source code is the markdown code that will be processed
+during the test. The majority of markdown tokens are configured by the support
+files to produce output to the log file. This output will be compared against
+the expected test output.
+
+The `<<<` and `>>>` markers may be surrounded by optional whitespaces. If the
+last section beginning with `>>>` is not present, it will be automatically
+generated during the testing and appended to the test file.
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/README.md b/macros/generic/markdown/tests/testfiles/lunamark-markdown/README.md
new file mode 100644
index 0000000000..238044662b
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/README.md
@@ -0,0 +1,2 @@
+This directory contains test files that were tailored specifically to the
+Markdown package.
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/blank-before-code-fence.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/blank-before-code-fence.test
new file mode 100644
index 0000000000..8d42218e09
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/blank-before-code-fence.test
@@ -0,0 +1,57 @@
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionBlankBeforeCodeFence{true}
+<<<
+This test ensures that the Lua `fencedCode` and `blankBeforeCodeFence` options
+correctly propagate through the plain TeX interface.
+
+The following fenced code block should resolve to a code span.
+
+foo
+``` foo
+bar
+```
+
+foo
+~~~ foo
+bar
+~~~
+
+The following fenced code blocks should be recognized as such.
+
+foo
+
+``` foo
+bar
+```
+
+foo
+
+~~~ foo
+bar
+~~~
+>>>
+codeSpan: fencedCode
+codeSpan: blankBeforeCodeFence
+interblockSeparator
+interblockSeparator
+codeSpan: foo bar
+interblockSeparator
+tilde
+tilde
+tilde
+tilde
+tilde
+tilde
+interblockSeparator
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/breakable-blockquotes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/breakable-blockquotes.test
new file mode 100644
index 0000000000..69dffa4e21
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/breakable-blockquotes.test
@@ -0,0 +1,19 @@
+\def\markdownOptionBreakableBlockquotes{true}
+<<<
+This test ensures that the Lua `breakableBlockquotes` option correctly
+propagates through the plain TeX interface.
+
+> *quote 1*
+
+> *quote 2*
+
+>>>
+codeSpan: breakableBlockquotes
+interblockSeparator
+blockQuoteBegin
+emphasis: quote 1
+blockQuoteEnd
+interblockSeparator
+blockQuoteBegin
+emphasis: quote 2
+blockQuoteEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/cache-dir.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/cache-dir.test
new file mode 100644
index 0000000000..f9968e9168
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/cache-dir.test
@@ -0,0 +1,12 @@
+\def\markdownOptionCacheDir{some-other-directory}
+<<<
+This test ensures that the Lua `cacheDir` option correctly propagates through
+the plain TeX interface and causes a change in the cache directory location.
+The following code should be stored in a temporary file inside the specified
+cache directory.
+
+ foo bar
+>>>
+codeSpan: cacheDir
+interblockSeparator
+inputVerbatim: some-other-directory/5ceaa7ed396ccb8e959c02753cb4bd18.verbatim
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-escapes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-escapes.test
new file mode 100644
index 0000000000..646c0b9610
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-escapes.test
@@ -0,0 +1,73 @@
+\def\markdownOptionCitations{true}
+<<<
+This test ensures that the Lua `citations` option correctly propagates through
+the plain TeX interface and that the `citationNbsps` option is enabled by
+default.
+
+Here is a simple parenthetical citation \[\@doe99] and here
+is a string of several [see @doe99, pp\; 33-35; also
+@smit:.#$%&-+?<>_/h04, chap. 1].
+
+A parenthetical citation can have a [prenote @doe99] and a
+[@smith04 postnote]. The name of the author can be
+suppressed by inserting a dash before the name of an author
+as follows [\-@smith04].
+
+Here is a simple text citation \@doe99 and here is a string
+of several @doe99 [pp\; 33-35; also @smit:.#$%&-+?<>_/h04,
+chap. 1]. Here is one with the name of the author
+suppressed \-@doe99.
+>>>
+codeSpan: citations
+codeSpan: citationNbsps
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote: see
+- postnote: pp;(nbsp)33-35
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote: also
+- postnote: chap.(nbsp)1
+- name: smit:.(hash)$(percentSign)&-+?<>_/h04
+END cite
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote: prenote
+- postnote:
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote: postnote
+- name: smith04
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote: -
+- postnote:
+- name: smith04
+END cite
+interblockSeparator
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote: pp;(nbsp)33-35
+- name: doe99
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote: also
+- postnote: chap.(nbsp)1
+- name: smit:.(hash)$(percentSign)&-+?<>_/h04
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: doe99
+END textCite
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-nbsps.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-nbsps.test
new file mode 100644
index 0000000000..e607828711
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-nbsps.test
@@ -0,0 +1,85 @@
+\def\markdownOptionCitations{true}
+<<<
+This test ensures that the Lua `citations` option correctly propagates through
+the plain TeX interface and that the `citationNbsps` option is enabled by
+default.
+
+Here is a simple parenthetical citation [@doe99] and here
+is a string of several [see @doe99, pp. 33-35; also
+@smit:.#$%&-+?<>_/h04, chap. 1].
+
+A parenthetical citation can have a [prenote @doe99] and
+a [@smith04 postnote]. The name of the author can be
+suppressed by inserting a dash before the name of an
+author as follows [-@smith04].
+
+Here is a simple text citation @doe99 and here is a
+string of several @doe99 [pp. 33-35; also
+@smit:.#$%&-+?<>_/h04, chap. 1]. Here is one with the
+name of the author suppressed -@doe99.
+>>>
+codeSpan: citations
+codeSpan: citationNbsps
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote: see
+- postnote: pp.(nbsp)33-35
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote: also
+- postnote: chap.(nbsp)1
+- name: smit:.(hash)$(percentSign)&-+?<>_/h04
+END cite
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote: prenote
+- postnote:
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote: postnote
+- name: smith04
+END cite
+BEGIN cite
+- suppressAuthor: true
+- prenote:
+- postnote:
+- name: smith04
+END cite
+interblockSeparator
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: doe99
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote: pp.(nbsp)33-35
+- name: doe99
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote: also
+- postnote: chap.(nbsp)1
+- name: smit:.(hash)$(percentSign)&-+?<>_/h04
+END textCite
+BEGIN textCite
+- suppressAuthor: true
+- prenote:
+- postnote:
+- name: doe99
+END textCite
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-no-nbsps.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-no-nbsps.test
new file mode 100644
index 0000000000..bc5b70c0d0
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-no-nbsps.test
@@ -0,0 +1,85 @@
+\def\markdownOptionCitations{true}
+\def\markdownOptionCitationNbsps{false}
+<<<
+This test ensures that the Lua `citations` and `citationNbsps` options correctly
+propagate through the plain TeX interface.
+
+Here is a simple parenthetical citation [@doe99] and here
+is a string of several [see @doe99, pp. 33-35; also
+@smit:.#$%&-+?<>_/h04, chap. 1].
+
+A parenthetical citation can have a [prenote @doe99] and
+a [@smith04 postnote]. The name of the author can be
+suppressed by inserting a dash before the name of an
+author as follows [-@smith04].
+
+Here is a simple text citation @doe99 and here is a
+string of several @doe99 [pp. 33-35; also
+@smit:.#$%&-+?<>_/h04, chap. 1]. Here is one with the
+name of the author suppressed -@doe99.
+>>>
+codeSpan: citations
+codeSpan: citationNbsps
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote: see
+- postnote: pp. 33-35
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote: also
+- postnote: chap. 1
+- name: smit:.(hash)$(percentSign)&-+?<>_/h04
+END cite
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote: prenote
+- postnote:
+- name: doe99
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote: postnote
+- name: smith04
+END cite
+BEGIN cite
+- suppressAuthor: true
+- prenote:
+- postnote:
+- name: smith04
+END cite
+interblockSeparator
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: doe99
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote: pp. 33-35
+- name: doe99
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote: also
+- postnote: chap. 1
+- name: smit:.(hash)$(percentSign)&-+?<>_/h04
+END textCite
+BEGIN textCite
+- suppressAuthor: true
+- prenote:
+- postnote:
+- name: doe99
+END textCite
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-trailing-punctuation.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-trailing-punctuation.test
new file mode 100644
index 0000000000..3063b324e9
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/citations-trailing-punctuation.test
@@ -0,0 +1,115 @@
+\def\markdownOptionCitations{true}
+<<<
+This test ensures that the Lua `citations` option correctly propagates through
+the plain TeX interface and that the trailing punctuation does not get included
+in the citation name.
+
+[@f] [@f:] [@foo:bar] [@foo:bar:]
+
+[@_] [@f_] [@foo_bar] [@foo_bar_]
+
+ @f @f: @foo:bar @foo:bar:
+
+ @_ @f_ @foo_bar @foo_bar_
+>>>
+codeSpan: citations
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: f
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: f
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo:bar
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo:bar
+END cite
+interblockSeparator
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: _
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: f_
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo_bar
+END cite
+BEGIN cite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo_bar_
+END cite
+interblockSeparator
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: f
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: f
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo:bar
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo:bar
+END textCite
+interblockSeparator
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: _
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: f_
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo_bar
+END textCite
+BEGIN textCite
+- suppressAuthor: false
+- prenote:
+- postnote:
+- name: foo_bar_
+END textCite
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks-language-map.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks-language-map.test
new file mode 100644
index 0000000000..545be6893d
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks-language-map.test
@@ -0,0 +1,16 @@
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionContentBlocksLanguageMap{markdown-languages-nonstandard.json}
+<<<
+This test ensures that the Lua `contentBlockLanguages` option correctly
+propagates through the plain TeX interface.
+
+/basename.WEIRDextension (title)
+>>>
+codeSpan: contentBlockLanguages
+interblockSeparator
+BEGIN contentBlockCode
+- suffix: weirdextension
+- language: weirdLANGUAGE
+- URI: basename.WEIRDextension
+- title: title
+END contentBlockCode
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks.test
new file mode 100644
index 0000000000..60b460fbf9
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/content-blocks.test
@@ -0,0 +1,64 @@
+\def\markdownOptionContentBlocks{true}
+<<<
+This test ensures that the Lua `contentBlocks` option correctly propagates
+through the plain TeX interface.
+/not/a/translusion.md
+
+/not/a/
+transclusion/either.md
+
+<http://example.com/minard.jpg>
+<http://example.com/minard.jpg> <-- This is just a link.
+
+htt(p:/)/exam(ple.c)om/m\(inard.jpg (Napoleon's disastrous Russian campaign of 1812)
+/Flowchart.png "Engineering Flowchart"
+
+/Savings Account.csv 'Recent Transactions'
+/Example.jS (Source code)
+/Lorem Ipsum.txt
+>>>
+codeSpan: contentBlocks
+interblockSeparator
+interblockSeparator
+BEGIN contentBlockOnlineImage
+- suffix: jpg
+- URI: http://example.com/minard.jpg
+- title:
+END contentBlockOnlineImage
+interblockSeparator
+BEGIN link
+- label: http://example.com/minard.jpg
+- URI: http://example.com/minard.jpg
+- title:
+END link
+interblockSeparator
+BEGIN contentBlockOnlineImage
+- suffix: jpg
+- URI: htt(p:/)/exam(ple.c)om/m(inard.jpg
+- title: Napoleon's disastrous Russian campaign of 1812
+END contentBlockOnlineImage
+interblockSeparator
+BEGIN contentBlock
+- suffix: png
+- URI: Flowchart.png
+- title: Engineering Flowchart
+END contentBlock
+interblockSeparator
+BEGIN contentBlock
+- suffix: csv
+- URI: Savings Account.csv
+- title: Recent Transactions
+END contentBlock
+interblockSeparator
+BEGIN contentBlockCode
+- suffix: js
+- language: JavaScript
+- URI: Example.jS
+- title: Source code
+END contentBlockCode
+interblockSeparator
+BEGIN contentBlock
+- suffix: txt
+- URI: Lorem Ipsum.txt
+- title:
+END contentBlock
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/empty-code-spans.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/empty-code-spans.test
new file mode 100644
index 0000000000..cd69efae60
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/empty-code-spans.test
@@ -0,0 +1,24 @@
+<<<
+These are just two backticks:
+
+``
+
+These are empty code spans:
+
+` `
+
+` `
+
+This is a code span containing a single space:
+
+` `
+>>>
+interblockSeparator
+interblockSeparator
+interblockSeparator
+codeSpan:
+interblockSeparator
+codeSpan:
+interblockSeparator
+interblockSeparator
+codeSpan:
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/fenced-code.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/fenced-code.test
new file mode 100644
index 0000000000..2efe132ad1
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/fenced-code.test
@@ -0,0 +1,27 @@
+\def\markdownOptionFencedCode{true}
+<<<
+This test ensures that the Lua `fencedCode` option correctly propagates through
+the plain TeX interface.
+
+The following fenced code blocks should be recognized as such.
+
+``` foo
+bar
+```
+
+~~~ foo
+bar
+~~~
+>>>
+codeSpan: fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/header-attributes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/header-attributes.test
new file mode 100644
index 0000000000..3da7ac7a7d
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/header-attributes.test
@@ -0,0 +1,37 @@
+\def\markdownOptionHeaderAttributes{true}
+<<<
+This test ensures that the Lua `headerAttributes` option correctly propagates
+through the plain TeX interface.
+
+# A level one heading {#first-id}
+
+A level one heading {#second_id2}
+=================================
+
+## A level two heading ### {#third-3id .a-class}
+
+A level two heading {#fourth4-id .2not-a-class}
+-----------------------------------------------
+
+### A level three heading ## {#5not-the-fifth-id}
+#### A level four heading {#-6not-the-sixth-id}
+##### A level five heading ## {#--7the-seventh-id}
+###### A level six heading {#-_the-eighth-id attribute=value}
+>>>
+codeSpan: headerAttributes
+interblockSeparator
+headingOne: A level one heading
+interblockSeparator
+headingOne: A level one heading
+interblockSeparator
+headingTwo: A level two heading
+interblockSeparator
+headingTwo: A level two heading (leftBrace)(hash)fourth4-id .2not-a-class(rightBrace)
+interblockSeparator
+headingThree: A level three heading (hash)(hash) (leftBrace)(hash)5not-the-fifth-id(rightBrace)
+interblockSeparator
+headingFour: A level four heading (leftBrace)(hash)-6not-the-sixth-id(rightBrace)
+interblockSeparator
+headingFive: A level five heading
+interblockSeparator
+headingSix: A level six heading
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/html.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/html.test
new file mode 100644
index 0000000000..1975c5b221
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/html.test
@@ -0,0 +1,53 @@
+\def\markdownOptionHtml{true}
+<<<
+This test ensures that the Lua `html` option correctly propagates through
+the plain TeX interface.
+
+<div>
+*There is block tag support.*
+</div>
+*There is <inline tag="tag"></inline> support.*
+_There is <!-- comment --> support._
+_There is <? HTML instruction ?> support._
+
+Here are several ways to write a pipe:
+
+- |
+- &verbar;
+- &vert;
+- &VerticalLine;
+- &#x0007C;
+- &#124;
+
+Unrecognized character entities are ignored: &nonsense;
+>>>
+codeSpan: html
+interblockSeparator
+interblockSeparator
+emphasis: There is support.
+emphasis: There is support.
+emphasis: There is support.
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+pipe
+ulItemEnd
+ulItem
+pipe
+ulItemEnd
+ulItem
+pipe
+ulItemEnd
+ulItem
+pipe
+ulItemEnd
+ulItem
+pipe
+ulItemEnd
+ulItem
+pipe
+ulItemEnd
+ulEndTight
+interblockSeparator
+ampersand
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/hybrid.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/hybrid.test
new file mode 100644
index 0000000000..a82ba1aa1b
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/hybrid.test
@@ -0,0 +1,43 @@
+\def\markdownOptionHybrid{true}
+<<<
+This test ensures that the Lua `hybrid` option correctly propagates through
+the plain TeX interface. The following special characters should not be
+processed by lunamark in any way.
+
+ * \char`{
+ * \char`}
+ * \char`$
+ * \char`\%
+ * \char`&
+ * \char`_
+ * \char`#
+ * \char`^
+ * \char`\
+ * \char`~
+ * \char`|
+>>>
+codeSpan: hybrid
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/inline-footnotes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/inline-footnotes.test
new file mode 100644
index 0000000000..28ecb568b3
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/inline-footnotes.test
@@ -0,0 +1,17 @@
+\def\markdownOptionInlineFootnotes{true}
+<<<
+This test ensures that the Lua `footnotes` and `inlineFootnotes` options
+correctly propagate through the plain TeX interface.
+
+^[Here is the footnote. It can go anywhere after the footnote
+reference. It need *not* be placed at the end of the document.]
+
+\^[This should *not* be a footnote, because it has been escaped.]
+>>>
+codeSpan: footnotes
+codeSpan: inlineFootnotes
+interblockSeparator
+footnote: Here is the footnote. It can go anywhere after the footnote reference. It need (emphasis: not) be placed at the end of the document.
+interblockSeparator
+circumflex
+emphasis: not
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-blank-before-code-fence.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-blank-before-code-fence.test
new file mode 100644
index 0000000000..fbe81311a3
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-blank-before-code-fence.test
@@ -0,0 +1,57 @@
+\def\markdownOptionFencedCode{true}
+<<<
+This test ensures that the Lua `fencedCode` option correctly propagates through
+the plain TeX interface and that the Lua `blankBeforeCodeFence` option is
+disabled by default.
+
+The following fenced code blocks should be recognized as such.
+
+foo
+``` foo
+bar
+```
+
+foo
+~~~ foo
+bar
+~~~
+
+foo
+
+``` foo
+bar
+```
+
+foo
+
+~~~ foo
+bar
+~~~
+>>>
+codeSpan: fencedCode
+codeSpan: blankBeforeCodeFence
+interblockSeparator
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/c157a79031e1c40f85931829bc5fc552.verbatim
+- infostring: foo
+END fencedCode
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-breakable-blockquotes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-breakable-blockquotes.test
new file mode 100644
index 0000000000..d65cbef728
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-breakable-blockquotes.test
@@ -0,0 +1,15 @@
+<<<
+This test ensures that the Lua `breakableBlockquotes` option is disabled by
+default.
+
+> *quote 1*
+
+> *quote 2*
+
+>>>
+codeSpan: breakableBlockquotes
+interblockSeparator
+blockQuoteBegin
+emphasis: quote 1
+emphasis: quote 2
+blockQuoteEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-citations.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-citations.test
new file mode 100644
index 0000000000..811c8aed35
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-citations.test
@@ -0,0 +1,31 @@
+<<<
+This test ensures that the Lua `citations` option is disabled by default.
+
+Here is a simple parenthetical citation [@doe99] and here
+is a string of several [see @doe99, pp. 33-35; also
+@smit:.#$%&-+?<>~/h04, chap. 1].
+
+A parenthetical citation can have a [prenote @doe99] and
+a [@smith04 postnote]. The name of the author can be
+suppressed by inserting a dash before the name of an
+author as follows [-@smith04].
+
+Here is a simple text citation @doe99 and here is a
+string of several @doe99 [pp. 33-35; also
+@smit:.#$%&-+?<>~/h04, chap. 1]. Here is one with the
+name of the author suppressed -@doe99.
+>>>
+codeSpan: citations
+interblockSeparator
+hash
+dollarSign
+percentSign
+ampersand
+tilde
+interblockSeparator
+interblockSeparator
+hash
+dollarSign
+percentSign
+ampersand
+tilde
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-code-spans.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-code-spans.test
new file mode 100644
index 0000000000..de24f9db29
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-code-spans.test
@@ -0,0 +1,9 @@
+\def\markdownOptionCodeSpans{false}
+<<<
+This test ensures that the Lua `codeSpans` option correctly propagates through
+the plain TeX interface.
+
+``This is a quote.''
+``This is another one.''
+>>>
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-content-blocks.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-content-blocks.test
new file mode 100644
index 0000000000..ed814a3071
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-content-blocks.test
@@ -0,0 +1,32 @@
+<<<
+This test ensures that the Lua `contentBlocks` option is disabled by default.
+/not/a/translusion.md
+
+/not/a/
+transclusion/either.md
+
+<http://example.com/minard.jpg>
+<http://example.com/minard.jpg> <-- This is just a link.
+
+htt(p:/)/exam(ple.c)om/m\(inard.jpg (Napoleon's disastrous Russian campaign of 1812)
+/Flowchart.png "Engineering Flowchart"
+
+/Savings Account.csv 'Recent Transactions'
+/Example.swift (Source code)
+/Lorem Ipsum.txt
+>>>
+codeSpan: contentBlocks
+interblockSeparator
+interblockSeparator
+BEGIN link
+- label: http://example.com/minard.jpg
+- URI: http://example.com/minard.jpg
+- title:
+END link
+BEGIN link
+- label: http://example.com/minard.jpg
+- URI: http://example.com/minard.jpg
+- title:
+END link
+interblockSeparator
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-fenced-code.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-fenced-code.test
new file mode 100644
index 0000000000..aab1caa4fb
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-fenced-code.test
@@ -0,0 +1,22 @@
+<<<
+This test ensures that the Lua `fencedCode` option is disabled by default. The
+following fenced code block should resolve to a code spans.
+
+``` foo
+bar
+```
+
+~~~ foo
+bar
+~~~
+>>>
+codeSpan: fencedCode
+interblockSeparator
+codeSpan: foo bar
+interblockSeparator
+tilde
+tilde
+tilde
+tilde
+tilde
+tilde
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-header-attributes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-header-attributes.test
new file mode 100644
index 0000000000..ba752d6e8d
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-header-attributes.test
@@ -0,0 +1,35 @@
+<<<
+This test ensures that the Lua `headerAttributes` option is disabled by default.
+
+# A level one heading {#first-id}
+
+A level one heading {#second_id2}
+=================================
+
+## A level two heading ### {#third-3id .a-class}
+
+A level two heading {#fourth4-id .2not-a-class}
+-----------------------------------------------
+
+### A level three heading ## {#5not-the-fifth-id}
+#### A level four heading {#-6not-the-sixth-id}
+##### A level five heading ## {#--7the-seventh-id}
+###### A level six heading {#-_the-eighth-id attribute=value}
+>>>
+codeSpan: headerAttributes
+interblockSeparator
+headingOne: A level one heading (leftBrace)(hash)first-id(rightBrace)
+interblockSeparator
+headingOne: A level one heading (leftBrace)(hash)second(underscore)id2(rightBrace)
+interblockSeparator
+headingTwo: A level two heading (hash)(hash)(hash) (leftBrace)(hash)third-3id .a-class(rightBrace)
+interblockSeparator
+headingTwo: A level two heading (leftBrace)(hash)fourth4-id .2not-a-class(rightBrace)
+interblockSeparator
+headingThree: A level three heading (hash)(hash) (leftBrace)(hash)5not-the-fifth-id(rightBrace)
+interblockSeparator
+headingFour: A level four heading (leftBrace)(hash)-6not-the-sixth-id(rightBrace)
+interblockSeparator
+headingFive: A level five heading (hash)(hash) (leftBrace)(hash)--7the-seventh-id(rightBrace)
+interblockSeparator
+headingSix: A level six heading (leftBrace)(hash)-(underscore)the-eighth-id attribute=value(rightBrace)
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-html.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-html.test
new file mode 100644
index 0000000000..cf1763f854
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-html.test
@@ -0,0 +1,53 @@
+<<<
+This test ensures that the Lua `html` option is disabled by default.
+
+<div>
+*There is no block tag support.*
+</div>
+*There is no <inline tag="tag"></inline> support.*
+_There is no <!-- comment --> support._
+_There is no <? HTML instruction ?> support._
+
+Here are several ways to write a pipe:
+
+- |
+- &verbar;
+- &vert;
+- &VerticalLine;
+- &#x0007C;
+- &#124;
+
+Unrecognized character entities are ignored: &nonsense;
+>>>
+codeSpan: html
+interblockSeparator
+emphasis: There is no block tag support.
+emphasis: There is no <inline tag="tag"></inline> support.
+emphasis: There is no <!-- comment --> support.
+emphasis: There is no <? HTML instruction ?> support.
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+pipe
+ulItemEnd
+ulItem
+ampersand
+ulItemEnd
+ulItem
+ampersand
+ulItemEnd
+ulItem
+ampersand
+ulItemEnd
+ulItem
+ampersand
+hash
+ulItemEnd
+ulItem
+ampersand
+hash
+ulItemEnd
+ulEndTight
+interblockSeparator
+ampersand
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-hybrid.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-hybrid.test
new file mode 100644
index 0000000000..d1f3100921
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-hybrid.test
@@ -0,0 +1,65 @@
+<<<
+This test ensures that the Lua `hybrid` option is disabled by default. The
+following special characters should be processed by lunamark.
+
+ * \char`{
+ * \char`}
+ * \char`$
+ * \char`\%
+ * \char`&
+ * \char`_
+ * \char`#
+ * \char`^
+ * \char`\
+ * \char`~
+ * \char`|
+>>>
+codeSpan: hybrid
+interblockSeparator
+ulBeginTight
+ulItem
+backslash
+leftBrace
+ulItemEnd
+ulItem
+backslash
+rightBrace
+ulItemEnd
+ulItem
+backslash
+dollarSign
+ulItemEnd
+ulItem
+backslash
+backslash
+percentSign
+ulItemEnd
+ulItem
+backslash
+ampersand
+ulItemEnd
+ulItem
+backslash
+underscore
+ulItemEnd
+ulItem
+backslash
+hash
+ulItemEnd
+ulItem
+backslash
+circumflex
+ulItemEnd
+ulItem
+backslash
+backslash
+ulItemEnd
+ulItem
+backslash
+tilde
+ulItemEnd
+ulItem
+backslash
+pipe
+ulItemEnd
+ulEndTight
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-inline-footnotes.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-inline-footnotes.test
new file mode 100644
index 0000000000..52053b3393
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-inline-footnotes.test
@@ -0,0 +1,16 @@
+<<<
+This test ensures that the Lua `inlineFootnotes` option is disabled by default.
+The following inline footnotes should resolve to footnotes.
+
+^[Here is the footnote. It can go anywhere after the footnote
+reference. It need *not* be placed at the end of the document.]
+
+\^[This should *not* be a footnote, because it has been escaped.]
+>>>
+codeSpan: inlineFootnotes
+interblockSeparator
+circumflex
+emphasis: not
+interblockSeparator
+circumflex
+emphasis: not
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-pipe-tables.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-pipe-tables.test
new file mode 100644
index 0000000000..ef1545c2fc
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-pipe-tables.test
@@ -0,0 +1,41 @@
+<<<
+This test ensures that the Lua `pipeTables` option is disabled by default.
+
+| Right | *Left* | Default | Center |
+|------:|:-------|-------------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | **123** | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.
+>>>
+codeSpan: pipeTables
+interblockSeparator
+pipe
+pipe
+emphasis: Left
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+strongEmphasis: 123
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+pipe
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-shift-headings.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-shift-headings.test
new file mode 100644
index 0000000000..35c21a73d1
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-shift-headings.test
@@ -0,0 +1,35 @@
+<<<
+This test ensures that the Lua `shiftHeadings` option is disabled by default.
+
+# A level one heading
+
+A level one heading
+===================
+
+## A level two heading
+
+A level two heading
+-------------------
+
+### A level three heading
+#### A level four heading
+##### A level five heading
+###### A level six heading
+>>>
+codeSpan: shiftHeadings
+interblockSeparator
+headingOne: A level one heading
+interblockSeparator
+headingOne: A level one heading
+interblockSeparator
+headingTwo: A level two heading
+interblockSeparator
+headingTwo: A level two heading
+interblockSeparator
+headingThree: A level three heading
+interblockSeparator
+headingFour: A level four heading
+interblockSeparator
+headingFive: A level five heading
+interblockSeparator
+headingSix: A level six heading
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-slice.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-slice.test
new file mode 100644
index 0000000000..130042e81f
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-slice.test
@@ -0,0 +1,251 @@
+\def\markdownOptionHeaderAttributes{true}
+<<<
+This test ensures that the Lua `slice` option processes the entire document by
+default.
+
+This is an H1
+=============
+
+This is an H2 {#first-h2}
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is an H2 {#second-h2}
+-------------
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is an H2
+-------------
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
+>>>
+codeSpan: slice
+interblockSeparator
+headingOne: This is an H1
+interblockSeparator
+headingTwo: This is an H2
+interblockSeparator
+headingThree: This is an H3
+interblockSeparator
+headingFour: This is an H4
+interblockSeparator
+headingFive: This is an H5
+interblockSeparator
+headingSix: This is an H6
+interblockSeparator
+interblockSeparator
+horizontalRule
+interblockSeparator
+codeSpan: code
+BEGIN link
+- label: link
+- URI: http://google.cz
+- title: Google
+END link
+emphasis: This is an (emphasis: emphasized) span of text
+strongEmphasis: This is a (strongEmphasis: strongly emphasized) span of text
+interblockSeparator
+BEGIN image
+- label: example image
+- URI: example-image.pdf
+- title: An example image from Martin Scharrer's mwe package
+END image
+interblockSeparator
+interblockSeparator
+interblockSeparator
+codeSpan: latex (backslash)documentclass(leftBrace)article(rightBrace) (backslash)begin(leftBrace)document(rightBrace) Hello world! (backslash)end(leftBrace)document(rightBrace)
+interblockSeparator
+headingTwo: This is an H2
+interblockSeparator
+interblockSeparator
+ulBegin
+ulItem
+interblockSeparator
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEnd
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 5
+interblockSeparator
+olItemEnd
+olItemWithNumber: 6
+olItemEnd
+olItemWithNumber: 7
+olItemEnd
+olEnd
+interblockSeparator
+interblockSeparator
+hash
+interblockSeparator
+inputVerbatim: ./_markdown_test/484324226416f8957283b25427f6a56e.verbatim
+interblockSeparator
+hash
+hash
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 5
+olItemEnd
+olItemWithNumber: 6
+olItemEnd
+olItemWithNumber: 7
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+hash
+hash
+hash
+interblockSeparator
+interblockSeparator
+interblockSeparator
+interblockSeparator
+emphasis: Term 2
+interblockSeparator
+interblockSeparator
+inputVerbatim: ./_markdown_test/75062d55efa99b0f4cb94891f3745f93.verbatim
+interblockSeparator
+interblockSeparator
+interblockSeparator
+emphasis: Term 2
+interblockSeparator
+headingTwo: This is an H2
+interblockSeparator
+interblockSeparator
+blockQuoteBegin
+interblockSeparator
+blockQuoteBegin
+blockQuoteEnd
+interblockSeparator
+blockQuoteEnd
+interblockSeparator
+circumflex
+circumflex
+circumflex
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-start-number.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-start-number.test
new file mode 100644
index 0000000000..49e03d7653
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-start-number.test
@@ -0,0 +1,41 @@
+\def\markdownOptionStartNumber{false}
+<<<
+This test ensures that the Lua `startNumber` option correctly propagates
+through the plain TeX interface. The following lists should not receive
+any starting number.
+
+Tight:
+
+3. three
+4. four
+5. five
+
+Loose:
+
+3. three
+
+4. four
+
+5. five
+>>>
+codeSpan: startNumber
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItem
+olItemEnd
+olItem
+olItemEnd
+olItem
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBegin
+olItem
+olItemEnd
+olItem
+olItemEnd
+olItem
+olItemEnd
+olEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-strip-percent-signs.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-strip-percent-signs.test
new file mode 100644
index 0000000000..a077a44db7
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-strip-percent-signs.test
@@ -0,0 +1,10 @@
+<<<
+This test ensures that the plain TeX `stripPercentSigns` option is disabled by
+default.
+
+The following emphasized text *should contain the percent sign at the
+% beginning of the line*.
+>>>
+codeSpan: stripPercentSigns
+interblockSeparator
+emphasis: should contain the percent sign at the (percentSign) beginning of the line
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-table-captions.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-table-captions.test
new file mode 100644
index 0000000000..7bcab8e5b3
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-table-captions.test
@@ -0,0 +1,79 @@
+\def\markdownOptionPipeTables{true}
+<<<
+This test ensures that the Lua `tableCaptions` option is disabled by
+default.
+
+| Right | *Left* | Default | Center |
+|------:|:-------|-------------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | **123** | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of *pipe table* syntax with the caption spreading over
+ multiple lines.
+
+| Right | *Left* | Default | Center |
+|------:|:-------|-------------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | **123** | 123 |
+| 1 | 1 | 1 | 1 |
+
+ Table: Demonstration of *pipe table* syntax with the caption spreading over
+ multiple lines.
+
+A caption may not span multiple paragraphs.
+>>>
+codeSpan: tableCaptions
+interblockSeparator
+BEGIN table (4 rows, 4 columns)
+- caption:
+- alignment of column 1: r
+- alignment of column 2: l
+- alignment of column 3: d
+- alignment of column 4: c
+- row 1, column 1: Right
+- row 1, column 2: (emphasis: Left)
+- row 1, column 3: Default
+- row 1, column 4: Center
+- row 2, column 1: 12
+- row 2, column 2: 12
+- row 2, column 3: 12
+- row 2, column 4: 12
+- row 3, column 1: 123
+- row 3, column 2: 123
+- row 3, column 3: (strongEmphasis: 123)
+- row 3, column 4: 123
+- row 4, column 1: 1
+- row 4, column 2: 1
+- row 4, column 3: 1
+- row 4, column 4: 1
+END table
+interblockSeparator
+emphasis: pipe table
+interblockSeparator
+BEGIN table (4 rows, 4 columns)
+- caption:
+- alignment of column 1: r
+- alignment of column 2: l
+- alignment of column 3: d
+- alignment of column 4: c
+- row 1, column 1: Right
+- row 1, column 2: (emphasis: Left)
+- row 1, column 3: Default
+- row 1, column 4: Center
+- row 2, column 1: 12
+- row 2, column 2: 12
+- row 2, column 3: 12
+- row 2, column 4: 12
+- row 3, column 1: 123
+- row 3, column 2: 123
+- row 3, column 3: (strongEmphasis: 123)
+- row 3, column 4: 123
+- row 4, column 1: 1
+- row 4, column 2: 1
+- row 4, column 3: 1
+- row 4, column 4: 1
+END table
+interblockSeparator
+emphasis: pipe table
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-tight-lists.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-tight-lists.test
new file mode 100644
index 0000000000..446eb681fc
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-tight-lists.test
@@ -0,0 +1,19 @@
+\def\markdownOptionTightLists{false}
+<<<
+This test ensures that the Lua `tightLists` option correctly propagates
+through the plain TeX interface. The following list should be regular.
+
+3. three
+4. four
+5. five
+>>>
+codeSpan: tightLists
+interblockSeparator
+olBegin
+olItemWithNumber: 3
+olItemEnd
+olItemWithNumber: 4
+olItemEnd
+olItemWithNumber: 5
+olItemEnd
+olEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-underscores.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-underscores.test
new file mode 100644
index 0000000000..6e24e3c6d0
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/no-underscores.test
@@ -0,0 +1,15 @@
+\def\markdownOptionUnderscores{false}
+\def\markdownOptionHybrid{true}
+<<<
+This test ensures that the Lua `underscores` option correctly propagates
+through the plain TeX interface.
+
+This is a math expression: $\sqrt{\sum_{i=0}^n (a_i + b_i)^2}$.
+\begingroup\catcode`\_=12
+This __is no__ strongly emphasized span of text.
+This **is** a strongly emphasized span of text.
+\endgroup
+>>>
+codeSpan: underscores
+interblockSeparator
+strongEmphasis: is
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-backwards.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-backwards.test
new file mode 100644
index 0000000000..127658d479
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-backwards.test
@@ -0,0 +1,37 @@
+\def\markdownOptionShiftHeadings{-2}
+<<<
+This test ensures that the Lua `shiftHeadings` option correctly propagates
+through the plain TeX interface.
+
+# A level one heading
+
+A level one heading
+===================
+
+## A level two heading
+
+A level two heading
+-------------------
+
+### A level three heading
+#### A level four heading
+##### A level five heading
+###### A level six heading
+>>>
+codeSpan: shiftHeadings
+interblockSeparator
+headingOne: A level one heading
+interblockSeparator
+headingOne: A level one heading
+interblockSeparator
+headingOne: A level two heading
+interblockSeparator
+headingOne: A level two heading
+interblockSeparator
+headingOne: A level three heading
+interblockSeparator
+headingTwo: A level four heading
+interblockSeparator
+headingThree: A level five heading
+interblockSeparator
+headingFour: A level six heading
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-forward.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-forward.test
new file mode 100644
index 0000000000..f38f9d44e9
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/shift-headings-forward.test
@@ -0,0 +1,37 @@
+\def\markdownOptionShiftHeadings{2}
+<<<
+This test ensures that the Lua `shiftHeadings` option correctly propagates
+through the plain TeX interface.
+
+# A level one heading
+
+A level one heading
+===================
+
+## A level two heading
+
+A level two heading
+-------------------
+
+### A level three heading
+#### A level four heading
+##### A level five heading
+###### A level six heading
+>>>
+codeSpan: shiftHeadings
+interblockSeparator
+headingThree: A level one heading
+interblockSeparator
+headingThree: A level one heading
+interblockSeparator
+headingFour: A level two heading
+interblockSeparator
+headingFour: A level two heading
+interblockSeparator
+headingFive: A level three heading
+interblockSeparator
+headingSix: A level four heading
+interblockSeparator
+headingSix: A level five heading
+interblockSeparator
+headingSix: A level six heading
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-conclusion.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-conclusion.test
new file mode 100644
index 0000000000..affb0a44c3
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-conclusion.test
@@ -0,0 +1,155 @@
+\def\markdownOptionHashEnumerators{true}
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\def\markdownOptionSmartEllipses{true}
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionSlice{$second-h2 $}
+<<<
+This test ensures that the Lua `slice` option correctly propagates through the
+plain TeX interface.
+
+This is an H1
+=============
+
+This is an H2 {#first-h2}
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is an H2 {#second-h2}
+-------------
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is an H2
+-------------
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
+>>>
+headingTwo: This is an H2
+interblockSeparator
+interblockSeparator
+blockQuoteBegin
+interblockSeparator
+blockQuoteBegin
+blockQuoteEnd
+interblockSeparator
+blockQuoteEnd
+interblockSeparator
+footnote: Here is the footnote.
+footnote: Here's one with multiple blocks.(interblockSeparator)Subsequent paragraphs are indented to show that they belong to the previous footnote.(interblockSeparator)(inputVerbatim: ./_markdown_test/384313ed77c3960a536af8343b57216d.verbatim)(interblockSeparator)The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.
+footnote: Inlines notes are easier to write, since you don't have to pick an identifier and move down to type the note.
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-existing-section.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-existing-section.test
new file mode 100644
index 0000000000..d291815912
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-existing-section.test
@@ -0,0 +1,182 @@
+\def\markdownOptionHashEnumerators{true}
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\def\markdownOptionSmartEllipses{true}
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionSlice{first-h2}
+<<<
+This test ensures that the Lua `slice` option correctly propagates through the
+plain TeX interface.
+
+This is an H1
+=============
+
+This is an H2 {#first-h2}
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is an H2 {#second-h2}
+-------------
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is an H2
+-------------
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
+>>>
+headingTwo: This is an H2
+interblockSeparator
+headingThree: This is an H3
+interblockSeparator
+headingFour: This is an H4
+interblockSeparator
+headingFive: This is an H5
+interblockSeparator
+headingSix: This is an H6
+interblockSeparator
+ellipsis
+interblockSeparator
+horizontalRule
+interblockSeparator
+codeSpan: code
+BEGIN link
+- label: link
+- URI: http://google.cz
+- title: Google
+END link
+emphasis: This is an (emphasis: emphasized) span of text
+strongEmphasis: This is a (strongEmphasis: strongly emphasized) span of text
+interblockSeparator
+BEGIN image
+- label: example image
+- URI: example-image.pdf
+- title: An example image from Martin Scharrer's mwe package
+END image
+interblockSeparator
+BEGIN contentBlock
+- suffix: csv
+- URI: scientists.csv
+- title: The great minds of the 19th century rendered via a content block
+END contentBlock
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/5ccbfd8d1e383aae968fc8c9b1412c8e.verbatim
+- infostring: latex
+END fencedCode
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-nonexisting-section.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-nonexisting-section.test
new file mode 100644
index 0000000000..d2a7cd5b8e
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-nonexisting-section.test
@@ -0,0 +1,141 @@
+\def\markdownOptionHashEnumerators{true}
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\def\markdownOptionSmartEllipses{true}
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionSlice{third-h2}
+<<<
+This test ensures that the Lua `slice` option correctly propagates through the
+plain TeX interface.
+
+This is an H1
+=============
+
+This is an H2 {#first-h2}
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is an H2 {#second-h2}
+-------------
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is an H2
+-------------
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
+>>>
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-preface.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-preface.test
new file mode 100644
index 0000000000..1891c5ecad
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-preface.test
@@ -0,0 +1,148 @@
+\def\markdownOptionHashEnumerators{true}
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\def\markdownOptionSmartEllipses{true}
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionSlice{^ ^first-h2}
+<<<
+This test ensures that the Lua `slice` option correctly propagates through the
+plain TeX interface.
+
+This is an H1
+=============
+
+This is an H2 {#first-h2}
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is an H2 {#second-h2}
+-------------
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is an H2
+-------------
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+>
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
+>>>
+codeSpan: slice
+interblockSeparator
+headingOne: This is an H1
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-two-sections.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-two-sections.test
new file mode 100644
index 0000000000..d202fd3e42
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/slice-two-sections.test
@@ -0,0 +1,278 @@
+\def\markdownOptionHashEnumerators{true}
+\def\markdownOptionDefinitionLists{true}
+\def\markdownOptionFootnotes{true}
+\def\markdownOptionInlineFootnotes{true}
+\def\markdownOptionSmartEllipses{true}
+\def\markdownOptionFencedCode{true}
+\def\markdownOptionContentBlocks{true}
+\def\markdownOptionHeaderAttributes{true}
+\def\markdownOptionSlice{first-h2 second-h2}
+<<<
+This test ensures that the Lua `slice` option correctly propagates through the
+plain TeX interface.
+
+This is an H1
+=============
+
+This is an H2 {#first-h2}
+-------------
+
+### This is an H3
+#### This is an H4
+##### This is an H5
+###### This is an H6
+
+This is a text paragraph containing an ellipsis ... and followed by a horizontal rule.
+
+***
+
+This is inline `code`. This is a [link](http://google.cz "Google"). _This is an *emphasized* span of text_. __This is a **strongly emphasized** span of text__.
+
+ ![example image](example-image.pdf "An example image from Martin Scharrer's mwe package")
+
+ /scientists.csv (The great minds of the 19th century rendered via a content block)
+
+This is a fenced code block:
+
+``` latex
+\documentclass{article}
+\begin{document}
+ Hello world!
+\end{document}
+```
+
+This is an H2 {#second-h2}
+-------------
+
+This is a bullet list:
+
+ * The first item of a bullet list
+
+ that spans several paragraphs,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is a compact bullet list:
+
+ * The first item of a bullet list,
+ * the second item of a bullet list,
+ * the third item of a bullet list.
+
+This is an ordered list:
+
+ 5. The first item of an ordered list
+
+ that spans several paragraphs,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is an ordered list using hash enumerators:
+
+ #. The first item of an ordered list
+
+ that spans several paragraphs,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a compact ordered list:
+
+ 5. The first item of an ordered list,
+ 6. the second item of an ordered list,
+ 7. the third item of an ordered list.
+
+This is a compact ordered list using hash enumerators:
+
+ #. The first item of an ordered list,
+ #. the second item of an ordered list,
+ #. the third item of an ordered list.
+
+This is a definition list:
+
+Term 1
+
+: Definition 1
+
+*Term 2*
+
+: Definition 2
+
+ Some code, part of Definition 2
+
+ Third paragraph of Definition 2.
+
+: Definition 3
+
+This is a compact definition list:
+
+Term 1
+: Definition 1
+*Term 2*
+: Definition 2
+: Definition 3
+
+This is an H2
+-------------
+
+This is a block quote:
+
+> This is the first level of quoting.
+>
+> > This is nested blockquote.
+>
+> Back to the first level.
+
+Here is a footnote reference[^1] and another.[^longnote]
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+
+[^1]: Here is the footnote.
+
+[^longnote]: Here'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.
+>>>
+headingTwo: This is an H2
+interblockSeparator
+headingThree: This is an H3
+interblockSeparator
+headingFour: This is an H4
+interblockSeparator
+headingFive: This is an H5
+interblockSeparator
+headingSix: This is an H6
+interblockSeparator
+ellipsis
+interblockSeparator
+horizontalRule
+interblockSeparator
+codeSpan: code
+BEGIN link
+- label: link
+- URI: http://google.cz
+- title: Google
+END link
+emphasis: This is an (emphasis: emphasized) span of text
+strongEmphasis: This is a (strongEmphasis: strongly emphasized) span of text
+interblockSeparator
+BEGIN image
+- label: example image
+- URI: example-image.pdf
+- title: An example image from Martin Scharrer's mwe package
+END image
+interblockSeparator
+BEGIN contentBlock
+- suffix: csv
+- URI: scientists.csv
+- title: The great minds of the 19th century rendered via a content block
+END contentBlock
+interblockSeparator
+interblockSeparator
+BEGIN fencedCode
+- src: ./_markdown_test/5ccbfd8d1e383aae968fc8c9b1412c8e.verbatim
+- infostring: latex
+END fencedCode
+interblockSeparator
+headingTwo: This is an H2
+interblockSeparator
+interblockSeparator
+ulBegin
+ulItem
+interblockSeparator
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEnd
+interblockSeparator
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 5
+interblockSeparator
+olItemEnd
+olItemWithNumber: 6
+olItemEnd
+olItemWithNumber: 7
+olItemEnd
+olEnd
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 1
+interblockSeparator
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEnd
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 5
+olItemEnd
+olItemWithNumber: 6
+olItemEnd
+olItemWithNumber: 7
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olItemWithNumber: 3
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+dlBegin
+dlItem: Term 1
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: (emphasis: Term 2)
+dlDefinitionBegin
+interblockSeparator
+inputVerbatim: ./_markdown_test/341d9e6b078ab6ffb77652958c88c4ef.verbatim
+interblockSeparator
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEnd
+interblockSeparator
+interblockSeparator
+dlBeginTight
+dlItem: Term 1
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: (emphasis: Term 2)
+dlDefinitionBegin
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEndTight
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/start-number.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/start-number.test
new file mode 100644
index 0000000000..8f0245016f
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/start-number.test
@@ -0,0 +1,39 @@
+<<<
+This test ensures that the Lua `startNumber` option is enabled by default. The
+following lists should start with number three.
+
+Tight:
+
+3. three
+4. four
+5. five
+
+Loose:
+
+3. three
+
+4. four
+
+5. five
+>>>
+codeSpan: startNumber
+interblockSeparator
+interblockSeparator
+olBeginTight
+olItemWithNumber: 3
+olItemEnd
+olItemWithNumber: 4
+olItemEnd
+olItemWithNumber: 5
+olItemEnd
+olEndTight
+interblockSeparator
+interblockSeparator
+olBegin
+olItemWithNumber: 3
+olItemEnd
+olItemWithNumber: 4
+olItemEnd
+olItemWithNumber: 5
+olItemEnd
+olEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/table-captions.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/table-captions.test
new file mode 100644
index 0000000000..11db7c69e6
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/table-captions.test
@@ -0,0 +1,76 @@
+\def\markdownOptionPipeTables{true}
+\def\markdownOptionTableCaptions{true}
+<<<
+This test ensures that the Lua `tableCaptions` option correctly propagates
+through the plain TeX interface.
+
+| Right | *Left* | Default | Center |
+|------:|:-------|-------------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | **123** | 123 |
+| 1 | 1 | 1 | 1 |
+
+ : Demonstration of *pipe table* syntax with the caption spreading over
+ multiple lines.
+
+| Right | *Left* | Default | Center |
+|------:|:-------|-------------|:------:|
+| 12 | 12 | 12 | 12 |
+| 123 | 123 | **123** | 123 |
+| 1 | 1 | 1 | 1 |
+
+ Table: Demonstration of *pipe table* syntax with the caption spreading over
+ multiple lines.
+
+A caption may not span multiple paragraphs.
+>>>
+codeSpan: tableCaptions
+interblockSeparator
+BEGIN table (4 rows, 4 columns)
+- caption: Demonstration of (emphasis: pipe table) syntax with the caption spreading over multiple lines.
+- alignment of column 1: r
+- alignment of column 2: l
+- alignment of column 3: d
+- alignment of column 4: c
+- row 1, column 1: Right
+- row 1, column 2: (emphasis: Left)
+- row 1, column 3: Default
+- row 1, column 4: Center
+- row 2, column 1: 12
+- row 2, column 2: 12
+- row 2, column 3: 12
+- row 2, column 4: 12
+- row 3, column 1: 123
+- row 3, column 2: 123
+- row 3, column 3: (strongEmphasis: 123)
+- row 3, column 4: 123
+- row 4, column 1: 1
+- row 4, column 2: 1
+- row 4, column 3: 1
+- row 4, column 4: 1
+END table
+interblockSeparator
+BEGIN table (4 rows, 4 columns)
+- caption: Demonstration of (emphasis: pipe table) syntax with the caption spreading over multiple lines.
+- alignment of column 1: r
+- alignment of column 2: l
+- alignment of column 3: d
+- alignment of column 4: c
+- row 1, column 1: Right
+- row 1, column 2: (emphasis: Left)
+- row 1, column 3: Default
+- row 1, column 4: Center
+- row 2, column 1: 12
+- row 2, column 2: 12
+- row 2, column 3: 12
+- row 2, column 4: 12
+- row 3, column 1: 123
+- row 3, column 2: 123
+- row 3, column 3: (strongEmphasis: 123)
+- row 3, column 4: 123
+- row 4, column 1: 1
+- row 4, column 2: 1
+- row 4, column 3: 1
+- row 4, column 4: 1
+END table
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark-markdown/tight-lists.test b/macros/generic/markdown/tests/testfiles/lunamark-markdown/tight-lists.test
new file mode 100644
index 0000000000..47ecbcb726
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark-markdown/tight-lists.test
@@ -0,0 +1,18 @@
+<<<
+This test ensures that the Lua `tightLists` option is enabled by default. The
+following list should be tight.
+
+3. three
+4. four
+5. five
+>>>
+codeSpan: tightLists
+interblockSeparator
+olBeginTight
+olItemWithNumber: 3
+olItemEnd
+olItemWithNumber: 4
+olItemEnd
+olItemWithNumber: 5
+olItemEnd
+olEndTight
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/README.md b/macros/generic/markdown/tests/testfiles/lunamark/README.md
new file mode 100644
index 0000000000..59a2e70f47
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/README.md
@@ -0,0 +1,2 @@
+This directory contains test files that were inherited from the
+`tests/lunamark/` directory in the lunamark project.
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/backticks-in-links.test b/macros/generic/markdown/tests/testfiles/lunamark/backticks-in-links.test
new file mode 100644
index 0000000000..4f1f3fb24b
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/backticks-in-links.test
@@ -0,0 +1,8 @@
+<<<
+[hi `there] bud`](/url)
+>>>
+BEGIN link
+- label: hi (codeSpan: there] bud)
+- URI: /url
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/case-insensitive-references.test b/macros/generic/markdown/tests/testfiles/lunamark/case-insensitive-references.test
new file mode 100644
index 0000000000..4b2e6ad26b
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/case-insensitive-references.test
@@ -0,0 +1,10 @@
+<<<
+[hI]
+
+[Hi]: /foo
+>>>
+BEGIN link
+- label: hI
+- URI: /foo
+- title:
+END link
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/consecutive-lists.test b/macros/generic/markdown/tests/testfiles/lunamark/consecutive-lists.test
new file mode 100644
index 0000000000..56aaf8a8b3
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/consecutive-lists.test
@@ -0,0 +1,19 @@
+<<<
+- one
+- two
+1. one
+2. two
+>>>
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olEndTight
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/definition-lists.test b/macros/generic/markdown/tests/testfiles/lunamark/definition-lists.test
new file mode 100644
index 0000000000..35e5ef684b
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/definition-lists.test
@@ -0,0 +1,200 @@
+\def\markdownOptionDefinitionLists{true}
+<<<
+Tight using spaces:
+
+apple
+: red fruit
+orange
+: orange fruit
+banana
+: yellow fruit
+
+Tight using tabs:
+
+apple
+: red fruit
+orange
+: orange fruit
+banana
+: yellow fruit
+
+Loose:
+
+apple
+: red fruit
+
+orange
+: orange fruit
+
+banana
+: yellow fruit
+
+Multiple blocks with italics:
+
+*apple*
+: red fruit
+
+ contains seeds,
+ crisp, pleasant to taste
+
+*orange*
+: orange fruit
+
+ { orange code block }
+
+ > orange block quote
+
+Multiple definitions, tight:
+
+apple
+: red fruit
+: computer
+orange
+: orange fruit
+: bank
+
+Multiple definitions, loose:
+
+apple
+: red fruit
+
+: computer
+
+orange
+: orange fruit
+
+: bank
+
+Blank line after term, indented marker, alternate markers:
+
+apple
+
+ ~ red fruit
+
+ ~ computer
+
+orange
+
+ ~ orange fruit
+
+ 1. sublist
+ 2. sublist
+>>>
+interblockSeparator
+dlBeginTight
+dlItem: apple
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: orange
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: banana
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEndTight
+interblockSeparator
+interblockSeparator
+dlBeginTight
+dlItem: apple
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: orange
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: banana
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEndTight
+interblockSeparator
+interblockSeparator
+dlBegin
+dlItem: apple
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: orange
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: banana
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEnd
+interblockSeparator
+interblockSeparator
+dlBegin
+dlItem: (emphasis: apple)
+dlDefinitionBegin
+interblockSeparator
+dlDefinitionEnd
+dlItemEnd
+dlItem: (emphasis: orange)
+dlDefinitionBegin
+interblockSeparator
+inputVerbatim: ./_markdown_test/f9f08689e38f4705165b9018b14b4a09.verbatim
+interblockSeparator
+blockQuoteBegin
+blockQuoteEnd
+dlDefinitionEnd
+dlItemEnd
+dlEnd
+interblockSeparator
+interblockSeparator
+dlBeginTight
+dlItem: apple
+dlDefinitionBegin
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: orange
+dlDefinitionBegin
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEndTight
+interblockSeparator
+interblockSeparator
+dlBegin
+dlItem: apple
+dlDefinitionBegin
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: orange
+dlDefinitionBegin
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlEnd
+interblockSeparator
+interblockSeparator
+dlBegin
+dlItem: apple
+dlDefinitionBegin
+dlDefinitionEnd
+dlDefinitionBegin
+dlDefinitionEnd
+dlItemEnd
+dlItem: orange
+dlDefinitionBegin
+interblockSeparator
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olEndTight
+dlDefinitionEnd
+dlItemEnd
+dlEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/hash-enumerators.test b/macros/generic/markdown/tests/testfiles/lunamark/hash-enumerators.test
new file mode 100644
index 0000000000..94f63fd2ad
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/hash-enumerators.test
@@ -0,0 +1,11 @@
+\def\markdownOptionHashEnumerators{true}
+<<<
+#. one
+#. two
+>>>
+olBeginTight
+olItemWithNumber: 1
+olItemEnd
+olItemWithNumber: 2
+olItemEnd
+olEndTight
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/indented-code-in-list-item.test b/macros/generic/markdown/tests/testfiles/lunamark/indented-code-in-list-item.test
new file mode 100644
index 0000000000..8e35081172
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/indented-code-in-list-item.test
@@ -0,0 +1,16 @@
+<<<
+1. Just a small test
+
+ This is some code
+
+ and some indented code
+
+ and this is the end
+>>>
+olBegin
+olItemWithNumber: 1
+interblockSeparator
+inputVerbatim: ./_markdown_test/36d7a0503b844c792d46549a49b6e7b8.verbatim
+interblockSeparator
+olItemEnd
+olEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/list-spacing.test b/macros/generic/markdown/tests/testfiles/lunamark/list-spacing.test
new file mode 100644
index 0000000000..4e7f84248d
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/list-spacing.test
@@ -0,0 +1,42 @@
+<<<
+ * item 1
+ * item 1a
+ * item 2
+* item 2a
+ * item 2b
+ * item 2c
+ * item 3
+
+----
+
+ 8. item 1
+ 9. item 2
+10. item 2a
+>>>
+ulBeginTight
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulItem
+ulItemEnd
+ulEndTight
+interblockSeparator
+horizontalRule
+interblockSeparator
+olBeginTight
+olItemWithNumber: 8
+olItemEnd
+olItemWithNumber: 9
+olItemEnd
+olItemWithNumber: 10
+olItemEnd
+olEndTight
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/lists-and-hrules.test b/macros/generic/markdown/tests/testfiles/lunamark/lists-and-hrules.test
new file mode 100644
index 0000000000..cffd38dc87
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/lists-and-hrules.test
@@ -0,0 +1,18 @@
+<<<
++ item 1
+
+ + item 2
+
+ * * * * *
+>>>
+ulBegin
+ulItem
+interblockSeparator
+ulBeginTight
+ulItem
+ulItemEnd
+ulEndTight
+ulItemEnd
+ulEnd
+interblockSeparator
+horizontalRule
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/notes.test b/macros/generic/markdown/tests/testfiles/lunamark/notes.test
new file mode 100644
index 0000000000..312090de8a
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/notes.test
@@ -0,0 +1,27 @@
+\def\markdownOptionFootnotes{true}
+<<<
+Here is a footnote reference,[^1] and another.[^longnote]
+This should *not* be a footnote reference, because it has not been
+defined.[^my note]
+
+[^longnote]: Here's the long note. This one contains multiple blocks.
+
+ Subsequent blocks are indented to show that they belong to the
+footnote (as with list items).
+
+ { <code> }
+
+ If you want, you can indent every line, but you can also be
+ lazy and just indent the first line of each block.
+
+This paragraph should not be part of the note, as it is not indented.
+
+ [^1]: Here is the footnote. It can go anywhere after the footnote
+ reference. It need not be placed at the end of the document.
+
+>>>
+footnote: Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document.
+footnote: Here's the long note. This one contains multiple blocks.(interblockSeparator)Subsequent blocks are indented to show that they belong to the footnote (as with list items).(interblockSeparator)(inputVerbatim: ./_markdown_test/7f88af46ac2c38c6ee0c6837fcb8cbc6.verbatim)(interblockSeparator)If you want, you can indent every line, but you can also be lazy and just indent the first line of each block.
+emphasis: not
+circumflex
+interblockSeparator
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/reference-defined-in-blockquote.test b/macros/generic/markdown/tests/testfiles/lunamark/reference-defined-in-blockquote.test
new file mode 100644
index 0000000000..8bafd8f0d4
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/reference-defined-in-blockquote.test
@@ -0,0 +1,12 @@
+<<<
+> [foo]
+>
+> [foo]: /bar
+>>>
+blockQuoteBegin
+BEGIN link
+- label: foo
+- URI: /bar
+- title:
+END link
+blockQuoteEnd
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-blockquote.test b/macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-blockquote.test
new file mode 100644
index 0000000000..9c476ac354
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-blockquote.test
@@ -0,0 +1,5 @@
+\def\markdownOptionBlankBeforeBlockquote{true}
+<<<
+Hi
+> no quote
+>>>
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-header.test b/macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-header.test
new file mode 100644
index 0000000000..4ed22912e7
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/require-blank-before-header.test
@@ -0,0 +1,6 @@
+\def\markdownOptionBlankBeforeHeading{true}
+<<<
+Hi
+# No header
+>>>
+hash
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/smart.test b/macros/generic/markdown/tests/testfiles/lunamark/smart.test
new file mode 100644
index 0000000000..ce48cf374c
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/smart.test
@@ -0,0 +1,7 @@
+\def\markdownOptionSmartEllipses{true}
+<<<
+Ellipses...and...and....
+>>>
+ellipsis
+ellipsis
+ellipsis
diff --git a/macros/generic/markdown/tests/testfiles/lunamark/unicode.test b/macros/generic/markdown/tests/testfiles/lunamark/unicode.test
new file mode 100644
index 0000000000..1392aa0915
--- /dev/null
+++ b/macros/generic/markdown/tests/testfiles/lunamark/unicode.test
@@ -0,0 +1,10 @@
+<<<
+[Beiß nicht in die Hand, die dich füttert.]
+
+[BEIß NICHT IN DIE HAND, DIE DICH FÜTTERT.]: http://en.wikiquote.org/wiki/German_proverbs
+>>>
+BEGIN link
+- label: Beiß nicht in die Hand, die dich füttert.
+- URI: http://en.wikiquote.org/wiki/German(underscore)proverbs
+- title:
+END link