From c5a2b996ae14f24d174cd68b44fb854752961036 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 15 Sep 2020 03:02:49 +0000 Subject: CTAN sync 202009150302 --- macros/generic/markdown/README.md | 38 +- macros/generic/markdown/markdown.dtx | 831 ++++- macros/generic/markdown/markdown.html | 6485 +++++++++++++++++---------------- macros/generic/markdown/markdown.md | 4 +- macros/generic/markdown/markdown.pdf | Bin 431227 -> 443344 bytes 5 files changed, 4114 insertions(+), 3244 deletions(-) (limited to 'macros/generic') diff --git a/macros/generic/markdown/README.md b/macros/generic/markdown/README.md index d29e20c875..99ee0367e3 100644 --- a/macros/generic/markdown/README.md +++ b/macros/generic/markdown/README.md @@ -1,5 +1,6 @@ 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] @@ -14,10 +15,13 @@ does not require any external programs, and 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" + [markdown]: https://daringfireball.net/projects/markdown/basics "Daring Fireball: Markdown Basics" + + ![banner](banner.png "An example LaTeX document using the Markdown package") Further information ------------------- + For further information, consult one of the following: 1. The [user manual][manual], which can be produced by interpreting the @@ -40,7 +44,8 @@ For further information, consult one of the following: - [Using Markdown inside TeX documents][tb119], and - [Markdown 2.7.0: Towards lightweight markup in TeX][tb124]. 5. My journal articles published by [CSTUG][] (in Czech): - - [Rendering Markdown inside TeX Documents][10.5300/2016-1-4/78]. + - [Rendering Markdown inside TeX Documents][10.5300/2016-1-4/78], and + - [Markdown 2.8.1: Boldly Unto the Throne of Lightweight Markup in TeX][10.5300/2020-1-2/48]. [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" @@ -49,10 +54,11 @@ For further information, consult one of the following: [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/members/TUGboat/tb40-1/tb124novotny-markdown.pdf "Markdown 2.7.0: Towards lightweight markup in TeX" + [tb119]: https://www.tug.org/TUGboat/tb38-2/tb119novotny.pdf "Using Markdown inside TeX documents" + [tb124]: https://www.tug.org/TUGboat/tb40-1/tb124novotny-markdown.pdf "Markdown 2.7.0: Towards lightweight markup in TeX" - [10.5300/2016-1-4/78]: https://doi.org/10.5300/2016-1-4/78 "Rendering Markdown inside TeX Documents" + [10.5300/2016-1-4/78]: https://bulletin.cstug.cz/pdf/2016-1-4.pdf#page=80 "Rendering Markdown inside TeX Documents" + [10.5300/2020-1-2/48]: https://bulletin.cstug.cz/pdf/2020-1-2.pdf#page=50 "Markdown 2.8.1: Boldly Unto the Throne of 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" @@ -83,6 +89,7 @@ Acknowledgements Contributing ------------ + Apart from the example markdown documents, tests, and continuous integration, which are placed in the `examples/`, `tests/`, and `.circleci/` directories, the complete source code and documentation of the package are placed in the @@ -108,3 +115,24 @@ is provided by the [doc][] LaTeX package. [LaTeXMK]: https://ctan.org/pkg/latexmk "latexmk – Fully automated LaTeX document generation" [literate programming]: https://en.wikipedia.org/wiki/Literate_programming "Literate programming" [ltxdockit]: https://ctan.org/pkg/ltxdockit "ltxdockit – Documentation support" + +Citing Markdown +--------------- + +When citing Markdown in academic papers and theses, please use the following +BibTeX entry: + +```bib +@article{novotny17markdown, + author = {V\'{i}t Novotn\'{y}}, + year = {2017}, + title = {Using {M}arkdown Inside {\TeX} Documents}, + journal = {TUGboat}, + volume = {38}, + number = {2}, + pages = {214--217}, + issn = {0896-3207}, + url = {https://tug.org/TUGboat/tb38-2/tb119novotny.pdf}, + urldate = {2020-07-31}, +} +``` diff --git a/macros/generic/markdown/markdown.dtx b/macros/generic/markdown/markdown.dtx index 0cf9f4f9ac..a3ebaecd88 100644 --- a/macros/generic/markdown/markdown.dtx +++ b/macros/generic/markdown/markdown.dtx @@ -2,7 +2,7 @@ %<*driver> \documentclass{ltxdockit} \usepackage[american]{babel} -\usepackage{amsmath,btxdockit,doc,fancyvrb,hologo,microtype,minted,xcolor} +\usepackage{amsmath,btxdockit,doc,fancyvrb,hologo,microtype,minted} \usepackage{fontspec} \defaultfontfeatures[\rmfamily,\sffamily,\ttfamily]{} @@ -20,7 +20,7 @@ \setkomafont{captionlabel}{\bfseries\sffamily\spotcolor} \hypersetup{citecolor=spot} \let\oldCodelineNo\theCodelineNo -\def\theCodelineNo{\textcolor{gray}{\oldCodelineNo}} +\def\theCodelineNo{\textcolor[gray]{0.5}{\oldCodelineNo}} % Define some markup. \let\pkg\relax % A package name @@ -92,8 +92,7 @@ \CodelineIndex % Set up the bibliography. -\usepackage{filecontents} -\begin{filecontents}{markdown.bib} +\begin{filecontents}[overwrite,nosearch,noheader]{markdown.bib} @online{sotkov17, author = {Sotkov, Anton}, title = {File transclusion syntax for Markdown}, @@ -121,6 +120,14 @@ date = {2017-04-15}, url = {http://mirrors.ctan.org/macros/latex/base/doc.pdf}, urldate = {2018-02-19}} +@book{poore17, + author = {Poore, Geoffrey M.}, + title = {The \texttt{minted} Package}, + subtitle = {Highlighted source code in \LaTeX}, + date = {2017-07-19}, + version = {v2.5}, + url = {http://mirrors.ctan.org/macros/latex/contrib/minted/minted.pdf}, + urldate = {2020-09-01}} @online{novotny15, author = {Novotný, Vít}, year = {2015}, @@ -539,7 +546,7 @@ does not require any external programs, and 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/ + [markdown]: https://daringfireball.net/projects/markdown/basics (Daring Fireball: Markdown Basics) [pkg]: https://ctan.org/pkg/markdown (CTAN: Package markdown) @@ -570,7 +577,7 @@ documentation][techdoc]. % \fi % \begin{macrocode} local metadata = { - version = "2.8.2", + version = "2.9.0", 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", @@ -989,7 +996,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. [Kpathsea]: https://tug.org/kpathsea/ (Kpathsea - TeX Users Group) @@ -1318,7 +1325,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -1468,7 +1475,7 @@ 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 +systems. Use the command `kpsewhich -a 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 @@ -1551,6 +1558,224 @@ defaultOptions.cacheDir = "." % \iffalse % %<*manual-options> + +#### Option `frozenCacheFileName` + +`frozenCacheFileName` (default value: `"frozenCache.tex"`) + +% \fi +% \begin{markdown} +% +% \Valitem[frozenCache.tex]{frozenCacheFileName}{path} +% +: A path to an output file (frozen cache) that will be created when + the \Opt{finalizeCache} option is enabled and will contain a mapping + between an enumeration of markdown documents and their auxiliary cache + files. + + The frozen cache makes it possible to later typeset a plain \TeX{} + document that contains markdown documents without invoking Lua using + the \m{markdownOptionFrozenCache} plain \TeX{} option. As a result, the + plain \TeX{} document becomes more portable, but further changes in the + order and the content of markdown documents will not be reflected. + +% \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({finalizeCache = true, frozenCacheFileName = "cache.tex"}) + local input = "Hello *world*!" + 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 text +“Hello *world*!” A frozen cache will also be produced in the `cache.tex` +output file as we requested using the `finalizeCache` and `frozenCacheFileName` +options. + +##### 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⟩ finalizeCache=true frozenCacheFileName=cache.tex -- 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 -a 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 frozen cache will also be produced in the `cache.tex` +output file as we requested using the `finalizeCache` and `frozenCacheFileName` +options. + +##### Plain \TeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\input markdown +\def\markdownOptionFinalizeCache{true} +\def\markdownOptionFrozenCacheFileName{cache.tex} +\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 frozen cache will also be produced in the `cache.tex` +output file as we requested using the `finalizeCache` and `frozenCacheFileName` +options. + +Next, create a new text document `frozen-document.tex` with the following +content: +``` tex +\input markdown +\def\markdownOptionFrozenCache{true} +\def\markdownOptionFrozenCacheFileName{cache.tex} +\markdownBegin +Hi *world*! +\markdownEnd +\bye +``````` +Last, invoke pdfTeX without shell access from the terminal: +``` sh +pdftex -no-shell-escape frozen-document.tex +`````` +A PDF document named `frozen-document.pdf` should be produced and contain the +text “Hello *world*!” Since we used the contents of the frozen cache using +the `\markdownOptionFrozenCache` option, we were able to typeset the +document without accessing the shell or invoking Lua, but the change in the +content of the markdown document from “Hello *world*!” to “Hi *world*!” was +not reflected. + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\documentclass[finalizecache]{article} +\usepackage[frozenCacheFileName=cache.tex]{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 frozen cache will also be produced in the `cache.tex` +output file as we requested using the `finalizecache` and `frozenCacheFileName` +options. + +Next, create a new text document `frozen-document.tex` with the following +content: +``` tex +\documentclass[frozencache]{article} +\usepackage[frozenCacheFileName=cache.tex]{markdown} +\begin{document} +\begin{markdown} +Hi *world*! +\end{markdown} +\end{document} +``````` +Last, invoke pdfTeX without shell access from the terminal: +``` sh +pdflatex -no-shell-escape frozen-document.tex +`````` +A PDF document named `frozen-document.pdf` should be produced and contain the +text “Hello *world*!” Since we used the contents of the frozen cache using +the `frozencache` option, we were able to typeset the document without +accessing the shell or invoking Lua, but the change in the content of the +markdown document from “Hello *world*!” to “Hi *world*!” was not reflected. + +##### \Hologo{ConTeXt} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\usemodule[t][markdown] +\def\markdownOptionFinalizeCache{true} +\def\markdownOptionFrozenCacheFileName{cache.tex} +\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 frozen cache will also be produced in the `cache.tex` +output file as we requested using the `finalizeCache` and `frozenCacheFileName` +options. + +Next, create a new text document `frozen-document.tex` with the following +content: +``` tex +\usemodule[t][markdown] +\def\markdownOptionFrozenCache{true} +\def\markdownOptionFrozenCacheFileName{cache.tex} +\starttext +\startmarkdown +Hi *world*! +\stopmarkdown +\stoptext +``````` +Last, invoke pdfTeX without shell access from the terminal: +``` sh +texexec --passon=--no-shell-escape frozen-document.tex +`````` +A PDF document named `frozen-document.pdf` should be produced and contain the +text “Hello *world*!” Since we used the contents of the frozen cache using +the `\markdownOptionFrozenCache` option, we were able to typeset the document +without accessing the shell or invoking Lua, but the change in the content of +the markdown document from “Hello *world*!” to “Hi *world*!” was not reflected. + +% +%<*lua,lua-cli> +% \fi +% \begin{macrocode} +defaultOptions.frozenCacheFileName = "frozenCache.tex" +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> % \fi % \begin{markdown} % @@ -1642,7 +1867,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -1859,7 +2084,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -2093,7 +2318,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -2311,7 +2536,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -2708,7 +2933,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -3425,6 +3650,160 @@ defaultOptions.fencedCode = false % %<*manual-options> +#### Option `finalizeCache` + +`finalizeCache` (default value: `false`) + +% \fi +% \begin{markdown} +% +% \Optitem[false]{finalizeCache}{\opt{true}, \opt{false}} +% +: Whether an output file specified with the \Opt{frozenCacheFileName} option + (frozen cache) that contains a mapping between an enumeration of markdown + documents and their auxiliary cache files will be created. + + The frozen cache makes it possible to later typeset a plain \TeX{} + document that contains markdown documents without invoking Lua using + the \m{markdownOptionFrozenCache} plain \TeX{} option. As a result, the + plain \TeX{} document becomes more portable, but further changes in the + order and the content of markdown documents will not be reflected. + +% \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\markdownOptionFinalizeCache{true} +\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 frozen cache will also be produced as we requested using the +`finalizeCache` option. + +Next, change the content of `document.tex` as follows: +``` tex +\input markdown +\def\markdownOptionFrozenCache{true} +\markdownBegin +Hi *world*! +\markdownEnd +\bye +``````` +Last, invoke pdfTeX without shell access from the terminal: +``` sh +pdftex -no-shell-escape document.tex +`````` +A new PDF document named `document.pdf` should be produced and contain the +same text “Hello *world*!” Since we used the contents of the frozen cache using +the `\markdownOptionFrozenCache` option, we were able to typeset the document +without accessing the shell or invoking Lua, but the change in the content of +the markdown document from “Hello *world*!” to “Hi *world*!” was not reflected. + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\documentclass[finalizecache]{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*!” A frozen cache will also be produced as we requested using the +`finalizecache` option. + +Next, change the content of `document.tex` as follows: +``` tex +\documentclass[frozencache]{article} +\usepackage{markdown} +\begin{document} +\begin{markdown} +Hi *world*! +\end{markdown} +\end{document} +``````` +Last, invoke pdfTeX without shell access from the terminal: +``` sh +pdflatex -no-shell-escape document.tex +`````` +A new PDF document named `document.pdf` should be produced and contain the +same text “Hello *world*!” Since we used the contents of the frozen cache using +the `\markdownOptionFrozenCache` option, we were able to typeset the document +without accessing the shell or invoking Lua, but the change in the content of +the markdown document from “Hello *world*!” to “Hi *world*!” was not reflected. + +##### \Hologo{ConTeXt} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\usemodule[t][markdown] +\def\markdownOptionFinalizeCache{true} +\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 frozen cache will also be produced in the `cache.tex` +output file as we requested using the `finalizeCache` option. + +Next, change the content of `document.tex` as follows: +``` tex +\usemodule[t][markdown] +\def\markdownOptionFrozenCache{true} +\starttext +\startmarkdown +Hi *world*! +\stopmarkdown +\stoptext +``````` +Last, invoke pdfTeX without shell access from the terminal: +``` sh +texexec --passon=--no-shell-escape document.tex +`````` +A new PDF document named `document.pdf` should be produced and contain the +same text “Hello *world*!” Since we used the contents of the frozen cache using +the `\markdownOptionFrozenCache` option, we were able to typeset the document +without accessing the shell or invoking Lua, but the change in the content of +the markdown document from “Hello *world*!” to “Hi *world*!” was not reflected. + +% +%<*lua,lua-cli> +% \fi +% \begin{macrocode} +defaultOptions.finalizeCache = false +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> + #### Option `footnotes` `footnotes` (default value: `false`) @@ -3584,6 +3963,61 @@ defaultOptions.footnotes = false % %<*manual-options> +#### Option `frozenCacheCounter` + +`frozenCacheCounter` (default value: `0`) + +% \fi +% \begin{markdown} +% +% \Valitem[0]{frozenCacheCounter}{number} +% +: The number of the current markdown document that will be stored in + an output file (frozen cache) when the \Opt{finalizeCache} is enabled. + When the document number is 0, then a new frozen cache will be created. + Otherwise, the frozen cache will be appended. + + Each frozen cache entry will define a \TeX{} macro + `\markdownFrozenCache`\meta{number} that will typeset markdown document + number \meta{number}. + +% \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 firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0}) + local firstInput = "Hello" + local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1}) + local secondInput = "*world*!" + tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) } +\bye +``````` +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*!” A frozen cache with two entries will also be produced as we +requested using the `frozenCacheCounter` option. + +% +%<*lua,lua-cli> +% \fi +% \begin{macrocode} +defaultOptions.frozenCacheCounter = 0 +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> + #### Option `hashEnumerators` `hashEnumerators` (default value: `false`) @@ -3849,7 +4283,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -4089,7 +4523,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -4845,7 +5279,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the @@ -5509,6 +5943,8 @@ for i = 1, #arg do default_type = type(defaultOptions[key]) if default_type == "boolean" then options[key] = (value == "true") + elseif default_type == "number" then + options[key] = tonumber(value) else if default_type ~= "string" then if default_type == "nil" then @@ -5660,8 +6096,8 @@ pdftex --shell-escape document.tex % % \end{markdown} % \begin{macrocode} -\def\markdownLastModified{2020/03/20}% -\def\markdownVersion{2.8.2}% +\def\markdownLastModified{2020/09/14}% +\def\markdownVersion{2.9.0}% % \end{macrocode} % \par % \begin{markdown} @@ -5778,8 +6214,63 @@ 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. +% +%<*tex> % \fi +% \par % \begin{markdown} +% +%#### Finalizing and Freezing the Cache +% The \mdef{markdownOptionFinalizeCache} option corresponds to the Lua +% interface \Opt{finalizeCache} option, which creates an output file +% \m{markdownOptionFrozenCacheFileName} (frozen cache) that contains a mapping +% between an enumeration of the markdown documents in the plain \TeX{} document +% and their auxiliary files cached in the \Opt{cacheDir} directory. +% +% \end{markdown} +% \begin{macrocode} +\let\markdownOptionFinalizeCache\undefined +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> + +#### Finalizing and Freezing the Cache + +% \fi +% \begin{markdown} +% +The \mdef{markdownOptionFrozenCache} option uses the mapping previously +% created by the \m{markdownOptionFinalizeCache} option, +% \iffalse +created by the Lua interface \Opt{finalizeCache} option, +% \fi +and uses it to typeset the plain \TeX{} document without invoking Lua. As a +result, the plain \TeX{} document becomes more portable, but further changes +in the order and the content of markdown documents will not be reflected. It +defaults to `false`. + +% The standard usage of the above two options is as follows: +% \iffalse +The standard usage of the \Opt{finalizeCache} and \m{markdownOptionFrozenCache} +options is as follows: +% \fi + +1. Remove the \Opt{cacheDir} cache directory with stale auxiliary cache + files. +% 2. Enable the \m{markdownOptionFinalizeCache} option. +% \iffalse +2. Enable the \Opt{finalizeCache} option. +% \fi +3. Typeset the plain \TeX{} document to populate and finalize the cache. +4. Enable the \m{markdownOptionFrozenCache} option. +5. Publish the source code of the plain \TeX{} document and the + \Opt{cacheDir} directory. + +% \iffalse +For more information, see the examples for the \Opt{finalizeCache} option. +% \fi #### File and Directory Names @@ -5848,9 +6339,9 @@ interfaces. % \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 `.`. +% will contain the auxiliary 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 @@ -5876,6 +6367,20 @@ interfaces. % \begin{macrocode} \def\markdownOptionCacheDir{\markdownOptionOutputDir/_markdown_\jobname}% % \end{macrocode} +% \par +% \begin{markdown} +% +% The \mdef{markdownOptionFrozenCacheFileName} macro corresponds to the Lua +% interface \Opt{frozenCacheFileName} option that sets the path to an output +% file (frozen cache) that will contain a mapping between an enumeration of the +% markdown documents in the plain \TeX{} document and their auxiliary cache +% files. The option defaults to `frozenCache.tex`. The same limitations apply +% here as in the case of the \m{markdownOptionHelperScriptFileName} macro. +% +% \end{markdown} +% \begin{macrocode} +\def\markdownOptionFrozenCacheFileName{\markdownOptionCacheDir/frozenCache.tex} +% \end{macrocode} % % \iffalse % @@ -5889,8 +6394,9 @@ Markdown to \TeX{}: - `\markdownOptionInputTempFileName`, - `\markdownOptionOutputTempFileName`, - `\markdownOptionErrorTempFileName`, -- `\markdownOptionOutputDir`, and -- `\markdownOptionCacheDir`. +- `\markdownOptionOutputDir`, +- `\markdownOptionCacheDir`, and +- `\markdownOptionFrozenCacheFileName`. Using a text editor, create a folder named `output-directory` and a text document named `document.tex` with the following content: @@ -5903,6 +6409,8 @@ document named `document.tex` with the following content: \def\markdownOptionErrorTempFileName{error-output.txt} \def\markdownOptionOutputDir{output-directory} \def\markdownOptionCacheDir{output-directory/cache-directory} +\markdownOptionFinalizeCachetrue +\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex} \markdownBegin Hello *world*! \markdownEnd @@ -5989,7 +6497,8 @@ 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. +Mittelbach. The recognized values of the macro are `true` (discard) and `false` +(retain). It defaults to `false`. [doc]: https://ctan.org/pkg/doc (doc – Format LaTeX documentation) @@ -6029,34 +6538,13 @@ A PDF document named `document.pdf` should be produced and contain the text % 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). +% values of the macro are `true` (discard) and `false` (retain). It defaults +% to `false`. % % \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 % %<*manual-tokens> @@ -6355,7 +6843,7 @@ following text: #### 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. + \Opt{smartEllipses} option is enabled. The macro receives no arguments. % \end{markdown} % @@ -7683,7 +8171,7 @@ an ordered list. The macro receives no arguments. 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. +option is enabled. The macro receives no arguments. % \end{markdown} % @@ -8010,7 +8498,7 @@ following text: #### Definition List Renderers The following macros are only produced, when the \Opt{definitionLists} option -is `true`. +is enabled. The \mdef{markdownRendererDlBegin} macro represents the beginning of a definition list that contains an item with several paragraphs of text (the @@ -8859,7 +9347,7 @@ filename of a file contaning the code block contents. 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 +enabled. 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} @@ -9330,7 +9818,7 @@ following text: #### Footnote Renderer The \mdef{markdownRendererFootnote} macro represents a footnote. This macro -will only be produced, when the \Opt{footnotes} option is `true`. The +will only be produced, when the \Opt{footnotes} option is enabled. The macro receives a single argument that corresponds to the footnote text. % \end{markdown} @@ -9444,9 +9932,9 @@ following text: #### 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 +\Opt{citations} option is enabled. 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. @@ -9532,7 +10020,7 @@ following text: #### 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 +\Opt{citations} option is enabled. The macro receives parameters in the same format as the \m{markdownRendererCite} macro. % \end{markdown} @@ -9614,7 +10102,7 @@ following text: #### 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 +be produced, when the \Opt{pipeTables} option is enabled. 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 @@ -10285,6 +10773,43 @@ pdflatex --shell-escape document.tex % \par % \begin{markdown} % +% The \m{markdownOptionFinalizeCache} and \m{markdownOptionFrozenCache} plain +% \TeX{} options are exposed through \LaTeX{} options with keys `finalizeCache` +% and `frozenCache`. +% +% To ensure compatibility with the `minted` package [@poore17, Section +% 5.1], which supports the `finalizecache` and `frozencache` package options +% with similar semantics, the Markdown package also recognizes these as aliases +% and recognizes them as document class options. By passing `finalizecache` and +% `frozencache` as document class options, you may conveniently control the +% behavior of both packages at once: +% +% ``` tex +% \documentclass[frozencache]{article} +% \usepackage{markdown,minted} +% \begin{document} +% % ... +% \end{document} +% ``````` +% +% We hope that other packages will support the `finalizecache` and +% `frozencache` package options in the future, so that they can become a +% standard interface for preparing \LaTeX{} document sources for distribution. +% +% \end{markdown} +% \begin{macrocode} +\define@key{markdownOptions}{finalizeCache}[true]{% + \def\markdownOptionFinalizeCache{#1}}% +\DeclareOption{finalizecache}{\markdownSetup{finalizeCache}} +\define@key{markdownOptions}{frozenCache}[true]{% + \def\markdownOptionFrozenCache{#1}}% +\DeclareOption{frozencache}{\markdownSetup{frozenCache}} +\define@key{markdownOptions}{frozenCacheFileName}{% + \def\markdownOptionFrozenCacheFileName{#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}. @@ -13379,7 +13904,7 @@ function M.writer.new(options) % 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, +% If the \Opt{hybrid} option is enabled, use identity functions. Otherwise, % use the \luam{escape} and \luam{escape_minimal} functions. % % \end{markdown} @@ -13828,7 +14353,7 @@ function M.writer.new(options) % % 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. +% is enabled, 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 @@ -14687,7 +15212,7 @@ function M.reader.new(writer, options) % \begin{markdown} % % Define \luamdef{expandtabs} either as an identity function, when the -% \Opt{preserveTabs} Lua inrerface option is `true`, or to a function that +% \Opt{preserveTabs} Lua inrerface option is enabled, or to a function that % expands tabs into spaces otherwise. % % \end{markdown} @@ -15578,14 +16103,35 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline 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. +% Produce the cache file and transform its filename to plain \TeX{} output +% via the \luam{writer->pack} method. % \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) + local output = writer.pack(name) +% \end{macrocode} +% \begin{markdown} +% If the \Opt{frozenCache} option is enabled, populate the frozen cache in +% the file \Opt{frozenCacheFileName} with an entry for markdown document +% number \Opt{frozenCacheCounter}. +% \end{markdown} +% \begin{macrocode} + if options.finalizeCache then + local file, mode + if options.frozenCacheCounter > 0 then + mode = "a" + else + mode = "w" + end + file = assert(io.open(options.frozenCacheFileName, mode)) + assert(file:write([[\expandafter\def\csname markdownFrozenCache]] .. + options.frozenCacheCounter .. [[\endcsname{]] .. output .. [[}]] .. + "\n")) + assert(file:close()) + end + return output end return self end @@ -15626,9 +16172,9 @@ return M local input if input_filename then - local input_file = io.open(input_filename, "r") + local input_file = assert(io.open(input_filename, "r")) input = assert(input_file:read("*a")) - input_file:close() + assert(input_file:close()) else input = assert(io.read("*a")) end @@ -15668,7 +16214,7 @@ local convert = md.new(options) local output = convert(input:gsub("\r\n?", "\n") .. "\n") if output_filename then - local output_file = io.open(output_filename, "w") + local output_file = assert(io.open(output_filename, "w")) assert(output_file:write(output)) assert(output_file:close()) else @@ -15706,6 +16252,23 @@ end % \par % \begin{markdown} % +%### Finalizing and Freezing the Cache +% +% When the \m{markdownOptionFinalizeCache} option is enabled, then the +% \mdef{markdownFrozenCacheCounter} counter is used to enumerate the markdown +% documents using the Lua interface \Opt{frozenCacheCounter} option. +% +% When the \m{markdownOptionFrozenCache} option is enabled, then the +% \m{markdownFrozenCacheCounter} counter is used to render markdown documents +% from the frozen cache without invoking Lua. +% +% \end{markdown} +% \begin{macrocode} +\newcount\markdownFrozenCacheCounter +% \end{macrocode} +% \par +% \begin{markdown} +% %### Token Renderer Prototypes % The following definitions should be considered placeholder. % @@ -15719,7 +16282,7 @@ end \def\markdownRendererRightBracePrototype{\char`\}}% \def\markdownRendererDollarSignPrototype{\char`$}% \def\markdownRendererPercentSignPrototype{\char`\%}% -\def\markdownRendererAmpersandPrototype{\char`&}% +\def\markdownRendererAmpersandPrototype{\&}% \def\markdownRendererUnderscorePrototype{\char`_}% \def\markdownRendererHashPrototype{\char`\#}% \def\markdownRendererCircumflexPrototype{\char`^}% @@ -15818,6 +16381,11 @@ end \ifx\markdownOptionDefinitionLists\undefined\else definitionLists = \markdownOptionDefinitionLists, \fi +\ifx\markdownOptionFinalizeCache\undefined\else + finalizeCache = \markdownOptionFinalizeCache, +\fi + frozenCacheFileName = "\markdownOptionFrozenCacheFileName", + frozenCacheCounter = \the\markdownFrozenCacheCounter, \ifx\markdownOptionFootnotes\undefined\else footnotes = \markdownOptionFootnotes, \fi @@ -15883,11 +16451,11 @@ end % 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 + 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 @@ -15895,8 +16463,8 @@ end % \m{markdownLuaOptions} macro. % \end{markdown} % \begin{macrocode} -local md = require("markdown") -local convert = md.new(\markdownLuaOptions) + local md = require("markdown") + local convert = md.new(\markdownLuaOptions) }% % \end{macrocode} % \par @@ -15904,6 +16472,24 @@ local convert = md.new(\markdownLuaOptions) % %### Buffering Markdown Input % \label{sec:buffering} +% +% The +% \mdef{markdownIfOption}`{`\meta{name}`}{`\meta{iftrue}`}{`\meta{iffalse}`}` +% macro is provided for testing, whether the value of +% `\markdownOption`\meta{name} is `true`. If the value is `true`, then +% \meta{iftrue} is expanded, otherwise \meta{iffalse} is expanded. +% +% \end{markdown} +% \begin{macrocode} +\def\markdownIfOption#1#2#3{% + \begingroup + \def\next{true}% + \expandafter\ifx\csname markdownOption#1\endcsname\next + \endgroup#2\else\endgroup#3\fi}% +% \end{macrocode} +% \par +% \begin{markdown} +% % 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. @@ -15941,7 +16527,7 @@ local convert = md.new(\markdownLuaOptions) % 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`. +% \m{markdownOptionStripPercentSigns} is enabled. % \end{markdown} % \begin{macrocode} \catcode`\^^M=13% @@ -15954,14 +16540,17 @@ local convert = md.new(\markdownLuaOptions) |begingroup@ % \end{macrocode} % \begin{markdown} -% Open the \m{markdownOptionInputTempFileName} file for writing. +% If we are not reading markdown documents from the frozen cache, +% 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"}@ + |markdownIfOption{FrozenCache}{}{@ + |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 @@ -15977,14 +16566,14 @@ local convert = md.new(\markdownLuaOptions) % \begin{markdown} % The \mdef{markdownReadAndConvertStripPercentSigns} macro will process the % individual lines of output, stipping away leading percent signs (`%`) when -% \m{markdownOptionStripPercentSigns} is `true`. +% \m{markdownOptionStripPercentSigns} is enabled. % 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}@ + |markdownIfOption{StripPercentSigns}{@ |if##1%@ |expandafter|expandafter|expandafter@ |markdownReadAndConvertProcessLine@ @@ -15993,11 +16582,12 @@ local convert = md.new(\markdownLuaOptions) |markdownReadAndConvertProcessLine@ |expandafter|expandafter|expandafter##1@ |fi@ - |else@ + }{@ |expandafter@ |markdownReadAndConvertProcessLine@ |expandafter##1@ - |fi}@ + }@ + }@ % \end{macrocode} % \begin{markdown} % The \mdef{markdownReadAndConvertProcessLine} macro will process the individual @@ -16010,12 +16600,17 @@ local convert = md.new(\markdownLuaOptions) |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. +% If we are not reading markdown documents from the frozen cache and the ending +% token sequence does not appear in the line, store the line in the +% \m{markdownOptionInputTempFileName} file. +% If we are reading markdown documents from the frozen cache and the +% ending token sequence does not appear in the line, gobble the line. % \end{markdown} % \begin{macrocode} |ifx|relax##3|relax@ - |immediate|write|markdownOutputFileStream{##1}@ + |markdownIfOption{FrozenCache}{}{@ + |immediate|write|markdownOutputFileStream{##1}@ + }@ |else@ % \end{macrocode} % \begin{markdown} @@ -16029,7 +16624,9 @@ local convert = md.new(\markdownLuaOptions) % \begin{macrocode} |def^^M{@ |markdownInfo{The ending token sequence was found}@ - |immediate|closeout|markdownOutputFileStream@ + |markdownIfOption{FrozenCache}{}{@ + |immediate|closeout|markdownOutputFileStream@ + }@ |endgroup@ |markdownInput{@ |markdownOptionOutputDir@ @@ -16274,6 +16871,7 @@ local convert = md.new(\markdownLuaOptions) % \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 @@ -16291,7 +16889,25 @@ local convert = md.new(\markdownLuaOptions) \catcode`|=0% \catcode`\\=12% |gdef|markdownInput#1{% - |markdownInfo{Including markdown document "#1"}% +% \end{macrocode} +% \begin{markdown} +% If we are reading from the frozen cache, input it, expand the corresponding +% `\markdownFrozenCache`\meta{number} macro, and increment +% \m{markdownFrozenCacheCounter}. +% \end{markdown} +% \begin{macrocode} + |markdownIfOption{FrozenCache}{% + |ifnum|markdownFrozenCacheCounter=0|relax + |markdownInfo{Reading frozen cache from + "|markdownOptionFrozenCacheFileName"}% + |input|markdownOptionFrozenCacheFileName|relax + |fi + |markdownInfo{Including markdown document number + "|the|markdownFrozenCacheCounter" from frozen cache}% + |csname markdownFrozenCache|the|markdownFrozenCacheCounter|endcsname + |advance|markdownFrozenCacheCounter by 1|relax + }{% + |markdownInfo{Including markdown document "#1"}% % \end{macrocode} % \begin{markdown} % Attempt to open the markdown document to record it in the `.log` and @@ -16299,11 +16915,13 @@ local convert = md.new(\markdownLuaOptions) % changes to the markdown document. % \end{markdown} % \begin{macrocode} - |openin|markdownInputFileStream#1 - |closein|markdownInputFileStream - |markdownLuaExecute{% - |markdownPrepare - local input = assert(io.open("#1", "r"):read("*a")) + |openin|markdownInputFileStream#1 + |closein|markdownInputFileStream + |markdownLuaExecute{% + |markdownPrepare + local file = assert(io.open("#1", "r")) + local input = assert(file:read("*a")) + assert(file:close()) % \end{macrocode} % \begin{markdown} % Since the Lua converter expects \acro{unix} line endings, normalize the @@ -16311,7 +16929,18 @@ local convert = md.new(\markdownLuaOptions) % has none. % \end{markdown} % \begin{macrocode} - print(convert(input:gsub("\r\n?", "\n") .. "\n"))}}% + print(convert(input:gsub("\r\n?", "\n") .. "\n"))}% +% \end{macrocode} +% \begin{markdown} +% If we are finalizing the frozen cache, increment +% \m{markdownFrozenCacheCounter}. +% \end{markdown} +% \begin{macrocode} + |markdownIfOption{FinalizeCache}{% + |advance|markdownFrozenCacheCounter by 1|relax + }% + }% + }% |endgroup % \end{macrocode} % \iffalse @@ -16377,10 +17006,12 @@ local convert = md.new(\markdownLuaOptions) % \end{markdown} % \begin{macrocode} \renewenvironment{markdown}{% - \markdownReadAndConvert@markdown{}}\relax + \markdownReadAndConvert@markdown{}}{% + \markdownEnd}% \renewenvironment{markdown*}[1]{% \markdownSetup{#1}% - \markdownReadAndConvert@markdown*}\relax + \markdownReadAndConvert@markdown*}{% + \markdownEnd}% \begingroup % \end{macrocode} % \begin{markdown} @@ -16493,7 +17124,6 @@ local convert = md.new(\markdownLuaOptions) \ifx\empty#4\empty\else \caption{#4}% \fi - \label{tab:#1}% \end{table}}{% \markdownInput{#3}}}, image = {% @@ -17040,6 +17670,7 @@ local convert = md.new(\markdownLuaOptions) |gdef|startmarkdown{% |markdownReadAndConvert{\stopmarkdown}% {|stopmarkdown}}% + |gdef|stopmarkdown{|markdownEnd}% |endgroup % \end{macrocode} % \par diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html index cc1c9fe59f..5ca9b7eb10 100644 --- a/macros/generic/markdown/markdown.html +++ b/macros/generic/markdown/markdown.html @@ -86,7 +86,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Markdown Package User Manual

Vít Novotný

-

v2.8.2 (2020/03/20)

+

v2.9.0 (2020/09/14)

1 Introduction

-

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 documents containing markdown markup. Unlike other convertors, the Markdown package does not require any external programs, and makes it easy to redefine how each and every markdown element is rendered. Creative abuse of the markdown syntax is encouraged.

+

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 documents containing markdown markup. Unlike other convertors, the Markdown package does not require any external programs, and makes it easy to redefine how each and every markdown element is rendered. Creative abuse of the markdown syntax is encouraged.

This document is a user manual for the Markdown package. It provides tutorials and code examples. For an in-depth description of the package requirements, interfaces, and implementation, please refer to the technical documentation.

1.1 Requirements

The package requires a working TeX distribution. TeX Live ≥ 2013 is known to work and so are recent installation of MikTeX. If you are using a minimal installation of a TeX distribution, please consult the technical documentation for a detailed list of required packages.

@@ -181,7 +181,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Next, invoke LuaTeX from the terminal:

texlua ⟨CLI pathname⟩ -- hello.md hello.tex
 luatex document.tex
-

where ⟨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\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.

+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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!” Invoking pdfTeX should have the same effect:

texlua ⟨CLI pathname⟩ -- hello.md hello.tex
 pdftex document.tex
@@ -321,7 +321,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
texlua ⟨CLI pathname⟩ -- example.md safe.tex
 texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
 luatex document.tex
-

where ⟨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\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.

+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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$.

@@ -442,7 +442,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Next, invoke LuaTeX from the terminal:

-

where ⟨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\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.

+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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

Using a text editor, create a text document named document.tex with the following content:

@@ -479,7 +479,109 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Next, invoke LuaTeX from the terminal:

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.

-

2.2.1.2 Option blankBeforeBlockquote

+

2.2.1.2 Option frozenCacheFileName

+
+
frozenCacheFileName (default value: "frozenCache.tex")
+

A path to an output file (frozen cache) that will be created when the finalizeCache option is enabled and will contain a mapping between an enumeration of markdown documents and their auxiliary cache files.

+

The frozen cache makes it possible to later typeset a plain TeX document that contains markdown documents without invoking Lua using the \markdownOptionFrozenCache plain TeX option. As a result, the plain TeX document becomes more portable, but further changes in the order and the content of markdown documents will not be reflected.

+
+
+
Lua Module Example
+

Using a text editor, create a text document named document.tex with the following content:

+ +

Then, invoke LuaTeX from the terminal:

+ +

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced in the cache.tex output file as we requested using the finalizeCache and frozenCacheFileName options.

+
Lua CLI Example
+

Using a text editor, create a text document named document.tex with the following content:

+ +

Using a text editor, create a text document named hello.md with the following content:

+ +

Next, invoke LuaTeX from the terminal:

+ +

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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 frozen cache will also be produced in the cache.tex output file as we requested using the finalizeCache and frozenCacheFileName options.

+
Plain TeX Example
+

Using a text editor, create a text document named document.tex with the following content:

+ +

Next, invoke LuaTeX from the terminal:

+ +

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced in the cache.tex output file as we requested using the finalizeCache and frozenCacheFileName options.

+

Next, create a new text document frozen-document.tex with the following content:

+ +

Last, invoke pdfTeX without shell access from the terminal:

+ +

A PDF document named frozen-document.pdf should be produced and contain the text “Hello world!” Since we used the contents of the frozen cache using the \markdownOptionFrozenCache option, we were able to typeset the document without accessing the shell or invoking Lua, but the change in the content of the markdown document from “Hello world!” to “Hi world!” was not reflected.

+
LaTeX Example
+

Using a text editor, create a text document named document.tex with the following content:

+ +

Next, invoke LuaTeX from the terminal:

+ +

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced in the cache.tex output file as we requested using the finalizecache and frozenCacheFileName options.

+

Next, create a new text document frozen-document.tex with the following content:

+ +

Last, invoke pdfTeX without shell access from the terminal:

+ +

A PDF document named frozen-document.pdf should be produced and contain the text “Hello world!” Since we used the contents of the frozen cache using the frozencache option, we were able to typeset the document without accessing the shell or invoking Lua, but the change in the content of the markdown document from “Hello world!” to “Hi world!” was not reflected.

+
ConTeXt Example
+

Using a text editor, create a text document named document.tex with the following content:

+ +

Next, invoke LuaTeX from the terminal:

+ +

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced in the cache.tex output file as we requested using the finalizeCache and frozenCacheFileName options.

+

Next, create a new text document frozen-document.tex with the following content:

+ +

Last, invoke pdfTeX without shell access from the terminal:

+ +

A PDF document named frozen-document.pdf should be produced and contain the text “Hello world!” Since we used the contents of the frozen cache using the \markdownOptionFrozenCache option, we were able to typeset the document without accessing the shell or invoking Lua, but the change in the content of the markdown document from “Hello world!” to “Hi world!” was not reflected.

+

2.2.1.3 Option blankBeforeBlockquote

blankBeforeBlockquote (default value: false)
@@ -492,27 +594,27 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
Lua Module Example
+
Lua Module Example

Using a text editor, create a text document named document.tex with the following content:

- +

Then, invoke LuaTeX from the terminal:

- +

A PDF document named document.pdf should be produced and contain the following text:

A paragraph.

@@ -521,21 +623,21 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

A paragraph > Not a quote.

-
Lua CLI Example
+
Lua CLI Example

Using a text editor, create a text document named document.tex with the following content:

-
\input markdown
-\input lmfonts
-\input optionfalse
-\input optiontrue
-\bye
+
\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye

Using a text editor, create a text document named content.md with the following content:

-
A paragraph.
-> A quote?
+
A paragraph.
+> A quote?

Next, invoke LuaTeX from the terminal:

-
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex
-luatex document.tex
-

where ⟨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\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.

+
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex
+luatex document.tex
+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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.

@@ -544,24 +646,24 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

A paragraph. > A quote?

-
Plain TeX Example
+
Plain TeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
luatex document.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:

+
luatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

A paragraph.

@@ -570,25 +672,25 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

A paragraph > Not a quote.

-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
lualatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

A paragraph.

@@ -597,25 +699,25 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

A paragraph > Not a quote.

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

A paragraph.

@@ -624,7 +726,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

A paragraph > Not a quote.

-

2.2.1.3 Option blankBeforeCodeFence

+

2.2.1.4 Option blankBeforeCodeFence

blankBeforeCodeFence (default value: false)
@@ -637,150 +739,150 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
Lua Module Example
+
Lua Module Example

Using a text editor, create a text document named document.tex with the following content:

-
\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
+
\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:

-
luatex document.tex
+
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
+
Lua CLI Example

Using a text editor, create a text document named document.tex with the following content:

-
\input markdown
-\input lmfonts
-\input optionfalse
-\input optiontrue
-\bye
+
\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye

Using a text editor, create a text document named content.md with the following content:

-
A paragraph.
-```
-A code fence?
-```
-

Next, invoke LuaTeX from the terminal:

-
texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true  -- content.md optiontrue.tex
-luatex document.tex
-

where ⟨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\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 paragraph.
+```
+A code fence?
+```
+

Next, invoke LuaTeX from the terminal:

+
texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true  -- content.md optiontrue.tex
+luatex document.tex
+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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
+
Plain TeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
luatex document.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:

+
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
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
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.

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
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.

-

2.2.1.4 Option blankBeforeHeading

+

2.2.1.5 Option blankBeforeHeading

blankBeforeHeading (default value: false)
@@ -793,139 +895,139 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
Lua Module Example
+
Lua Module Example

Using a text editor, create a text document named document.tex with the following content:

-
\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
+
\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:

-
luatex document.tex
+
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
+
Lua CLI Example

Using a text editor, create a text document named document.tex with the following content:

-
\input markdown
-\input lmfonts
-\input optionfalse
-\input optiontrue
-\bye
+
\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye

Using a text editor, create a text document named content.md with the following content:

-
A paragraph.
-A heading?
-==========
-

Next, invoke LuaTeX from the terminal:

-
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ blankBeforeHeading=true  -- content.md optiontrue.tex
-luatex document.tex
-

where ⟨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\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 paragraph.
+A heading?
+==========
+

Next, invoke LuaTeX from the terminal:

+
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ blankBeforeHeading=true  -- content.md optiontrue.tex
+luatex document.tex
+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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
+
Plain TeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
luatex document.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:

+
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
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
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. ==============

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
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. ==============

-

2.2.1.5 Option breakableBlockquotes

+

2.2.1.6 Option breakableBlockquotes

breakableBlockquotes (default value: false)
@@ -938,28 +1040,28 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
Lua Module Example
+
Lua Module Example

Using a text editor, create a text document named document.tex with the following content:

-
\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
+
\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:

-
luatex document.tex
+
luatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -972,22 +1074,22 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Another block quote.

-
Lua CLI Example
+
Lua CLI Example

Using a text editor, create a text document named document.tex with the following content:

-
\input markdown
-\input lmfonts
-\input optionfalse
-\input optiontrue
-\bye
+
\input markdown
+\input lmfonts
+\input optionfalse
+\input optiontrue
+\bye

Using a text editor, create a text document named content.md with the following content:

-
> A single block quote
-
-> or two block quotes?
-

Next, invoke LuaTeX from the terminal:

-
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ breakableBlockquotes=true  -- content.md optiontrue.tex
-luatex document.tex
-

where ⟨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\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 single block quote
+
+> or two block quotes?
+

Next, invoke LuaTeX from the terminal:

+
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ breakableBlockquotes=true  -- content.md optiontrue.tex
+luatex document.tex
+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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:

@@ -1000,26 +1102,26 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

or two block quotes?

-
Plain TeX Example
+
Plain TeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
luatex document.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:

+
luatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1032,27 +1134,27 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Another block quote.

-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
lualatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1065,27 +1167,27 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Another block quote.

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1098,7 +1200,7 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

Another block quote.

-

2.2.1.6 Option citationNbsps

+

2.2.1.7 Option citationNbsps

citationNbsps (default value: true)
@@ -1111,35 +1213,35 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.bib with the following content:

-
@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:

-
\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}
+
@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:

+
\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:

-
lualatex document.tex
-bibtex document.aux
-lualatex document.tex
-lualatex document.tex
+
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.

@@ -1147,25 +1249,25 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni

References

[1] Donald·Ervin Knuth. The TeXbook, volume A of Computers and typesetting. Addison-Wesley, 1984.

-

2.2.1.7 Option citations

+

2.2.1.8 Option citations

citations (default value: false)
true

Enable the pandoc citation syntax extension:

- +
@@ -1176,46 +1278,46 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.bib with the following content:

-
@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:

-
\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}
+
@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:

+
\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:

-
lualatex document.tex
-biber document.bcf
-lualatex document.tex
-lualatex document.tex
+
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 TeXbook, volume A of Computers and typesetting. Addison-Wesley, 1984.

-

2.2.1.8 Option codeSpans

+

2.2.1.9 Option codeSpans

codeSpans (default value: true)
true

Enable the code span syntax:

- +
@@ -1227,136 +1329,136 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
Lua Module Example
+
Lua Module Example

Using a text editor, create a text document named document.tex with the following content:

-
\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
+
\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:

-
luatex document.tex
+
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
+
Lua CLI Example

Using a text editor, create a text document named document.tex with the following content:

-
\input markdown
-\input lmfonts
-\input optionfalse
-\par
-\input optiontrue
-\bye
+
\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:

-
``Is this a code span?'' ``Or a quote?''
+
``Is this a code span?'' ``Or a quote?''

Next, invoke LuaTeX from the terminal:

-
texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex
-luatex document.tex
-

where ⟨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\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.

+
texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex
+luatex document.tex
+

where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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
+
Plain TeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
luatex document.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:

+
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
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
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.”

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
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.”

-

2.2.1.9 Option contentBlocks

+

2.2.1.10 Option contentBlocks

contentBlocks (default value: false)
true

Enable the iA Writer content blocks syntax extension:

- +
@@ -1367,33 +1469,33 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named table.csv with the following content:

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:

-
{
-  "tex": "LaTeX"
-}
+
{
+  "tex": "LaTeX"
+}

Create also a text document named code.tex with the following content:

-
This is an example code listing in \LaTeX.
+
This is an example code listing in \LaTeX.

Create also a text document named part.md with the following content:

-
This is a *transcluded markdown document*.
+
This is a *transcluded markdown document*.

Create also a text document named document.tex with the following content:

-
\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:

-
lualatex --shell-escape document.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:

+
lualatex --shell-escape document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1423,37 +1525,37 @@ Thomas,Edison,1847

Table 1: An example table

- +

This is a transcluded markdown document.

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named table.csv with the following content:

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:

-
{
-  "tex": "ConTeXt"
-}
+
{
+  "tex": "ConTeXt"
+}

Create also a text document named code.tex with the following content:

-
This is an example code listing in \ConTeXt.
+
This is an example code listing in \ConTeXt.

Create also a text document named part.md with the following content:

-
This is a *transcluded markdown document*.
+
This is a *transcluded markdown document*.

Create also a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1483,45 +1585,45 @@ Thomas,Edison,1847

Table 1: An example table

- +

This is a transcluded markdown document.

-

2.2.1.10 Option contentBlocksLanguageMap

+

2.2.1.11 Option contentBlocksLanguageMap

contentBlocksLanguageMap (default value: "markdown-languages.json")

The filename of the JSON file that maps filename extensions to programming language names in the iA Writer content blocks.

-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named table.csv with the following content:

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:

-
{
-  "tex": "LaTeX"
-}
+
{
+  "tex": "LaTeX"
+}

Create also a text document named code.tex with the following content:

-
This is an example code listing in \LaTeX.
+
This is an example code listing in \LaTeX.

Create also a text document named part.md with the following content:

-
This is a *transcluded markdown document*.
+
This is a *transcluded markdown document*.

Create also a text document named document.tex with the following content:

-
\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:

-
lualatex --shell-escape document.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:

+
lualatex --shell-escape document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1551,38 +1653,38 @@ Thomas,Edison,1847

Table 1: An example table

- +

This is a transcluded markdown document.

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named table.csv with the following content:

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:

-
{
-  "tex": "ConTeXt"
-}
+
{
+  "tex": "ConTeXt"
+}

Create also a text document named code.tex with the following content:

-
This is an example code listing in \ConTeXt.
+
This is an example code listing in \ConTeXt.

Create also a text document named part.md with the following content:

-
This is a *transcluded markdown document*.
+
This is a *transcluded markdown document*.

Create also a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1612,26 +1714,26 @@ Thomas,Edison,1847

Table 1: An example table

- +

This is a transcluded markdown document.

-

2.2.1.11 Option definitionLists

+

2.2.1.12 Option definitionLists

definitionLists (default value: false)
true

Enable the pandoc definition list syntax extension:

- +
@@ -1642,27 +1744,27 @@ Thomas,Edison,1847
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
lualatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1676,27 +1778,27 @@ Thomas,Edison,1847
-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

@@ -1710,28 +1812,28 @@ Thomas,Edison,1847
-

2.2.1.12 Option fencedCode

+

2.2.1.13 Option fencedCode

fencedCode (default value: false)
true

Enable the commonmark fenced code block extension:

- +
@@ -1742,113 +1844,187 @@ Thomas,Edison,1847
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex --shell-escape document.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:

+
lualatex --shell-escape document.tex

A PDF document named document.pdf should be produced and contain the following text:

- - + +
-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

- - -
-

2.2.1.13 Option footnotes

+
if (a > 3) {
+    moveShip(5 * gravity, DOWN);
+}
+
<pre>
+  <code>
+    // Some comments
+    line 1 of code
+    line 2 of code
+    line 3 of code
+  </code>
+</pre>
+ +

2.2.1.14 Option finalizeCache

+
+
finalizeCache (default value: false)
+

Whether an output file specified with the frozenCacheFileName option (frozen cache) that contains a mapping between an enumeration of markdown documents and their auxiliary cache files will be created.

+

The frozen cache makes it possible to later typeset a plain TeX document that contains markdown documents without invoking Lua using the \markdownOptionFrozenCache plain TeX option. As a result, the plain TeX document becomes more portable, but further changes in the order and the content of markdown documents will not be reflected.

+
+
+
Plain TeX Example
+

Using a text editor, create a text document named document.tex with the following content:

+
\input markdown
+\def\markdownOptionFinalizeCache{true}
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye
+

Next, invoke LuaTeX from the terminal:

+
luatex document.tex
+

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced as we requested using the finalizeCache option.

+

Next, change the content of document.tex as follows:

+
\input markdown
+\def\markdownOptionFrozenCache{true}
+\markdownBegin
+Hi *world*!
+\markdownEnd
+\bye
+

Last, invoke pdfTeX without shell access from the terminal:

+
pdftex -no-shell-escape document.tex
+

A new PDF document named document.pdf should be produced and contain the same text “Hello world!” Since we used the contents of the frozen cache using the \markdownOptionFrozenCache option, we were able to typeset the document without accessing the shell or invoking Lua, but the change in the content of the markdown document from “Hello world!” to “Hi world!” was not reflected.

+
LaTeX Example
+

Using a text editor, create a text document named document.tex with the following content:

+
\documentclass[finalizecache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+Hello *world*!
+\end{markdown}
+\end{document}
+

Next, invoke LuaTeX from the terminal:

+
lualatex document.tex
+

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced as we requested using the finalizecache option.

+

Next, change the content of document.tex as follows:

+
\documentclass[frozencache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+Hi *world*!
+\end{markdown}
+\end{document}
+

Last, invoke pdfTeX without shell access from the terminal:

+
pdflatex -no-shell-escape document.tex
+

A new PDF document named document.pdf should be produced and contain the same text “Hello world!” Since we used the contents of the frozen cache using the \markdownOptionFrozenCache option, we were able to typeset the document without accessing the shell or invoking Lua, but the change in the content of the markdown document from “Hello world!” to “Hi world!” was not reflected.

+
ConTeXt Example
+

Using a text editor, create a text document named document.tex with the following content:

+
\usemodule[t][markdown]
+\def\markdownOptionFinalizeCache{true}
+\starttext
+\startmarkdown
+Hello *world*!
+\stopmarkdown
+\stoptext
+

Next, invoke LuaTeX from the terminal:

+
context document.tex
+

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache will also be produced in the cache.tex output file as we requested using the finalizeCache option.

+

Next, change the content of document.tex as follows:

+
\usemodule[t][markdown]
+\def\markdownOptionFrozenCache{true}
+\starttext
+\startmarkdown
+Hi *world*!
+\stopmarkdown
+\stoptext
+

Last, invoke pdfTeX without shell access from the terminal:

+
texexec --passon=--no-shell-escape document.tex
+

A new PDF document named document.pdf should be produced and contain the same text “Hello world!” Since we used the contents of the frozen cache using the \markdownOptionFrozenCache option, we were able to typeset the document without accessing the shell or invoking Lua, but the change in the content of the markdown document from “Hello world!” to “Hi world!” was not reflected.

+

2.2.1.15 Option footnotes

footnotes (default value: false)
true

Enable the pandoc footnote syntax extension:

- +
@@ -1859,79 +2035,100 @@ Thomas,Edison,1847
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
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.2

This paragraph won’t be part of the note, because it isn’t indented.

-
ConTeXt Example
+
ConTeXt Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
context document.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:

+
context document.tex

A PDF document named document.pdf should be produced and contain the following text:

Here is a footnote reference,3 and another.4

This paragraph won’t be part of the note, because it isn’t indented.

-

2.2.1.14 Option hashEnumerators

+

2.2.1.16 Option frozenCacheCounter

+
+
frozenCacheCounter (default value: 0)
+

The number of the current markdown document that will be stored in an output file (frozen cache) when the finalizeCache is enabled. When the document number is 0, then a new frozen cache will be created. Otherwise, the frozen cache will be appended.

+

Each frozen cache entry will define a TeX macro \markdownFrozenCachenumber⟩ that will typeset markdown document number ⟨number⟩.

+
+
+
Lua Module Example
+

Using a text editor, create a text document named document.tex with the following content:

+
\input markdown
+\directlua{
+  local markdown = require("markdown")
+  local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
+  local firstInput = "Hello"
+  local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
+  local secondInput = "*world*!"
+  tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }
+\bye
+

Then, invoke LuaTeX from the terminal:

+
luatex document.tex
+

A PDF document named document.pdf should be produced and contain the text “Hello world!” A frozen cache with two entries will also be produced as we requested using the frozenCacheCounter option.

+

2.2.1.17 Option hashEnumerators

hashEnumerators (default value: false)
true

Enable the use of hash symbols (#) as ordered item list markers:

- +
@@ -1942,27 +2139,27 @@ Thomas,Edison,1847
-
LaTeX Example
+
LaTeX Example

Using a text editor, create a text document named document.tex with the following content:

-
\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:

-
lualatex document.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:

+
lualatex document.tex

A PDF document named document.pdf should be produced and contain the following text:

. Bird

@@ -1974,27 +2171,27 @@ Thomas,Edison,1847
  • Parish
  • -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \usemodule[t][markdown]
    -\starttext
    -
    -\startmarkdown
    -. Bird
    -. McHale
    -. Parish
    -\stopmarkdown
    -
    -\def\markdownOptionHashEnumerators{true}
    -\startmarkdown
    -. Bird
    -. McHale
    -. Parish
    -\stopmarkdown
    -
    -\stoptext
    -

    Next, invoke LuaTeX from the terminal:

    -
    context document.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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    . Bird

    @@ -2006,18 +2203,18 @@ Thomas,Edison,1847
  • Parish
  • -

    2.2.1.15 Option headerAttributes

    +

    2.2.1.18 Option headerAttributes

    headerAttributes (default value: false)
    true

    Enable the assignment of HTML attributes to headings:

    - +

    These HTML attributes have currently no effect other than enabling content slicing.

    @@ -2029,7 +2226,7 @@ Thomas,Edison,1847
    -

    2.2.1.16 Option html

    +

    2.2.1.19 Option html

    html (default value: false)
    @@ -2045,160 +2242,160 @@ Thomas,Edison,1847
    -
    Lua Module Example
    +
    Lua Module Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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
    +
    \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:

    -
    luatex document.tex
    +
    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
    +
    Lua CLI Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \input markdown
    -\input lmfonts
    -\input optionfalse
    -\par
    -\input optiontrue
    -\bye
    +
    \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:

    -
    <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:

    -
    texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
    -texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex
    -luatex document.tex
    -

    where ⟨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\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.

    +
    <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:

    +
    texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
    +texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex
    +luatex document.tex
    +

    where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    luatex document.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:

    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    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.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    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.

    -

    2.2.1.17 Option hybrid

    +

    2.2.1.20 Option hybrid

    hybrid (default value: true)
    @@ -2214,127 +2411,127 @@ Thomas,Edison,1847
    -
    Lua Module Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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
    +
    Lua Module Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    +
    \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:

    -
    luatex document.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.

    -
    Lua CLI Example
    +
    Lua CLI Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \input markdown
    -\input lmfonts
    -\input optionfalse
    -
    -\input optiontrue
    -\bye
    +
    \input markdown
    +\input lmfonts
    +\input optionfalse
    +
    +\input optiontrue
    +\bye

    Using a text editor, create a text document named content.md with the following content:

    -
    $\sqrt{-1}$ *equals* $i$.
    +
    $\sqrt{-1}$ *equals* $i$.

    Next, invoke LuaTeX from the terminal:

    -
    texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
    -texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex
    -luatex document.tex
    -

    where ⟨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\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.

    +
    texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
    +texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex
    +luatex document.tex
    +

    where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    luatex document.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:

    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    $\sqrt {-1}$ equals $i$.

    √-̅1̅ equals i.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    $\sqrt {-1}$ equals $i$.

    √-̅1̅ equals i.

    -

    2.2.1.18 Option inlineFootnotes

    +

    2.2.1.21 Option inlineFootnotes

    inlineFootnotes (default value: false)
    true

    Enable the pandoc inline footnote syntax extension:

    - +
    @@ -2345,52 +2542,52 @@ Thomas,Edison,1847
    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    Here is an inline note.5

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    Here is an inline note.6

    -

    2.2.1.19 Option pipeTables

    +

    2.2.1.22 Option pipeTables

    pipeTables (default value: false)
    true

    Enable the PHP Markdown table syntax extension:

    - +
    @@ -2401,21 +2598,21 @@ Thomas,Edison,1847
    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    @@ -2449,21 +2646,21 @@ Thomas,Edison,1847
    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    @@ -2497,7 +2694,7 @@ Thomas,Edison,1847
    -

    2.2.1.20 Option preserveTabs

    +

    2.2.1.23 Option preserveTabs

    preserveTabs (default value: false)
    @@ -2513,89 +2710,89 @@ Thomas,Edison,1847
    -

    2.2.1.21 Option shiftHeadings

    +

    2.2.1.24 Option shiftHeadings

    shiftHeadings (default value: 0)

    All headings will be shifted by ⟨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 ⟨shift amount⟩ is positive, and to level 1, when ⟨shift amount⟩ is negative.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named example.md with the following content:

    -
    ## A section
    -

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    luatex document.tex
    +
    ## A section
    +

    Using a text editor, create a text document named document.tex with the following content:

    +
    \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:

    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    A section

    A section

    A section

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named example.md with the following content:

    -
    ## A section
    -

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.tex
    +
    ## A section
    +

    Using a text editor, create a text document named document.tex with the following content:

    +
    \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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    A section

    A section

    A section

    -

    2.2.1.22 Option slice

    +

    2.2.1.25 Option slice

    slice (default value: ^ $)

    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:

    @@ -2609,41 +2806,41 @@ Thomas,Edison,1847

    Specifying only a single selector, ⟨identifier⟩, is equivalent to specifying the two selectors ⟨identifier⟩ ⟨identifier⟩, which is equivalent to ^identifier$identifier⟩, i.e. the entire section with the HTML attribute #identifier⟩ will be selected.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named hamlet.md with the following content:

    -
    # 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:

    -
    \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:

    -
    luatex document.tex
    +
    # 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:

    +
    \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:

    +
    luatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    The Tragedy of Hamlet

    @@ -2655,31 +2852,31 @@ Thomas,Edison,1847

    Act V

    Hamlet dies.

    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    The Tragedy of Hamlet

    @@ -2691,36 +2888,36 @@ Thomas,Edison,1847

    Act V

    Hamlet dies.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named hamlet.md with the following content:

    -
    # 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:

    -
    \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:

    -
    context document.tex
    +
    # 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:

    +
    \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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    The Tragedy of Hamlet

    @@ -2732,7 +2929,7 @@ Thomas,Edison,1847

    Act V

    Hamlet dies.

    -

    2.2.1.23 Option smartEllipses

    +

    2.2.1.26 Option smartEllipses

    smartEllipses (default value: false)
    @@ -2748,122 +2945,122 @@ Thomas,Edison,1847
    -
    Lua Module Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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
    +
    Lua Module Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    +
    \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:

    -
    luatex document.tex
    +
    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
    +
    Lua CLI Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \input markdown
    -\def\markdownRendererEllipsis{. . .}
    -\input lmfonts
    -\input optionfalse
    -\par
    -\input optiontrue
    -\bye
    +
    \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:

    -
    Are these just three regular dots, a victorian ellipsis, or ... ?
    +
    Are these just three regular dots, a victorian ellipsis, or ... ?

    Next, invoke LuaTeX from the terminal:

    -
    texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
    -texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex
    -luatex document.tex
    -

    where ⟨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\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.

    +
    texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
    +texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex
    +luatex document.tex
    +

    where ⟨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\Your username\texmf\scripts\markdown\markdown-cli.lua on Windows systems. Use the command kpsewhich -a 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
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    luatex document.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:

    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    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.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    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.

    -

    2.2.1.24 Option startNumber

    +

    2.2.1.27 Option startNumber

    startNumber (default value: true)
    @@ -2879,32 +3076,32 @@ Thomas,Edison,1847
    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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}
    +
    \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:

    -
    lualatex document.tex
    +
    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:

    @@ -2920,30 +3117,30 @@ Thomas,Edison,1847
  • fifth item
  • -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    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:

    @@ -2959,19 +3156,19 @@ Thomas,Edison,1847
  • fifth item
  • -

    2.2.1.25 Option tableCaptions

    +

    2.2.1.28 Option tableCaptions

    tableCaptions (default value: false)
    true

    Enable the Pandoc table_captions syntax extension for pipe tables.

    - +
    @@ -2982,23 +3179,23 @@ Thomas,Edison,1847
    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    @@ -3033,24 +3230,24 @@ Thomas,Edison,1847
    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    @@ -3085,7 +3282,7 @@ Thomas,Edison,1847
    -

    2.2.1.26 Option tightLists

    +

    2.2.1.29 Option tightLists

    tightLists (default value: true)
    @@ -3101,39 +3298,39 @@ Thomas,Edison,1847
    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    The following list is tight:

    @@ -3156,16 +3353,16 @@ multiple paragraphs
  • third item

  • -

    2.2.1.27 Option underscores

    +

    2.2.1.30 Option underscores

    underscores (default value: true)
    true

    Both underscores and asterisks can be used to denote emphasis and strong emphasis:

    - +
    @@ -3176,68 +3373,68 @@ multiple paragraphs
    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    luatex document.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:

    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    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ₙ.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    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ₙ.

    @@ -3245,55 +3442,69 @@ multiple paragraphs

    2.2.2 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 ConTeXt interfaces.

    -

    2.2.2.1 File and Directory Names

    +

    2.2.2.1 Finalizing and Freezing the Cache

    +

    The \markdownOptionFrozenCache option uses the mapping previously created by the Lua interface finalizeCache option, and uses it to typeset the plain TeX document without invoking Lua. As a result, the plain TeX document becomes more portable, but further changes in the order and the content of markdown documents will not be reflected. It defaults to false.

    +

    The standard usage of the finalizeCache and \markdownOptionFrozenCache options is as follows:

    +
      +
    1. Remove the cacheDir cache directory with stale auxiliary cache files.
    2. +
    3. Enable the finalizeCache option.
    4. +
    5. Typeset the plain TeX document to populate and finalize the cache.
    6. +
    7. Enable the \markdownOptionFrozenCache option.
    8. +
    9. Publish the source code of the plain TeX document and the cacheDir directory.
    10. +
    +

    For more information, see the examples for the finalizeCache option.

    +

    2.2.2.2 File and Directory Names

    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:

    Using a text editor, create a folder named output-directory and a text document named document.tex with the following content:

    -
    \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:

    -
    luatex --output-directory output-directory document.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}
    +\markdownOptionFinalizeCachetrue
    +\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex}
    +\markdownBegin
    +Hello *world*!
    +\markdownEnd
    +\bye
    +

    Next, invoke LuaTeX from the terminal:

    +
    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:

    -
    pdftex --output-directory output-directory --shell-escape document.tex
    +
    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.

    -

    2.2.2.2 Package Documentation

    -

    The \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 by Frank Mittelbach.

    +

    2.2.2.3 Package Documentation

    +

    The \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 by Frank Mittelbach. The recognized values of the macro are true (discard) and false (retain). It defaults to false.

    Using a text editor, create a text document named document.dtx with the following content:

    -
    % \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:

    -
    lualatex document.dtx
    +
    % \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:

    +
    lualatex document.dtx

    A PDF document named document.pdf should be produced and contain the text “Hello world!”

    2.3 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.

    @@ -3301,73 +3512,73 @@ multiple paragraphs

    Token renderers are user-defined TeX macros, which render markdown tokens. In this section, I will describe the individual token renderers.

    2.3.1.1 Interblock Separator Renderer

    The \markdownRendererInterblockSeparator macro represents a separator between two markdown block elements. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    luatex document.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:

    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    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!

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    context document.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:

    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    Hello world!

    @@ -3376,67 +3587,67 @@ multiple paragraphs

    2.3.1.2 Line Break Renderer

    The \markdownRendererLineBreak macro represents a forced line break. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \input markdown
    -\def\markdownRendererLineBreak{%
    -  \par
    -  {\it(A forced linebreak)}%
    -  \par
    -}
    -\markdownInput{example.md}
    -\bye
    +
    \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.

    Hello world!  
    _Foo_ bar!

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    lineBreak = {%
    -      \par
    -      \emph{(A forced linebreak)}%
    -      \par
    -    },
    -  },
    -}
    -\begin{document}
    -\markdownInput{example.md}
    -\end{document}
    +
    \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.

    Hello world!  
    _Foo_ bar!

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    Hello world!

    (A forced linebreak)

    Foo bar!

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \usemodule[t][markdown]
    -\def\markdownRendererLineBreak{%
    -  \par
    -  \emph{(A forced linebreak)}%
    -  \par
    -}
    -\starttext
    -\markdownInput{example.md}
    -\stoptext
    +
    \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.

    Hello world!  
    _Foo_ bar!

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    Hello world!

    @@ -3444,54 +3655,54 @@ multiple paragraphs

    Foo bar!

    2.3.1.3 Ellipsis Renderer

    -

    The \markdownRendererEllipsis macro replaces any occurance of ASCII ellipses in the input text. This macro will only be produced, when the smartEllipses option is true. The macro receives no arguments.

    -
    Plain TeX Example
    +

    The \markdownRendererEllipsis macro replaces any occurance of ASCII ellipses in the input text. This macro will only be produced, when the smartEllipses option is enabled. The macro receives no arguments.

    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \input markdown
    -\def\markdownOptionSmartEllipses{true}
    -\def\markdownRendererEllipsis{{\it SHAZAM}!}
    -\markdownBegin
    -The secret word is ...
    -\markdownEnd
    -\bye
    -

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    \input markdown
    +\def\markdownOptionSmartEllipses{true}
    +\def\markdownRendererEllipsis{{\it SHAZAM}!}
    +\markdownBegin
    +The secret word is ...
    +\markdownEnd
    +\bye
    +

    Next, invoke LuaTeX from the terminal:

    +
    luatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    The secret word is SHAZAM!

    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    -
    lualatex document.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:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    The secret word is SHAZAM!

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \usemodule[t][markdown]
    -\def\markdownOptionSmartEllipses{true}
    -\def\markdownRendererEllipsis{\emph{SHAZAM}!}
    -\starttext
    -\startmarkdown
    -The secret word is ...
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionSmartEllipses{true}
    +\def\markdownRendererEllipsis{\emph{SHAZAM}!}
    +\starttext
    +\startmarkdown
    +The secret word is ...
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

    A PDF document named document.pdf should be produced and contain the following text:

    Hello world!

    @@ -3500,40 +3711,40 @@ multiple paragraphs

    2.3.1.4 Non-Breaking Space Renderer

    The \markdownRendererNbsp macro represents a non-breaking space.

    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.bib with the following content:

    -
    @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:

    -
    \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}
    +
    @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:

    +
    \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:

    -
    lualatex document.tex
    -bibtex document.aux
    -lualatex document.tex
    -lualatex document.tex
    +
    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.

    @@ -3555,134 +3766,134 @@ multiple paragraphs
  • \markdownRendererTilde replaces the tilde (~).
  • \markdownRendererUnderscore replaces the underscore (_).
  • -
    Plain TeX Example
    +
    Plain TeX Example

    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.

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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
    +
    LaTeX Example

    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.

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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

    -
    ConTeXt Example
    +
    ConTeXt Example

    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.

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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

    2.3.1.6 Code Span Renderer

    The \markdownRendererCodeSpan macro represents inlined code span in the input text. It receives a single argument that corresponds to the inlined code span.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    $\sqrt{-1}$ *equals* $i$.

    @@ -3691,108 +3902,108 @@ multiple paragraphs

    The \markdownRendererLink macro represents a hyperlink. It receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    2.3.1.8 Image Renderer

    The \markdownRendererImage macro represents an image. It receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link.

    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - - - -

    Next, invoke LuaTeX from the terminal:

    - + + + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    @@ -3802,100 +4013,100 @@ multiple paragraphs

    The \markdownRendererContentBlockOnlineImage macro represents an iA Writer online image content block. The macro receives the same arguments as \markdownRendererContentBlock.

    The \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 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 uri that can be directly typeset, the raw 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 Anton Sotkov is a good starting point.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - +

    Create also a text document named markdown-languages.json with the following content:

    - +

    Next, invoke LuaTeX from the terminal:

    - +

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - +

    Create also a text document named markdown-languages.json with the following content:

    - +

    Next, invoke LuaTeX from the terminal:

    - +

    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.

    @@ -3909,52 +4120,52 @@ multiple paragraphs

    The \markdownRendererUlItemEnd macro represents the end of an item in a bulleted list. The macro receives no arguments.

    The \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.

    The \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 tightLists option is false. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    @@ -3965,57 +4176,57 @@ multiple paragraphs
  • This is the third item.

  • -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    @@ -4026,53 +4237,53 @@ multiple paragraphs
  • This is the third item.

  • -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    @@ -4088,73 +4299,73 @@ multiple paragraphs

    The \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 tightLists option is false. The macro receives no arguments.

    The \markdownRendererOlItem macro represents an item in an ordered list. This macro will only be produced, when the startNumber option is false. The macro receives no arguments.

    The \markdownRendererOlItemEnd macro represents the end of an item in an ordered list. The macro receives no arguments.

    -

    The \markdownRendererOlItemWithNumber macro represents an item in an ordered list. This macro will only be produced, when the startNumber option is true. The macro receives no arguments.

    +

    The \markdownRendererOlItemWithNumber macro represents an item in an ordered list. This macro will only be produced, when the startNumber option is enabled. The macro receives no arguments.

    The \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.

    The \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 tightLists option is false. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    @@ -4165,73 +4376,73 @@ multiple paragraphs
  • This is the third item.

  • -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    @@ -4242,71 +4453,71 @@ multiple paragraphs
  • This is the third item.

  • -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    @@ -4318,7 +4529,7 @@ multiple paragraphs

    2.3.1.12 Definition List Renderers

    -

    The following macros are only produced, when the definitionLists option is true.

    +

    The following macros are only produced, when the definitionLists option is enabled.

    The \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.

    The \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 tightLists option is false. The macro receives no arguments.

    The \markdownRendererDlItem macro represents a term in a definition list. The macro receives a single argument that corresponds to the term being defined.

    @@ -4327,88 +4538,88 @@ multiple paragraphs

    The \markdownRendererDlDefinitionEnd macro represents the end of a definition in a definition list. There can be several definitions for a single term.

    The \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.

    The \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 tightLists option is false. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    - +
    \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:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is a tight definition list:

    @@ -4426,90 +4637,90 @@ multiple paragraphs

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is a tight definition list:

    @@ -4527,87 +4738,87 @@ multiple paragraphs

    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.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    -
    \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:

    - +
    \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:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is a tight definition list:

    @@ -4627,62 +4838,62 @@ multiple paragraphs

    2.3.1.13 Emphasis Renderers

    The \markdownRendererEmphasis macro represents an emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is emphasis.

    This is strong emphasis.

    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is emphasis.

    This is strong emphasis.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is emphasis.

    @@ -4691,31 +4902,31 @@ multiple paragraphs

    The \markdownRendererStrongEmphasis macro represents a strongly emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.

    2.3.1.14 Block Quote Renderers

    The \markdownRendererBlockQuoteBegin macro represents the beginning of a block quote. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    A quote from William Shakespeare’s King Lear:

    @@ -4723,28 +4934,28 @@ multiple paragraphs

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    A quote from William Shakespeare’s King Lear:

    @@ -4752,23 +4963,23 @@ multiple paragraphs

    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 […]

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    A quote from William Shakespeare’s King Lear:

    @@ -4779,74 +4990,74 @@ multiple paragraphs

    The \markdownRendererBlockQuoteEnd macro represents the end of a block quote. The macro receives no arguments.

    2.3.1.15 Code Block Renderers

    The \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.

    -

    The \markdownRendererInputFencedCode macro represents a fenced code block. This macro will only be produced, when the 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.

    -
    LaTeX Example
    +

    The \markdownRendererInputFencedCode macro represents a fenced code block. This macro will only be produced, when the fencedCode option is enabled. The macro receives two arguments that correspond to the filename of a file contaning the code block contents and to the code fence infostring.

    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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:

    - +

    The following code in Python contained in file ./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim:

    - +

    2.3.1.16 Heading Renderers

    The \markdownRendererHeadingOne macro represents a first level heading. The macro receives a single argument that corresponds to the heading text.

    @@ -4855,148 +5066,148 @@ multiple paragraphs

    The \markdownRendererHeadingFour macro represents a fourth level heading. The macro receives a single argument that corresponds to the heading text.

    The \markdownRendererHeadingFive macro represents a fifth level heading. The macro receives a single argument that corresponds to the heading text.

    The \markdownRendererHeadingSix macro represents a sixth level heading. The macro receives a single argument that corresponds to the heading text.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    65536

    -
    LaTeX Example
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    65536

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    65536

    2.3.1.17 Horizontal Rule Renderer

    The \markdownRendererHorizontalRule macro represents a horizontal rule. The macro receives no arguments.

    -
    Plain TeX Example
    +
    Plain TeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is the first page.


    This is the second page.

    -
    ConTeXt Example
    +
    ConTeXt Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    This is the first page.

    @@ -5004,320 +5215,320 @@ multiple paragraphs

    This is the second page.

    2.3.1.18 Footnote Renderer

    -

    The \markdownRendererFootnote macro represents a footnote. This macro will only be produced, when the footnotes option is true. The macro receives a single argument that corresponds to the footnote text.

    -
    Plain TeX Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - +

    The \markdownRendererFootnote macro represents a footnote. This macro will only be produced, when the footnotes option is enabled. The macro receives a single argument that corresponds to the footnote text.

    +
    Plain TeX Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    + +

    Next, invoke LuaTeX from the terminal:

    +

    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
    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    -
    ConTeXt Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - +
    ConTeXt Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    + +

    Next, invoke LuaTeX from the terminal:

    +

    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).

    2.3.1.19 Parenthesized Citations Renderer

    -

    The \markdownRendererCite macro represents a string of one or more parenthetical citations. This macro will only be produced, when the citations option is true. The macro receives the parameter {number of citations} followed by {prenote}{postnote}{name} repeated ⟨number of citations⟩ times. The ⟨suppress author⟩ parameter is either the token -, when the author’s name is to be suppressed, or + otherwise.

    -
    LaTeX Example
    +

    The \markdownRendererCite macro represents a string of one or more parenthetical citations. This macro will only be produced, when the citations option is enabled. The macro receives the parameter {number of citations} followed by ⟨suppress author{prenote}{postnote}{name} repeated ⟨number of citations⟩ times. The ⟨suppress author⟩ parameter is either the token -, when the author’s name is to be suppressed, or + otherwise.

    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    2.3.1.20 Text Citations Renderer

    -

    The \markdownRendererTextCite macro represents a string of one or more text citations. This macro will only be produced, when the citations option is true. The macro receives parameters in the same format as the \markdownRendererCite macro.

    -
    LaTeX Example
    +

    The \markdownRendererTextCite macro represents a string of one or more text citations. This macro will only be produced, when the citations option is enabled. The macro receives parameters in the same format as the \markdownRendererCite macro.

    +
    LaTeX Example

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    2.3.1.21 Table Renderer

    -

    The \markdownRendererTable macro represents a table. This macro will only be produced, when the pipeTables option is true. The macro receives the parameters {caption}{number of rows}{number of columns} followed by {alignments} and then by {row} repeated ⟨number of rows⟩ times, where ⟨row⟩ is {column} repeated ⟨number of columns⟩ times, ⟨alignments⟩ is ⟨alignment⟩ repeated ⟨number of columns⟩ times, and ⟨alignment⟩ is one of the following:

    +

    The \markdownRendererTable macro represents a table. This macro will only be produced, when the pipeTables option is enabled. The macro receives the parameters {caption}{number of rows}{number of columns} followed by {alignments} and then by {row} repeated ⟨number of rows⟩ times, where ⟨row⟩ is {column} repeated ⟨number of columns⟩ times, ⟨alignments⟩ is ⟨alignment⟩ repeated ⟨number of columns⟩ times, and ⟨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.
    -
    LaTeX Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - +
    LaTeX Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    2.3.2 Token Renderer Prototypes

    By default, token renderers point to package-defined TeX macros, further referred to as prototypes, which provide useful default definitions.

    -
    Plain TeX Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - +
    Plain TeX Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    + +

    Next, invoke LuaTeX from the terminal:

    +

    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
    -

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - +
    LaTeX Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    + +

    Next, invoke LuaTeX from the terminal:

    +

    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.

    -
    ConTeXt Example
    -

    Using a text editor, create a text document named document.tex with the following content:

    - -

    Next, invoke LuaTeX from the terminal:

    - +
    ConTeXt Example
    +

    Using a text editor, create a text document named document.tex with the following content:

    + +

    Next, invoke LuaTeX from the terminal:

    +

    A PDF document named document.pdf should be produced and contain the following text:

    Packages can specify token renderer prototypes.

    diff --git a/macros/generic/markdown/markdown.md b/macros/generic/markdown/markdown.md index 2a184c3f25..443a64fd6e 100644 --- a/macros/generic/markdown/markdown.md +++ b/macros/generic/markdown/markdown.md @@ -18,7 +18,7 @@ does not require any external programs, and 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/ + [markdown]: https://daringfireball.net/projects/markdown/basics (Daring Fireball: Markdown Basics) [pkg]: https://ctan.org/pkg/markdown (CTAN: Package markdown) @@ -151,7 +151,7 @@ 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 +systems. Use the command `kpsewhich -a markdown-cli.lua` to locate the Lua CLI script file using [Kpathsea][]. [Kpathsea]: https://tug.org/kpathsea/ (Kpathsea - TeX Users Group) diff --git a/macros/generic/markdown/markdown.pdf b/macros/generic/markdown/markdown.pdf index 4d8394cebd..1fb559127d 100644 Binary files a/macros/generic/markdown/markdown.pdf and b/macros/generic/markdown/markdown.pdf differ -- cgit v1.2.3