From 36595a910f2b8a3a56606d6f16c2626f44b29822 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 5 Apr 2022 21:58:26 +0000 Subject: markdown (31mar22) git-svn-id: svn://tug.org/texlive/trunk@62928 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/generic/markdown/README.md | 12 +- Master/texmf-dist/doc/generic/markdown/VERSION | 2 +- .../texmf-dist/doc/generic/markdown/markdown.html | 6163 ++++++++++---------- .../texmf-dist/doc/generic/markdown/markdown.pdf | Bin 760842 -> 799016 bytes .../texmf-dist/scripts/markdown/markdown-cli.lua | 3 +- .../source/generic/markdown/markdown.dtx | 3278 ++++++++--- .../texmf-dist/tex/generic/markdown/markdown.tex | 1611 ++++- Master/texmf-dist/tex/latex/markdown/markdown.sty | 602 +- .../tex/latex/markdown/markdownthemewitiko_dot.sty | 2 +- .../markdown/markdownthemewitiko_graphicx_http.sty | 2 +- Master/texmf-dist/tex/luatex/markdown/markdown.lua | 106 +- 11 files changed, 7295 insertions(+), 4486 deletions(-) diff --git a/Master/texmf-dist/doc/generic/markdown/README.md b/Master/texmf-dist/doc/generic/markdown/README.md index 38661d1c3a8..8460bb5c899 100644 --- a/Master/texmf-dist/doc/generic/markdown/README.md +++ b/Master/texmf-dist/doc/generic/markdown/README.md @@ -245,8 +245,8 @@ Acknowledgements [option-slice]: https://mirrors.ctan.org/macros/generic/markdown/markdown.html#slice "Markdown Package User Manual" [option-table-captions]: https://mirrors.ctan.org/macros/generic/markdown/markdown.html#option-tablecaptions "Markdown Package User Manual" -Contributing ------------- +Contributing to the Development of Markdown +------------------------------------------- Apart from the example markdown documents, tests, and continuous integration, which are placed in the `examples/`, `tests/`, and `.github/` directories, @@ -282,6 +282,14 @@ reproduced by running the `docker build` command on `Dockerfile` (`docker build [literate programming]: https://en.wikipedia.org/wiki/Literate_programming "Literate programming" [ltxdockit]: https://ctan.org/pkg/ltxdockit "ltxdockit – Documentation support" +Contributed Software +-------------------- + +Links to contributed third-party software for the Markdown package are +available in the `contributions/` directory. The intention is to show +interesting tools for the Markdown package and to give them wider exposure +without taking responsibility for their development or maintenance. + Citing Markdown --------------- diff --git a/Master/texmf-dist/doc/generic/markdown/VERSION b/Master/texmf-dist/doc/generic/markdown/VERSION index db73644a40c..58060d55094 100644 --- a/Master/texmf-dist/doc/generic/markdown/VERSION +++ b/Master/texmf-dist/doc/generic/markdown/VERSION @@ -1 +1 @@ -2.14.1-0-gb933d81 (2022/03/01) +2.15.0-0-g9296cf1 (2022/03/31) diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.html b/Master/texmf-dist/doc/generic/markdown/markdown.html index 3711e5ae22a..4ccaeb8bf13 100644 --- a/Master/texmf-dist/doc/generic/markdown/markdown.html +++ b/Master/texmf-dist/doc/generic/markdown/markdown.html @@ -82,7 +82,7 @@

Markdown Package User Manual

Vít Novotný

-

2.14.1-0-gb933d81 (2022/03/01)

+

2.15.0-0-g9296cf1 (2022/03/31)

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 TeX 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 either our official Docker image, which contains the latest development version of the Markdown package, or a TeX distribution: TeX Live ≥ 2018 is known to work with the current version of the Markdown package and so are recent versions of MikTeX. If you are using an older, incomplete, or atypical TeX distribution, please consult the technical documentation for a detailed list of requirements.

+

The package requires either our official Docker image, which contains the latest development version of the Markdown package, or a TeX distribution: TeX Live ≥ 2020 is known to work with the current version of the Markdown package and so are recent versions of MikTeX. If you are using an older, incomplete, or atypical TeX distribution, please consult the technical documentation for a detailed list of requirements.

1.2 Installation

If Markdown is not included in your TeX distribution, you will need to install it.

First, download the package from the repository using Git:

@@ -1834,15 +1834,21 @@ Thomas,Edison,1847

2.2.1.13 Option eagerCache

eagerCache (default value: true)
-

true

-

Converted markdown documents will be cached in cacheDir. This can be useful for post-processing the converted documents and for recovering historical versions of the documents from the cache. However, it also produces a large number of auxiliary files on the disk and obscures the output of the Lua command-line interface when it is used for plumbing.

+
+
true
+

Converted markdown documents will be cached in cacheDir. This can be useful for post-processing the converted documents and for recovering historical versions of the documents from the cache. However, it also produces a large number of auxiliary files on the disk and obscures the output of the Lua command-line interface when it is used for plumbing.

This behavior will always be used if the finalizeCache option is enabled.

-

false

-

Converted markdown documents will not be cached. This decreases the number of auxiliary files that we produce and makes it easier to use the Lua command-line interface for plumbing.

+
+
+
+
false
+

Converted markdown documents will not be cached. This decreases the number of auxiliary files that we produce and makes it easier to use the Lua command-line interface for plumbing.

This behavior will only be used when the finalizeCache option is disabled. Furthermore, this behavior is planned to be the new default in the next major release of the Markdown package.

+
+
Lua Module Example

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

Hello *world*!
@@ -1858,28 +1864,110 @@ Thomas,Edison,1847
\input ./⟨hash⟩.md.tex\relax

Additionally, a TeX document named ⟨hash⟩.md.tex should be produced and contain the following code:

Hello \markdownRendererEmphasis{world}!\relax
-

2.2.1.14 Option fencedCode

+

2.2.1.14 Option expectJekyllData

+
+
expectJekyllData (default value: false)
+
+
false
+

When the jekyllData option is enabled, then a markdown document may begin with yaml metadata if and only if the metadata begin with the end-of-directives marker (---) and they end with either the end-of-directives or the end-of-document marker (...):

+
\documentclass{article}
+\usepackage[jekyllData]{markdown}
+\begin{document}
+\begin{markdown}
+---
+- this
+- is
+- YAML
+...
+- followed
+- by
+- Markdown
+\end{markdown}
+\begin{markdown}
+- this
+- is
+- Markdown
+\end{markdown}
+\end{document}
+
+
+
+
+
true
+

When the jekyllData option is enabled, then a markdown document may begin directly with yaml metadata and may contain nothing but yaml metadata.

+
\documentclass{article}
+\usepackage[jekyllData, expectJekyllData]{markdown}
+\begin{document}
+\begin{markdown}
+- this
+- is
+- YAML
+...
+- followed
+- by
+- Markdown
+\end{markdown}
+\begin{markdown}
+- this
+- is
+- YAML
+\end{markdown}
+\end{document}
+
+
+
+
+
LaTeX Example
+

Using a text editor, create a text document named jane-doe.yml with the following content:

+
name: Jane Doe
+age:  99
+

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

+
\documentclass{article}
+\usepackage[jekyllData]{markdown}
+\ExplSyntaxOn
+\keys_define:nn
+  { markdown/jekyllData }
+  {
+    name .code:n = { \gdef\name{#1} },
+    age  .code:n = { \gdef\age{#1}  },
+  }
+\ExplSyntaxOff
+\markdownSetup{
+  renderers = {
+    jekyllDataEnd = {\name{} is \age{} years old.},
+  }
+}
+\begin{document}
+\markdownInput[expectJekyllData]{jane-doe.yml}
+\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:

+
+

Jane Doe is 99 years old.

+
+

2.2.1.15 Option fencedCode

fencedCode (default value: false)
true

Enable the commonmark fenced code block extension:

-
~~~ 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>
-  ```
+
~~~ 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>
+  ```
@@ -1890,91 +1978,91 @@ 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
-

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

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

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

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

-
-
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.15 Option finalizeCache

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

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

@@ -1983,94 +2071,94 @@ Thomas,Edison,1847
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
+
\input markdown
+\def\markdownOptionFinalizeCache{true}
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye

Next, invoke LuaTeX from the terminal:

-
luatex document.tex
+
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
+
\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
+
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
+
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}
+
\documentclass[finalizecache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+Hello *world*!
+\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 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}
+
\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
+
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
+
\usemodule[t][markdown]
+\def\markdownOptionFinalizeCache{true}
+\starttext
+\startmarkdown
+Hello *world*!
+\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 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
+
\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
+
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.16 Option footnotes

+

2.2.1.17 Option footnotes

footnotes (default value: false)
true

Enable the pandoc footnote syntax extension:

-
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.
+
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.
@@ -2081,33 +2169,33 @@ 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

@@ -2115,37 +2203,37 @@ Thomas,Edison,1847
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.17 Option frozenCacheCounter

+

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

@@ -2154,19 +2242,19 @@ Thomas,Edison,1847
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
+
\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
+
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.18 Option hardLineBreaks

+

2.2.1.19 Option hardLineBreaks

hardLineBreaks (default value: false)
@@ -2182,43 +2270,43 @@ 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}
-'Twas brillig, and the slithy toves
-Did gyre and gimble in the wabe;
-All mimsy were the borogoves,
-And the mome raths outgrabe.
-\end{markdown}
-
-\begin{markdown*}{hardLineBreaks}
-'Twas brillig, and the slithy toves
-Did gyre and gimble in the wabe;
-All mimsy were the borogoves,
-And the mome raths outgrabe.
-\end{markdown*}
-
-\end{document}
-

Next, invoke LuaTeX from the terminal:

-
lualatex document.tex
+
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+'Twas brillig, and the slithy toves
+Did gyre and gimble in the wabe;
+All mimsy were the borogoves,
+And the mome raths outgrabe.
+\end{markdown}
+
+\begin{markdown*}{hardLineBreaks}
+'Twas brillig, and the slithy toves
+Did gyre and gimble in the wabe;
+All mimsy were the borogoves,
+And the mome raths outgrabe.
+\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:

’Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe.

’Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe.

-

2.2.1.19 Option hashEnumerators

+

2.2.1.20 Option hashEnumerators

hashEnumerators (default value: false)
true

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

-
#. Bird
-#. McHale
-#. Parish
+
#. Bird
+#. McHale
+#. Parish
@@ -2229,27 +2317,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

@@ -2263,25 +2351,25 @@ Thomas,Edison,1847
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

@@ -2293,18 +2381,18 @@ Thomas,Edison,1847
  • Parish
  • -

    2.2.1.20 Option headerAttributes

    +

    2.2.1.21 Option headerAttributes

    headerAttributes (default value: false)
    true

    Enable the assignment of HTML attributes to headings:

    -
    # My first heading {#foo}
    -
    -## My second heading ##    {#bar .baz}
    -
    -Yet another heading   {key=value}
    -===================
    +
    # My first heading {#foo}
    +
    +## My second heading ##    {#bar .baz}
    +
    +Yet another heading   {key=value}
    +===================

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

    @@ -2316,7 +2404,7 @@ Thomas,Edison,1847
    -

    2.2.1.21 Option html

    +

    2.2.1.22 Option html

    html (default value: false)
    @@ -2334,31 +2422,31 @@ 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 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.

    @@ -2366,23 +2454,23 @@ Thomas,Edison,1847
    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
    +
    <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:

    @@ -2391,63 +2479,63 @@ Thomas,Edison,1847
    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.

    @@ -2455,37 +2543,37 @@ Thomas,Edison,1847
    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.22 Option hybrid

    +

    2.2.1.23 Option hybrid

    hybrid (default value: false)
    @@ -2503,25 +2591,25 @@ 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
    +
    \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$.

    @@ -2529,21 +2617,21 @@ Thomas,Edison,1847
    Lua CLI Example

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

    -
    \input markdown
    -\input lmfonts
    -\input optionfalse
    -
    -\begingroup
    -\catcode`\%=12
    -\input optiontrue
    -\endgroup
    -\bye
    +
    \input markdown
    +\input lmfonts
    +\input optionfalse
    +
    +\begingroup
    +\catcode`\%=12
    +\input optiontrue
    +\endgroup
    +\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
    +
    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:

    @@ -2552,43 +2640,43 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    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}
    +
    \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
    +
    lualatex document.tex

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

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

    @@ -2596,35 +2684,35 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    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.23 Option inlineFootnotes

    +

    2.2.1.24 Option inlineFootnotes

    inlineFootnotes (default value: false)
    true

    Enable the pandoc inline footnote syntax extension:

    -
    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.]
    +
    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.]
    @@ -2635,57 +2723,57 @@ 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[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}
    +
    \documentclass{article}
    +\usepackage[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
    +
    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

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

    -
    \usemodule[t][markdown]
    -\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
    +
    \usemodule[t][markdown]
    +\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
    +
    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.24 Option jekyllData

    +

    2.2.1.25 Option jekyllData

    jekyllData (default value: false)
    true

    Enable the Pandoc yaml_metadata_block syntax extension for entering metadata in yaml:

    -
    ---
    -title:  'This is the title: it contains a colon'
    -author:
    -- Author One
    -- Author Two
    -keywords: [nothing, nothingness]
    -abstract: |
    -  This is the abstract.
    -
    -  It consists of two paragraphs.
    ----
    +
    ---
    +title:  'This is the title: it contains a colon'
    +author:
    +- Author One
    +- Author Two
    +keywords: [nothing, nothingness]
    +abstract: |
    +  This is the abstract.
    +
    +  It consists of two paragraphs.
    +---
    @@ -2698,87 +2786,105 @@ Thomas,Edison,1847
    Plain TeX Example

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

    -
    \input markdown
    -\def\markdownOptionJekyllData{true}
    -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
    -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
    -\def\markdownRendererJekyllDataEnd{%
    -  \name{} is \age{} years old.}
    -\markdownBegin
    ----
    -name: Jane Doe
    -age:  99
    ----
    -\markdownEnd
    -\bye
    -

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    \input markdown
    +\def\markdownOptionJekyllData{true}
    +\ExplSyntaxOn
    +\keys_define:nn
    +  { markdown/jekyllData }
    +  {
    +    name .code:n = { \gdef\name{#1} },
    +    age  .code:n = { \gdef\age{#1}  },
    +  }
    +\ExplSyntaxOff
    +\def\markdownRendererJekyllDataEnd{%
    +  \name{} is \age{} years old.}
    +\markdownBegin
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    Jane Doe is 99 years old.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[jekyllData]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    jekyllDataString = {\gdef\name{#2}},
    -    jekyllDataNumber = {\gdef\age{#2}},
    -    jekyllDataEnd = {\name{} is \age{} years old.},
    -  }
    -}
    -\begin{document}
    -
    -\begin{markdown}
    ----
    -name: Jane Doe
    -age:  99
    ----
    -\end{markdown}
    -
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[jekyllData]{markdown}
    +\ExplSyntaxOn
    +\keys_define:nn
    +  { markdown/jekyllData }
    +  {
    +    name .code:n = { \gdef\name{#1} },
    +    age  .code:n = { \gdef\age{#1}  },
    +  }
    +\ExplSyntaxOff
    +\markdownSetup{
    +  renderers = {
    +    jekyllDataEnd = {\name{} is \age{} years old.},
    +  }
    +}
    +\begin{document}
    +
    +\begin{markdown}
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    Jane Doe is 99 years old.

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionJekyllData{true}
    -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
    -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
    -\def\markdownRendererJekyllDataEnd{%
    -  \name{} is \age{} years old.}
    -\starttext
    -
    -\startmarkdown
    ----
    -name: Jane Doe
    -age:  99
    ----
    -\stopmarkdown
    -
    -\stoptext
    -

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    \usemodule[t][markdown]
    +\def\markdownOptionJekyllData{true}
    +\ExplSyntaxOn
    +\keys_define:nn
    +  { markdown/jekyllData }
    +  {
    +    name .code:n = { \gdef\name{#1} },
    +    age  .code:n = { \gdef\age{#1}  },
    +  }
    +\ExplSyntaxOff
    +\def\markdownRendererJekyllDataEnd{%
    +  \name{} is \age{} years old.}
    +\starttext
    +
    +\startmarkdown
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    Jane Doe is 99 years old.

    -

    2.2.1.25 Option pipeTables

    +

    2.2.1.26 Option pipeTables

    pipeTables (default value: false)
    true

    Enable the PHP Markdown table syntax extension:

    -
    | Right | Left | Default | Center |
    -|------:|:-----|---------|:------:|
    -|   12  |  12  |    12   |    12  |
    -|  123  |  123 |   123   |   123  |
    -|    1  |    1 |     1   |     1  |
    +
    | Right | Left | Default | Center |
    +|------:|:-----|---------|:------:|
    +|   12  |  12  |    12   |    12  |
    +|  123  |  123 |   123   |   123  |
    +|    1  |    1 |     1   |     1  |
    @@ -2789,21 +2895,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}
    +
    \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
    +
    lualatex document.tex

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

    @@ -2839,19 +2945,19 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    context document.tex

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

    @@ -2885,7 +2991,7 @@ Thomas,Edison,1847
    -

    2.2.1.26 Option preserveTabs

    +

    2.2.1.27 Option preserveTabs

    preserveTabs (default value: false)
    @@ -2901,19 +3007,19 @@ Thomas,Edison,1847
    -

    2.2.1.27 Option relativeReferences

    +

    2.2.1.28 Option relativeReferences

    relativeReferences (default value: false)
    true

    Enable relative references in autolinks:

    -
    I conclude in Section <#conclusion>.
    -
    -Conclusion {#conclusion}
    -==========
    -In this paper, we have discovered that most
    -grandmas would rather eat dinner with their
    -grandchildren than get eaten. Begone, wolf!
    +
    I conclude in Section <#conclusion>.
    +
    +Conclusion {#conclusion}
    +==========
    +In this paper, we have discovered that most
    +grandmas would rather eat dinner with their
    +grandchildren than get eaten. Begone, wolf!
    @@ -2924,33 +3030,33 @@ 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[headerAttributes, relativeReferences]{markdown}
    -\begin{document}
    -\begin{markdown}
    -
    -I conclude in Section <#conclusion>.
    -
    -Conclusion {#conclusion}
    -==========
    -In this paper, we have discovered that most
    -grandmas would rather eat dinner with their
    -grandchildren than get eaten. Begone, wolf!
    -
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[headerAttributes, relativeReferences]{markdown}
    +\begin{document}
    +\begin{markdown}
    +
    +I conclude in Section <#conclusion>.
    +
    +Conclusion {#conclusion}
    +==========
    +In this paper, we have discovered that most
    +grandmas would rather eat dinner with their
    +grandchildren than get eaten. Begone, wolf!
    +
    +\end{markdown}
    +\end{document}

    Next, invoke LuaTeX twice from the terminal:

    -
    lualatex document.tex
    -lualatex document.tex
    +
    lualatex document.tex
    +lualatex document.tex

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

    I conclude in Section 1.

    1. Conclusion

    In this paper, we have discovered that most grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!

    -

    2.2.1.28 Option shiftHeadings

    +

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

    @@ -2958,48 +3064,48 @@ Thomas,Edison,1847
    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}
    -\begin{filecontents}[overwrite,nosearch,noheader]{example.md}
    -## A section
    -\end{filecontents}
    -\begin{document}
    -\markdownInput[shiftHeadings=-1]{example.md}
    -\markdownInput{example.md}
    -\markdownInput[shiftHeadings=+1]{example.md}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\begin{filecontents}[overwrite,nosearch,noheader]{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
    +
    lualatex document.tex

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

    A section

    @@ -3008,30 +3114,30 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    ## A section
    +
    ## 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
    +
    \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
    +
    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.29 Option slice

    +

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

    @@ -3047,39 +3153,39 @@ Thomas,Edison,1847
    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

    @@ -3091,30 +3197,30 @@ 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}
    -\begin{filecontents}[overwrite,nosearch,noheader]{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}
    +\begin{filecontents}[overwrite,nosearch,noheader]{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

    @@ -3128,34 +3234,34 @@ Thomas,Edison,1847
    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

    @@ -3167,7 +3273,7 @@ Thomas,Edison,1847

    Act V

    Hamlet dies.

    -

    2.2.1.30 Option smartEllipses

    +

    2.2.1.31 Option smartEllipses

    smartEllipses (default value: false)
    @@ -3185,23 +3291,23 @@ 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
    +
    \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 …

    @@ -3209,19 +3315,19 @@ Thomas,Edison,1847
    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
    +
    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:

    @@ -3230,48 +3336,48 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    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 …

    @@ -3279,28 +3385,28 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    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.31 Option startNumber

    +

    2.2.1.32 Option startNumber

    startNumber (default value: true)
    @@ -3316,32 +3422,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}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\begin{document}
    +
    +\begin{markdown}
    +The following list respects the numbers specified in the markup:
    +
    +3. third item
    +4. fourth item
    +5. fifth item
    +\end{markdown}
    +
    +\begin{markdown*}{startNumber=false}
    +The following list does not respect the numbers specified in the
    +markup:
    +
    +3. third item
    +4. fourth item
    +5. fifth item
    +\end{markdown*}
    +
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

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

    @@ -3359,28 +3465,28 @@ Thomas,Edison,1847
    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:

    @@ -3396,19 +3502,19 @@ Thomas,Edison,1847
  • fifth item
  • -

    2.2.1.32 Option stripIndent

    +

    2.2.1.33 Option stripIndent

    stripIndent (default value: false)
    true

    Strip the minimal indentation of non-blank lines from all lines in a markdown document. Requires that the preserveTabs Lua option is :

    -
    \documentclass{article}
    -\usepackage[stripIndent]{markdown}
    -\begin{document}
    -    \begin{markdown}
    -        Hello *world*!
    -    \end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[stripIndent]{markdown}
    +\begin{document}
    +    \begin{markdown}
    +        Hello *world*!
    +    \end{markdown}
    +\end{document}
    @@ -3421,52 +3527,52 @@ Thomas,Edison,1847
    Plain TeX Example

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

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

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[stripIndent]{markdown}
    -\begin{document}
    -    \begin{markdown}
    -        Hello *world*!
    -    \end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[stripIndent]{markdown}
    +\begin{document}
    +    \begin{markdown}
    +        Hello *world*!
    +    \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 text “Hello world!”

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionStripIndent{true}
    -\starttext
    -    \startmarkdown
    -        Hello *world*!
    -    \stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionStripIndent{true}
    +\starttext
    +    \startmarkdown
    +        Hello *world*!
    +    \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 text “Hello world!”

    -

    2.2.1.33 Option tableCaptions

    +

    2.2.1.34 Option tableCaptions

    tableCaptions (default value: false)
    true

    Enable the Pandoc table_captions syntax extension for pipe tables.

    -
    | Right | Left | Default | Center |
    -|------:|:-----|---------|:------:|
    -|   12  |  12  |    12   |    12  |
    -|  123  |  123 |   123   |   123  |
    -|    1  |    1 |     1   |     1  |
    -
    -  : Demonstration of pipe table syntax.
    +
    | Right | Left | Default | Center |
    +|------:|:-----|---------|:------:|
    +|   12  |  12  |    12   |    12  |
    +|  123  |  123 |   123   |   123  |
    +|    1  |    1 |     1   |     1  |
    +
    +  : Demonstration of pipe table syntax.
    @@ -3477,23 +3583,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}
    +
    \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
    +
    lualatex document.tex

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

    @@ -3530,22 +3636,22 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    context document.tex

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

    @@ -3580,15 +3686,15 @@ Thomas,Edison,1847
    -

    2.2.1.34 Option taskLists

    +

    2.2.1.35 Option taskLists

    taskLists (default value: false)
    true

    Enable the Pandoc task_lists syntax extension.

    -
    - [ ] an unticked task list item
    -- [/] a half-checked task list item
    -- [X] a ticked task list item
    +
    - [ ] an unticked task list item
    +- [/] a half-checked task list item
    +- [X] a ticked task list item
    @@ -3599,26 +3705,26 @@ 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[taskLists]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    untickedBox = No,
    -    halfTickedBox = Maybe,
    -    tickedBox = Yes,
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -- [ ] you can't.
    -- [/] I can?
    -- [X] I can!
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[taskLists]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    untickedBox = No,
    +    halfTickedBox = Maybe,
    +    tickedBox = Yes,
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +- [ ] you can't.
    +- [/] I can?
    +- [X] I can!
    +\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:

      @@ -3629,20 +3735,20 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionTaskLists{true}
    -\def\markdownRendererUntickedBox{No}
    -\def\markdownRendererHalftickedBox{Maybe}
    -\def\markdownRendererTickedBox{Yes}
    -\starttext
    -\startmarkdown
    -- [ ] you can't.
    -- [/] I can?
    -- [X] I can!
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionTaskLists{true}
    +\def\markdownRendererUntickedBox{No}
    +\def\markdownRendererHalftickedBox{Maybe}
    +\def\markdownRendererTickedBox{Yes}
    +\starttext
    +\startmarkdown
    +- [ ] you can't.
    +- [/] I can?
    +- [X] I can!
    +\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:

      @@ -3651,20 +3757,20 @@ Thomas,Edison,1847
    • Yes I can!
    -

    2.2.1.35 Option texComments

    +

    2.2.1.36 Option texComments

    texComments (default value: false)
    true

    Strip TeX-style comments.

    -
    \documentclass{article}
    -\usepackage[texComments]{markdown}
    -\begin{document}
    -\begin{markdown}
    -Hel%  this is a comment
    -   lo *world*!
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[texComments]{markdown}
    +\begin{document}
    +\begin{markdown}
    +Hel%  this is a comment
    +   lo *world*!
    +\end{markdown}
    +\end{document}

    Always enabled when hybrid is enabled.

    @@ -3678,91 +3784,100 @@ Thomas,Edison,1847
    Plain TeX Example

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

    -
    \input markdown
    -\def\markdownOptionTeXComments{true}
    -\markdownBegin
    -Hel%  this is a comment
    -   lo *world*!
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownOptionTexComments{true}
    +\markdownBegin
    +Hel%  this is a comment
    +   lo *world*!
    +\markdownEnd
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[texComments]{markdown}
    -\begin{document}
    -\begin{markdown}
    -Hel%  this is a comment
    -   lo *world*!
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[texComments]{markdown}
    +\begin{document}
    +\begin{markdown}
    +Hel%  this is a comment
    +   lo *world*!
    +\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 text “Hello world!”

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionTeXComments{true}
    -\starttext
    -\startmarkdown
    -Hel%  this is a comment
    -   lo *world*!
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionTexComments{true}
    +\starttext
    +\startmarkdown
    +Hel%  this is a comment
    +   lo *world*!
    +\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 text “Hello world!”

    -

    2.2.1.36 Option tightLists

    +

    2.2.1.37 Option tightLists

    tightLists (default value: true)
    true
    -

    Lists whose bullets do not consist of multiple paragraphs will be passed to the , , , , , and TeX macros.

    +

    Unordered and ordered Lists whose items do not consist of multiple paragraphs will be considered tight. Tight lists will produce tight renderers that may produce different output than lists that are not tight:

    +
    - This is
    +- a tight
    +- unordered list.
    +
    +- This is
    +
    +  not a tight
    +
    +- unordered list.
    false
    -

    Lists whose bullets do not consist of multiple paragraphs will be treated the same way as lists that do consist of multiple paragraphs.

    +

    Unordered and ordered lists whose items consist of multiple paragraphs will be treated the same way as lists that consist of multiple paragraphs.

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

    @@ -3785,16 +3900,16 @@ Thomas,Edison,1847
  • third item

  • -

    2.2.1.37 Option underscores

    +

    2.2.1.38 Option underscores

    underscores (default value: true)
    true

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

    -
    *single asterisks*
    -_single underscores_
    -**double asterisks**
    -__double underscores__
    +
    *single asterisks*
    +_single underscores_
    +**double asterisks**
    +__double underscores__
    @@ -3807,43 +3922,43 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    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}
    +
    \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
    +
    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ₙ.

    @@ -3851,22 +3966,22 @@ Thomas,Edison,1847
    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
    +
    \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
    +
    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ₙ.

    @@ -3876,7 +3991,7 @@ Thomas,Edison,1847

    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 Setting Lua options from plain TeX

    As a rule of thumb, you can set all Lua options directly from plain TeX. For example, to set the taskLists Lua option to true, you would include the following code in your plain TeX document:

    -
    \def\markdownOptionTaskLists{true}
    +
    \def\markdownOptionTaskLists{true}

    2.2.2.2 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 frozenCache options is as follows:

    @@ -3901,68 +4016,68 @@ Thomas,Edison,1847

    The \markdownOptionCacheDir and \markdownOptionFrozenCacheFileName commands correspond to the cacheDir and frozenCacheFileName Lua options.

    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}
    -\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
    +
    \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.4 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.

    +

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

    LaTeX options allow us to disable the redefinition of the default renderer prototypes from plain TeX, load user-contributed themes, and invoke user-defined setup snippets.

    2.2.3.1 Setting Lua and plain TeX options from LaTeX

    As a rule of thumb, we can set all Lua options directly from LaTeX. For example, to set the taskLists Lua option to true, we would include the following code in our LaTeX document:

    -
    \markdownSetup{
    -  taskLists = true,
    -}
    +
    \markdownSetup{
    +  taskLists = true,
    +}

    We can also set all plain TeX options directly from LaTeX. For example, to set the \markdownOptionHelperScriptFileName plain TeX option to helper-script.lua, we would inclde the following code in our LaTeX document:

    -
    \markdownSetup{
    -  helperScriptFileName = helper-script.lua,
    -}
    +
    \markdownSetup{
    +  helperScriptFileName = helper-script.lua,
    +}

    2.2.3.2 No default token renderer prototypes

    Default token renderer prototypes require LaTeX packages that may clash with other packages used in a document. Additionally, if we redefine token renderers and renderer prototypes ourselves, the default definitions will bring no benefit to us. Using the plain package option, we can keep the default definitions from the plain TeX implementation and prevent the soft LaTeX prerequisites from being loaded:

    -
    \usepackage[plain]{markdown}
    +
    \usepackage[plain]{markdown}

    2.2.3.3 LaTeX themes

    User-contributed LaTeX themes for the Markdown package provide a domain-specific interpretation of some Markdown tokens. Similarly to LaTeX packages, themes allow the authors to achieve a specific look and other high-level goals without low-level programming.

    For example, to load themes named witiko/beamer/MU and witiko/dot, you would use the following code in the preamble of your document:

    -
    \usepackage[
    -  theme = witiko/beamer/MU,
    -  theme = witiko/dot,
    -]{markdown}
    +
    \usepackage[
    +  theme = witiko/beamer/MU,
    +  theme = witiko/dot,
    +]{markdown}

    Due to limitations of LaTeX, themes may not be loaded after the beginning of a LaTeX document.

    Example themes provided with the Markdown package include:

    @@ -3970,44 +4085,44 @@ Thomas,Edison,1847

    A theme that typesets fenced code blocks with the dot … infostring as images of directed graphs rendered by the Graphviz tools. The right tail of the infostring is used as the image title. The theme requires a Unix-like operating system with GNU Diffutils and Graphviz installed. The theme also requires shell access unless the plain TeX option is enabled.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[theme=witiko/dot]{markdown}
    -\setkeys{Gin}{
    -  width=\columnwidth,
    -  height=0.65\paperheight,
    -  keepaspectratio}
    -\begin{document}
    -\begin{markdown}
    -``` dot Various formats of mathemathical formulae
    -digraph tree {
    -  margin = 0;
    -  rankdir = "LR";
    -
    -  latex -> pmml;
    -  latex -> cmml;
    -  pmml -> slt;
    -  cmml -> opt;
    -  cmml -> prefix;
    -  cmml -> infix;
    -  pmml -> mterms [style=dashed];
    -  cmml -> mterms;
    -
    -  latex [label = "LaTeX"];
    -  pmml [label = "Presentation MathML"];
    -  cmml [label = "Content MathML"];
    -  slt [label = "Symbol Layout Tree"];
    -  opt [label = "Operator Tree"];
    -  prefix [label = "Prefix"];
    -  infix [label = "Infix"];
    -  mterms [label = "M-Terms"];
    -}
    -```
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[theme=witiko/dot]{markdown}
    +\setkeys{Gin}{
    +  width=\columnwidth,
    +  height=0.65\paperheight,
    +  keepaspectratio}
    +\begin{document}
    +\begin{markdown}
    +``` dot Various formats of mathemathical formulae
    +digraph tree {
    +  margin = 0;
    +  rankdir = "LR";
    +
    +  latex -> pmml;
    +  latex -> cmml;
    +  pmml -> slt;
    +  cmml -> opt;
    +  cmml -> prefix;
    +  cmml -> infix;
    +  pmml -> mterms [style=dashed];
    +  cmml -> mterms;
    +
    +  latex [label = "LaTeX"];
    +  pmml [label = "Presentation MathML"];
    +  cmml [label = "Content MathML"];
    +  slt [label = "Symbol Layout Tree"];
    +  opt [label = "Operator Tree"];
    +  prefix [label = "Prefix"];
    +  infix [label = "Infix"];
    +  mterms [label = "M-Terms"];
    +}
    +```
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain a drawing of a directed graph similar to Figure 1 from the following conference article:

    NOVOTNÝ, Vít, Petr SOJKA, Michal ŠTEFÁNIK and Dávid LUPTÁK. Three is Better than One: Ensembling Math Information Retrieval Systems. CEUR Workshop Proceedings. Thessaloniki, Greece: M. Jeusfeld c/o Redaktion Sun SITE, Informatik V, RWTH Aachen., 2020, vol. 2020, No 2696, p. 1-30. ISSN 1613-0073. http://ceur-ws.org/Vol-2696/paper_235.pdf

    @@ -4017,18 +4132,18 @@ Thomas,Edison,1847

    A theme that adds support for downloading images whose URL has the http or https protocol. The theme requires the catchfile LaTeX package and a Unix-like operating system with GNU Coreutils md5sum and either GNU Wget or cURL installed. The theme also requires shell access unless the plain TeX option is enabled.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[theme=witiko/graphicx/http]{markdown}
    -\begin{document}
    -\begin{markdown}
    -![img](https://github.com/witiko/markdown/raw/main/markdown.png
    -       "The banner of the Markdown package")
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[theme=witiko/graphicx/http]{markdown}
    +\begin{document}
    +\begin{markdown}
    +![img](https://github.com/witiko/markdown/raw/main/markdown.png
    +       "The banner of the Markdown package")
    +\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 image:

    @@ -4040,17 +4155,17 @@ Thomas,Edison,1847

    A theme that makes tilde (~) always typeset the non-breaking space even when the hybrid Lua option is false.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[theme=witiko/tilde]{markdown}
    -\begin{document}
    -\begin{markdown}
    -Bartel~Leendert van~der~Waerden
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[theme=witiko/tilde]{markdown}
    +\begin{document}
    +\begin{markdown}
    +Bartel~Leendert van~der~Waerden
    +\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, where the middot (·) denotes a non-breaking space:

    Bartel·Leendert van·der·Waerden

    @@ -4058,53 +4173,53 @@ Thomas,Edison,1847

    2.2.3.4 LaTeX setup snippets

    User-contributed LaTeX themes provide global control over high-level goals. However, it is often desirable to change only some local aspects of a document. LaTeX setup snippets provide syntactic sugar for defining and invoking various options locally.

    Here is how we can use setup snippets to store options and invoke them later:

    -
    \markdownSetupSnippet{romanNumerals}{
    -  renderers = {
    -      olItemWithNumber = {%
    -          \item[\romannumeral#1\relax.]%
    -      },
    -  },
    -}
    -\begin{markdown}
    -
    -The following ordered list will be preceded by arabic numerals:
    -
    -1. wahid
    -2. aithnayn
    -
    -\end{markdown}
    -\begin{markdown*}{snippet=romanNumerals}
    -
    -The following ordered list will be preceded by roman numerals:
    -
    -3. tres
    -4. quattuor
    -
    -\end{markdown*}
    +
    \markdownSetupSnippet{romanNumerals}{
    +  renderers = {
    +      olItemWithNumber = {%
    +          \item[\romannumeral#1\relax.]%
    +      },
    +  },
    +}
    +\begin{markdown}
    +
    +The following ordered list will be preceded by arabic numerals:
    +
    +1. wahid
    +2. aithnayn
    +
    +\end{markdown}
    +\begin{markdown*}{snippet=romanNumerals}
    +
    +The following ordered list will be preceded by roman numerals:
    +
    +3. tres
    +4. quattuor
    +
    +\end{markdown*}

    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.

    2.3.1 Token Renderers

    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 Tickbox Renderers

    The macros named \markdownRendererTickedBox, \markdownRendererHalfTickedBox, and \markdownRendererUntickedBox represent ticked and unticked boxes, respectively. These macros will either be produced, when the taskLists option is enabled, or when the Ballot Box with X (☒, U+2612), Hourglass (⌛, U+231B) or Ballot Box (☐, U+2610) Unicode characters are encountered in the markdown input, respectively.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[taskLists]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    untickedBox = No,
    -    tickedBox = Yes,
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -- [ ] you can't.
    -- [x] I can!
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[taskLists]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    untickedBox = No,
    +    tickedBox = Yes,
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +- [ ] you can't.
    +- [x] I can!
    +\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:

      @@ -4114,18 +4229,18 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionTaskLists{true}
    -\def\markdownRendererUntickedBox{No}
    -\def\markdownRendererTickedBox{Yes}
    -\starttext
    -\startmarkdown
    -- [ ] you can't.
    -- [x] I can!
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionTaskLists{true}
    +\def\markdownRendererUntickedBox{No}
    +\def\markdownRendererTickedBox{Yes}
    +\starttext
    +\startmarkdown
    +- [ ] you can't.
    +- [x] I can!
    +\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:

      @@ -4136,75 +4251,75 @@ Thomas,Edison,1847

      2.3.1.2 Markdown Document Renderers

      The \markdownRendererDocumentBegin and \markdownRendererDocumentEnd macros represent the beginning and the end of a markdown document. The macros receive no arguments.

      A TeX document may contain any number of markdown documents. Additionally, markdown documents may appear not only in a sequence, but several markdown documents may also be nested. Redefinitions of the macros should take this into account.

      -
      LaTeX Example
      +
      LaTeX Example

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

      -
      This is a *nested* markdown document.
      -

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

      -
      \documentclass{article}
      -\usepackage[contentBlocks]{markdown}
      -\markdownSetup{
      -  renderers = {
      -    contentBlock = {%
      -      \markdownInput{#3}%
      -    },
      -    documentBegin = {%
      -      \par
      -      \emph{(The beginning of a document)}
      -      \par
      -      \begingroup
      -      \markdownSetup{snippet=first-nesting-level}%
      -    },
      -    documentEnd = {%
      -      \endgroup
      -      \par
      -      \emph{(The end of a document)}
      -      \par
      -    },
      -  },
      -}
      -\markdownSetupSnippet{first-nesting-level}{
      -  renderers = {
      -    documentBegin = {
      -      \par
      -      \emph{(The beginning of a nested document)}
      -      \par
      -      \begingroup
      -      \markdownSetup{snippet=second-nesting-level-and-below}
      -    },
      -  },
      -}
      -\markdownSetupSnippet{second-nesting-level-and-below}{
      -  renderers = {
      -    documentBegin = {
      -      \par
      -      \emph{(The beginning of a nested document)}
      -      \par
      -      \begingroup
      -    },
      -    documentEnd = {
      -      \endgroup
      -      \par
      -      \emph{(The end of a nested document)}
      -      \par
      -    },
      -  },
      -}
      -\begin{document}
      -\begin{markdown}
      -Hello *world*!
      -
      -/nested.md
      -
      -_Foo_ bar!
      -\end{markdown}
      -\begin{markdown}
      -
      -Bar baz!
      -
      -\end{markdown}
      -\end{document}
      -

      Next, invoke LuaTeX from the terminal:

      -
      lualatex document.tex
      +
      This is a *nested* markdown document.
      +

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

      +
      \documentclass{article}
      +\usepackage[contentBlocks]{markdown}
      +\markdownSetup{
      +  renderers = {
      +    contentBlock = {%
      +      \markdownInput{#3}%
      +    },
      +    documentBegin = {%
      +      \par
      +      \emph{(The beginning of a document)}
      +      \par
      +      \begingroup
      +      \markdownSetup{snippet=first-nesting-level}%
      +    },
      +    documentEnd = {%
      +      \endgroup
      +      \par
      +      \emph{(The end of a document)}
      +      \par
      +    },
      +  },
      +}
      +\markdownSetupSnippet{first-nesting-level}{
      +  renderers = {
      +    documentBegin = {
      +      \par
      +      \emph{(The beginning of a nested document)}
      +      \par
      +      \begingroup
      +      \markdownSetup{snippet=second-nesting-level-and-below}
      +    },
      +  },
      +}
      +\markdownSetupSnippet{second-nesting-level-and-below}{
      +  renderers = {
      +    documentBegin = {
      +      \par
      +      \emph{(The beginning of a nested document)}
      +      \par
      +      \begingroup
      +    },
      +    documentEnd = {
      +      \endgroup
      +      \par
      +      \emph{(The end of a nested document)}
      +      \par
      +    },
      +  },
      +}
      +\begin{document}
      +\begin{markdown}
      +Hello *world*!
      +
      +/nested.md
      +
      +_Foo_ bar!
      +\end{markdown}
      +\begin{markdown}
      +
      +Bar baz!
      +
      +\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 beginning of a document)

      @@ -4222,48 +4337,48 @@ Thomas,Edison,1847

      The \markdownRendererInterblockSeparator macro represents a separator between two markdown block elements. 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\markdownRendererInterblockSeparator{%
      -  \par
      -  {\it(The end of a block)}%
      -  \par
      -}
      -\markdownBegin
      -Hello *world*!
      -
      -_Foo_ bar!
      -\markdownEnd
      -\bye
      +
      \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
      +
      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!

      @@ -4272,21 +4387,21 @@ Thomas,Edison,1847
      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
      +
      \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
      +
      context document.tex

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

      Hello world!

      @@ -4297,44 +4412,44 @@ Thomas,Edison,1847

      The \markdownRendererLineBreak macro represents a forced line break. 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\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!

      @@ -4343,19 +4458,19 @@ Thomas,Edison,1847
      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!

      @@ -4366,51 +4481,51 @@ Thomas,Edison,1847

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

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

      The secret word is SHAZAM!

      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!

      @@ -4419,40 +4534,40 @@ Thomas,Edison,1847

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

      @@ -4476,49 +4591,49 @@ Thomas,Edison,1847
    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.

    -
    \input markdown
    -\def\markdownRendererTilde{~}
    -\markdownBegin
    -Bartel~Leendert van~der~Waerden
    -\markdownEnd
    -\bye
    -

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    \input markdown
    +\def\markdownRendererTilde{~}
    +\markdownBegin
    +Bartel~Leendert van~der~Waerden
    +\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, where the middot (·) denotes a non-breaking 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.

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    tilde = ~,
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -Bartel~Leendert van~der~Waerden
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  renderers = {
    +    tilde = ~,
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +Bartel~Leendert van~der~Waerden
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text, where the middot (·) denotes a non-breaking space:

    Bartel·Leendert van·der·Waerden

    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.

    -
    \usemodule[t][markdown]
    -\def\markdownRendererTilde{~}
    -\starttext
    -\startmarkdown
    -Bartel~Leendert van~der~Waerden
    -\stopmarkdown
    -\stoptext
    -

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    \usemodule[t][markdown]
    +\def\markdownRendererTilde{~}
    +\starttext
    +\startmarkdown
    +Bartel~Leendert van~der~Waerden
    +\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, where the middot (·) denotes a non-breaking space:

    Bartel·Leendert van·der·Waerden

    @@ -4527,55 +4642,55 @@ Thomas,Edison,1847

    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

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

    -
    \input markdown
    -\input lmfonts
    -
    -\def\markdownRendererCodeSpan#1{#1}
    -
    -\markdownBegin
    -`$\sqrt{-1}$ *equals* $i$`
    -
    -$\sqrt{-1}$ *equals* $i$
    -\markdownEnd
    -
    -\def\markdownOptionHybrid{true}
    -\markdownBegin
    -$\sqrt{-1}$ *equals* $i$
    -\markdownEnd
    -
    -\bye
    +
    \input markdown
    +\input lmfonts
    +
    +\def\markdownRendererCodeSpan#1{#1}
    +
    +\markdownBegin
    +`$\sqrt{-1}$ *equals* $i$`
    +
    +$\sqrt{-1}$ *equals* $i$
    +\markdownEnd
    +
    +\def\markdownOptionHybrid{true}
    +\markdownBegin
    +$\sqrt{-1}$ *equals* $i$
    +\markdownEnd
    +
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

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

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

    √-̅1̅ equals i.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[smartEllipses]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    codeSpan = {#1},
    -  },
    -}
    -\begin{document}
    -
    -\begin{markdown}
    -`$\sqrt{-1}$ *equals* $i$`
    -
    -$\sqrt{-1}$ *equals* $i$
    -\end{markdown}
    -
    -\begin{markdown*}{hybrid}
    -$\sqrt{-1}$ *equals* $i$
    -\end{markdown*}
    -
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[smartEllipses]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    codeSpan = {#1},
    +  },
    +}
    +\begin{document}
    +
    +\begin{markdown}
    +`$\sqrt{-1}$ *equals* $i$`
    +
    +$\sqrt{-1}$ *equals* $i$
    +\end{markdown}
    +
    +\begin{markdown*}{hybrid}
    +$\sqrt{-1}$ *equals* $i$
    +\end{markdown*}
    +
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

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

    @@ -4584,24 +4699,24 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererCodeSpan#1{#1}
    -\starttext
    -
    -\startmarkdown
    -`$\sqrt{-1}$ *equals* $i$`
    -
    -$\sqrt{-1}$ *equals* $i$
    -\stopmarkdown
    -
    -\def\markdownOptionHybrid{true}
    -\startmarkdown
    -$\sqrt{-1}$ *equals* $i$
    -\stopmarkdown
    -
    -\bye
    +
    \usemodule[t][markdown]
    +\def\markdownRendererCodeSpan#1{#1}
    +\starttext
    +
    +\startmarkdown
    +`$\sqrt{-1}$ *equals* $i$`
    +
    +$\sqrt{-1}$ *equals* $i$
    +\stopmarkdown
    +
    +\def\markdownOptionHybrid{true}
    +\startmarkdown
    +$\sqrt{-1}$ *equals* $i$
    +\stopmarkdown
    +
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

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

    @@ -4612,106 +4727,106 @@ Thomas,Edison,1847

    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

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

    -
    \input markdown
    -\def\markdownRendererLink#1#2#3#4{%
    -  #1 {\tt#2} titled {\it#4}%
    -}
    -\markdownBegin
    -Please visit [the link][ctan].
    -
    - [ctan]: https://ctan.org/
    -         (the Comprehensive TeX Archive Network)
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownRendererLink#1#2#3#4{%
    +  #1 {\tt#2} titled {\it#4}%
    +}
    +\markdownBegin
    +Please visit [the link][ctan].
    +
    + [ctan]: https://ctan.org/
    +         (the Comprehensive TeX Archive Network)
    +\markdownEnd
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    Please visit the link https://ctan.org/ titled the Comprehensive TeX Archive Network.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    link = {%
    -      #1 \texttt{#2} titled \emph{#4}%
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -Please visit [the link][ctan].
    -
    - [ctan]: https://ctan.org/
    -         (the Comprehensive TeX Archive Network)
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  renderers = {
    +    link = {%
    +      #1 \texttt{#2} titled \emph{#4}%
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +Please visit [the link][ctan].
    +
    + [ctan]: https://ctan.org/
    +         (the Comprehensive TeX Archive Network)
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    Please visit the link https://ctan.org/ titled the Comprehensive TeX Archive Network.

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererLink#1#2#3#4{%
    -  #1 {\tt#2} titled \emph{#4}%
    -}
    -\starttext
    -\startmarkdown
    -Please visit [the link][ctan].
    -
    - [ctan]: https://ctan.org/
    -         (the Comprehensive TeX Archive Network)
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownRendererLink#1#2#3#4{%
    +  #1 {\tt#2} titled \emph{#4}%
    +}
    +\starttext
    +\startmarkdown
    +Please visit [the link][ctan].
    +
    + [ctan]: https://ctan.org/
    +         (the Comprehensive TeX Archive Network)
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    Please visit the link https://ctan.org/ titled the Comprehensive TeX Archive Network.

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

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\begingroup
    -\catcode`\@=11
    -\catcode`\%=12
    -\catcode`\^^A=14
    -\global\def\markdownRendererImage#1#2#3#4{^^A
    -  \immediate\write18{^^A
    -
        if printf '%s' "#3" | grep -q ^http; then
    -      OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A
    -              $(printf '%s' "#3" | sed 's/.*[.]//')";
    -      if ! [ -e "$OUTPUT" ]; then
    -        wget -O "$OUTPUT" '#3' || rm "$OUTPUT";
    -        convert "$OUTPUT" png:"$OUTPUT";
    -      fi;
    -      printf '%s%%' "$OUTPUT" > \jobname.fetched;
    -    else
    -      printf '%s%%' "#3"      > \jobname.fetched;
    -    fi^^A
    -
      }^^A
    -  {^^A
    -    \everyeof={\noexpand}^^A
    -    \edef\filename{\__markdowninput"\jobname.fetched" }^^A
    -    \includegraphics[width=\textwidth]{\filename}^^A
    -  }^^A
    -}
    -\endgroup
    -\begin{document}
    -\begin{markdown}
    -![TUGboat](https://tug.org/tugboat/noword.jpg)
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex --shell-escape document.tex
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\begingroup
    +\catcode`\@=11
    +\catcode`\%=12
    +\catcode`\^^A=14
    +\global\def\markdownRendererImage#1#2#3#4{^^A
    +  \immediate\write18{^^A
    +
        if printf '%s' "#3" | grep -q ^http; then
    +      OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A
    +              $(printf '%s' "#3" | sed 's/.*[.]//')";
    +      if ! [ -e "$OUTPUT" ]; then
    +        wget -O "$OUTPUT" '#3' || rm "$OUTPUT";
    +        convert "$OUTPUT" png:"$OUTPUT";
    +      fi;
    +      printf '%s%%' "$OUTPUT" > \jobname.fetched;
    +    else
    +      printf '%s%%' "#3"      > \jobname.fetched;
    +    fi^^A
    +
      }^^A
    +  {^^A
    +    \everyeof={\noexpand}^^A
    +    \edef\filename{\__markdowninput"\jobname.fetched" }^^A
    +    \includegraphics[width=\textwidth]{\filename}^^A
    +  }^^A
    +}
    +\endgroup
    +\begin{document}
    +\begin{markdown}
    +![TUGboat](https://tug.org/tugboat/noword.jpg)
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex --shell-escape document.tex

    A PDF document named document.pdf should be produced and contain the following content. This assumes that you use a Unix-like operating system with Bourne or Bourne again shell as the default shell of the current user. It also assumes that the md5sum, wget, and convert binaries are installed and that the TeX engine has shell access.

    @@ -4723,64 +4838,64 @@ Thomas,Edison,1847

    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

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

    -
    \input markdown
    -\def\markdownOptionContentBlocks{true}
    -\def\markdownRendererContentBlock#1#2#3#4{%
    -  This is {\tt #2}, #4.
    -}
    -\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
    -  This is the image {\tt #2}, #4.
    -}
    -\def\markdownRendererContentBlockCode#1#2#3#4#5{%
    -  This is the #2 (\uppercase{#1}) document {\tt #3}, #5.
    -}
    -\markdownBegin
    -/document.tex (the document that we are currently typesetting)
    -/markdown-languages.json (the mapping between filename extensions
    -                          and programming language names)
    -https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownOptionContentBlocks{true}
    +\def\markdownRendererContentBlock#1#2#3#4{%
    +  This is {\tt #2}, #4.
    +}
    +\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
    +  This is the image {\tt #2}, #4.
    +}
    +\def\markdownRendererContentBlockCode#1#2#3#4#5{%
    +  This is the #2 (\uppercase{#1}) document {\tt #3}, #5.
    +}
    +\markdownBegin
    +/document.tex (the document that we are currently typesetting)
    +/markdown-languages.json (the mapping between filename extensions
    +                          and programming language names)
    +https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
    +\markdownEnd
    +\bye

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

    -
    {
    -  "json": "JavaScript Object Notation",
    -}
    +
    {
    +  "json": "JavaScript Object Notation",
    +}

    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:

    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:

    -
    \documentclass{article}
    -\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json}
    -{
    -  "json": "JavaScript Object Notation",
    -}
    -\end{filecontents}
    -\usepackage[contentBlocks]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    contentBlock = {This is \texttt{#2}, #4.},
    -    contentBlockOnlineImage = {This is the image \texttt{#2}, #4.},
    -    contentBlockCode = {%
    -      This is the #2 (\MakeUppercase{#1}) document \texttt{#3}, #5.
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -/document.tex (the document that we are currently typesetting)
    -/markdown-languages.json (the mapping between filename extensions
    -                          and programming language names)
    -https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json}
    +{
    +  "json": "JavaScript Object Notation",
    +}
    +\end{filecontents}
    +\usepackage[contentBlocks]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    contentBlock = {This is \texttt{#2}, #4.},
    +    contentBlockOnlineImage = {This is the image \texttt{#2}, #4.},
    +    contentBlockCode = {%
    +      This is the #2 (\MakeUppercase{#1}) document \texttt{#3}, #5.
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +/document.tex (the document that we are currently typesetting)
    +/markdown-languages.json (the mapping between filename extensions
    +                          and programming language names)
    +https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    This is document.tex, the document that we are currently typesetting.

    @@ -4789,31 +4904,31 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionContentBlocks{true}
    -\def\markdownRendererContentBlock#1#2#3#4{%
    -  This is {\tt #2}, #4.
    -}
    -\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
    -  This is the image {\tt #2}, #4.
    -}
    -\def\markdownRendererContentBlockCode#1#2#3#4#5{%
    -  This is the #2 (\uppercase{#1}) document {\tt #3}, #5.
    -}
    -\starttext
    -\startmarkdown
    -/document.tex (the document that we are currently typesetting)
    -/markdown-languages.json (the mapping between filename extensions
    -                          and programming language names)
    -https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionContentBlocks{true}
    +\def\markdownRendererContentBlock#1#2#3#4{%
    +  This is {\tt #2}, #4.
    +}
    +\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
    +  This is the image {\tt #2}, #4.
    +}
    +\def\markdownRendererContentBlockCode#1#2#3#4#5{%
    +  This is the #2 (\uppercase{#1}) document {\tt #3}, #5.
    +}
    +\starttext
    +\startmarkdown
    +/document.tex (the document that we are currently typesetting)
    +/markdown-languages.json (the mapping between filename extensions
    +                          and programming language names)
    +https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)
    +\stopmarkdown
    +\stoptext

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

    -
    {
    -  "json": "JavaScript Object Notation",
    -}
    +
    {
    +  "json": "JavaScript Object Notation",
    +}

    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:

    This is document.tex, the document that we are currently typesetting.

    @@ -4829,50 +4944,50 @@ Thomas,Edison,1847

    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

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

    -
    \input markdown
    -\def\markdownOptionTightLists{true}
    -
    -\def\markdownRendererInterblockSeparator{}
    -\def\markdownRendererUlBeginTight{ (}
    -\def\markdownRendererUlItem{%
    -  \def\markdownRendererUlItem{%
    -    ,
    -    \def\markdownRendererUlItem{, and }%
    -  }%
    -}
    -\def\markdownRendererUlItemEnd{}
    -\def\markdownRendererUlEndTight{).}
    -
    -\markdownBegin
    -This is a tight list
    -
    -- the first item
    -- the second item
    -- the third item
    -\markdownEnd
    -
    -\def\markdownRendererInterblockSeparator{%
    -  :\par
    -  \def\markdownRendererInterblockSeparator{\par}%
    -}
    -\def\markdownRendererUlBegin{}
    -\def\markdownRendererUlItem{--\kern 0.5em}
    -\def\markdownRendererUlItemEnd{.\par}
    -\def\markdownRendererUlEnd{}
    -
    -\markdownBegin
    -This is a loose list
    -
    -- This is the first item
    -
    -- This is the second item
    -
    -- This is the third item
    -\markdownEnd
    -
    -\bye
    -

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    \input markdown
    +\def\markdownOptionTightLists{true}
    +
    +\def\markdownRendererInterblockSeparator{}
    +\def\markdownRendererUlBeginTight{ (}
    +\def\markdownRendererUlItem{%
    +  \def\markdownRendererUlItem{%
    +    ,
    +    \def\markdownRendererUlItem{, and }%
    +  }%
    +}
    +\def\markdownRendererUlItemEnd{}
    +\def\markdownRendererUlEndTight{).}
    +
    +\markdownBegin
    +This is a tight list
    +
    +- the first item
    +- the second item
    +- the third item
    +\markdownEnd
    +
    +\def\markdownRendererInterblockSeparator{%
    +  :\par
    +  \def\markdownRendererInterblockSeparator{\par}%
    +}
    +\def\markdownRendererUlBegin{}
    +\def\markdownRendererUlItem{--\kern 0.5em}
    +\def\markdownRendererUlItemEnd{.\par}
    +\def\markdownRendererUlEnd{}
    +
    +\markdownBegin
    +This is a loose list
    +
    +- This is the first item
    +
    +- This is the second item
    +
    +- This is the third item
    +\markdownEnd
    +
    +\bye
    +

    Next, invoke LuaTeX from the terminal:

    +
    luatex document.tex

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

    This is a tight list (the first item, the second item, and the third item).

    @@ -4883,57 +4998,57 @@ Thomas,Edison,1847
  • This is the third item.

  • -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[tightLists]{markdown}
    -\begin{document}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    interblockSeparator = {},
    -    ulBeginTight = { (},
    -    ulItem = {%
    -      \def\markdownRendererUlItem{%
    -        ,
    -        \def\markdownRendererUlItem{, and }%
    -      }%
    -    },
    -    ulItemEnd = {},
    -    ulEndTight = {).},
    -  },
    -}
    -This is a tight list
    -
    -- the first item
    -- the second item
    -- the third item
    -\end{markdown*}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    interblockSeparator = {%
    -      :\par
    -      \def\markdownRendererInterblockSeparator{\par}%
    -    },
    -    ulBeginTight = {\begin{itemize}},
    -    ulItem = {\item},
    -    ulItemEnd = {.},
    -    ulEnd = {\end{itemize}},
    -  },
    -}
    -This is a loose list
    -
    -- This is the first item
    -
    -- This is the second item
    -
    -- This is the third item
    -\end{markdown*}
    -
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[tightLists]{markdown}
    +\begin{document}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    interblockSeparator = {},
    +    ulBeginTight = { (},
    +    ulItem = {%
    +      \def\markdownRendererUlItem{%
    +        ,
    +        \def\markdownRendererUlItem{, and }%
    +      }%
    +    },
    +    ulItemEnd = {},
    +    ulEndTight = {).},
    +  },
    +}
    +This is a tight list
    +
    +- the first item
    +- the second item
    +- the third item
    +\end{markdown*}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    interblockSeparator = {%
    +      :\par
    +      \def\markdownRendererInterblockSeparator{\par}%
    +    },
    +    ulBeginTight = {\begin{itemize}},
    +    ulItem = {\item},
    +    ulItemEnd = {.},
    +    ulEnd = {\end{itemize}},
    +  },
    +}
    +This is a loose list
    +
    +- This is the first item
    +
    +- This is the second item
    +
    +- This is the third item
    +\end{markdown*}
    +
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    This is a tight list (the first item, the second item, and the third item).

    @@ -4946,51 +5061,51 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionTightLists{true}
    -\starttext
    -
    -\def\markdownRendererInterblockSeparator{}
    -\def\markdownRendererUlBeginTight{ (}
    -\def\markdownRendererUlItem{%
    -  \def\markdownRendererUlItem{%
    -    ,
    -    \def\markdownRendererUlItem{, and }%
    -  }%
    -}
    -\def\markdownRendererUlItemEnd{}
    -\def\markdownRendererUlEndTight{).}
    -
    -\startmarkdown
    -This is a tight list
    -
    -- the first item
    -- the second item
    -- the third item
    -\stopmarkdown
    -
    -\def\markdownRendererInterblockSeparator{%
    -  :\par
    -  \def\markdownRendererInterblockSeparator{\par}%
    -}
    -\def\markdownRendererUlBegin{\startitemize}
    -\def\markdownRendererUlItem{\item}
    -\def\markdownRendererUlItemEnd{.}
    -\def\markdownRendererUlEnd{\stopitemize}
    -
    -\startmarkdown
    -This is a loose list
    -
    -- This is the first item
    -
    -- This is the second item
    -
    -- This is the third item
    -\stopmarkdown
    -
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionTightLists{true}
    +\starttext
    +
    +\def\markdownRendererInterblockSeparator{}
    +\def\markdownRendererUlBeginTight{ (}
    +\def\markdownRendererUlItem{%
    +  \def\markdownRendererUlItem{%
    +    ,
    +    \def\markdownRendererUlItem{, and }%
    +  }%
    +}
    +\def\markdownRendererUlItemEnd{}
    +\def\markdownRendererUlEndTight{).}
    +
    +\startmarkdown
    +This is a tight list
    +
    +- the first item
    +- the second item
    +- the third item
    +\stopmarkdown
    +
    +\def\markdownRendererInterblockSeparator{%
    +  :\par
    +  \def\markdownRendererInterblockSeparator{\par}%
    +}
    +\def\markdownRendererUlBegin{\startitemize}
    +\def\markdownRendererUlItem{\item}
    +\def\markdownRendererUlItemEnd{.}
    +\def\markdownRendererUlEnd{\stopitemize}
    +
    +\startmarkdown
    +This is a loose list
    +
    +- This is the first item
    +
    +- This is the second item
    +
    +- This is the third item
    +\stopmarkdown
    +
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    This is a tight list (the first item, the second item, and the third item).

    @@ -5011,68 +5126,68 @@ Thomas,Edison,1847

    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

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

    -
    \input markdown
    -\def\markdownOptionTightLists{true}
    -\def\markdownOptionStartNumber{true}
    -
    -\def\markdownRendererInterblockSeparator{}
    -\def\markdownRendererOlBeginTight{ (}
    -\def\markdownRendererOlItemWithNumber#1{%
    -  \ifnum #1=1\relax
    -    the first
    -  \else
    -    \ifnum #1=2\relax
    -      , the second
    -    \else
    -      , and the third
    -    \fi
    -  \fi
    -}
    -\def\markdownRendererOlItemEnd{}
    -\def\markdownRendererOlEndTight{).}
    -
    -\markdownBegin
    -This is a tight list
    -
    -1. item
    -2. item
    -3. item
    -\markdownEnd
    -
    -\def\markdownRendererInterblockSeparator{%
    -  :\par
    -  \def\markdownRendererInterblockSeparator{\par}%
    -}
    -\def\markdownRendererOlBegin{}
    -\def\markdownRendererOlItemWithNumber#1{%
    -  #1.\kern 0.5em%
    -  This is the
    -  \ifnum #1=1\relax
    -    first
    -  \else
    -    \ifnum #1=2\relax
    -      second
    -    \else
    -      third
    -    \fi
    -  \fi
    -}
    -\def\markdownRendererOlItemEnd{.\par}
    -\def\markdownRendererOlEnd{}
    -
    -\markdownBegin
    -This is a loose list
    -
    -1. item
    -
    -2. item
    -
    -3. item
    -\markdownEnd
    -
    -\bye
    +
    \input markdown
    +\def\markdownOptionTightLists{true}
    +\def\markdownOptionStartNumber{true}
    +
    +\def\markdownRendererInterblockSeparator{}
    +\def\markdownRendererOlBeginTight{ (}
    +\def\markdownRendererOlItemWithNumber#1{%
    +  \ifnum #1=1\relax
    +    the first
    +  \else
    +    \ifnum #1=2\relax
    +      , the second
    +    \else
    +      , and the third
    +    \fi
    +  \fi
    +}
    +\def\markdownRendererOlItemEnd{}
    +\def\markdownRendererOlEndTight{).}
    +
    +\markdownBegin
    +This is a tight list
    +
    +1. item
    +2. item
    +3. item
    +\markdownEnd
    +
    +\def\markdownRendererInterblockSeparator{%
    +  :\par
    +  \def\markdownRendererInterblockSeparator{\par}%
    +}
    +\def\markdownRendererOlBegin{}
    +\def\markdownRendererOlItemWithNumber#1{%
    +  #1.\kern 0.5em%
    +  This is the
    +  \ifnum #1=1\relax
    +    first
    +  \else
    +    \ifnum #1=2\relax
    +      second
    +    \else
    +      third
    +    \fi
    +  \fi
    +}
    +\def\markdownRendererOlItemEnd{.\par}
    +\def\markdownRendererOlEnd{}
    +
    +\markdownBegin
    +This is a loose list
    +
    +1. item
    +
    +2. item
    +
    +3. item
    +\markdownEnd
    +
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    This is a tight list (the first item, the second item, and the third item).

    @@ -5083,73 +5198,73 @@ Thomas,Edison,1847
  • This is the third item.

  • -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[tightLists, startNumber]{markdown}
    -\begin{document}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    interblockSeparator = {},
    -    olBeginTight = { (},
    -    olItemWithNumber = {%
    -      \ifnum #1=1\relax
    -        the first
    -      \else
    -        \ifnum #1=2\relax
    -          , the second
    -        \else
    -          , and the third
    -        \fi
    -      \fi
    -    },
    -    olItemEnd = {},
    -    olEndTight = {).},
    -  },
    -}
    -This is a tight list
    -
    -1. item
    -2. item
    -3. item
    -\end{markdown*}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    interblockSeparator = {%
    -      :\par
    -      \def\markdownRendererInterblockSeparator{\par}%
    -    },
    -    olBeginTight = {\begin{enumerate}},
    -    olItemWithNumber = {%
    -      \item This is the
    -      \ifnum #1=1\relax
    -        first
    -      \else
    -        \ifnum #1=2\relax
    -          second
    -        \else
    -          third
    -        \fi
    -      \fi
    -    },
    -    olItemEnd = {.},
    -    olEnd = {\end{enumerate}},
    -  },
    -}
    -This is a loose list
    -
    -1. item
    -
    -2. item
    -
    -3. item
    -\end{markdown*}
    -
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[tightLists, startNumber]{markdown}
    +\begin{document}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    interblockSeparator = {},
    +    olBeginTight = { (},
    +    olItemWithNumber = {%
    +      \ifnum #1=1\relax
    +        the first
    +      \else
    +        \ifnum #1=2\relax
    +          , the second
    +        \else
    +          , and the third
    +        \fi
    +      \fi
    +    },
    +    olItemEnd = {},
    +    olEndTight = {).},
    +  },
    +}
    +This is a tight list
    +
    +1. item
    +2. item
    +3. item
    +\end{markdown*}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    interblockSeparator = {%
    +      :\par
    +      \def\markdownRendererInterblockSeparator{\par}%
    +    },
    +    olBeginTight = {\begin{enumerate}},
    +    olItemWithNumber = {%
    +      \item This is the
    +      \ifnum #1=1\relax
    +        first
    +      \else
    +        \ifnum #1=2\relax
    +          second
    +        \else
    +          third
    +        \fi
    +      \fi
    +    },
    +    olItemEnd = {.},
    +    olEnd = {\end{enumerate}},
    +  },
    +}
    +This is a loose list
    +
    +1. item
    +
    +2. item
    +
    +3. item
    +\end{markdown*}
    +
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

    This is a tight list (the first item, the second item, and the third item).

    @@ -5162,69 +5277,69 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionTightLists{true}
    -\def\markdownOptionStartNumber{true}
    -\starttext
    -
    -\def\markdownRendererInterblockSeparator{}
    -\def\markdownRendererOlBeginTight{ (}
    -\def\markdownRendererOlItemWithNumber#1{%
    -  \ifnum #1=1\relax
    -    the first
    -  \else
    -    \ifnum #1=2\relax
    -      , the second
    -    \else
    -      , and the third
    -    \fi
    -  \fi
    -}
    -\def\markdownRendererOlItemEnd{}
    -\def\markdownRendererOlEndTight{).}
    -
    -\startmarkdown
    -This is a tight list
    -
    -1. item
    -2. item
    -3. item
    -\stopmarkdown
    -
    -\def\markdownRendererInterblockSeparator{%
    -  :\par
    -  \def\markdownRendererInterblockSeparator{\par}%
    -}
    -\def\markdownRendererOlBegin{\startitemize}
    -\def\markdownRendererOlItemWithNumber#1{%
    -  \sym{#1.}
    -  This is the
    -  \ifnum #1=1\relax
    -    first
    -  \else
    -    \ifnum #1=2\relax
    -      second
    -    \else
    -      third
    -    \fi
    -  \fi
    -}
    -\def\markdownRendererOlItemEnd{.\par}
    -\def\markdownRendererOlEnd{\stopitemize}
    -
    -\startmarkdown
    -This is a loose list
    -
    -1. item
    -
    -2. item
    -
    -3. item
    -\stopmarkdown
    -
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionTightLists{true}
    +\def\markdownOptionStartNumber{true}
    +\starttext
    +
    +\def\markdownRendererInterblockSeparator{}
    +\def\markdownRendererOlBeginTight{ (}
    +\def\markdownRendererOlItemWithNumber#1{%
    +  \ifnum #1=1\relax
    +    the first
    +  \else
    +    \ifnum #1=2\relax
    +      , the second
    +    \else
    +      , and the third
    +    \fi
    +  \fi
    +}
    +\def\markdownRendererOlItemEnd{}
    +\def\markdownRendererOlEndTight{).}
    +
    +\startmarkdown
    +This is a tight list
    +
    +1. item
    +2. item
    +3. item
    +\stopmarkdown
    +
    +\def\markdownRendererInterblockSeparator{%
    +  :\par
    +  \def\markdownRendererInterblockSeparator{\par}%
    +}
    +\def\markdownRendererOlBegin{\startitemize}
    +\def\markdownRendererOlItemWithNumber#1{%
    +  \sym{#1.}
    +  This is the
    +  \ifnum #1=1\relax
    +    first
    +  \else
    +    \ifnum #1=2\relax
    +      second
    +    \else
    +      third
    +    \fi
    +  \fi
    +}
    +\def\markdownRendererOlItemEnd{.\par}
    +\def\markdownRendererOlEnd{\stopitemize}
    +
    +\startmarkdown
    +This is a loose list
    +
    +1. item
    +
    +2. item
    +
    +3. item
    +\stopmarkdown
    +
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    This is a tight list (the first item, the second item, and the third item).

    @@ -5247,86 +5362,86 @@ Thomas,Edison,1847

    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

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

    -
    luatex document.tex
    +
    luatex document.tex

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

    This is a tight definition list:

    @@ -5344,90 +5459,90 @@ Thomas,Edison,1847

    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:

    -
    \documentclass{article}
    -\usepackage[definitionLists, tightLists]{markdown}
    -\begin{document}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    interblockSeparator = {%
    -      :%
    -      \def\markdownRendererInterblockSeparator{\par}%
    -    },
    -    dlBeginTight = {\begin{description}},
    -    dlItem = {%
    -      \item[#1]
    -      \begin{itemize}
    -      \def\markdownRendererDlDefinitionEnd{%
    -        ,
    -        \def\markdownRendererDlDefinitionEnd{%
    -          , and
    -          \def\markdownRendererDlDefinitionEnd{.}%
    -        }%
    -      }%
    -    },
    -    dlItemEnd = {\end{itemize}},
    -    dlDefinitionBegin = \item,
    -    dlEndTight = {\end{description}},
    -  },
    -}
    -This is a tight definition list
    -
    -Coffee
    -:   black hot drink
    -:   prepared from roasted coffee beans
    -:   one of the most traded agricultural commodities in the world
    -
    -Milk
    -:   white cold drink
    -:   nutrient-rich
    -:   produced on an industrial scale
    -\end{markdown*}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    interblockSeparator = {%
    -      \def\markdownRendererInterblockSeparator{\par}%
    -    },
    -    dlBegin = {},
    -    dlItem = {%
    -      . #1 is a
    -      \def\markdownRendererDlDefinitionBegin{%
    -        \def\markdownRendererDlDefinitionBegin{%
    -          ,
    -          \def\markdownRendererDlDefinitionBegin{, and }%
    -        }%
    -      }%
    -    },
    -    dlItemEnd = {},
    -    dlDefinitionEnd = {},
    -    dlEnd = {.},
    -  },
    -}
    -This is a loose definition list
    -
    -Coffee
    -
    -:   black hot drink
    -
    -:   prepared from roasted coffee beans
    -
    -:   one of the most traded agricultural commodities in the world
    -
    -Milk
    -
    -:   white cold drink
    -
    -:   nutrient-rich
    -
    -:   produced on an industrial scale
    -\end{markdown*}
    -
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[definitionLists, tightLists]{markdown}
    +\begin{document}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    interblockSeparator = {%
    +      :%
    +      \def\markdownRendererInterblockSeparator{\par}%
    +    },
    +    dlBeginTight = {\begin{description}},
    +    dlItem = {%
    +      \item[#1]
    +      \begin{itemize}
    +      \def\markdownRendererDlDefinitionEnd{%
    +        ,
    +        \def\markdownRendererDlDefinitionEnd{%
    +          , and
    +          \def\markdownRendererDlDefinitionEnd{.}%
    +        }%
    +      }%
    +    },
    +    dlItemEnd = {\end{itemize}},
    +    dlDefinitionBegin = \item,
    +    dlEndTight = {\end{description}},
    +  },
    +}
    +This is a tight definition list
    +
    +Coffee
    +:   black hot drink
    +:   prepared from roasted coffee beans
    +:   one of the most traded agricultural commodities in the world
    +
    +Milk
    +:   white cold drink
    +:   nutrient-rich
    +:   produced on an industrial scale
    +\end{markdown*}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    interblockSeparator = {%
    +      \def\markdownRendererInterblockSeparator{\par}%
    +    },
    +    dlBegin = {},
    +    dlItem = {%
    +      . #1 is a
    +      \def\markdownRendererDlDefinitionBegin{%
    +        \def\markdownRendererDlDefinitionBegin{%
    +          ,
    +          \def\markdownRendererDlDefinitionBegin{, and }%
    +        }%
    +      }%
    +    },
    +    dlItemEnd = {},
    +    dlDefinitionEnd = {},
    +    dlEnd = {.},
    +  },
    +}
    +This is a loose definition list
    +
    +Coffee
    +
    +:   black hot drink
    +
    +:   prepared from roasted coffee beans
    +
    +:   one of the most traded agricultural commodities in the world
    +
    +Milk
    +
    +:   white cold drink
    +
    +:   nutrient-rich
    +
    +:   produced on an industrial scale
    +\end{markdown*}
    +
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

    This is a tight definition list:

    @@ -5447,85 +5562,85 @@ Thomas,Edison,1847
    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
    +
    \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:

    -
    context document.tex
    +
    context document.tex

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

    This is a tight definition list:

    @@ -5547,41 +5662,41 @@ Thomas,Edison,1847

    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

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

    -
    \input markdown
    -\def\markdownRendererEmphasis#1{{\it#1}}
    -\def\markdownRendererStrongEmphasis#1{{\bf#1}}
    -\markdownBegin
    -This is *emphasis*.
    -
    -This is **strong emphasis**.
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownRendererEmphasis#1{{\it#1}}
    +\def\markdownRendererStrongEmphasis#1{{\bf#1}}
    +\markdownBegin
    +This is *emphasis*.
    +
    +This is **strong emphasis**.
    +\markdownEnd
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    This is emphasis.

    This is strong emphasis.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    emphasis = {\emph{#1}},
    -    strongEmphasis = {\textbf{#1}},
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -This is *emphasis*.
    -
    -This is **strong emphasis**.
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  renderers = {
    +    emphasis = {\emph{#1}},
    +    strongEmphasis = {\textbf{#1}},
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +This is *emphasis*.
    +
    +This is **strong emphasis**.
    +\end{markdown}
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

    This is emphasis.

    @@ -5589,18 +5704,18 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererEmphasis#1{\emph{#1}}
    -\def\markdownRendererStrongEmphasis#1{\bold{#1}}
    -\starttext
    -\startmarkdown
    -This is *emphasis*.
    -
    -This is **strong emphasis**.
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownRendererEmphasis#1{\emph{#1}}
    +\def\markdownRendererStrongEmphasis#1{\bold{#1}}
    +\starttext
    +\startmarkdown
    +This is *emphasis*.
    +
    +This is **strong emphasis**.
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    This is emphasis.

    @@ -5612,29 +5727,29 @@ Thomas,Edison,1847

    The \markdownRendererBlockQuoteEnd macro represents the end of a block quote. 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\markdownRendererBlockQuoteBegin{%
    -  \begingroup
    -  \vskip\parindent
    -  \leftskip=2\parindent
    -  \parindent=0pt
    -}
    -\def\markdownRendererBlockQuoteEnd{%
    -  \par
    -  \vskip\parindent
    -  \endgroup
    -}
    -\markdownBegin
    -A quote from William Shakespeare's King Lear:
    -
    -> This is the excellent foppery of the world that when we are
    -> sick in fortune---often the surfeit of our own behavior---we
    -> make guilty of our disasters the sun, the moon, and the
    -> stars [...]
    -\markdownEnd
    -\bye
    -

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    \input markdown
    +\def\markdownRendererBlockQuoteBegin{%
    +  \begingroup
    +  \vskip\parindent
    +  \leftskip=2\parindent
    +  \parindent=0pt
    +}
    +\def\markdownRendererBlockQuoteEnd{%
    +  \par
    +  \vskip\parindent
    +  \endgroup
    +}
    +\markdownBegin
    +A quote from William Shakespeare's King Lear:
    +
    +> This is the excellent foppery of the world that when we are
    +> sick in fortune---often the surfeit of our own behavior---we
    +> make guilty of our disasters the sun, the moon, and the
    +> stars [...]
    +\markdownEnd
    +\bye
    +

    Next, invoke LuaTeX from the terminal:

    +
    luatex document.tex

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

    A quote from William Shakespeare’s King Lear:

    @@ -5642,28 +5757,28 @@ Thomas,Edison,1847

    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:

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    blockQuoteBegin = {\begin{quote}},
    -    blockQuoteEnd = {\end{quote}},
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -A quote from William Shakespeare's King Lear:
    -
    -> This is the excellent foppery of the world that when we are
    -> sick in fortune---often the surfeit of our own behavior---we
    -> make guilty of our disasters the sun, the moon, and the
    -> stars [...]
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  renderers = {
    +    blockQuoteBegin = {\begin{quote}},
    +    blockQuoteEnd = {\end{quote}},
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +A quote from William Shakespeare's King Lear:
    +
    +> This is the excellent foppery of the world that when we are
    +> sick in fortune---often the surfeit of our own behavior---we
    +> make guilty of our disasters the sun, the moon, and the
    +> stars [...]
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    A quote from William Shakespeare’s King Lear:

    @@ -5673,21 +5788,21 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererBlockQuoteBegin{\startquotation}
    -\def\markdownRendererBlockQuoteEnd{\stopquotation}
    -\starttext
    -\startmarkdown
    -A quote from William Shakespeare's King Lear:
    -
    -> This is the excellent foppery of the world that when we are
    -> sick in fortune---often the surfeit of our own behavior---we
    -> make guilty of our disasters the sun, the moon, and the
    -> stars [...]
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownRendererBlockQuoteBegin{\startquotation}
    +\def\markdownRendererBlockQuoteEnd{\stopquotation}
    +\starttext
    +\startmarkdown
    +A quote from William Shakespeare's King Lear:
    +
    +> This is the excellent foppery of the world that when we are
    +> sick in fortune---often the surfeit of our own behavior---we
    +> make guilty of our disasters the sun, the moon, and the
    +> stars [...]
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    A quote from William Shakespeare’s King Lear:

    @@ -5698,75 +5813,75 @@ Thomas,Edison,1847

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

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

    -
    \documentclass{article}
    -\usepackage{verbatim}
    -\usepackage[hyphens]{url}
    -\usepackage[fencedCode]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    interblockSeparator = {
    -      \def\markdownRendererInterblockSeparator{%
    -        \par
    -        \def\markdownRendererInterblockSeparator{%
    -          \def\markdownRendererInterblockSeparator{%
    -            \par
    -          }%
    -        }%
    -      }%
    -    },
    -    inputVerbatim = {
    -      is contained in file \url{#1}:%
    -      \verbatiminput{#1}%
    -    },
    -    inputFencedCode = {
    -      in #2 \markdownRendererInputVerbatim{#1}%
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -The following code
    -
    -    def foo(bar):
    -      if len(bar) <= 1:
    -        return bar[0]
    -      elif len(bar) == 2:
    -        return sorted(bar)
    -      else:
    -        baz = len(bar) // 2
    -        return foo(bar[baz:], bar[:baz])
    -
    -The following code
    -
    -~~~ Python
    ->>> foo([4, 2, 1, 3])
    -[1, 2, 3, 4]
    -~~~~~~~~~~
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage{verbatim}
    +\usepackage[hyphens]{url}
    +\usepackage[fencedCode]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    interblockSeparator = {
    +      \def\markdownRendererInterblockSeparator{%
    +        \par
    +        \def\markdownRendererInterblockSeparator{%
    +          \def\markdownRendererInterblockSeparator{%
    +            \par
    +          }%
    +        }%
    +      }%
    +    },
    +    inputVerbatim = {
    +      is contained in file \url{#1}:%
    +      \verbatiminput{#1}%
    +    },
    +    inputFencedCode = {
    +      in #2 \markdownRendererInputVerbatim{#1}%
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +The following code
    +
    +    def foo(bar):
    +      if len(bar) <= 1:
    +        return bar[0]
    +      elif len(bar) == 2:
    +        return sorted(bar)
    +      else:
    +        baz = len(bar) // 2
    +        return foo(bar[baz:], bar[:baz])
    +
    +The following code
    +
    +~~~ Python
    +>>> foo([4, 2, 1, 3])
    +[1, 2, 3, 4]
    +~~~~~~~~~~
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

    A PDF document named document.pdf should be produced and contain the following text except for the filename, which may differ:

    The following code is contained in file ./_markdown_document/882453149edcf288976647f6fe147ada.verbatim:

    -
    def foo(bar):
    -  if len(bar) <= 1:
    -    return bar[:1]
    -  elif len(bar) == 2:
    -    return sorted(bar)
    -  else:
    -    baz = bar[len(bar) // 2]
    -    return (
    -      foo([qux for qux in bar if qux < baz]) + [baz] +
    -      foo([qux for qux in bar if qux > baz])
    -    )
    +
    def foo(bar):
    +  if len(bar) <= 1:
    +    return bar[:1]
    +  elif len(bar) == 2:
    +    return sorted(bar)
    +  else:
    +    baz = bar[len(bar) // 2]
    +    return (
    +      foo([qux for qux in bar if qux < baz]) + [baz] +
    +      foo([qux for qux in bar if qux > baz])
    +    )

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

    -
    >>> foo([4, 2, 1, 3])
    -[1, 2, 3, 4]
    +
    >>> foo([4, 2, 1, 3])
    +[1, 2, 3, 4]
    -

    2.3.1.18 YAML Metadata Renderers

    +

    2.3.1.18 YAML Metadata Renderers

    The \markdownRendererJekyllDataBegin macro represents the beginning of a yaml document. This macro will only be produced when the jekyllData option is enabled. The macro receives no arguments.

    The \markdownRendererJekyllDataEnd macro represents the end of a yaml document. This macro will only be produced when the jekyllData option is enabled. The macro receives no arguments.

    The \markdownRendererJekyllDataMappingBegin macro represents the beginning of a mapping in a yaml document. This macro will only be produced when the jekyllData option is enabled. The macro receives two arguments: the scalar key in the parent structure, cast to a string following yaml serialization rules, and the number of items in the mapping.

    @@ -5779,72 +5894,72 @@ Thomas,Edison,1847

    The \markdownRendererJekyllDataEmpty macro represents an empty scalar value in a yaml document. This macro will only be produced when the jekyllData option is enabled. The macro receives one argument: the scalar key in the parent structure, cast to a string following yaml serialization rules.

    Plain TeX Example

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

    -
    \input markdown
    -\def\markdownOptionJekyllData{true}
    -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
    -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
    -\def\markdownRendererJekyllDataEnd{%
    -  \name{} is \age{} years old.}
    -\markdownBegin
    ----
    -name: Jane Doe
    -age:  99
    ----
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownOptionJekyllData{true}
    +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
    +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
    +\def\markdownRendererJekyllDataEnd{%
    +  \name{} is \age{} years old.}
    +\markdownBegin
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\markdownEnd
    +\bye

    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:

    Jane Doe is 99 years old.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[jekyllData]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    jekyllDataString = {\gdef\name{#2}},
    -    jekyllDataNumber = {\gdef\age{#2}},
    -    jekyllDataEnd = {\name{} is \age{} years old.},
    -  }
    -}
    -\begin{document}
    -
    -\begin{markdown}
    ----
    -name: Jane Doe
    -age:  99
    ----
    -\end{markdown}
    -
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[jekyllData]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    jekyllDataString = {\gdef\name{#2}},
    +    jekyllDataNumber = {\gdef\age{#2}},
    +    jekyllDataEnd = {\name{} is \age{} years old.},
    +  }
    +}
    +\begin{document}
    +
    +\begin{markdown}
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    Jane Doe is 99 years old.

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionJekyllData{true}
    -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
    -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
    -\def\markdownRendererJekyllDataEnd{%
    -  \name{} is \age{} years old.}
    -\starttext
    -
    -\startmarkdown
    ----
    -name: Jane Doe
    -age:  99
    ----
    -\stopmarkdown
    -
    -\stoptext
    -

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    \usemodule[t][markdown]
    +\def\markdownOptionJekyllData{true}
    +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
    +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
    +\def\markdownRendererJekyllDataEnd{%
    +  \name{} is \age{} years old.}
    +\starttext
    +
    +\startmarkdown
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    Jane Doe is 99 years old.

    @@ -5858,79 +5973,79 @@ Thomas,Edison,1847

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

    Plain TeX Example

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

    -
    \input markdown
    -\def\markdownRendererInterblockSeparator{}
    -\def\markdownRendererHeadingOne{1}
    -\def\markdownRendererHeadingTwo{2}
    -\def\markdownRendererHeadingThree{3}
    -\def\markdownRendererHeadingFour{4}
    -\def\markdownRendererHeadingFive{5}
    -\def\markdownRendererHeadingSix{6}
    -\markdownBegin
    -######
    -#####
    -#####
    -###
    -######
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownRendererInterblockSeparator{}
    +\def\markdownRendererHeadingOne{1}
    +\def\markdownRendererHeadingTwo{2}
    +\def\markdownRendererHeadingThree{3}
    +\def\markdownRendererHeadingFour{4}
    +\def\markdownRendererHeadingFive{5}
    +\def\markdownRendererHeadingSix{6}
    +\markdownBegin
    +######
    +#####
    +#####
    +###
    +######
    +\markdownEnd
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

    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:

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    interblockSeparator = {},
    -    headingOne = 1,
    -    headingTwo = 2,
    -    headingThree = 3,
    -    headingFour = 4,
    -    headingFive = 5,
    -    headingSix = 6,
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -######
    -#####
    -#####
    -###
    -######
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  renderers = {
    +    interblockSeparator = {},
    +    headingOne = 1,
    +    headingTwo = 2,
    +    headingThree = 3,
    +    headingFour = 4,
    +    headingFive = 5,
    +    headingSix = 6,
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +######
    +#####
    +#####
    +###
    +######
    +\end{markdown}
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

    65536

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererInterblockSeparator{}
    -\def\markdownRendererHeadingOne{1}
    -\def\markdownRendererHeadingTwo{2}
    -\def\markdownRendererHeadingThree{3}
    -\def\markdownRendererHeadingFour{4}
    -\def\markdownRendererHeadingFive{5}
    -\def\markdownRendererHeadingSix{6}
    -\starttext
    -\startmarkdown
    -######
    -#####
    -#####
    -###
    -######
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownRendererInterblockSeparator{}
    +\def\markdownRendererHeadingOne{1}
    +\def\markdownRendererHeadingTwo{2}
    +\def\markdownRendererHeadingThree{3}
    +\def\markdownRendererHeadingFour{4}
    +\def\markdownRendererHeadingFive{5}
    +\def\markdownRendererHeadingSix{6}
    +\starttext
    +\startmarkdown
    +######
    +#####
    +#####
    +###
    +######
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    65536

    @@ -5939,44 +6054,44 @@ Thomas,Edison,1847

    The \markdownRendererHorizontalRule macro represents a horizontal rule. 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\markdownRendererHorizontalRule{\vfil\break}
    -\markdownBegin
    -This is the first page.
    -
    -***
    -
    -This is the second page.
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownRendererHorizontalRule{\vfil\break}
    +\markdownBegin
    +This is the first page.
    +
    +***
    +
    +This is the second page.
    +\markdownEnd
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    This is the first page.


    This is the second page.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  renderers = {
    -    horizontalRule = \newpage,
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -This is the first page.
    -
    -***
    -
    -This is the second page.
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  renderers = {
    +    horizontalRule = \newpage,
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +This is the first page.
    +
    +***
    +
    +This is the second page.
    +\end{markdown}
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

    This is the first page.

    @@ -5985,19 +6100,19 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererHorizontalRule{\page[yes]}
    -\starttext
    -\startmarkdown
    -This is the first page.
    -
    -***
    -
    -This is the second page.
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownRendererHorizontalRule{\page[yes]}
    +\starttext
    +\startmarkdown
    +This is the first page.
    +
    +***
    +
    +This is the second page.
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    This is the first page.

    @@ -6008,163 +6123,163 @@ Thomas,Edison,1847

    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:

    -
    \input markdown
    -\def\markdownOptionFootnotes{true}
    -\def\markdownRendererFootnote#1{ (and \lowercase{#1})}
    -\markdownBegin
    -This is some text[^1] and this is some other text[^2].
    -
    - [^1]: this is a footnote
    -
    - [^2]: this is some other footnote
    -\markdownEnd
    -\bye
    +
    \input markdown
    +\def\markdownOptionFootnotes{true}
    +\def\markdownRendererFootnote#1{ (and \lowercase{#1})}
    +\markdownBegin
    +This is some text[^1] and this is some other text[^2].
    +
    + [^1]: this is a footnote
    +
    + [^2]: this is some other footnote
    +\markdownEnd
    +\bye

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    luatex document.tex

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

    This is some text (and this is a footnote) and this is some other text (and this is some other footnote).

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[footnotes]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    footnote = { (and \MakeLowercase{#1})},
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -This is some text[^1] and this is some other text[^2].
    -
    - [^1]: this is a footnote
    -
    - [^2]: this is some other footnote
    -\end{markdown}
    -\end{document}
    +
    \documentclass{article}
    +\usepackage[footnotes]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    footnote = { (and \MakeLowercase{#1})},
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +This is some text[^1] and this is some other text[^2].
    +
    + [^1]: this is a footnote
    +
    + [^2]: this is some other footnote
    +\end{markdown}
    +\end{document}

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    lualatex document.tex

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

    This is some text (and this is a footnote) and this is some other text (and this is some other footnote).

    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownOptionFootnotes{true}
    -\def\markdownRendererFootnote#1{ (and \lowercase{#1})}
    -\starttext
    -\startmarkdown
    -This is some text[^1] and this is some other text[^2].
    -
    - [^1]: this is a footnote
    -
    - [^2]: this is some other footnote
    -\stopmarkdown
    -\stoptext
    +
    \usemodule[t][markdown]
    +\def\markdownOptionFootnotes{true}
    +\def\markdownRendererFootnote#1{ (and \lowercase{#1})}
    +\starttext
    +\startmarkdown
    +This is some text[^1] and this is some other text[^2].
    +
    + [^1]: this is a footnote
    +
    + [^2]: this is some other footnote
    +\stopmarkdown
    +\stoptext

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    context document.tex

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

    This is some text (and this is a footnote) and this is some other text (and this is some other footnote).

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

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

    -
    \documentclass{article}
    -\usepackage[citations]{markdown}
    -\newcount\citationsCounter
    -\newcount\citationsTotal
    -\makeatletter
    -\def\citations#1#2#3#4{%
    -  a parenthesized citation \emph{#4}
    -  \advance\citationsCounter by 1\relax
    -  \ifx\relax#2\relax
    -    \ifx\relax#3\relax\else
    -      with a postfix \emph{#3}%
    -    \fi
    -  \else
    -    with a prefix \emph{#2}%
    -    \ifx\relax#3\relax\else
    -      \ and a postfix \emph{#3}%
    -    \fi
    -  \fi
    -  \ifnum\citationsCounter>\citationsTotal\relax
    -    .%
    -    \expandafter\@gobble
    -  \else
    -    , and
    -  \fi\citations}
    -\makeatother
    -\markdownSetup{
    -  renderers = {
    -    cite = {%
    -      \citationsCounter=1%
    -      \citationsTotal=#1%
    -      This is
    -      \expandafter\citations
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -[see @abrahams90, pp. 12; @eijkhout91, pp. 34]
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[citations]{markdown}
    +\newcount\citationsCounter
    +\newcount\citationsTotal
    +\makeatletter
    +\def\citations#1#2#3#4{%
    +  a parenthesized citation \emph{#4}
    +  \advance\citationsCounter by 1\relax
    +  \ifx\relax#2\relax
    +    \ifx\relax#3\relax\else
    +      with a postfix \emph{#3}%
    +    \fi
    +  \else
    +    with a prefix \emph{#2}%
    +    \ifx\relax#3\relax\else
    +      \ and a postfix \emph{#3}%
    +    \fi
    +  \fi
    +  \ifnum\citationsCounter>\citationsTotal\relax
    +    .%
    +    \expandafter\@gobble
    +  \else
    +    , and
    +  \fi\citations}
    +\makeatother
    +\markdownSetup{
    +  renderers = {
    +    cite = {%
    +      \citationsCounter=1%
    +      \citationsTotal=#1%
    +      This is
    +      \expandafter\citations
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +[see @abrahams90, pp. 12; @eijkhout91, pp. 34]
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    This is a parenthesized citation abrahams90 with a prefix see and a postfix pp. 12, and a citation eijkhout91 with a postfix pp. 34.

    2.3.1.23 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 enabled. The macro receives parameters in the same format as the macro.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[citations]{markdown}
    -\newcount\citationsCounter
    -\newcount\citationsTotal
    -\makeatletter
    -\def\citations#1#2#3#4{%
    -  a text citation \emph{#4}
    -  \advance\citationsCounter by 1\relax
    -  \ifx\relax#2\relax
    -    \ifx\relax#3\relax\else
    -      with a postfix \emph{#3}%
    -    \fi
    -  \else
    -    with a prefix \emph{#2}%
    -    \ifx\relax#3\relax\else
    -      \ and a postfix \emph{#3}%
    -    \fi
    -  \fi
    -  \ifnum\citationsCounter>\citationsTotal\relax
    -    .%
    -    \expandafter\@gobble
    -  \else
    -    , and
    -  \fi\citations}
    -\makeatother
    -\markdownSetup{
    -  renderers = {
    -    textCite = {%
    -      \citationsCounter=1%
    -      \citationsTotal=#1%
    -      This is
    -      \expandafter\citations
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -@abrahams90 [pp. 12; also @eijkhout91]
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[citations]{markdown}
    +\newcount\citationsCounter
    +\newcount\citationsTotal
    +\makeatletter
    +\def\citations#1#2#3#4{%
    +  a text citation \emph{#4}
    +  \advance\citationsCounter by 1\relax
    +  \ifx\relax#2\relax
    +    \ifx\relax#3\relax\else
    +      with a postfix \emph{#3}%
    +    \fi
    +  \else
    +    with a prefix \emph{#2}%
    +    \ifx\relax#3\relax\else
    +      \ and a postfix \emph{#3}%
    +    \fi
    +  \fi
    +  \ifnum\citationsCounter>\citationsTotal\relax
    +    .%
    +    \expandafter\@gobble
    +  \else
    +    , and
    +  \fi\citations}
    +\makeatother
    +\markdownSetup{
    +  renderers = {
    +    textCite = {%
    +      \citationsCounter=1%
    +      \citationsTotal=#1%
    +      This is
    +      \expandafter\citations
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +@abrahams90 [pp. 12; also @eijkhout91]
    +\end{markdown}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    This is a text citation abrahams90 with a postfix pp. 12, and a citation eijkhout91 with a prefix also.

    @@ -6177,67 +6292,67 @@ Thomas,Edison,1847
  • c – The corresponding column is centered.
  • r – The corresponding column is right-aligned.
  • -
    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}
    -\newcount\rowCounter
    -\newcount\columnCounter
    -\makeatletter
    -\def\processRow#1{%
    -  \columnCounter=1%
    -  \ifnum\rowCounter=0\relax
    -    As for the alignment,
    -  \else
    -    In row \the\rowCounter,
    -  \fi
    -  \processColumn#1
    -  \advance\rowCounter by 1\relax
    -  \ifnum\rowCounter>\rowTotal\relax
    -    \expandafter\@gobble
    -  \fi\processRow}%
    -\def\processColumn#1{%
    -  column number \the\columnCounter{}
    -  \ifnum\rowCounter=0\relax
    -    \if#1d{}has default alignment\fi
    -    \if#1l{}is left-aligned\fi
    -    \if#1c{}is centered\fi
    -    \if#1r{}is right-aligned\fi
    -  \else
    -    says \emph{#1}%
    -  \fi
    -  \advance\columnCounter by 1\relax
    -  \ifnum\columnCounter<\columnTotal\relax, \fi
    -  \ifnum\columnCounter=\columnTotal\relax, and \fi
    -  \ifnum\columnCounter>\columnTotal\relax
    -    .\expandafter\@gobble
    -  \fi\processColumn}%
    -\makeatother
    -\markdownSetup{
    -  renderers = {
    -    table = {%
    -      This is a table with caption \emph{#1} that is #3 colums wide
    -      and #2 rows long.
    -      \rowCounter=0%
    -      \def\rowTotal{#2}%
    -      \def\columnTotal{#3}%
    -      \processRow
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -| Right | Left | Default | Center |
    -|------:|:-----|---------|:------:|
    -|   12  |  12  |    12   |    12  |
    -|  123  |  123 |   123   |   123  |
    -|    1  |    1 |     1   |     1  |
    -
    -  : Demonstration of pipe table syntax
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[pipeTables, tableCaptions]{markdown}
    +\newcount\rowCounter
    +\newcount\columnCounter
    +\makeatletter
    +\def\processRow#1{%
    +  \columnCounter=1%
    +  \ifnum\rowCounter=0\relax
    +    As for the alignment,
    +  \else
    +    In row \the\rowCounter,
    +  \fi
    +  \processColumn#1
    +  \advance\rowCounter by 1\relax
    +  \ifnum\rowCounter>\rowTotal\relax
    +    \expandafter\@gobble
    +  \fi\processRow}%
    +\def\processColumn#1{%
    +  column number \the\columnCounter{}
    +  \ifnum\rowCounter=0\relax
    +    \if#1d{}has default alignment\fi
    +    \if#1l{}is left-aligned\fi
    +    \if#1c{}is centered\fi
    +    \if#1r{}is right-aligned\fi
    +  \else
    +    says \emph{#1}%
    +  \fi
    +  \advance\columnCounter by 1\relax
    +  \ifnum\columnCounter<\columnTotal\relax, \fi
    +  \ifnum\columnCounter=\columnTotal\relax, and \fi
    +  \ifnum\columnCounter>\columnTotal\relax
    +    .\expandafter\@gobble
    +  \fi\processColumn}%
    +\makeatother
    +\markdownSetup{
    +  renderers = {
    +    table = {%
    +      This is a table with caption \emph{#1} that is #3 colums wide
    +      and #2 rows long.
    +      \rowCounter=0%
    +      \def\rowTotal{#2}%
    +      \def\columnTotal{#3}%
    +      \processRow
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +| Right | Left | Default | Center |
    +|------:|:-----|---------|:------:|
    +|   12  |  12  |    12   |    12  |
    +|  123  |  123 |   123   |   123  |
    +|    1  |    1 |     1   |     1  |
    +
    +  : Demonstration of pipe table syntax
    +\end{markdown}
    +\end{document}
    +

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

    @@ -6245,36 +6360,36 @@ Thomas,Edison,1847

    2.3.1.25 HTML Comment Renderers

    The \markdownRendererInlineHtmlComment macro represents the contents of an inline HTML comment. This macro will only be produced, when the html option is enabled. The macro receives a single argument that corresponds to the contents of the HTML comment.

    The \markdownRendererBlockHtmlCommentBegin and \markdownRendererBlockHtmlCommentEnd macros represent the beginning and the end of a block HTML comment. The macros receive no arguments.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[html]{markdown}
    -\usepackage{marginnote}
    -\markdownSetup{
    -  renderers = {
    -    inlineHtmlComment = {\marginnote{#1}},
    -    blockHtmlCommentBegin = {\begin{quote}},
    -    blockHtmlCommentEnd = {\end{quote}},
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -A useful use of inline HTML comments are side notes.
    -<!-- Side notes are displayed in the horizontal margins next to the relevant
    -passages, which makes them *easier for the reader to find* than footnotes. -->
    -
    -We can render block HTML comments as blockquotes:
    -
    -<!--
    -Here is a block HTML comment with a code example that a programmer might understand:
    -
    -    foo = bar + baz - 42
    --->
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    -lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[html]{markdown}
    +\usepackage{marginnote}
    +\markdownSetup{
    +  renderers = {
    +    inlineHtmlComment = {\marginnote{#1}},
    +    blockHtmlCommentBegin = {\begin{quote}},
    +    blockHtmlCommentEnd = {\end{quote}},
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +A useful use of inline HTML comments are side notes.
    +<!-- Side notes are displayed in the horizontal margins next to the relevant
    +passages, which makes them *easier for the reader to find* than footnotes. -->
    +
    +We can render block HTML comments as blockquotes:
    +
    +<!--
    +Here is a block HTML comment with a code example that a programmer might understand:
    +
    +    foo = bar + baz - 42
    +-->
    +\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 body text:

    A useful use of HTML comments are side notes.

    @@ -6291,28 +6406,28 @@ Thomas,Edison,1847

    2.3.1.26 HTML Tag and Element Renderers

    The \markdownRendererInlineHtmlTag macro represents an opening, closing, or empty inline HTML tag. This macro will only be produced, when the html option is enabled. The macro receives a single argument that corresponds to the contents of the HTML tag.

    The \markdownRendererInputBlockHtmlElement macro represents a block HTML element. This macro will only be produced, when the html option is enabled. The macro receives a single argument that filename of a file containing the contents of the HTML element.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[html]{markdown}
    -\usepackage{marginnote}
    -\usepackage{verbatim}
    -\markdownSetup{
    -  renderers = {
    -    inlineHtmlTag = {\textbf{#1}},
    -    inputBlockHtmlElement = {\verbatiminput{#1}},
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -<b>_Hello,_ world!</b><br/>
    -
    -<div>_Hello,_ world!</div>
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    -lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[html]{markdown}
    +\usepackage{marginnote}
    +\usepackage{verbatim}
    +\markdownSetup{
    +  renderers = {
    +    inlineHtmlTag = {\textbf{#1}},
    +    inputBlockHtmlElement = {\verbatiminput{#1}},
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +<b>_Hello,_ world!</b><br/>
    +
    +<div>_Hello,_ world!</div>
    +\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 body text:

    _Hello,_ world!

    @@ -6323,42 +6438,42 @@ Thomas,Edison,1847

    \markdownRendererAttributeIdentifier represents the ⟨identifier⟩ of a markdown element (id="identifier" in HTML and #identifier⟩ in Markdown’s headerAttributes syntax extension). The macro receives a single attribute that corresponds to the ⟨identifier⟩.

    \markdownRendererAttributeClassName represents the ⟨class name⟩ of a markdown element (class="class name⟩ …" in HTML and .class name⟩ in Markdown’s headerAttributes syntax extension). The macro receives a single attribute that corresponds to the .

    \markdownRendererAttributeKeyValue represents a HTML attribute in the form ⟨key=value⟩ that is neither an identifier nor a class name. The macro receives two attributes that correspond to the ⟨key⟩ and the ⟨value⟩, respectively.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[headerAttributes, underscores=false]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    attributeIdentifier = {%
    -      \par
    -      \emph{(Identifier: #1)}
    -      \par
    -    },
    -    attributeClassName = {%
    -      \par
    -      \emph{(Class name: #1)}
    -      \par
    -    },
    -    attributeKeyValue = {%
    -      \par
    -      \emph{(Key: #1, Value: #2)}
    -      \par
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -
    -# First top-level heading {jane=doe}
    -
    -## A subheading {#identifier}
    -
    -# Second top-level heading {.class_name}
    -
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[headerAttributes, underscores=false]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    attributeIdentifier = {%
    +      \par
    +      \emph{(Identifier: #1)}
    +      \par
    +    },
    +    attributeClassName = {%
    +      \par
    +      \emph{(Class name: #1)}
    +      \par
    +    },
    +    attributeKeyValue = {%
    +      \par
    +      \emph{(Key: #1, Value: #2)}
    +      \par
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +
    +# First top-level heading {jane=doe}
    +
    +## A subheading {#identifier}
    +
    +# Second top-level heading {.class_name}
    +
    +\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:

    First top-level heading

    @@ -6371,37 +6486,37 @@ Thomas,Edison,1847

    2.3.1.28 Header Attribute Context Renderers

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

    The \markdownRendererHeaderAttributeContextBegin and \markdownRendererHeaderAttributeContextEnd macros represent the beginning and the end of a section in which the attributes of a heading apply. The macros receive no arguments.

    -
    LaTeX Example
    +
    LaTeX Example

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

    -
    \documentclass{article}
    -\usepackage[headerAttributes]{markdown}
    -\markdownSetup{
    -  renderers = {
    -    headerAttributeContextBegin = {%
    -      \par
    -      \emph{(The beginning of a header attribute context)}
    -      \par
    -    },
    -    headerAttributeContextBegin = {%
    -      \par
    -      \emph{(The end of a header attribute context)}
    -      \par
    -    },
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -
    -# First top-level heading
    -
    -## A subheading {#identifier}
    -
    -# Second top-level heading {.class_name}
    -
    -\end{markdown}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    \documentclass{article}
    +\usepackage[headerAttributes]{markdown}
    +\markdownSetup{
    +  renderers = {
    +    headerAttributeContextBegin = {%
    +      \par
    +      \emph{(The beginning of a header attribute context)}
    +      \par
    +    },
    +    headerAttributeContextBegin = {%
    +      \par
    +      \emph{(The end of a header attribute context)}
    +      \par
    +    },
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +
    +# First top-level heading
    +
    +## A subheading {#identifier}
    +
    +# Second top-level heading {.class_name}
    +
    +\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:

    First top-level heading

    @@ -6416,52 +6531,52 @@ Thomas,Edison,1847

    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:

    -
    \input markdown
    -\def\markdownRendererTildePrototype{%
    -  Packages can specify token renderer prototypes.%
    -}
    -\markdownBegin
    -~
    -\markdownEnd
    -
    -\def\markdownRendererTilde{%
    -  User-defined token renderers take precedence.%
    -}
    -\markdownBegin
    -~
    -\markdownEnd
    -\bye
    -

    Next, invoke LuaTeX from the terminal:

    -
    luatex document.tex
    +
    \input markdown
    +\def\markdownRendererTildePrototype{%
    +  Packages can specify token renderer prototypes.%
    +}
    +\markdownBegin
    +~
    +\markdownEnd
    +
    +\def\markdownRendererTilde{%
    +  User-defined token renderers take precedence.%
    +}
    +\markdownBegin
    +~
    +\markdownEnd
    +\bye
    +

    Next, invoke LuaTeX from the terminal:

    +
    luatex document.tex

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

    Packages can specify token renderer prototypes.

    User-defined token renderers take precedence.

    -
    LaTeX Example
    -

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

    -
    \documentclass{article}
    -\usepackage{markdown}
    -\markdownSetup{
    -  rendererPrototypes = {
    -    tilde = {Packages can specify token renderer prototypes.},
    -  },
    -}
    -\begin{document}
    -\begin{markdown}
    -~
    -\end{markdown}
    -
    -\begin{markdown*}{
    -  renderers = {
    -    tilde = {User-defined token renderers take precedence.},
    -  },
    -}
    -~
    -\end{markdown*}
    -\end{document}
    -

    Next, invoke LuaTeX from the terminal:

    -
    lualatex document.tex
    +
    LaTeX Example
    +

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

    +
    \documentclass{article}
    +\usepackage{markdown}
    +\markdownSetup{
    +  rendererPrototypes = {
    +    tilde = {Packages can specify token renderer prototypes.},
    +  },
    +}
    +\begin{document}
    +\begin{markdown}
    +~
    +\end{markdown}
    +
    +\begin{markdown*}{
    +  renderers = {
    +    tilde = {User-defined token renderers take precedence.},
    +  },
    +}
    +~
    +\end{markdown*}
    +\end{document}
    +

    Next, invoke LuaTeX from the terminal:

    +
    lualatex document.tex

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

    Packages can specify token renderer prototypes.

    @@ -6469,29 +6584,121 @@ Thomas,Edison,1847
    ConTeXt Example

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

    -
    \usemodule[t][markdown]
    -\def\markdownRendererTildePrototype{%
    -  Packages can specify token renderer prototypes.%
    -}
    -\starttext
    -\startmarkdown
    -~
    -\stopmarkdown
    -
    -\def\markdownRendererTilde{%
    -  User-defined token renderers take precedence.%
    -}
    -\startmarkdown
    -~
    -\stopmarkdown
    -\stoptext
    -

    Next, invoke LuaTeX from the terminal:

    -
    context document.tex
    +
    \usemodule[t][markdown]
    +\def\markdownRendererTildePrototype{%
    +  Packages can specify token renderer prototypes.%
    +}
    +\starttext
    +\startmarkdown
    +~
    +\stopmarkdown
    +
    +\def\markdownRendererTilde{%
    +  User-defined token renderers take precedence.%
    +}
    +\startmarkdown
    +~
    +\stopmarkdown
    +\stoptext
    +

    Next, invoke LuaTeX from the terminal:

    +
    context document.tex

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

    Packages can specify token renderer prototypes.

    User-defined token renderers take precedence.

    +

    2.3.2.1 YAML Metadata Renderer Prototypes

    +

    By default, the renderer prototypes for YAML metadata provide a high-level interface that can be programmed using the markdown/jekyllData key–values from the l3keys module of the 3 kernel.

    +
    Plain TeX Example
    +

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

    +
    \input markdown
    +\def\markdownOptionJekyllData{true}
    +\ExplSyntaxOn
    +\keys_define:nn
    +  { markdown/jekyllData }
    +  {
    +    name .code:n = { \gdef\name{#1} },
    +    age  .code:n = { \gdef\age{#1}  },
    +  }
    +\ExplSyntaxOff
    +\def\markdownRendererJekyllDataEnd{%
    +  \name{} is \age{} years old.}
    +\markdownBegin
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    +
    +

    Jane Doe is 99 years old.

    +
    +
    LaTeX Example
    +

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

    +
    \documentclass{article}
    +\usepackage[jekyllData]{markdown}
    +\ExplSyntaxOn
    +\keys_define:nn
    +  { markdown/jekyllData }
    +  {
    +    name .code:n = { \gdef\name{#1} },
    +    age  .code:n = { \gdef\age{#1}  },
    +  }
    +\ExplSyntaxOff
    +\markdownSetup{
    +  renderers = {
    +    jekyllDataEnd = {\name{} is \age{} years old.},
    +  }
    +}
    +\begin{document}
    +
    +\begin{markdown}
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    +
    +

    Jane Doe is 99 years old.

    +
    +
    ConTeXt Example
    +

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

    +
    \usemodule[t][markdown]
    +\def\markdownOptionJekyllData{true}
    +\ExplSyntaxOn
    +\keys_define:nn
    +  { markdown/jekyllData }
    +  {
    +    name .code:n = { \gdef\name{#1} },
    +    age  .code:n = { \gdef\age{#1}  },
    +  }
    +\ExplSyntaxOff
    +\def\markdownRendererJekyllDataEnd{%
    +  \name{} is \age{} years old.}
    +\starttext
    +
    +\startmarkdown
    +---
    +name: Jane Doe
    +age:  99
    +---
    +\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:

    +
    +

    Jane Doe is 99 years old.

    +

      diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf index 6a505363c16..ecad79cd26f 100644 Binary files a/Master/texmf-dist/doc/generic/markdown/markdown.pdf and b/Master/texmf-dist/doc/generic/markdown/markdown.pdf differ diff --git a/Master/texmf-dist/scripts/markdown/markdown-cli.lua b/Master/texmf-dist/scripts/markdown/markdown-cli.lua index f0f9bab545d..6afe55ffd86 100644 --- a/Master/texmf-dist/scripts/markdown/markdown-cli.lua +++ b/Master/texmf-dist/scripts/markdown/markdown-cli.lua @@ -58,7 +58,7 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.14.1-0-gb933d81", + version = "2.15.0-0-g9296cf1", 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", @@ -80,6 +80,7 @@ defaultOptions.contentBlocks = false defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" defaultOptions.definitionLists = false defaultOptions.eagerCache = true +defaultOptions.expectJekyllData = false defaultOptions.fencedCode = false defaultOptions.finalizeCache = false defaultOptions.footnotes = false diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx index 60d76269908..d43c7ab3cd4 100644 --- a/Master/texmf-dist/source/generic/markdown/markdown.dtx +++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx @@ -869,17 +869,17 @@ author: Vít Novotný date: \markdownVersion{} (\markdownLastModified{}) --- + + % \fi % \par % \begin{markdown} - - Introduction ============ The [Markdown package][pkg] converts [markdown][] markup to \TeX{} commands. The functionality is provided both as a Lua module and as plain \TeX{}, \LaTeX{}, and -\Hologo{ConTeXt} macro packages that can be used to directly typeset \TeX documents +\Hologo{ConTeXt} macro packages that can be used to directly typeset \TeX{} 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 @@ -916,7 +916,7 @@ documentation][techdoc]. % \fi % \begin{macrocode} local metadata = { - version = "$(VERSION)", + version = "(((VERSION)))", 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", @@ -942,7 +942,7 @@ Requirements The package requires either [our official Docker image][docker], which contains the latest development version of the Markdown package, or a \TeX{} -distribution: [\TeX{} Live][tl] ≥ 2018 is known to work with the current +distribution: [\TeX{} Live][tl] ≥ 2020 is known to work with the current version of the Markdown package and so are recent versions of [Mik\TeX{}][mik]. If you are using an older, incomplete, or atypical \TeX{} distribution, please consult the [technical documentation][techdoc] for a detailed list of @@ -1104,7 +1104,22 @@ local md5 = require("md5") % % The plain \TeX{} part of the package requires that the plain \TeX{} % format (or its superset) is loaded, all the Lua prerequisites (see -% Section <#sec:luaprerequisites>), and the following Lua module: +% Section <#sec:luaprerequisites>), and the following package: +% +% \pkg{expl3} +% +%: A package that enables the expl3 language from the \LaTeX3 kernel in +% \TeX{} Live${}\leq{}2019$. It is not used for anything... yet. +% +% \end{markdown} +% \begin{macrocode} +\ifx\ExplSyntaxOn\undefined + \input expl3-generic\relax +\fi +% \end{macrocode} +% \begin{markdown} +% +% The plain \TeX{} part of the package also requires the following Lua module: % % \pkg{Lua File System} % @@ -1210,10 +1225,8 @@ local md5 = require("md5") % \pkg{ifthen} % %: A package that provides a concise syntax for the inspection of macro -% values. It is used to determine whether or not the \pkg{paralist} package -% should be loaded based on the user options, in the `witiko/dot` \LaTeX{} -% theme (see Section <#sec:latexthemes>), and to provide default token -% renderer prototypes. +% values. It is used in the `witiko/dot` \LaTeX{} theme (see Section +% <#sec:latexthemes>), and to provide default token renderer prototypes. % % \pkg{fancyvrb} % @@ -1804,6 +1817,33 @@ Lua options control the conversion from markdown to \TeX{}. They are supported by all interfaces of the Markdown package starting with the low-level Lua interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. +% +%<*tex> +% \fi +% \begin{markdown} +% +% To enable the enumeration of Lua options, we will maintain the +% \mdef{g_\@\@_lua_options_seq} sequence. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\seq_new:N \g_@@_lua_options_seq +% \end{macrocode} +% \begin{markdown} +% +% To enable the reflection of default Lua options and their types, we will +% maintain the \mdef{g_\@\@_default_lua_options_prop} and +% \mdef{g_\@\@_lua_option_types_prop} property lists, respectively. +% +% \end{markdown} +% \begin{macrocode} +\prop_new:N \g_@@_lua_option_types_prop +\prop_new:N \g_@@_default_lua_options_prop +% \end{macrocode} +% \iffalse +% +%<*manual-options> % \fi % \begin{markdown} % @@ -1953,6 +1993,23 @@ Markdown package will also be produced as we requested using the `cacheDir` option. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { cacheDir } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { cacheDir } + { string } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { cacheDir } + { . } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -2171,6 +2228,23 @@ 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. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { frozenCacheFileName } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { frozenCacheFileName } + { string } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { frozenCacheFileName } + { frozenCache.tex } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -2385,6 +2459,23 @@ following text: > A paragraph > Not a quote. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { blankBeforeBlockquote } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { blankBeforeBlockquote } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { blankBeforeBlockquote } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -2624,6 +2715,23 @@ following text: > A paragraph. ``` Not a code fence. ``` % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { blankBeforeCodeFence } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { blankBeforeCodeFence } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { blankBeforeCodeFence } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -2846,6 +2954,23 @@ following text: > A paragraph. Not a heading. ============== % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { blankBeforeHeading } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { blankBeforeHeading } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { blankBeforeHeading } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3060,6 +3185,23 @@ following text: > > Another block quote. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { breakableBlockquotes } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { breakableBlockquotes } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { breakableBlockquotes } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3144,6 +3286,23 @@ following text, where the middot (`·`) denotes a non-breaking space: > Addison-Wesley, 1984. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { citationNbsps } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { citationNbsps } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { citationNbsps } + { true } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3235,6 +3394,23 @@ following text: > Addison-Wesley, 1984. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { citations } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { citations } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { citations } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3443,6 +3619,23 @@ following text: > “This is a quote.” “This is another quote.” % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { codeSpans } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { codeSpans } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { codeSpans } + { true } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3607,6 +3800,23 @@ following text: > This is a *transcluded markdown document*. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { contentBlocks } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { contentBlocks } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { contentBlocks } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3757,6 +3967,23 @@ following text: > This is a *transcluded markdown document*. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { contentBlocksLanguageMap } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { contentBlocksLanguageMap } + { string } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { contentBlocksLanguageMap } + { markdown-languages.json } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3886,6 +4113,23 @@ following text: > Third paragraph of definition 2. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { definitionLists } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { definitionLists } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { definitionLists } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3907,24 +4151,24 @@ defaultOptions.definitionLists = false % : true - Converted markdown documents will be cached in \Opt{cacheDir}. This can be - useful for post-processing the converted documents and for recovering - historical versions of the documents from the cache. However, it also - produces a large number of auxiliary files on the disk and obscures the - output of the Lua command-line interface when it is used for plumbing. + : Converted markdown documents will be cached in \Opt{cacheDir}. This can be + useful for post-processing the converted documents and for recovering + historical versions of the documents from the cache. However, it also + produces a large number of auxiliary files on the disk and obscures the + output of the Lua command-line interface when it is used for plumbing. - This behavior will always be used if the \Opt{finalizeCache} option is - enabled. + This behavior will always be used if the \Opt{finalizeCache} option is + enabled. : false - Converted markdown documents will not be cached. This decreases the number - of auxiliary files that we produce and makes it easier to use the Lua - command-line interface for plumbing. + : Converted markdown documents will not be cached. This decreases the number + of auxiliary files that we produce and makes it easier to use the Lua + command-line interface for plumbing. - This behavior will only be used when the \Opt{finalizeCache} option is - disabled. Furthermore, this behavior is planned to be the new default in - the next major release of the Markdown package. + This behavior will only be used when the \Opt{finalizeCache} option is + disabled. Furthermore, this behavior is planned to be the new default in + the next major release of the Markdown package. % \end{markdown} % \iffalse @@ -3977,6 +4221,23 @@ Hello \markdownRendererEmphasis{world}!\relax ``` % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { eagerCache } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { eagerCache } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { eagerCache } + { true } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -3987,6 +4248,141 @@ defaultOptions.eagerCache = true % %<*manual-options> +#### Option `expectJekyllData` + +`expectJekyllData` (default value: `false`) + +% \fi +% \markdownBegin +% +% \Optitem[false]{expectJekyllData}{\opt{true}, \opt{false}} +% +: false + + : When the \Opt{jekyllData} option is enabled, then a markdown document + may begin with \acro{yaml} metadata if and only if the metadata begin + with the end-of-directives marker (`---`) and they end with either the + end-of-directives or the end-of-document marker (`...`): + + ~~~~~ latex + \documentclass{article} + \usepackage[jekyllData]{markdown} + \begin{document} + \begin{markdown} + --- + - this + - is + - YAML + ... + - followed + - by + - Markdown + \end{markdown} + \begin{markdown} + - this + - is + - Markdown + \end{markdown} + \end{document} + ~~~~~~~~~~~ + +: true + + : When the \Opt{jekyllData} option is enabled, then a markdown document may + begin directly with \acro{yaml} metadata and may contain nothing but + \acro{yaml} metadata. + + ~~~~~ latex + \documentclass{article} + \usepackage[jekyllData, expectJekyllData]{markdown} + \begin{document} + \begin{markdown} + - this + - is + - YAML + ... + - followed + - by + - Markdown + \end{markdown} + \begin{markdown} + - this + - is + - YAML + \end{markdown} + \end{document} + ~~~~~~~~~~~ + +% \markdownEnd +% \iffalse + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `jane-doe.yml` with the +following content: +``` yaml +name: Jane Doe +age: 99 +``` +Using a text editor, create also a text document named `document.tex` with the +following content: +``` tex +\documentclass{article} +\usepackage[jekyllData]{markdown} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff +\markdownSetup{ + renderers = { + jekyllDataEnd = {\name{} is \age{} years old.}, + } +} +\begin{document} +\markdownInput[expectJekyllData]{jane-doe.yml} +\end{document} +``````` +Next, invoke LuaTeX from the terminal: +``` sh +lualatex document.tex +`````` +A PDF document named `document.pdf` should be produced and contain the +following text: + +> Jane Doe is 99 years old. + +% +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { expectJekyllData } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { expectJekyllData } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { expectJekyllData } + { false } +% \end{macrocode} +% \iffalse +% +%<*lua,lua-cli> +% \fi +% \begin{macrocode} +defaultOptions.expectJekyllData = false +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> + #### Option `fencedCode` `fencedCode` (default value: `false`) @@ -4135,6 +4531,23 @@ following text: > ``` % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { fencedCode } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { fencedCode } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { fencedCode } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4289,6 +4702,23 @@ 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. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { finalizeCache } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { finalizeCache } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { finalizeCache } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4448,6 +4878,23 @@ following text: > isn't indented. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { footnotes } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { footnotes } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { footnotes } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4503,6 +4950,23 @@ A PDF document named `document.pdf` should be produced and contain the text requested using the `frozenCacheCounter` option. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { frozenCacheCounter } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { frozenCacheCounter } + { counter } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { frozenCacheCounter } + { 0 } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4577,6 +5041,23 @@ following text: > And the mome raths outgrabe. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { hardLineBreaks } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { hardLineBreaks } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { hardLineBreaks } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4698,6 +5179,23 @@ following text: > #. Parish % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { hashEnumerators } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { hashEnumerators } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { hashEnumerators } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4743,6 +5241,23 @@ defaultOptions.hashEnumerators = false % \end{markdown} % \iffalse % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { headerAttributes } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { headerAttributes } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { headerAttributes } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -4995,6 +5510,23 @@ following text: > There is support. There is support. There is support. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { html } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { html } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { html } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5196,6 +5728,23 @@ following text: > √-̅1̅ *equals* $i$. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { hybrid } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { hybrid } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { hybrid } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5285,6 +5834,23 @@ following text: > move down to type the note.] % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { inlineFootnotes } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { inlineFootnotes } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { inlineFootnotes } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5338,8 +5904,14 @@ following content: ``` tex \input markdown \def\markdownOptionJekyllData{true} -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff \def\markdownRendererJekyllDataEnd{% \name{} is \age{} years old.} \markdownBegin @@ -5366,10 +5938,16 @@ following content: ``` tex \documentclass{article} \usepackage[jekyllData]{markdown} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff \markdownSetup{ renderers = { - jekyllDataString = {\gdef\name{#2}}, - jekyllDataNumber = {\gdef\age{#2}}, jekyllDataEnd = {\name{} is \age{} years old.}, } } @@ -5400,8 +5978,14 @@ following content: ``` tex \usemodule[t][markdown] \def\markdownOptionJekyllData{true} -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff \def\markdownRendererJekyllDataEnd{% \name{} is \age{} years old.} \starttext @@ -5425,6 +6009,23 @@ following text: > Jane Doe is 99 years old. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { jekyllData } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { jekyllData } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { jekyllData } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5524,6 +6125,23 @@ following text: > | 1 | 1 | 1 | 1 | % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { pipeTables } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { pipeTables } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { pipeTables } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5554,6 +6172,23 @@ defaultOptions.pipeTables = false % \end{markdown} % \iffalse % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { preserveTabs } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { preserveTabs } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { preserveTabs } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5633,6 +6268,23 @@ following text: > with their grandchildren than get eaten. Begone, wolf! % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { relativeReferences } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { relativeReferences } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { relativeReferences } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5768,6 +6420,23 @@ following text: > ### A section % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { shiftHeadings } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { shiftHeadings } + { number } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { shiftHeadings } + { 0 } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -5976,6 +6645,23 @@ following text: > Hamlet dies. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { slice } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { slice } + { string } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { slice } + { ^~$ } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6173,6 +6859,23 @@ following text: > . . . and this is a victorian ellipsis. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { smartEllipses } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { smartEllipses } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { smartEllipses } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6299,6 +7002,23 @@ following text: > 3. fifth item % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { startNumber } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { startNumber } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { startNumber } + { true } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6402,6 +7122,23 @@ A PDF document named `document.pdf` should be produced and contain the text “Hello *world*!” % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { stripIndent } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { stripIndent } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { stripIndent } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6516,6 +7253,23 @@ following text: > : Demonstration of pipe table syntax. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { tableCaptions } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { tableCaptions } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { tableCaptions } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6616,6 +7370,23 @@ following text: > - Yes I can! % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { taskLists } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { taskLists } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { taskLists } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6665,7 +7436,7 @@ Using a text editor, create a text document named `document.tex` with the following content: ``` tex \input markdown -\def\markdownOptionTeXComments{true} +\def\markdownOptionTexComments{true} \markdownBegin Hel% this is a comment lo *world*! @@ -6706,7 +7477,7 @@ Using a text editor, create a text document named `document.tex` with the following content: ``` tex \usemodule[t][markdown] -\def\markdownOptionTeXComments{true} +\def\markdownOptionTexComments{true} \starttext \startmarkdown Hel% this is a comment @@ -6722,6 +7493,23 @@ A PDF document named `document.pdf` should be produced and contain the text “Hello *world*!” % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { texComments } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { texComments } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { texComments } + { false } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6744,17 +7532,27 @@ defaultOptions.texComments = false % : true - : Lists whose bullets do not consist of multiple paragraphs will be - passed to the - \mref{markdownRendererOlBeginTight}, \mref{markdownRendererOlEndTight}, - \mref{markdownRendererUlBeginTight}, \mref{markdownRendererUlEndTight}, - \mref{markdownRendererDlBeginTight}, and - \mref{markdownRendererDlEndTight} \TeX{} macros. + : Unordered and ordered Lists whose items do not consist of multiple + paragraphs will be considered *tight*. Tight lists will produce tight + renderers that may produce different output than lists that are not + tight: + + ``` md + - This is + - a tight + - unordered list. + + - This is + + not a tight + + - unordered list. + ``` : false - : Lists whose bullets do not consist of multiple paragraphs will be - treated the same way as lists that do consist of multiple paragraphs. + : Unordered and ordered lists whose items consist of multiple paragraphs + will be treated the same way as lists that consist of multiple paragraphs. % \end{markdown} % \iffalse @@ -6824,6 +7622,23 @@ following text: > - third item % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { tightLists } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { tightLists } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { tightLists } + { true } +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -6956,6 +7771,24 @@ following text: > This is _emphasized text_ and this is a math subscript: *mₙ*. % +%<*tex> +% \fi +% \begin{macrocode} +\seq_put_right:Nn + \g_@@_lua_options_seq + { underscores } +\prop_put:Nnn + \g_@@_lua_option_types_prop + { underscores } + { boolean } +\prop_put:Nnn + \g_@@_default_lua_options_prop + { underscores } + { true } +\ExplSyntaxOff +% \end{macrocode} +% \iffalse +% %<*lua,lua-cli> % \fi % \begin{macrocode} @@ -7239,8 +8072,8 @@ pdftex --shell-escape document.tex % % \end{markdown} % \begin{macrocode} -\def\markdownLastModified{$(LAST_MODIFIED)}% -\def\markdownVersion{$(VERSION)}% +\def\markdownLastModified{(((LASTMODIFIED)))}% +\def\markdownVersion{(((VERSION)))}% % \end{macrocode} % \par % \begin{markdown} @@ -7645,7 +8478,7 @@ bug](https://github.com/witiko/markdown/issues). \let\markdownOptionStripIndent\undefined \let\markdownOptionTableCaptions\undefined \let\markdownOptionTaskLists\undefined -\let\markdownOptionTeXComments\undefined +\let\markdownOptionTexComments\undefined \let\markdownOptionTightLists\undefined % \end{macrocode} % \par @@ -7656,7 +8489,7 @@ bug](https://github.com/witiko/markdown/issues). #### Package Documentation The \mdef{markdownOptionStripPercentSigns} macro controls whether a percent -sign (`%`) at the beginning of a line will be discarded when reading Markdown +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. The recognized values of the macro are `true` (discard) and `false` @@ -7696,7 +8529,7 @@ A PDF document named `document.pdf` should be produced and contain the text %#### Miscellaneous Options % % The \mdef{markdownOptionStripPercentSigns} macro controls whether a percent -% sign (`%`) at the beginning of a line will be discarded when buffering +% sign (`\%`) at the beginning of a line will be discarded when buffering % Markdown input (see Section <#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 @@ -7738,6 +8571,38 @@ In this section, I will describe the individual token renderers. % macros are intended to be redefined by the user who is typesetting a % document. By default, they point to the corresponding prototypes (see Section % <#sec:texrendererprototypes>). +% +% \end{markdown} +% +% \iffalse +% +%<*tex> +% \fi +% \begin{markdown} +% +% To enable the enumeration of token renderers, we will maintain the +% \mdef{g_\@\@_renderers_seq} sequence. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\seq_new:N \g_@@_renderers_seq +% \end{macrocode} +% \begin{markdown} +% +% To enable the reflection of token renderers and their parameters, we will +% maintain the \mdef{g_\@\@_renderer_arities_prop} property list. +% +% \end{markdown} +% \begin{macrocode} +\prop_new:N \g_@@_renderer_arities_prop +\ExplSyntaxOff +% \end{macrocode} +% \iffalse +% +%<*manual-tokens> +% \fi +% \begin{markdown} #### Tickbox Renderers The macros named \mdef{markdownRendererTickedBox}, @@ -7814,10 +8679,37 @@ following text: % \begin{macrocode} \def\markdownRendererTickedBox{% \markdownRendererTickedBoxPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { tickedBox } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { tickedBox } + { 0 } +\ExplSyntaxOff \def\markdownRendererHalfTickedBox{% \markdownRendererHalfTickedBoxPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { halfTickedBox } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { halfTickedBox } + { 0 } +\ExplSyntaxOff \def\markdownRendererUntickedBox{% \markdownRendererUntickedBoxPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { untickedBox } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { untickedBox } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -7951,8 +8843,26 @@ following text: % \begin{macrocode} \def\markdownRendererDocumentBegin{% \markdownRendererDocumentBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { documentBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { documentBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererDocumentEnd{% \markdownRendererDocumentEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { documentEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { documentEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8078,6 +8988,15 @@ following text: % \begin{macrocode} \def\markdownRendererInterblockSeparator{% \markdownRendererInterblockSeparatorPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { interblockSeparator } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { interblockSeparator } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8215,6 +9134,15 @@ following text: % \begin{macrocode} \def\markdownRendererLineBreak{% \markdownRendererLineBreakPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { lineBreak } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { lineBreak } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8317,6 +9245,15 @@ following text: % \begin{macrocode} \def\markdownRendererEllipsis{% \markdownRendererEllipsisPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ellipsis } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ellipsis } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8393,6 +9330,15 @@ following text: % \begin{macrocode} \def\markdownRendererNbsp{% \markdownRendererNbspPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { nbsp } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { nbsp } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8509,26 +9455,125 @@ following text, where the middot (`·`) denotes a non-breaking space: % \begin{macrocode} \def\markdownRendererLeftBrace{% \markdownRendererLeftBracePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { leftBrace } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { leftBrace } + { 0 } +\ExplSyntaxOff \def\markdownRendererRightBrace{% \markdownRendererRightBracePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { rightBrace } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { rightBrace } + { 0 } +\ExplSyntaxOff \def\markdownRendererDollarSign{% \markdownRendererDollarSignPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dollarSign } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dollarSign } + { 0 } +\ExplSyntaxOff \def\markdownRendererPercentSign{% \markdownRendererPercentSignPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { percentSign } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { percentSign } + { 0 } +\ExplSyntaxOff \def\markdownRendererAmpersand{% \markdownRendererAmpersandPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ampersand } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ampersand } + { 0 } +\ExplSyntaxOff \def\markdownRendererUnderscore{% \markdownRendererUnderscorePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { underscore } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { underscore } + { 0 } +\ExplSyntaxOff \def\markdownRendererHash{% \markdownRendererHashPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { hash } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { hash } + { 0 } +\ExplSyntaxOff \def\markdownRendererCircumflex{% \markdownRendererCircumflexPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { circumflex } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { circumflex } + { 0 } +\ExplSyntaxOff \def\markdownRendererBackslash{% \markdownRendererBackslashPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { backslash } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { backslash } + { 0 } +\ExplSyntaxOff \def\markdownRendererTilde{% \markdownRendererTildePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { tilde } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { tilde } + { 0 } +\ExplSyntaxOff \def\markdownRendererPipe{% \markdownRendererPipePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { pipe } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { pipe } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8665,6 +9710,15 @@ following text: % \begin{macrocode} \def\markdownRendererCodeSpan{% \markdownRendererCodeSpanPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { codeSpan } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { codeSpan } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8780,6 +9834,15 @@ following text: % \begin{macrocode} \def\markdownRendererLink{% \markdownRendererLinkPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { link } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { link } + { 4 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8861,6 +9924,15 @@ that the \TeX{} engine has shell access. % \begin{macrocode} \def\markdownRendererImage{% \markdownRendererImagePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { image } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { image } + { 4 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8889,6 +9961,15 @@ and the title of the content block. % \begin{macrocode} \def\markdownRendererContentBlock{% \markdownRendererContentBlockPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { contentBlock } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { contentBlock } + { 4 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -8913,6 +9994,15 @@ as \mref{markdownRendererContentBlock}. % \begin{macrocode} \def\markdownRendererContentBlockOnlineImage{% \markdownRendererContentBlockOnlineImagePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { contentBlockOnlineImage } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { contentBlockOnlineImage } + { 4 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9099,6 +10189,15 @@ following text: % \begin{macrocode} \def\markdownRendererContentBlockCode{% \markdownRendererContentBlockCodePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { contentBlockCode } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { contentBlockCode } + { 5 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9124,6 +10223,15 @@ list is not tight). The macro receives no arguments. % \begin{macrocode} \def\markdownRendererUlBegin{% \markdownRendererUlBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ulBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ulBegin } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9149,6 +10257,15 @@ is `false`. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererUlBeginTight{% \markdownRendererUlBeginTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ulBeginTight } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ulBeginTight } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9172,6 +10289,15 @@ list. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererUlItem{% \markdownRendererUlItemPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ulItem } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ulItem } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9195,6 +10321,15 @@ bulleted list. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererUlItemEnd{% \markdownRendererUlItemEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ulItemEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ulItemEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9219,6 +10354,15 @@ tight). The macro receives no arguments. % \begin{macrocode} \def\markdownRendererUlEnd{% \markdownRendererUlEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ulEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ulEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9446,6 +10590,15 @@ following text: % \begin{macrocode} \def\markdownRendererUlEndTight{% \markdownRendererUlEndTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { ulEndTight } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { ulEndTight } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9471,6 +10624,15 @@ list is not tight). The macro receives no arguments. % \begin{macrocode} \def\markdownRendererOlBegin{% \markdownRendererOlBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olBegin } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9496,6 +10658,15 @@ option is `false`. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererOlBeginTight{% \markdownRendererOlBeginTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olBeginTight } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olBeginTight } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9520,6 +10691,15 @@ This macro will only be produced, when the \Opt{startNumber} option is % \begin{macrocode} \def\markdownRendererOlItem{% \markdownRendererOlItemPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olItem } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olItem } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9543,6 +10723,15 @@ an ordered list. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererOlItemEnd{% \markdownRendererOlItemEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olItemEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olItemEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9568,6 +10757,15 @@ corresponds to the item number. % \begin{macrocode} \def\markdownRendererOlItemWithNumber{% \markdownRendererOlItemWithNumberPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olItemWithNumber } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olItemWithNumber } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9592,6 +10790,15 @@ tight). The macro receives no arguments. % \begin{macrocode} \def\markdownRendererOlEnd{% \markdownRendererOlEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9871,6 +11078,15 @@ following text: % \begin{macrocode} \def\markdownRendererOlEndTight{% \markdownRendererOlEndTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { olEndTight } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { olEndTight } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9899,6 +11115,15 @@ list is not tight). The macro receives no arguments. % \begin{macrocode} \def\markdownRendererDlBegin{% \markdownRendererDlBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlBegin } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9924,6 +11149,15 @@ list is not tight). This macro will only be produced, when the % \begin{macrocode} \def\markdownRendererDlBeginTight{% \markdownRendererDlBeginTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlBeginTight } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlBeginTight } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9948,6 +11182,15 @@ being defined. % \begin{macrocode} \def\markdownRendererDlItem{% \markdownRendererDlItemPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlItem } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlItem } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9971,6 +11214,15 @@ definitions for a single term. % \begin{macrocode} \def\markdownRendererDlItemEnd{% \markdownRendererDlItemEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlItemEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlItemEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -9995,6 +11247,15 @@ a single term. % \begin{macrocode} \def\markdownRendererDlDefinitionBegin{% \markdownRendererDlDefinitionBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlDefinitionBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlDefinitionBegin } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10019,6 +11280,15 @@ single term. % \begin{macrocode} \def\markdownRendererDlDefinitionEnd{% \markdownRendererDlDefinitionEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlDefinitionEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlDefinitionEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10043,6 +11313,15 @@ tight). The macro receives no arguments. % \begin{macrocode} \def\markdownRendererDlEnd{% \markdownRendererDlEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10400,6 +11679,15 @@ following text: % \begin{macrocode} \def\markdownRendererDlEndTight{% \markdownRendererDlEndTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { dlEndTight } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { dlEndTight } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10511,6 +11799,15 @@ following text: % \begin{macrocode} \def\markdownRendererEmphasis{% \markdownRendererEmphasisPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { emphasis } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { emphasis } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10535,6 +11832,15 @@ corresponds to the emphasized span of text. % \begin{macrocode} \def\markdownRendererStrongEmphasis{% \markdownRendererStrongEmphasisPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { strongEmphasis } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { strongEmphasis } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10559,6 +11865,15 @@ a block quote. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererBlockQuoteBegin{% \markdownRendererBlockQuoteBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { blockQuoteBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { blockQuoteBegin } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10695,6 +12010,15 @@ following text: % \begin{macrocode} \def\markdownRendererBlockQuoteEnd{% \markdownRendererBlockQuoteEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { blockQuoteEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { blockQuoteEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10720,6 +12044,15 @@ filename of a file contaning the code block contents. % \begin{macrocode} \def\markdownRendererInputVerbatim{% \markdownRendererInputVerbatimPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { inputVerbatim } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { inputVerbatim } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10827,6 +12160,15 @@ following text except for the filename, which may differ: % \begin{macrocode} \def\markdownRendererInputFencedCode{% \markdownRendererInputFencedCodePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { inputFencedCode } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { inputFencedCode } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10836,7 +12178,8 @@ following text except for the filename, which may differ: % \fi % \begin{markdown} -#### YAML Metadata Renderers +#### YAML Metadata Renderers {#yamlmetadatarenderers} + The \mdef{markdownRendererJekyllDataBegin} macro represents the beginning of a \acro{yaml} document. This macro will only be produced when the \Opt{jekyllData} option is enabled. The macro receives no arguments. @@ -10851,6 +12194,15 @@ option is enabled. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererJekyllDataBegin{% \markdownRendererJekyllDataBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataBegin } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10875,6 +12227,15 @@ The \mdef{markdownRendererJekyllDataEnd} macro represents the end of a % \begin{macrocode} \def\markdownRendererJekyllDataEnd{% \markdownRendererJekyllDataEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10901,6 +12262,15 @@ arguments: the scalar key in the parent structure, cast to a string following % \begin{macrocode} \def\markdownRendererJekyllDataMappingBegin{% \markdownRendererJekyllDataMappingBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataMappingBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataMappingBegin } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10925,6 +12295,15 @@ when the \Opt{jekyllData} option is enabled. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererJekyllDataMappingEnd{% \markdownRendererJekyllDataMappingEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataMappingEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataMappingEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10951,6 +12330,15 @@ arguments: the scalar key in the parent structure, cast to a string following % \begin{macrocode} \def\markdownRendererJekyllDataSequenceBegin{% \markdownRendererJekyllDataSequenceBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataSequenceBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataSequenceBegin } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -10975,6 +12363,15 @@ when the \Opt{jekyllData} option is enabled. The macro receives no arguments. % \begin{macrocode} \def\markdownRendererJekyllDataSequenceEnd{% \markdownRendererJekyllDataSequenceEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataSequenceEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataSequenceEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11001,6 +12398,15 @@ following \acro{yaml} serialization rules. % \begin{macrocode} \def\markdownRendererJekyllDataBoolean{% \markdownRendererJekyllDataBooleanPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataBoolean } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataBoolean } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11027,6 +12433,15 @@ following \acro{yaml} serialization rules. % \begin{macrocode} \def\markdownRendererJekyllDataNumber{% \markdownRendererJekyllDataNumberPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataNumber } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataNumber } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11053,6 +12468,15 @@ serialization rules, and the scalar value. % \begin{macrocode} \def\markdownRendererJekyllDataString{% \markdownRendererJekyllDataStringPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataString } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataString } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11069,6 +12493,10 @@ value in a \acro{yaml} document. This macro will only be produced when the scalar key in the parent structure, cast to a string following \acro{yaml} serialization rules. +% See also Section <#sec:expl3yamlmetadata> for the description of the +% high-level expl3 interface that you can also use to react to \acro{yaml} +% metadata. +% % \end{markdown} % % \iffalse @@ -11079,6 +12507,15 @@ serialization rules. % \begin{macrocode} \def\markdownRendererJekyllDataEmpty{% \markdownRendererJekyllDataEmptyPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { jekyllDataEmpty } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { jekyllDataEmpty } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11197,6 +12634,15 @@ The macro receives a single argument that corresponds to the heading text. % \begin{macrocode} \def\markdownRendererHeadingOne{% \markdownRendererHeadingOnePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headingOne } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headingOne } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11221,6 +12667,15 @@ text. % \begin{macrocode} \def\markdownRendererHeadingTwo{% \markdownRendererHeadingTwoPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headingTwo } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headingTwo } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11245,6 +12700,15 @@ text. % \begin{macrocode} \def\markdownRendererHeadingThree{% \markdownRendererHeadingThreePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headingThree } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headingThree } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11269,6 +12733,15 @@ text. % \begin{macrocode} \def\markdownRendererHeadingFour{% \markdownRendererHeadingFourPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headingFour } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headingFour } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11293,6 +12766,15 @@ text. % \begin{macrocode} \def\markdownRendererHeadingFive{% \markdownRendererHeadingFivePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headingFive } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headingFive } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11418,6 +12900,15 @@ following text: % \begin{macrocode} \def\markdownRendererHeadingSix{% \markdownRendererHeadingSixPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headingSix } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headingSix } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11537,6 +13028,15 @@ following text: % \begin{macrocode} \def\markdownRendererHorizontalRule{% \markdownRendererHorizontalRulePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { horizontalRule } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { horizontalRule } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11650,6 +13150,15 @@ following text: % \begin{macrocode} \def\markdownRendererFootnote{% \markdownRendererFootnotePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { footnote } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { footnote } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11738,6 +13247,15 @@ following text: % \begin{macrocode} \def\markdownRendererCite{% \markdownRendererCitePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { cite } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { cite } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11821,6 +13339,15 @@ following text: % \begin{macrocode} \def\markdownRendererTextCite{% \markdownRendererTextCitePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { textCite } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { textCite } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -11939,6 +13466,15 @@ following text: % \begin{macrocode} \def\markdownRendererTable{% \markdownRendererTablePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { table } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { table } + { 3 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -12024,10 +13560,37 @@ The horizontal margins should contain the following text: % \begin{macrocode} \def\markdownRendererInlineHtmlComment{% \markdownRendererInlineHtmlCommentPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { inlineHtmlComment } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { inlineHtmlComment } + { 1 } +\ExplSyntaxOff \def\markdownRendererBlockHtmlCommentBegin{% \markdownRendererBlockHtmlCommentBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { blockHtmlCommentBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { blockHtmlCommentBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererBlockHtmlCommentEnd{% \markdownRendererBlockHtmlCommentEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { blockHtmlCommentEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { blockHtmlCommentEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -12096,8 +13659,26 @@ following body text: % \begin{macrocode} \def\markdownRendererInlineHtmlTag{% \markdownRendererInlineHtmlTagPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { inlineHtmlTag } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { inlineHtmlTag } + { 1 } +\ExplSyntaxOff \def\markdownRendererInputBlockHtmlElement{% \markdownRendererInputBlockHtmlElementPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { inputBlockHtmlElement } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { inputBlockHtmlElement } + { 1 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -12196,10 +13777,37 @@ following text: % \begin{macrocode} \def\markdownRendererAttributeIdentifier{% \markdownRendererAttributeIdentifierPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { attributeIdentifier } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { attributeIdentifier } + { 1 } +\ExplSyntaxOff \def\markdownRendererAttributeClassName{% \markdownRendererAttributeClassNamePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { attributeClassName } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { attributeClassName } + { 1 } +\ExplSyntaxOff \def\markdownRendererAttributeKeyValue{% \markdownRendererAttributeKeyValuePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { attributeKeyValue } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { attributeKeyValue } + { 2 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -12284,8 +13892,26 @@ following text: % \begin{macrocode} \def\markdownRendererHeaderAttributeContextBegin{% \markdownRendererHeaderAttributeContextBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headerAttributeContextBegin } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headerAttributeContextBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererHeaderAttributeContextEnd{% \markdownRendererHeaderAttributeContextEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g_@@_renderers_seq + { headerAttributeContextEnd } +\prop_put:Nnn + \g_@@_renderer_arities_prop + { headerAttributeContextEnd } + { 0 } +\ExplSyntaxOff % \end{macrocode} % \par % @@ -12298,17 +13924,12 @@ following text: ### Token Renderer Prototypes {#texrendererprototypes} -% % \end{markdown} % \iffalse By default, token renderers point to package-defined \TeX{} macros, further referred to as *prototypes*, which provide useful default definitions. -% \fi -% -% \iffalse - ##### Plain \TeX{} Example {.unnumbered} Using a text editor, create a text document named `document.tex` with the @@ -12411,9 +14032,140 @@ following text: > > User-defined token renderers take precedence. +% \fi +% +% \begin{markdown} + +#### YAML Metadata Renderer Prototypes {#expl3yamlmetadata} + +By default, the renderer prototypes for YAML metadata provide a high-level +interface that can be programmed using the `markdown/jekyllData` key--values +from the l3keys module of the \LaTeX3 kernel. + +% \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\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% + \name{} is \age{} years old.} +\markdownBegin +--- +name: Jane Doe +age: 99 +--- +\markdownEnd +\bye +``````` +Next, invoke LuaTeX from the terminal: +``` sh +luatex document.tex +`````` +A PDF document named `document.pdf` should be produced and contain the +following text: + +> Jane Doe is 99 years old. + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\documentclass{article} +\usepackage[jekyllData]{markdown} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff +\markdownSetup{ + renderers = { + jekyllDataEnd = {\name{} is \age{} years old.}, + } +} +\begin{document} + +\begin{markdown} +--- +name: Jane Doe +age: 99 +--- +\end{markdown} + +\end{document} +``````` +Next, invoke LuaTeX from the terminal: +``` sh +lualatex document.tex +`````` +A PDF document named `document.pdf` should be produced and contain the +following text: + +> Jane Doe is 99 years old. + +##### \Hologo{ConTeXt} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\usemodule[t][markdown] +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { + name .code:n = { \gdef\name{#1} }, + age .code:n = { \gdef\age{#1} }, + } +\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% + \name{} is \age{} years old.} +\starttext + +\startmarkdown +--- +name: Jane Doe +age: 99 +--- +\stopmarkdown + +\stoptext +``````` +Next, invoke LuaTeX from the terminal: +``` sh +context document.tex +`````` +A PDF document named `document.pdf` should be produced and contain the +following text: + +> Jane Doe is 99 years old. + % %<*tex> % \fi +% \begin{macrocode} +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { } +\ExplSyntaxOff +% \end{macrocode} % % \begin{markdown} % @@ -12481,16 +14233,8 @@ following text: \def\markdownRendererBlockQuoteEndPrototype{}% \def\markdownRendererInputVerbatimPrototype#1{}% \def\markdownRendererInputFencedCodePrototype#1#2{}% -\def\markdownRendererJekyllDataBooleanPrototype#1#2{}% -\def\markdownRendererJekyllDataEmptyPrototype#1{}% -\def\markdownRendererJekyllDataNumberPrototype#1#2{}% -\def\markdownRendererJekyllDataStringPrototype#1#2{}% \def\markdownRendererJekyllDataBeginPrototype{}% \def\markdownRendererJekyllDataEndPrototype{}% -\def\markdownRendererJekyllDataSequenceBeginPrototype#1#2{}% -\def\markdownRendererJekyllDataSequenceEndPrototype{}% -\def\markdownRendererJekyllDataMappingBeginPrototype#1#2{}% -\def\markdownRendererJekyllDataMappingEndPrototype{}% \def\markdownRendererHeadingOnePrototype#1{}% \def\markdownRendererHeadingTwoPrototype#1{}% \def\markdownRendererHeadingThreePrototype#1{}% @@ -12791,21 +14535,33 @@ pdflatex --shell-escape document.tex % \end{markdown} % \begin{macrocode} \newcommand\markdownSetupSnippet[2]{% - \@ifundefined - {markdownLaTeXSetupSnippet\markdownLaTeXThemeName#1}{% - \newtoks\next - \next={#2}% - \expandafter\let\csname markdownLaTeXSetupSnippet% - \markdownLaTeXThemeName#1\endcsname=\next - }{% + \markdownIfSnippetExists{#1}% + {% \markdownWarning {Redefined setup snippet \markdownLaTeXThemeName#1}% \csname markdownLaTeXSetupSnippet% \markdownLaTeXThemeName#1\endcsname={#2}% + }{% + \newtoks\next + \next={#2}% + \expandafter\let\csname markdownLaTeXSetupSnippet% + \markdownLaTeXThemeName#1\endcsname=\next }}% % \end{macrocode} % \begin{markdown} % +% To decide whether a setup snippet exists, we can use the +% \mdef{markdownIfSnippetExists} macro: +% +% \end{markdown} +% \begin{macrocode} +\newcommand\markdownIfSnippetExists[3]{% + \@ifundefined + {markdownLaTeXSetupSnippet\markdownLaTeXThemeName#1}% + {#3}{#2}}% +% \end{macrocode} +% \begin{markdown} +% % See Section <#sec:latexthemes> for information on interactions between % setup snippets and \LaTeX{} themes. See Section <#sec:latexsetupsnippets> % for information about invoking the stored setup snippets. @@ -13282,14 +15038,15 @@ various options locally. % \fi % \begin{macrocode} \define@key{markdownOptions}{snippet}{% - \@ifundefined - {markdownLaTeXSetupSnippet#1}{% + \markdownIfSnippetExists{#1}% + {% + \expandafter\markdownSetup\expandafter{% + \the\csname markdownLaTeXSetupSnippet% + \markdownLaTeXThemeName#1\endcsname}% + }{% \markdownError {Can't invoke setup snippet #1}% {The setup snippet is undefined}% - }{% - \expandafter\markdownSetup\expandafter{% - \the\csname markdownLaTeXSetupSnippet#1\endcsname}% }% }% % \end{macrocode} @@ -13373,6 +15130,8 @@ The following ordered list will be preceded by roman numerals: \def\markdownOptionDefinitionLists{#1}}% \define@key{markdownOptions}{eagerCache}[true]{% \def\markdownOptionEagerCache{#1}}% +\define@key{markdownOptions}{expectJekyllData}[true]{% + \def\markdownOptionExpectJekyllData{#1}}% \define@key{markdownOptions}{footnotes}[true]{% \def\markdownOptionFootnotes{#1}}% \define@key{markdownOptions}{fencedCode}[true]{% @@ -13412,7 +15171,7 @@ The following ordered list will be preceded by roman numerals: \define@key{markdownOptions}{taskLists}[true]{% \def\markdownOptionTaskLists{#1}}% \define@key{markdownOptions}{texComments}[true]{% - \def\markdownOptionTeXComments{#1}}% + \def\markdownOptionTexComments{#1}}% \define@key{markdownOptions}{tightLists}[true]{% \def\markdownOptionTightLists{#1}}% \define@key{markdownOptions}{underscores}[true]{% @@ -13480,174 +15239,52 @@ The following ordered list will be preceded by roman numerals: % % \end{markdown} % \begin{macrocode} -\define@key{markdownRenderers}{attributeIdentifier}{% - \renewcommand\markdownRendererAttributeIdentifier[1]{#1}}% -\define@key{markdownRenderers}{attributeClassName}{% - \renewcommand\markdownRendererAttributeClassName[1]{#1}}% -\define@key{markdownRenderers}{attributeKeyValue}{% - \renewcommand\markdownRendererAttributeKeyValue[2]{#1}}% -\define@key{markdownRenderers}{documentBegin}{% - \renewcommand\markdownRendererDocumentBegin{#1}}% -\define@key{markdownRenderers}{documentEnd}{% - \renewcommand\markdownRendererDocumentEnd{#1}}% -\define@key{markdownRenderers}{interblockSeparator}{% - \renewcommand\markdownRendererInterblockSeparator{#1}}% -\define@key{markdownRenderers}{lineBreak}{% - \renewcommand\markdownRendererLineBreak{#1}}% -\define@key{markdownRenderers}{ellipsis}{% - \renewcommand\markdownRendererEllipsis{#1}}% -\define@key{markdownRenderers}{headerAttributeContextBegin}{% - \renewcommand\markdownRendererHeaderAttributeContextBegin{#1}}% -\define@key{markdownRenderers}{headerAttributeContextEnd}{% - \renewcommand\markdownRendererHeaderAttributeContextEnd{#1}}% -\define@key{markdownRenderers}{nbsp}{% - \renewcommand\markdownRendererNbsp{#1}}% -\define@key{markdownRenderers}{leftBrace}{% - \renewcommand\markdownRendererLeftBrace{#1}}% -\define@key{markdownRenderers}{rightBrace}{% - \renewcommand\markdownRendererRightBrace{#1}}% -\define@key{markdownRenderers}{dollarSign}{% - \renewcommand\markdownRendererDollarSign{#1}}% -\define@key{markdownRenderers}{percentSign}{% - \renewcommand\markdownRendererPercentSign{#1}}% -\define@key{markdownRenderers}{ampersand}{% - \renewcommand\markdownRendererAmpersand{#1}}% -\define@key{markdownRenderers}{underscore}{% - \renewcommand\markdownRendererUnderscore{#1}}% -\define@key{markdownRenderers}{hash}{% - \renewcommand\markdownRendererHash{#1}}% -\define@key{markdownRenderers}{circumflex}{% - \renewcommand\markdownRendererCircumflex{#1}}% -\define@key{markdownRenderers}{backslash}{% - \renewcommand\markdownRendererBackslash{#1}}% -\define@key{markdownRenderers}{tilde}{% - \renewcommand\markdownRendererTilde{#1}}% -\define@key{markdownRenderers}{pipe}{% - \renewcommand\markdownRendererPipe{#1}}% -\define@key{markdownRenderers}{codeSpan}{% - \renewcommand\markdownRendererCodeSpan[1]{#1}}% -\define@key{markdownRenderers}{link}{% - \renewcommand\markdownRendererLink[4]{#1}}% -\define@key{markdownRenderers}{contentBlock}{% - \renewcommand\markdownRendererContentBlock[4]{#1}}% -\define@key{markdownRenderers}{contentBlockOnlineImage}{% - \renewcommand\markdownRendererContentBlockOnlineImage[4]{#1}}% -\define@key{markdownRenderers}{contentBlockCode}{% - \renewcommand\markdownRendererContentBlockCode[5]{#1}}% -\define@key{markdownRenderers}{image}{% - \renewcommand\markdownRendererImage[4]{#1}}% -\define@key{markdownRenderers}{ulBegin}{% - \renewcommand\markdownRendererUlBegin{#1}}% -\define@key{markdownRenderers}{ulBeginTight}{% - \renewcommand\markdownRendererUlBeginTight{#1}}% -\define@key{markdownRenderers}{ulItem}{% - \renewcommand\markdownRendererUlItem{#1}}% -\define@key{markdownRenderers}{ulItemEnd}{% - \renewcommand\markdownRendererUlItemEnd{#1}}% -\define@key{markdownRenderers}{ulEnd}{% - \renewcommand\markdownRendererUlEnd{#1}}% -\define@key{markdownRenderers}{ulEndTight}{% - \renewcommand\markdownRendererUlEndTight{#1}}% -\define@key{markdownRenderers}{olBegin}{% - \renewcommand\markdownRendererOlBegin{#1}}% -\define@key{markdownRenderers}{olBeginTight}{% - \renewcommand\markdownRendererOlBeginTight{#1}}% -\define@key{markdownRenderers}{olItem}{% - \renewcommand\markdownRendererOlItem{#1}}% -\define@key{markdownRenderers}{olItemWithNumber}{% - \renewcommand\markdownRendererOlItemWithNumber[1]{#1}}% -\define@key{markdownRenderers}{olItemEnd}{% - \renewcommand\markdownRendererOlItemEnd{#1}}% -\define@key{markdownRenderers}{olEnd}{% - \renewcommand\markdownRendererOlEnd{#1}}% -\define@key{markdownRenderers}{olEndTight}{% - \renewcommand\markdownRendererOlEndTight{#1}}% -\define@key{markdownRenderers}{dlBegin}{% - \renewcommand\markdownRendererDlBegin{#1}}% -\define@key{markdownRenderers}{dlBeginTight}{% - \renewcommand\markdownRendererDlBeginTight{#1}}% -\define@key{markdownRenderers}{dlItem}{% - \renewcommand\markdownRendererDlItem[1]{#1}}% -\define@key{markdownRenderers}{dlItemEnd}{% - \renewcommand\markdownRendererDlItemEnd{#1}}% -\define@key{markdownRenderers}{dlDefinitionBegin}{% - \renewcommand\markdownRendererDlDefinitionBegin{#1}}% -\define@key{markdownRenderers}{dlDefinitionEnd}{% - \renewcommand\markdownRendererDlDefinitionEnd{#1}}% -\define@key{markdownRenderers}{dlEnd}{% - \renewcommand\markdownRendererDlEnd{#1}}% -\define@key{markdownRenderers}{dlEndTight}{% - \renewcommand\markdownRendererDlEndTight{#1}}% -\define@key{markdownRenderers}{emphasis}{% - \renewcommand\markdownRendererEmphasis[1]{#1}}% -\define@key{markdownRenderers}{strongEmphasis}{% - \renewcommand\markdownRendererStrongEmphasis[1]{#1}}% -\define@key{markdownRenderers}{blockQuoteBegin}{% - \renewcommand\markdownRendererBlockQuoteBegin{#1}}% -\define@key{markdownRenderers}{blockQuoteEnd}{% - \renewcommand\markdownRendererBlockQuoteEnd{#1}}% -\define@key{markdownRenderers}{inputVerbatim}{% - \renewcommand\markdownRendererInputVerbatim[1]{#1}}% -\define@key{markdownRenderers}{inputFencedCode}{% - \renewcommand\markdownRendererInputFencedCode[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataBoolean}{% - \renewcommand\markdownRendererJekyllDataBoolean[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataEmpty}{% - \renewcommand\markdownRendererJekyllDataEmpty[1]{#1}}% -\define@key{markdownRenderers}{jekyllDataNumber}{% - \renewcommand\markdownRendererJekyllDataNumber[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataString}{% - \renewcommand\markdownRendererJekyllDataString[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataBegin}{% - \renewcommand\markdownRendererJekyllDataBegin{#1}}% -\define@key{markdownRenderers}{jekyllDataEnd}{% - \renewcommand\markdownRendererJekyllDataEnd{#1}}% -\define@key{markdownRenderers}{jekyllDataSequenceBegin}{% - \renewcommand\markdownRendererJekyllDataSequenceBegin[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataSequenceEnd}{% - \renewcommand\markdownRendererJekyllDataSequenceEnd{#1}}% -\define@key{markdownRenderers}{jekyllDataMappingBegin}{% - \renewcommand\markdownRendererJekyllDataMappingBegin[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataMappingEnd}{% - \renewcommand\markdownRendererJekyllDataMappingEnd{#1}}% -\define@key{markdownRenderers}{headingOne}{% - \renewcommand\markdownRendererHeadingOne[1]{#1}}% -\define@key{markdownRenderers}{headingTwo}{% - \renewcommand\markdownRendererHeadingTwo[1]{#1}}% -\define@key{markdownRenderers}{headingThree}{% - \renewcommand\markdownRendererHeadingThree[1]{#1}}% -\define@key{markdownRenderers}{headingFour}{% - \renewcommand\markdownRendererHeadingFour[1]{#1}}% -\define@key{markdownRenderers}{headingFive}{% - \renewcommand\markdownRendererHeadingFive[1]{#1}}% -\define@key{markdownRenderers}{headingSix}{% - \renewcommand\markdownRendererHeadingSix[1]{#1}}% -\define@key{markdownRenderers}{horizontalRule}{% - \renewcommand\markdownRendererHorizontalRule{#1}}% -\define@key{markdownRenderers}{footnote}{% - \renewcommand\markdownRendererFootnote[1]{#1}}% -\define@key{markdownRenderers}{cite}{% - \renewcommand\markdownRendererCite[1]{#1}}% -\define@key{markdownRenderers}{textCite}{% - \renewcommand\markdownRendererTextCite[1]{#1}}% -\define@key{markdownRenderers}{table}{% - \renewcommand\markdownRendererTable[3]{#1}}% -\define@key{markdownRenderers}{inlineHtmlComment}{% - \renewcommand\markdownRendererInlineHtmlComment[1]{#1}}% -\define@key{markdownRenderers}{blockHtmlCommentBegin}{% - \renewcommand\markdownRendererBlockHtmlCommentBegin{#1}}% -\define@key{markdownRenderers}{blockHtmlCommentEnd}{% - \renewcommand\markdownRendererBlockHtmlCommentEnd{#1}}% -\define@key{markdownRenderers}{inlineHtmlTag}{% - \renewcommand\markdownRendererInlineHtmlTag[1]{#1}}% -\define@key{markdownRenderers}{inputBlockHtmlElement}{% - \renewcommand\markdownRendererInputBlockHtmlElement[1]{#1}}% -\define@key{markdownRenderers}{tickedBox}{% - \renewcommand\markdownRendererTickedBox{#1}}% -\define@key{markdownRenderers}{halfTickedBox}{% - \renewcommand\markdownRendererHalfTickedBox{#1}}% -\define@key{markdownRenderers}{untickedBox}{% - \renewcommand\markdownRendererUntickedBox{#1}}% +\ExplSyntaxOn +\cs_new:Nn \@@_latex_define_renderers: + { + \seq_map_function:NN + \g_@@_renderers_seq + \@@_latex_define_renderer:n + } +\cs_new:Nn \@@_latex_define_renderer:n + { + \tl_set:Nn + \l_tmpb_tl +% TODO: Replace with \str_uppercase:n in TeX Live 2020. + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownRenderer + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \prop_get:NnN + \g_@@_renderer_arities_prop + { #1 } + \l_tmpb_tl + \@@_latex_define_renderer:ncV + { #1 } + { \l_tmpa_tl } + \l_tmpb_tl + } +\cs_new:Nn \@@_latex_define_renderer:nNn + { + \define@key + { markdownRenderers } + { #1 } + { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ##1 } + } + } +\cs_generate_variant:Nn + \@@_latex_define_renderer:nNn + { ncV } +\ExplSyntaxOff % \end{macrocode} % \par % \begin{markdown} @@ -13673,174 +15310,53 @@ The following ordered list will be preceded by roman numerals: % % \end{markdown} % \begin{macrocode} -\define@key{markdownRendererPrototypes}{attributeIdentifier}{% - \renewcommand\markdownRendererAttributeIdentifierPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{attributeClassName}{% - \renewcommand\markdownRendererAttributeClassNamePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{attributeKeyValue}{% - \renewcommand\markdownRendererAttributeKeyValuePrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{documentBegin}{% - \renewcommand\markdownRendererDocumentBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{documentEnd}{% - \renewcommand\markdownRendererDocumentEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{interblockSeparator}{% - \renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}% -\define@key{markdownRendererPrototypes}{lineBreak}{% - \renewcommand\markdownRendererLineBreakPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ellipsis}{% - \renewcommand\markdownRendererEllipsisPrototype{#1}}% -\define@key{markdownRendererPrototypes}{headerAttributeContextBegin}{% - \renewcommand\markdownRendererHeaderAttributeContextBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{headerAttributeContextEnd}{% - \renewcommand\markdownRendererHeaderAttributeContextEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{nbsp}{% - \renewcommand\markdownRendererNbspPrototype{#1}}% -\define@key{markdownRendererPrototypes}{leftBrace}{% - \renewcommand\markdownRendererLeftBracePrototype{#1}}% -\define@key{markdownRendererPrototypes}{rightBrace}{% - \renewcommand\markdownRendererRightBracePrototype{#1}}% -\define@key{markdownRendererPrototypes}{dollarSign}{% - \renewcommand\markdownRendererDollarSignPrototype{#1}}% -\define@key{markdownRendererPrototypes}{percentSign}{% - \renewcommand\markdownRendererPercentSignPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ampersand}{% - \renewcommand\markdownRendererAmpersandPrototype{#1}}% -\define@key{markdownRendererPrototypes}{underscore}{% - \renewcommand\markdownRendererUnderscorePrototype{#1}}% -\define@key{markdownRendererPrototypes}{hash}{% - \renewcommand\markdownRendererHashPrototype{#1}}% -\define@key{markdownRendererPrototypes}{circumflex}{% - \renewcommand\markdownRendererCircumflexPrototype{#1}}% -\define@key{markdownRendererPrototypes}{backslash}{% - \renewcommand\markdownRendererBackslashPrototype{#1}}% -\define@key{markdownRendererPrototypes}{tilde}{% - \renewcommand\markdownRendererTildePrototype{#1}}% -\define@key{markdownRendererPrototypes}{pipe}{% - \renewcommand\markdownRendererPipePrototype{#1}}% -\define@key{markdownRendererPrototypes}{codeSpan}{% - \renewcommand\markdownRendererCodeSpanPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{link}{% - \renewcommand\markdownRendererLinkPrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{contentBlock}{% - \renewcommand\markdownRendererContentBlockPrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{contentBlockOnlineImage}{% - \renewcommand\markdownRendererContentBlockOnlineImagePrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{contentBlockCode}{% - \renewcommand\markdownRendererContentBlockCodePrototype[5]{#1}}% -\define@key{markdownRendererPrototypes}{image}{% - \renewcommand\markdownRendererImagePrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{ulBegin}{% - \renewcommand\markdownRendererUlBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulBeginTight}{% - \renewcommand\markdownRendererUlBeginTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulItem}{% - \renewcommand\markdownRendererUlItemPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulItemEnd}{% - \renewcommand\markdownRendererUlItemEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulEnd}{% - \renewcommand\markdownRendererUlEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulEndTight}{% - \renewcommand\markdownRendererUlEndTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olBegin}{% - \renewcommand\markdownRendererOlBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olBeginTight}{% - \renewcommand\markdownRendererOlBeginTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olItem}{% - \renewcommand\markdownRendererOlItemPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olItemWithNumber}{% - \renewcommand\markdownRendererOlItemWithNumberPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{olItemEnd}{% - \renewcommand\markdownRendererOlItemEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olEnd}{% - \renewcommand\markdownRendererOlEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olEndTight}{% - \renewcommand\markdownRendererOlEndTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlBegin}{% - \renewcommand\markdownRendererDlBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlBeginTight}{% - \renewcommand\markdownRendererDlBeginTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlItem}{% - \renewcommand\markdownRendererDlItemPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{dlItemEnd}{% - \renewcommand\markdownRendererDlItemEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlDefinitionBegin}{% - \renewcommand\markdownRendererDlDefinitionBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlDefinitionEnd}{% - \renewcommand\markdownRendererDlDefinitionEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlEnd}{% - \renewcommand\markdownRendererDlEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlEndTight}{% - \renewcommand\markdownRendererDlEndTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{emphasis}{% - \renewcommand\markdownRendererEmphasisPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{strongEmphasis}{% - \renewcommand\markdownRendererStrongEmphasisPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{blockQuoteBegin}{% - \renewcommand\markdownRendererBlockQuoteBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{blockQuoteEnd}{% - \renewcommand\markdownRendererBlockQuoteEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{inputVerbatim}{% - \renewcommand\markdownRendererInputVerbatimPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{inputFencedCode}{% - \renewcommand\markdownRendererInputFencedCodePrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataBoolean}{% - \renewcommand\markdownRendererJekyllDataBooleanPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataEmpty}{% - \renewcommand\markdownRendererJekyllDataEmptyPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataNumber}{% - \renewcommand\markdownRendererJekyllDataNumberPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataString}{% - \renewcommand\markdownRendererJekyllDataStringPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataBegin}{% - \renewcommand\markdownRendererJekyllDataBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataEnd}{% - \renewcommand\markdownRendererJekyllDataEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataSequenceBegin}{% - \renewcommand\markdownRendererJekyllDataSequenceBeginPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataSequenceEnd}{% - \renewcommand\markdownRendererJekyllDataSequenceEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataMappingBegin}{% - \renewcommand\markdownRendererJekyllDataMappingBeginPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataMappingEnd}{% - \renewcommand\markdownRendererJekyllDataMappingEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{headingOne}{% - \renewcommand\markdownRendererHeadingOnePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingTwo}{% - \renewcommand\markdownRendererHeadingTwoPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingThree}{% - \renewcommand\markdownRendererHeadingThreePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingFour}{% - \renewcommand\markdownRendererHeadingFourPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingFive}{% - \renewcommand\markdownRendererHeadingFivePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingSix}{% - \renewcommand\markdownRendererHeadingSixPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{horizontalRule}{% - \renewcommand\markdownRendererHorizontalRulePrototype{#1}}% -\define@key{markdownRendererPrototypes}{footnote}{% - \renewcommand\markdownRendererFootnotePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{cite}{% - \renewcommand\markdownRendererCitePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{textCite}{% - \renewcommand\markdownRendererTextCitePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{table}{% - \renewcommand\markdownRendererTablePrototype[3]{#1}}% -\define@key{markdownRendererPrototypes}{inlineHtmlComment}{% - \renewcommand\markdownRendererInlineHtmlCommentPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{blockHtmlCommentBegin}{% - \renewcommand\markdownRendererBlockHtmlCommentBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{blockHtmlCommentEnd}{% - \renewcommand\markdownRendererBlockHtmlCommentEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{inlineHtmlTag}{% - \renewcommand\markdownRendererInlineHtmlTagPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{inputBlockHtmlElement}{% - \renewcommand\markdownRendererInputBlockHtmlElementPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{tickedBox}{% - \renewcommand\markdownRendererTickedBoxPrototype{#1}}% -\define@key{markdownRendererPrototypes}{halfTickedBox}{% - \renewcommand\markdownRendererHalfTickedBoxPrototype{#1}}% -\define@key{markdownRendererPrototypes}{untickedBox}{% - \renewcommand\markdownRendererUntickedBoxPrototype{#1}}% +\ExplSyntaxOn +\cs_new:Nn \@@_latex_define_renderer_prototypes: + { + \seq_map_function:NN + \g_@@_renderers_seq + \@@_latex_define_renderer_prototype:n + } +\cs_new:Nn \@@_latex_define_renderer_prototype:n + { + \tl_set:Nn + \l_tmpb_tl +% TODO: Replace with \str_uppercase:n in TeX Live 2020. + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownRenderer + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + Prototype + } + \prop_get:NnN + \g_@@_renderer_arities_prop + { #1 } + \l_tmpb_tl + \@@_latex_define_renderer_prototype:ncV + { #1 } + { \l_tmpa_tl } + \l_tmpb_tl + } +\cs_new:Nn \@@_latex_define_renderer_prototype:nNn + { + \define@key + { markdownRendererPrototypes } + { #1 } + { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ##1 } + } + } +\cs_generate_variant:Nn + \@@_latex_define_renderer_prototype:nNn + { ncV } +\ExplSyntaxOff % \end{macrocode} % \par % \begin{markdown} @@ -18241,8 +19757,6 @@ parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more % % \end{markdown} % \begin{macrocode} -parsers.Block = V("Block") - parsers.OnlineImageURL = parsers.leader * parsers.onlineimageurl @@ -18495,13 +20009,13 @@ function M.reader.new(writer, options) = create_parser("parse_blocks", function() return larsers.blocks - end, false) + end, true) - local parse_blocks_toplevel - = create_parser("parse_blocks_toplevel", + local parse_blocks_nested + = create_parser("parse_blocks_nested", function() - return larsers.blocks_toplevel - end, true) + return larsers.blocks_nested + end, false) local parse_inlines = create_parser("parse_inlines", @@ -18622,7 +20136,7 @@ function M.reader.new(writer, options) return writer.defer_call(function() local found = rawnotes[normalize_tag(ref)] if found then - return writer.note(parse_blocks_toplevel(found)) + return writer.note(parse_blocks_nested(found)) else return {"[", parse_inlines("^" .. ref), "]"} end @@ -18953,7 +20467,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline * parsers.contentblock_tail / writer.contentblock - larsers.DisplayHtml = (parsers.htmlcomment / parse_blocks) + larsers.DisplayHtml = (parsers.htmlcomment / parse_blocks_nested) / writer.block_html_comment + parsers.emptyelt_block / writer.block_html_element + parsers.openelt_exact("hr") / writer.block_html_element @@ -18971,21 +20485,40 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline expandtabs(code)) end - larsers.JekyllData = P("---") + larsers.JekyllData = Cmt( C((parsers.line - P("---") - P("..."))^0) + , function(s, i, text) + local data + local ran_ok, error = pcall(function() + local tinyyaml = require("markdown-tinyyaml") + data = tinyyaml.parse(text, {timestamps=false}) + end) + if ran_ok and data ~= nil then + return true, writer.jekyllData(data, function(s) + return parse_blocks_nested(s) + end, nil) + else + return false + end + end + ) + + larsers.UnexpectedJekyllData + = P("---") * parsers.blankline / 0 * #(-parsers.blankline) -- if followed by blank, it's an hrule - * C((parsers.line - P("---") - P("..."))^0) + * larsers.JekyllData * (P("---") + P("...")) - / function(text) - local tinyyaml = require("markdown-tinyyaml") - data = tinyyaml.parse(text,{timestamps=false}) - return writer.jekyllData(data, function(s) - return parse_blocks(s) - end, nil) - end + + larsers.ExpectedJekyllData + = ( P("---") + * parsers.blankline / 0 + * #(-parsers.blankline) -- if followed by blank, it's an hrule + )^-1 + * larsers.JekyllData + * (P("---") + P("..."))^-1 larsers.Blockquote = Cs(larsers.blockquote_body^1) - / parse_blocks_toplevel / writer.blockquote + / parse_blocks_nested / writer.blockquote larsers.HorizontalRule = ( parsers.lineof(parsers.asterisk) + parsers.lineof(parsers.dash) @@ -18995,15 +20528,6 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.Reference = parsers.define_reference_parser / register_link larsers.Paragraph = parsers.nonindentspace * Ct(parsers.Inline^1) - * parsers.newline - * ( parsers.blankline^1 - + #parsers.hash - + #(parsers.leader * parsers.more * parsers.space^-1) - ) - / writer.paragraph - - larsers.ToplevelParagraph - = parsers.nonindentspace * Ct(parsers.Inline^1) * ( parsers.newline * ( parsers.blankline^1 + #parsers.hash @@ -19052,7 +20576,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.TightListItem = function(starter) return -larsers.HorizontalRule * (Cs(starter / "" * larsers.tickbox^-1 * larsers.ListBlock * larsers.NestedList^-1) - / parse_blocks) + / parse_blocks_nested) * -(parsers.blanklines * parsers.indent) end @@ -19061,7 +20585,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline * Cs( starter / "" * larsers.tickbox^-1 * larsers.ListBlock * Cc("\n") * (larsers.NestedList + larsers.ListContinuationBlock^0) * (parsers.blanklines / "\n\n") - ) / parse_blocks + ) / parse_blocks_nested end larsers.BulletList = ( Ct(larsers.TightListItem(parsers.bullet)^1) * Cc(true) @@ -19098,12 +20622,12 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.DefinitionListItemLoose = C(parsers.line) * parsers.skipblanklines * Ct((parsers.defstart * parsers.indented_blocks(parsers.dlchunk) - / parse_blocks_toplevel)^1) + / parse_blocks_nested)^1) * Cc(false) / definition_list_item larsers.DefinitionListItemTight = C(parsers.line) * Ct((parsers.defstart * parsers.dlchunk - / parse_blocks)^1) + / parse_blocks_nested)^1) * Cc(true) / definition_list_item larsers.DefinitionList = ( Ct(larsers.DefinitionListItemLoose^1) * Cc(false) @@ -19202,17 +20726,22 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline local syntax = { "Blocks", - Blocks = larsers.Blank^0 * parsers.Block^-1 - * (larsers.Blank^0 / writer.interblocksep - * parsers.Block)^0 - * larsers.Blank^0 * parsers.eof, + Blocks = ( V("ExpectedJekyllData") + * (V("Blank")^0 / writer.interblocksep) + )^-1 + * V("Blank")^0 + * V("Block")^-1 + * (V("Blank")^0 / writer.interblocksep + * V("Block"))^0 + * V("Blank")^0 * parsers.eof, Blank = larsers.Blank, - JekyllData = larsers.JekyllData, + UnexpectedJekyllData = larsers.UnexpectedJekyllData, + ExpectedJekyllData = larsers.ExpectedJekyllData, Block = V("ContentBlock") - + V("JekyllData") + + V("UnexpectedJekyllData") + V("Blockquote") + V("PipeTable") + V("Verbatim") @@ -19341,7 +20870,11 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline end if not options.jekyllData then - syntax.JekyllData = parsers.fail + syntax.UnexpectedJekyllData = parsers.fail + end + + if not options.jekyllData or not options.expectJekyllData then + syntax.ExpectedJekyllData = parsers.fail end if options.preserveTabs then @@ -19360,9 +20893,9 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline syntax.AutoLinkRelativeReference = parsers.fail end - local blocks_toplevel_t = util.table_copy(syntax) - blocks_toplevel_t.Paragraph = larsers.ToplevelParagraph - larsers.blocks_toplevel = Ct(blocks_toplevel_t) + local blocks_nested_t = util.table_copy(syntax) + blocks_nested_t.ExpectedJekyllData = parsers.fail + larsers.blocks_nested = Ct(blocks_nested_t) larsers.blocks = Ct(syntax) @@ -19427,7 +20960,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline % \end{markdown} % \begin{macrocode} local function convert(input) - local document = parse_blocks_toplevel(input) + local document = parse_blocks(input) return util.rope_to_string(writer.document(document)) end if options.eagerCache or options.finalizeCache then @@ -19684,121 +21217,377 @@ end % \par % \begin{markdown} % -%### Lua Snippets -% The \mdef{markdownLuaOptions} macro expands to a Lua table that -% contains the plain \TeX{} options (see Section <#sec:texoptions>) in a -% format recognized by Lua (see Section <#sec:luaoptions>). +%#### YAML Metadata Renderer Prototypes {#expl3yamlmetadataimplementation} % -% \end{markdown} -% \begin{macrocode} -\def\markdownLuaOptions{{% -\ifx\markdownOptionBlankBeforeBlockquote\undefined\else - blankBeforeBlockquote = \markdownOptionBlankBeforeBlockquote, -\fi -\ifx\markdownOptionBlankBeforeCodeFence\undefined\else - blankBeforeCodeFence = \markdownOptionBlankBeforeCodeFence, -\fi -\ifx\markdownOptionBlankBeforeHeading\undefined\else - blankBeforeHeading = \markdownOptionBlankBeforeHeading, -\fi -\ifx\markdownOptionBreakableBlockquotes\undefined\else - breakableBlockquotes = \markdownOptionBreakableBlockquotes, -\fi - cacheDir = "\markdownOptionCacheDir", -\ifx\markdownOptionCitations\undefined\else - citations = \markdownOptionCitations, -\fi -\ifx\markdownOptionCitationNbsps\undefined\else - citationNbsps = \markdownOptionCitationNbsps, -\fi -\ifx\markdownOptionCodeSpans\undefined\else - codeSpans = \markdownOptionCodeSpans, -\fi -\ifx\markdownOptionContentBlocks\undefined\else - contentBlocks = \markdownOptionContentBlocks, -\fi -\ifx\markdownOptionContentBlocksLanguageMap\undefined\else - contentBlocksLanguageMap = - "\markdownOptionContentBlocksLanguageMap", -\fi -\ifx\markdownOptionDefinitionLists\undefined\else - definitionLists = \markdownOptionDefinitionLists, -\fi -\ifx\markdownOptionEagerCache\undefined\else - eagerCache = \markdownOptionEagerCache, -\fi -\ifx\markdownOptionFinalizeCache\undefined\else - finalizeCache = \markdownOptionFinalizeCache, -\fi - frozenCacheFileName = "\markdownOptionFrozenCacheFileName", - frozenCacheCounter = \the\markdownFrozenCacheCounter, -\ifx\markdownOptionFootnotes\undefined\else - footnotes = \markdownOptionFootnotes, -\fi -\ifx\markdownOptionFencedCode\undefined\else - fencedCode = \markdownOptionFencedCode, -\fi -\ifx\markdownOptionHardLineBreaks\undefined\else - hardLineBreaks = \markdownOptionHardLineBreaks, -\fi -\ifx\markdownOptionHashEnumerators\undefined\else - hashEnumerators = \markdownOptionHashEnumerators, -\fi -\ifx\markdownOptionHeaderAttributes\undefined\else - headerAttributes = \markdownOptionHeaderAttributes, -\fi -\ifx\markdownOptionHtml\undefined\else - html = \markdownOptionHtml, -\fi -\ifx\markdownOptionHybrid\undefined\else - hybrid = \markdownOptionHybrid, -\fi -\ifx\markdownOptionInlineFootnotes\undefined\else - inlineFootnotes = \markdownOptionInlineFootnotes, -\fi -\ifx\markdownOptionJekyllData\undefined\else - jekyllData = \markdownOptionJekyllData, -\fi -\ifx\markdownOptionPipeTables\undefined\else - pipeTables = \markdownOptionPipeTables, -\fi -\ifx\markdownOptionPreserveTabs\undefined\else - preserveTabs = \markdownOptionPreserveTabs, -\fi -\ifx\markdownOptionRelativeReferences\undefined\else - relativeReferences = \markdownOptionRelativeReferences, -\fi -\ifx\markdownOptionShiftHeadings\undefined\else - shiftHeadings = "\markdownOptionShiftHeadings", -\fi -\ifx\markdownOptionSlice\undefined\else - slice = "\markdownOptionSlice", -\fi -\ifx\markdownOptionSmartEllipses\undefined\else - smartEllipses = \markdownOptionSmartEllipses, -\fi -\ifx\markdownOptionStartNumber\undefined\else - startNumber = \markdownOptionStartNumber, -\fi -\ifx\markdownOptionStripIndent\undefined\else - stripIndent = \markdownOptionStripIndent, -\fi -\ifx\markdownOptionTableCaptions\undefined\else - tableCaptions = \markdownOptionTableCaptions, -\fi -\ifx\markdownOptionTaskLists\undefined\else - taskLists = \markdownOptionTaskLists, -\fi -\ifx\markdownOptionTeXComments\undefined\else - texComments = \markdownOptionTeXComments, -\fi -\ifx\markdownOptionTightLists\undefined\else - tightLists = \markdownOptionTightLists, -\fi -\ifx\markdownOptionUnderscores\undefined\else - underscores = \markdownOptionUnderscores, -\fi} -}% +% To keep track of the current type of structure we inhabit when we are +% traversing a \acro{yaml} document, we will maintain the +% \mdef{g_\@\@_jekyll_data_datatypes_seq} stack. At every step of the traversal, +% the stack will contain one of the following constants at any position $p$: +% +% \mdef{c_\@\@_jekyll_data_sequence_tl} +% +%: The currently traversed branch of the \acro{yaml} document contains a sequence +% at depth $p$. +% +% \mdef{c_\@\@_jekyll_data_mapping_tl} +% +%: The currently traversed branch of the \acro{yaml} document contains a mapping +% at depth $p$. +% +% \mdef{c_\@\@_jekyll_data_scalar_tl} +% +%: The currently traversed branch of the \acro{yaml} document contains a scalar +% value at depth $p$. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\seq_new:N \g_@@_jekyll_data_datatypes_seq +\tl_const:Nn \c_@@_jekyll_data_sequence_tl { sequence } +\tl_const:Nn \c_@@_jekyll_data_mapping_tl { mapping } +\tl_const:Nn \c_@@_jekyll_data_scalar_tl { scalar } +% \end{macrocode} +% \par +% \begin{markdown} +% +% To keep track of our current place when we are traversing a \acro{yaml} +% document, we will maintain the +% \mdef{g_\@\@_jekyll_data_wildcard_absolute_address_seq} stack of keys using +% the \mdef{markdown_jekyll_data_push_address_segment:n} macro. +% +% \end{markdown} +% \begin{macrocode} +\seq_new:N \g_@@_jekyll_data_wildcard_absolute_address_seq +\cs_new:Nn \markdown_jekyll_data_push_address_segment:n + { + \seq_if_empty:NF + \g_@@_jekyll_data_datatypes_seq + { + \seq_get_right:NN + \g_@@_jekyll_data_datatypes_seq + \l_tmpa_tl +% \end{macrocode} +% \begin{markdown} +% +% If we are currently in a sequence, we will put an asterisk (`*`) instead of +% a key into \mref{g_\@\@_jekyll_data_wildcard_absolute_address_seq} to make +% it represent a *wildcard*. Keeping a wildcard instead of a precise address +% makes it easy for the users to react to *any* item of a sequence regardless +% of how many there are, which can often be useful. +% +% \end{markdown} +% \begin{macrocode} + \tl_if_eq:NNTF + \l_tmpa_tl + \c_@@_jekyll_data_sequence_tl + { + \seq_put_right:Nn + \g_@@_jekyll_data_wildcard_absolute_address_seq + { * } + } + { + \seq_put_right:Nn + \g_@@_jekyll_data_wildcard_absolute_address_seq + { #1 } + } + } + } +% \end{macrocode} +% \par +% \begin{markdown} +% +% Out of \mref{g_\@\@_jekyll_data_wildcard_absolute_address_seq}, we will +% construct the following two token lists: +% +% \mdef{g_\@\@_jekyll_data_wildcard_absolute_address_tl} +% +%: An *absolute wildcard*: The wildcard from the root of the document +% prefixed with a slash (`/`) with individual keys and asterisks also +% delimited by slashes. Allows the users to react to complex +% context-sensitive structures with ease. +% +%: For example, the `name` key in the following \acro{yaml} document +% would correspond to the `/*/person/name` absolute wildcard: +% ``` yaml +% [{person: {name: Elon, surname: Musk}}] +% ``` +% +% \mdef{g_\@\@_jekyll_data_wildcard_relative_address_tl} +% +%: A *relative wildcard*: The rightmost segment of the wildcard. Allows the +% users to react to simple context-free structures. +% +%: For example, the `name` key in the following \acro{yaml} document +% would correspond to the `name` relative wildcard: +% ``` yaml +% [{person: {name: Elon, surname: Musk}}] +% ``` +% +% We will construct \mref{g_\@\@_jekyll_data_wildcard_absolute_address_tl} +% using the \mdef{markdown_jekyll_data_concatenate_address:NN} macro and +% we will construct both token lists using the +% \mdef{markdown_jekyll_data_update_address_tls:} macro. +% +% \end{markdown} +% \begin{macrocode} +\tl_new:N \g_@@_jekyll_data_wildcard_absolute_address_tl +\tl_new:N \g_@@_jekyll_data_wildcard_relative_address_tl +\cs_new:Nn \markdown_jekyll_data_concatenate_address:NN + { + \seq_pop_left:NN #1 \l_tmpa_tl + \tl_set:Nx #2 { / \seq_use:Nn #1 { / } } + \seq_put_left:NV #1 \l_tmpa_tl + } +\cs_new:Nn \markdown_jekyll_data_update_address_tls: + { + \markdown_jekyll_data_concatenate_address:NN + \g_@@_jekyll_data_wildcard_absolute_address_seq + \g_@@_jekyll_data_wildcard_absolute_address_tl + \seq_get_right:NN + \g_@@_jekyll_data_wildcard_absolute_address_seq + \g_@@_jekyll_data_wildcard_relative_address_tl + } +% \end{macrocode} +% \par +% \begin{markdown} +% +% To make sure that the stacks and token lists stay in sync, we will use the +% \mdef{markdown_jekyll_data_push:nN} and \mdef{markdown_jekyll_data_pop:} +% macros. +% +% \end{markdown} +% \begin{macrocode} +\cs_new:Nn \markdown_jekyll_data_push:nN + { + \markdown_jekyll_data_push_address_segment:n + { #1 } + \seq_put_right:NV + \g_@@_jekyll_data_datatypes_seq + #2 + \markdown_jekyll_data_update_address_tls: + } +\cs_new:Nn \markdown_jekyll_data_pop: + { + \seq_pop_right:NN + \g_@@_jekyll_data_wildcard_absolute_address_seq + \l_tmpa_tl + \seq_pop_right:NN + \g_@@_jekyll_data_datatypes_seq + \l_tmpa_tl + \markdown_jekyll_data_update_address_tls: + } +% \end{macrocode} +% \par +% \begin{markdown} +% +% To set a single key--value, we will use the +% \mdef{markdown_jekyll_data_set_keyval:Nn} macro, ignoring unknown keys. +% To set key--values for both absolute and relative wildcards, we will use the +% \mdef{markdown_jekyll_data_set_keyvals:nn} macro. +% +% \end{markdown} +% \begin{macrocode} +\cs_new:Nn \markdown_jekyll_data_set_keyval:nn + { + \keys_set_known:nn + { markdown/jekyllData } + { { #1 } = { #2 } } + } +\cs_generate_variant:Nn + \markdown_jekyll_data_set_keyval:nn + { Vn } +\cs_new:Nn \markdown_jekyll_data_set_keyvals:nn + { + \markdown_jekyll_data_push:nN + { #1 } + \c_@@_jekyll_data_scalar_tl + \markdown_jekyll_data_set_keyval:Vn + \g_@@_jekyll_data_wildcard_absolute_address_tl + { #2 } + \markdown_jekyll_data_set_keyval:Vn + \g_@@_jekyll_data_wildcard_relative_address_tl + { #2 } + \markdown_jekyll_data_pop: + } +% \end{macrocode} +% \par +% \begin{markdown} +% +% Finally, we will register our macros as token renderer prototypes +% to be able to react to the traversal of a \acro{yaml} document. +% +% \end{markdown} +% \begin{macrocode} +\def\markdownRendererJekyllDataSequenceBeginPrototype#1#2{ + \markdown_jekyll_data_push:nN + { #1 } + \c_@@_jekyll_data_sequence_tl +} +\def\markdownRendererJekyllDataMappingBeginPrototype#1#2{ + \markdown_jekyll_data_push:nN + { #1 } + \c_@@_jekyll_data_mapping_tl +} +\def\markdownRendererJekyllDataSequenceEndPrototype{ + \markdown_jekyll_data_pop: +} +\def\markdownRendererJekyllDataMappingEndPrototype{ + \markdown_jekyll_data_pop: +} +\def\markdownRendererJekyllDataBooleanPrototype#1#2{ + \markdown_jekyll_data_set_keyvals:nn + { #1 } + { #2 } +} +\def\markdownRendererJekyllDataEmptyPrototype#1{} +\def\markdownRendererJekyllDataNumberPrototype#1#2{ + \markdown_jekyll_data_set_keyvals:nn + { #1 } + { #2 } +} +\def\markdownRendererJekyllDataStringPrototype#1#2{ + \markdown_jekyll_data_set_keyvals:nn + { #1 } + { #2 } +} +\ExplSyntaxOff +% \end{macrocode} +% \begin{markdown} +% +%### Lua Snippets +% After the \mdef{markdownPrepareLuaOptions} macro has been fully expanded, +% the \mdef{markdownLuaOptions} macro will expands to a Lua table that +% contains the plain \TeX{} options (see Section <#sec:texoptions>) in a +% format recognized by Lua (see Section <#sec:luaoptions>). +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\tl_new:N \g_@@_formatted_lua_options_tl +\tl_const:Nn \c_@@_lua_option_type_boolean { boolean } +\tl_const:Nn \c_@@_lua_option_type_counter { counter } +\tl_const:Nn \c_@@_lua_option_type_number { number } +\tl_const:Nn \c_@@_lua_option_type_string { string } +\cs_new:Nn \@@_format_lua_options: + { + \tl_gclear:N + \g_@@_formatted_lua_options_tl + \seq_map_function:NN + \g_@@_lua_options_seq + \@@_format_lua_option:n + } +\cs_new:Nn \@@_format_lua_option:n + { + \@@_typecheck_lua_option:n { #1 } + \tl_set:Nn + \l_tmpb_tl +% TODO: Replace with \str_uppercase:n in TeX Live 2020. + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownOption + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \prop_get:NnN + \g_@@_lua_option_types_prop + { #1 } + \l_tmpb_tl + \cs_if_free:cTF + { \l_tmpa_tl } + { } + { + \tl_case:NnF + \l_tmpb_tl + { + \c_@@_lua_option_type_string + { + \tl_gput_right:Nx + \g_@@_formatted_lua_options_tl + { #1~=~" \cs:w \l_tmpa_tl \cs_end: ",~ } + } + \c_@@_lua_option_type_counter + { + \tl_gput_right:Nx + \g_@@_formatted_lua_options_tl + { #1~=~ \the \cs:w \l_tmpa_tl \cs_end: ,~ } + } + } + { + \tl_gput_right:Nx + \g_@@_formatted_lua_options_tl + { #1~=~ \cs:w \l_tmpa_tl \cs_end: ,~ } + } + } + } +\msg_new:nnn + { markdown } + { undefined-lua-option } + { + Lua~option~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { failed-typecheck-for-boolean-lua-option } + { + Lua~option~#1~has~value~#2,~ + but~a~boolean~(true~or~false)~was~expected. + } +\cs_new:Nn \@@_typecheck_lua_option:n + { + \tl_set:Nn + \l_tmpb_tl +% TODO: Replace with \str_uppercase:n in TeX Live 2020. + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownOption + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \prop_get:NnNTF + \g_@@_lua_option_types_prop + { #1 } + \l_tmpb_tl + { + \cs_if_free:cTF + { \l_tmpa_tl } + { } + { + \tl_case:Nn + \l_tmpb_tl + { + \c_@@_lua_option_type_boolean + { + \tl_case:cnF + { \l_tmpa_tl } + { + \c_@@_lua_option_value_true { } + \c_@@_lua_option_value_false { } + } + { + \msg_error:nnxx + { markdown } + { failed-typecheck-for-boolean-lua-option } + { #1 } + { \l_tmpa_tl } + } + } + } + } + } + { + \msg_error:nnn + { markdown } + { undefined-lua-option } + { #1 } + } + } +\let\markdownPrepareLuaOptions=\@@_format_lua_options: +\def\markdownLuaOptions{{ \g_@@_formatted_lua_options_tl }} +\ExplSyntaxOff % \end{macrocode} % \par % \begin{markdown} @@ -19844,11 +21633,43 @@ end % % \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}% +\ExplSyntaxOn +\tl_const:Nn \c_@@_lua_option_value_true { true } +\tl_const:Nn \c_@@_lua_option_value_false { false } +\cs_new:Nn \@@_if_option:nTF + { + \tl_set:Nn + \l_tmpb_tl +% TODO: Replace with \str_uppercase:n in TeX Live 2020. + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownOption + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \cs_if_free:cTF + { \l_tmpa_tl } + { + \prop_get:NnN + \g_@@_default_lua_options_prop + { #1 } + \l_tmpb_tl + } + { + \tl_set:Nf + \l_tmpb_tl + { \cs:w \l_tmpa_tl \cs_end: } + } + \tl_if_eq:NNTF + \l_tmpb_tl + \c_@@_lua_option_value_true + { #2 } + { #3 } + } +\let\markdownIfOption=\@@_if_option:nTF +\ExplSyntaxOff % \end{macrocode} % \par % \begin{markdown} @@ -19888,7 +21709,7 @@ end % Make the newline and tab characters active and swap the character codes of % the backslash symbol (`\`) and the pipe symbol (`|`), so that we can use the % backslash as an ordinary character inside the macro definition. Likewise, -% swap the character codes of the percent sign (`%`) and the ampersand (`@`), +% swap the character codes of the percent sign (`\%`) and the ampersand (`@`), % so that we can remove percent signs from the beginning of lines when % \mref{markdownOptionStripPercentSigns} is enabled. % \end{markdown} @@ -19907,7 +21728,7 @@ end % open the \mref{markdownOptionInputTempFileName} file for writing. % \end{markdown} % \begin{macrocode} - |markdownIfOption{FrozenCache}{}{@ + |markdownIfOption{frozenCache}{}{@ |immediate|openout|markdownOutputFileStream@ |markdownOptionInputTempFileName|relax@ |markdownInfo{Buffering markdown input into the temporary @ @@ -19928,7 +21749,7 @@ end % \end{macrocode} % \begin{markdown} % The \mdef{markdownReadAndConvertStripPercentSigns} macro will process the -% individual lines of output, stipping away leading percent signs (`%`) when +% individual lines of output, stipping away leading percent signs (`\%`) when % \mref{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 @@ -19936,7 +21757,7 @@ end % \end{markdown} % \begin{macrocode} |def|markdownReadAndConvertStripPercentSign##1{@ - |markdownIfOption{StripPercentSigns}{@ + |markdownIfOption{stripPercentSigns}{@ |if##1%@ |expandafter|expandafter|expandafter@ |markdownReadAndConvertProcessLine@ @@ -19971,7 +21792,7 @@ end % \end{markdown} % \begin{macrocode} |ifx|relax##3|relax@ - |markdownIfOption{FrozenCache}{}{@ + |markdownIfOption{frozenCache}{}{@ |immediate|write|markdownOutputFileStream{##1}@ }@ |else@ @@ -19987,7 +21808,7 @@ end % \begin{macrocode} |def^^M{@ |markdownInfo{The ending token sequence was found}@ - |markdownIfOption{FrozenCache}{}{@ + |markdownIfOption{frozenCache}{}{@ |immediate|closeout|markdownOutputFileStream@ }@ |endgroup@ @@ -20275,7 +22096,7 @@ end |gdef|markdownInput#1{% % \end{macrocode} % \begin{markdown} -% Change the category code of the percent sign (`%`) to other, so that a user +% Change the category code of the percent sign (`\%`) to other, so that a user % of the \Opt{hybrid} Lua option or a malevolent actor can't produce TeX % comments in the plain TeX output of the Markdown package. % \end{markdown} @@ -20289,7 +22110,7 @@ end % \mref{markdownFrozenCacheCounter}. % \end{markdown} % \begin{macrocode} - |markdownIfOption{FrozenCache}{% + |markdownIfOption{frozenCache}{% |ifnum|markdownFrozenCacheCounter=0|relax |markdownInfo{Reading frozen cache from "|markdownOptionFrozenCacheFileName"}% @@ -20310,6 +22131,7 @@ end % \begin{macrocode} |openin|markdownInputFileStream#1 |closein|markdownInputFileStream + |markdownPrepareLuaOptions |markdownLuaExecute{% |markdownPrepare local file = assert(io.open("#1", "r"), @@ -20330,7 +22152,7 @@ end % \mref{markdownFrozenCacheCounter}. % \end{markdown} % \begin{macrocode} - |markdownIfOption{FinalizeCache}{% + |markdownIfOption{finalizeCache}{% |global|advance|markdownFrozenCacheCounter by 1|relax }% }% @@ -20370,6 +22192,19 @@ end % \par % \begin{markdown} % +% Use reflection to define the `renderers` and `rendererPrototypes` keys of +% \mref{markdownSetup} as well as the keys that correspond to Lua options. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\@@_latex_define_renderers: +\@@_latex_define_renderer_prototypes: +\ExplSyntaxOff +% \end{macrocode} +% \par +% \begin{markdown} +% %### Logging Facilities % The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see % Section <#sec:texinterfacelogging>) to use the \LaTeX{} \mref{PackageInfo}, @@ -20520,7 +22355,7 @@ end \renewcommand\markdownRendererInputFencedCode[2]{% \def\next##1 ##2\relax{% \ifthenelse{\equal{##1}{dot}}{% - \markdownIfOption{FrozenCache}{}{% + \markdownIfOption{frozenCache}{}{% \immediate\write18{% if ! test -e #1.pdf.source || ! diff #1 #1.pdf.source; then @@ -20630,7 +22465,7 @@ end % % \end{markdown} % \begin{macrocode} - \markdownIfOption{FrozenCache}{}{^^A + \markdownIfOption{frozenCache}{}{^^A \immediate\write18{^^A if printf '%s' "#3" | grep -q -E '^https?:'; then @@ -20717,8 +22552,9 @@ end % \end{macrocode} % \begin{markdown} % -% After processing the options, activate the `renderers` and -% `rendererPrototypes` keys. +% After processing the options, activate the `renderers`, `rendererPrototypes`, +% and `code` keys. The `code` key is used to immediately expand and execute code, +% which can be especially useful in \LaTeX{} setup snippets. % % \end{markdown} % \begin{macrocode} @@ -20728,6 +22564,7 @@ end \define@key{markdownOptions}{rendererPrototypes}{% \setkeys{markdownRendererPrototypes}{#1}% \def\KV@prefix{KV@markdownOptions@}}% +\define@key{markdownOptions}{code}{#1}% % \end{macrocode} % \par % \begin{markdown} @@ -20743,23 +22580,14 @@ end % \end{macrocode} % \par % \begin{markdown}% -% If the \mref{markdownOptionTightLists} macro expands to `false`, do not load -% the \pkg{paralist} package. This is necessary for \Hologo{LaTeX2e} document -% classes that do not play nice with \pkg{paralist}, such as \pkg{beamer}. -% If the \mref{markdownOptionTightLists} is undefined and the \pkg{beamer} -% document class is in use, then do not load the \pkg{paralist} package either. +% If the \Opt{tightLists} Lua option is disabled or the current document class +% is \pkg{beamer}, do not load the \pkg{paralist} package. % % \end{markdown} % \begin{macrocode} -\RequirePackage{ifthen} - -\ifx\markdownOptionTightLists\undefined - \@ifclassloaded{beamer}{}{% - \RequirePackage{paralist}}% -\else - \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{% - \RequirePackage{paralist}}% -\fi +\markdownIfOption{tightLists}{ + \@ifclassloaded{beamer}{}{\RequirePackage{paralist}}% +}{} % \end{macrocode} % \par % \begin{markdown} @@ -20787,7 +22615,7 @@ end olEndTight = {\markdownRendererOlEnd}, dlBeginTight = {\markdownRendererDlBegin}, dlEndTight = {\markdownRendererDlEnd}}}} -\RequirePackage{amsmath} +\RequirePackage{amsmath,ifthen} % \end{macrocode} % \par % \begin{markdown} @@ -21431,180 +23259,14 @@ end % %#### YAML Metadata {#latexyamlmetadata} % -% \end{markdown} -% \begin{macrocode} -\ExplSyntaxOn -% \end{macrocode} -% \begin{markdown} -% -% To keep track of the current type of structure we inhabit when we are -% traversing a \acro{yaml} document, we will maintain the -% \mdef{g_\@\@_jekyll_data_datatypes_seq} stack. At every step of the traversal, -% the stack will contain one of the following constants at any position $p$: -% -% \mdef{c_\@\@_jekyll_data_sequence_tl} -% -%: The currently traversed branch of the \acro{yaml} document contains a sequence -% at depth $p$. -% -% \mdef{c_\@\@_jekyll_data_mapping_tl} -% -%: The currently traversed branch of the \acro{yaml} document contains a mapping -% at depth $p$. -% -% \mdef{c_\@\@_jekyll_data_scalar_tl} -% -%: The currently traversed branch of the \acro{yaml} document contains a scalar -% value at depth $p$. -% -% \end{markdown} -% \begin{macrocode} -\seq_new:N \g_@@_jekyll_data_datatypes_seq -\tl_const:Nn \c_@@_jekyll_data_sequence_tl { sequence } -\tl_const:Nn \c_@@_jekyll_data_mapping_tl { mapping } -\tl_const:Nn \c_@@_jekyll_data_scalar_tl { scalar } -% \end{macrocode} -% \par -% \begin{markdown} -% -% To keep track of our current place when we are traversing a \acro{yaml} -% document, we will maintain the -% \mdef{g_\@\@_jekyll_data_wildcard_absolute_address_seq} stack of keys using -% the \mdef{markdown_jekyll_data_push_address_segment:n} macro. -% -% \end{markdown} -% \begin{macrocode} -\seq_new:N \g_@@_jekyll_data_wildcard_absolute_address_seq -\cs_new:Nn \markdown_jekyll_data_push_address_segment:n - { - \seq_if_empty:NF - \g_@@_jekyll_data_datatypes_seq - { - \seq_get_right:NN - \g_@@_jekyll_data_datatypes_seq - \l_tmpa_tl -% \end{macrocode} -% \begin{markdown} -% -% If we are currently in a sequence, we will put an asterisk (`*`) instead of -% a key into \mref{g_\@\@_jekyll_data_wildcard_absolute_address_seq} to make -% it represent a *wildcard*. Keeping a wildcard instead of a precise address -% makes it easy for the users to react to *any* item of a sequence regardless -% of how many there are, which can often be useful. -% -% \end{markdown} -% \begin{macrocode} - \tl_if_eq:NNTF - \l_tmpa_tl - \c_@@_jekyll_data_sequence_tl - { - \seq_put_right:Nn - \g_@@_jekyll_data_wildcard_absolute_address_seq - { * } - } - { - \seq_put_right:Nn - \g_@@_jekyll_data_wildcard_absolute_address_seq - { #1 } - } - } - } -% \end{macrocode} -% \par -% \begin{markdown} -% -% Out of \mref{g_\@\@_jekyll_data_wildcard_absolute_address_seq}, we will -% construct the following two token lists: -% -% \mdef{g_\@\@_jekyll_data_wildcard_absolute_address_tl} -% -%: An *absolute wildcard*: The wildcard from the root of the document -% prefixed with a slash (`/`) with individual keys and asterisks also -% delimited by slashes. Allows the users to react to complex -% context-sensitive structures with ease. -% -%: For example, the `name` key in the following \acro{yaml} document -% would correspond to the `/*/person/name` absolute wildcard: -% ``` yaml -% [{person: {name: Elon, surname: Musk}}] -% ``` -% -% \mdef{g_\@\@_jekyll_data_wildcard_relative_address_tl} -% -%: A *relative wildcard*: The rightmost segment of the wildcard. Allows the -% users to react to simple context-free structures. -% -%: For example, the `name` key in the following \acro{yaml} document -% would correspond to the `name` relative wildcard: -% ``` yaml -% [{person: {name: Elon, surname: Musk}}] -% ``` -% -% We will construct \mref{g_\@\@_jekyll_data_wildcard_absolute_address_tl} -% using the \mdef{markdown_jekyll_data_concatenate_address:NN} macro and -% we will construct both token lists using the -% \mdef{markdown_jekyll_data_update_address_tls:} macro. -% -% \end{markdown} -% \begin{macrocode} -\tl_new:N \g_@@_jekyll_data_wildcard_absolute_address_tl -\tl_new:N \g_@@_jekyll_data_wildcard_relative_address_tl -\cs_new:Nn \markdown_jekyll_data_concatenate_address:NN - { - \seq_pop_left:NN #1 \l_tmpa_tl - \tl_set:Nx #2 { / \seq_use:Nn #1 { / } } - \seq_put_left:NV #1 \l_tmpa_tl - } -\cs_new:Nn \markdown_jekyll_data_update_address_tls: - { - \markdown_jekyll_data_concatenate_address:NN - \g_@@_jekyll_data_wildcard_absolute_address_seq - \g_@@_jekyll_data_wildcard_absolute_address_tl - \seq_get_right:NN - \g_@@_jekyll_data_wildcard_absolute_address_seq - \g_@@_jekyll_data_wildcard_relative_address_tl - } -% \end{macrocode} -% \par -% \begin{markdown} -% -% To make sure that the stacks and token lists stay in sync, we will use the -% \mdef{markdown_jekyll_data_push:nN} and \mdef{markdown_jekyll_data_pop:} -% macros. -% -% \end{markdown} -% \begin{macrocode} -\cs_new:Nn \markdown_jekyll_data_push:nN - { - \markdown_jekyll_data_push_address_segment:n - { #1 } - \seq_put_right:NV - \g_@@_jekyll_data_datatypes_seq - #2 - \markdown_jekyll_data_update_address_tls: - } -\cs_new:Nn \markdown_jekyll_data_pop: - { - \seq_pop_right:NN - \g_@@_jekyll_data_wildcard_absolute_address_seq - \l_tmpa_tl - \seq_pop_right:NN - \g_@@_jekyll_data_datatypes_seq - \l_tmpa_tl - \markdown_jekyll_data_update_address_tls: - } -% \end{macrocode} -% \par -% \begin{markdown} -% -% To interface with the user, we use `markdown/jekyllData` key--values from the -% l3keys module of the \LaTeX3 kernel. The default setup will invoke the -% \mref{title}, \mref{author}, and \mref{date} macros when scalar values for -% keys that correspond to the `title`, `author`, and `date` relative wildcards -% are encountered, respectively. +% The default setup of \acro{yaml} metadata will invoke the \mref{title}, +% \mref{author}, and \mref{date} macros when scalar values for keys that +% correspond to the `title`, `author`, and `date` relative wildcards are +% encountered, respectively. % % \end{markdown} % \begin{macrocode} +\ExplSyntaxOn \keys_define:nn { markdown/jekyllData } { @@ -21615,81 +23277,6 @@ end % \end{macrocode} % \begin{markdown} % -% To set a single key--value, we will use the -% \mdef{markdown_jekyll_data_set_keyval:Nn} macro, ignoring unknown keys. -% To set key--values for both absolute and relative wildcards, we will use the -% \mdef{markdown_jekyll_data_set_keyvals:nn} macro. -% -% \end{markdown} -% \begin{macrocode} -\cs_new:Nn \markdown_jekyll_data_set_keyval:nn - { - \keys_set_known:nn - { markdown/jekyllData } - { { #1 } = { #2 } } - } -\cs_generate_variant:Nn - \markdown_jekyll_data_set_keyval:nn - { Vn } -\cs_new:Nn \markdown_jekyll_data_set_keyvals:nn - { - \markdown_jekyll_data_push:nN - { #1 } - \c_@@_jekyll_data_scalar_tl - \markdown_jekyll_data_set_keyval:Vn - \g_@@_jekyll_data_wildcard_absolute_address_tl - { #2 } - \markdown_jekyll_data_set_keyval:Vn - \g_@@_jekyll_data_wildcard_relative_address_tl - { #2 } - \markdown_jekyll_data_pop: - } -% \end{macrocode} -% \par -% \begin{markdown} -% -% Finally, we will register our macros as token renderer prototypes -% to be able to react to the traversal of a \acro{yaml} document. -% -% \end{markdown} -% \begin{macrocode} -\markdownSetup{ - rendererPrototypes = { - jekyllDataSequenceBegin = { - \markdown_jekyll_data_push:nN - { #1 } - \c_@@_jekyll_data_sequence_tl - }, - jekyllDataMappingBegin = { - \markdown_jekyll_data_push:nN - { #1 } - \c_@@_jekyll_data_mapping_tl - }, - jekyllDataSequenceEnd = { - \markdown_jekyll_data_pop: - }, - jekyllDataMappingEnd = { - \markdown_jekyll_data_pop: - }, - jekyllDataBoolean = { - \markdown_jekyll_data_set_keyvals:nn - { #1 } - { #2 } - }, - jekyllDataEmpty = { }, - jekyllDataNumber = { - \markdown_jekyll_data_set_keyvals:nn - { #1 } - { #2 } - }, - jekyllDataString = { - \markdown_jekyll_data_set_keyvals:nn - { #1 } - { #2 } - }, -% \end{macrocode} -% \begin{markdown} -% % To complement the default setup of our key--values, we will use % the \mref{maketitle} macro to typeset the title page of a document % at the end of \acro{yaml} metadata. If we are in the preamble, we will wait @@ -21698,12 +23285,12 @@ end % % \end{markdown} % \begin{macrocode} - }, -} +% TODO: Remove the command definition in TeX Live 2021. \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} \markdownSetup{ rendererPrototypes = { jekyllDataEnd = { +% TODO: Remove the else branch in TeX Live 2021. \IfFormatAtLeastTF { 2020-10-01 } { \AddToHook{begindocument/end}{\maketitle} } @@ -21720,7 +23307,6 @@ end }, }, } - \ExplSyntaxOff % \end{macrocode} % \par diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index aeb4f0e3e03..bd5c3664aec 100644 --- a/Master/texmf-dist/tex/generic/markdown/markdown.tex +++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex @@ -45,8 +45,434 @@ %% %% The names of the source files used are shown above. %% -\def\markdownLastModified{2022/03/01}% -\def\markdownVersion{2.14.1-0-gb933d81}% +\ifx\ExplSyntaxOn\undefined + \input expl3-generic\relax +\fi +\ExplSyntaxOn +\seq_new:N \g__markdown_lua_options_seq +\prop_new:N \g__markdown_lua_option_types_prop +\prop_new:N \g__markdown_default_lua_options_prop +\seq_put_right:Nn + \g__markdown_lua_options_seq + { cacheDir } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { cacheDir } + { string } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { cacheDir } + { . } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { frozenCacheFileName } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { frozenCacheFileName } + { string } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { frozenCacheFileName } + { frozenCache.tex } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { blankBeforeBlockquote } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { blankBeforeBlockquote } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { blankBeforeBlockquote } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { blankBeforeCodeFence } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { blankBeforeCodeFence } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { blankBeforeCodeFence } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { blankBeforeHeading } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { blankBeforeHeading } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { blankBeforeHeading } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { breakableBlockquotes } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { breakableBlockquotes } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { breakableBlockquotes } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { citationNbsps } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { citationNbsps } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { citationNbsps } + { true } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { citations } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { citations } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { citations } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { codeSpans } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { codeSpans } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { codeSpans } + { true } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { contentBlocks } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { contentBlocks } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { contentBlocks } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { contentBlocksLanguageMap } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { contentBlocksLanguageMap } + { string } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { contentBlocksLanguageMap } + { markdown-languages.json } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { definitionLists } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { definitionLists } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { definitionLists } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { eagerCache } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { eagerCache } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { eagerCache } + { true } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { expectJekyllData } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { expectJekyllData } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { expectJekyllData } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { fencedCode } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { fencedCode } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { fencedCode } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { finalizeCache } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { finalizeCache } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { finalizeCache } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { footnotes } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { footnotes } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { footnotes } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { frozenCacheCounter } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { frozenCacheCounter } + { counter } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { frozenCacheCounter } + { 0 } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { hardLineBreaks } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { hardLineBreaks } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { hardLineBreaks } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { hashEnumerators } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { hashEnumerators } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { hashEnumerators } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { headerAttributes } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { headerAttributes } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { headerAttributes } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { html } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { html } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { html } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { hybrid } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { hybrid } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { hybrid } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { inlineFootnotes } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { inlineFootnotes } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { inlineFootnotes } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { jekyllData } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { jekyllData } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { jekyllData } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { pipeTables } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { pipeTables } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { pipeTables } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { preserveTabs } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { preserveTabs } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { preserveTabs } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { relativeReferences } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { relativeReferences } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { relativeReferences } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { shiftHeadings } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { shiftHeadings } + { number } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { shiftHeadings } + { 0 } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { slice } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { slice } + { string } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { slice } + { ^~$ } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { smartEllipses } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { smartEllipses } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { smartEllipses } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { startNumber } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { startNumber } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { startNumber } + { true } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { stripIndent } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { stripIndent } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { stripIndent } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { tableCaptions } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { tableCaptions } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { tableCaptions } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { taskLists } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { taskLists } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { taskLists } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { texComments } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { texComments } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { texComments } + { false } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { tightLists } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { tightLists } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { tightLists } + { true } +\seq_put_right:Nn + \g__markdown_lua_options_seq + { underscores } +\prop_put:Nnn + \g__markdown_lua_option_types_prop + { underscores } + { boolean } +\prop_put:Nnn + \g__markdown_default_lua_options_prop + { underscores } + { true } +\ExplSyntaxOff +\def\markdownLastModified{2022/03/31}% +\def\markdownVersion{2.15.0-0-g9296cf1}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax @@ -87,177 +513,942 @@ \let\markdownOptionStripIndent\undefined \let\markdownOptionTableCaptions\undefined \let\markdownOptionTaskLists\undefined -\let\markdownOptionTeXComments\undefined +\let\markdownOptionTexComments\undefined \let\markdownOptionTightLists\undefined \def\markdownOptionStripPercentSigns{false}% +\ExplSyntaxOn +\seq_new:N \g__markdown_renderers_seq +\prop_new:N \g__markdown_renderer_arities_prop +\ExplSyntaxOff \def\markdownRendererTickedBox{% \markdownRendererTickedBoxPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { tickedBox } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { tickedBox } + { 0 } +\ExplSyntaxOff \def\markdownRendererHalfTickedBox{% \markdownRendererHalfTickedBoxPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { halfTickedBox } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { halfTickedBox } + { 0 } +\ExplSyntaxOff \def\markdownRendererUntickedBox{% \markdownRendererUntickedBoxPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { untickedBox } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { untickedBox } + { 0 } +\ExplSyntaxOff \def\markdownRendererDocumentBegin{% \markdownRendererDocumentBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { documentBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { documentBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererDocumentEnd{% \markdownRendererDocumentEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { documentEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { documentEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererInterblockSeparator{% \markdownRendererInterblockSeparatorPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { interblockSeparator } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { interblockSeparator } + { 0 } +\ExplSyntaxOff \def\markdownRendererLineBreak{% \markdownRendererLineBreakPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { lineBreak } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { lineBreak } + { 0 } +\ExplSyntaxOff \def\markdownRendererEllipsis{% \markdownRendererEllipsisPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ellipsis } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ellipsis } + { 0 } +\ExplSyntaxOff \def\markdownRendererNbsp{% \markdownRendererNbspPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { nbsp } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { nbsp } + { 0 } +\ExplSyntaxOff \def\markdownRendererLeftBrace{% \markdownRendererLeftBracePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { leftBrace } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { leftBrace } + { 0 } +\ExplSyntaxOff \def\markdownRendererRightBrace{% \markdownRendererRightBracePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { rightBrace } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { rightBrace } + { 0 } +\ExplSyntaxOff \def\markdownRendererDollarSign{% \markdownRendererDollarSignPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dollarSign } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dollarSign } + { 0 } +\ExplSyntaxOff \def\markdownRendererPercentSign{% \markdownRendererPercentSignPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { percentSign } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { percentSign } + { 0 } +\ExplSyntaxOff \def\markdownRendererAmpersand{% \markdownRendererAmpersandPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ampersand } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ampersand } + { 0 } +\ExplSyntaxOff \def\markdownRendererUnderscore{% \markdownRendererUnderscorePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { underscore } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { underscore } + { 0 } +\ExplSyntaxOff \def\markdownRendererHash{% \markdownRendererHashPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { hash } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { hash } + { 0 } +\ExplSyntaxOff \def\markdownRendererCircumflex{% \markdownRendererCircumflexPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { circumflex } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { circumflex } + { 0 } +\ExplSyntaxOff \def\markdownRendererBackslash{% \markdownRendererBackslashPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { backslash } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { backslash } + { 0 } +\ExplSyntaxOff \def\markdownRendererTilde{% \markdownRendererTildePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { tilde } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { tilde } + { 0 } +\ExplSyntaxOff \def\markdownRendererPipe{% \markdownRendererPipePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { pipe } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { pipe } + { 0 } +\ExplSyntaxOff \def\markdownRendererCodeSpan{% \markdownRendererCodeSpanPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { codeSpan } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { codeSpan } + { 1 } +\ExplSyntaxOff \def\markdownRendererLink{% \markdownRendererLinkPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { link } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { link } + { 4 } +\ExplSyntaxOff \def\markdownRendererImage{% \markdownRendererImagePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { image } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { image } + { 4 } +\ExplSyntaxOff \def\markdownRendererContentBlock{% \markdownRendererContentBlockPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { contentBlock } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { contentBlock } + { 4 } +\ExplSyntaxOff \def\markdownRendererContentBlockOnlineImage{% \markdownRendererContentBlockOnlineImagePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { contentBlockOnlineImage } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { contentBlockOnlineImage } + { 4 } +\ExplSyntaxOff \def\markdownRendererContentBlockCode{% \markdownRendererContentBlockCodePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { contentBlockCode } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { contentBlockCode } + { 5 } +\ExplSyntaxOff \def\markdownRendererUlBegin{% \markdownRendererUlBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ulBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ulBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererUlBeginTight{% \markdownRendererUlBeginTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ulBeginTight } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ulBeginTight } + { 0 } +\ExplSyntaxOff \def\markdownRendererUlItem{% \markdownRendererUlItemPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ulItem } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ulItem } + { 0 } +\ExplSyntaxOff \def\markdownRendererUlItemEnd{% \markdownRendererUlItemEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ulItemEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ulItemEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererUlEnd{% \markdownRendererUlEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ulEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ulEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererUlEndTight{% \markdownRendererUlEndTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { ulEndTight } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { ulEndTight } + { 0 } +\ExplSyntaxOff \def\markdownRendererOlBegin{% \markdownRendererOlBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererOlBeginTight{% \markdownRendererOlBeginTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olBeginTight } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olBeginTight } + { 0 } +\ExplSyntaxOff \def\markdownRendererOlItem{% \markdownRendererOlItemPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olItem } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olItem } + { 0 } +\ExplSyntaxOff \def\markdownRendererOlItemEnd{% \markdownRendererOlItemEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olItemEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olItemEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererOlItemWithNumber{% \markdownRendererOlItemWithNumberPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olItemWithNumber } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olItemWithNumber } + { 1 } +\ExplSyntaxOff \def\markdownRendererOlEnd{% \markdownRendererOlEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererOlEndTight{% \markdownRendererOlEndTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { olEndTight } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { olEndTight } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlBegin{% \markdownRendererDlBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlBeginTight{% \markdownRendererDlBeginTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlBeginTight } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlBeginTight } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlItem{% \markdownRendererDlItemPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlItem } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlItem } + { 1 } +\ExplSyntaxOff \def\markdownRendererDlItemEnd{% \markdownRendererDlItemEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlItemEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlItemEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlDefinitionBegin{% \markdownRendererDlDefinitionBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlDefinitionBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlDefinitionBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlDefinitionEnd{% \markdownRendererDlDefinitionEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlDefinitionEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlDefinitionEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlEnd{% \markdownRendererDlEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererDlEndTight{% \markdownRendererDlEndTightPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { dlEndTight } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { dlEndTight } + { 0 } +\ExplSyntaxOff \def\markdownRendererEmphasis{% \markdownRendererEmphasisPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { emphasis } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { emphasis } + { 1 } +\ExplSyntaxOff \def\markdownRendererStrongEmphasis{% \markdownRendererStrongEmphasisPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { strongEmphasis } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { strongEmphasis } + { 1 } +\ExplSyntaxOff \def\markdownRendererBlockQuoteBegin{% \markdownRendererBlockQuoteBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { blockQuoteBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { blockQuoteBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererBlockQuoteEnd{% \markdownRendererBlockQuoteEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { blockQuoteEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { blockQuoteEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererInputVerbatim{% \markdownRendererInputVerbatimPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { inputVerbatim } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { inputVerbatim } + { 1 } +\ExplSyntaxOff \def\markdownRendererInputFencedCode{% \markdownRendererInputFencedCodePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { inputFencedCode } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { inputFencedCode } + { 2 } +\ExplSyntaxOff \def\markdownRendererJekyllDataBegin{% \markdownRendererJekyllDataBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererJekyllDataEnd{% \markdownRendererJekyllDataEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererJekyllDataMappingBegin{% \markdownRendererJekyllDataMappingBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataMappingBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataMappingBegin } + { 2 } +\ExplSyntaxOff \def\markdownRendererJekyllDataMappingEnd{% \markdownRendererJekyllDataMappingEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataMappingEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataMappingEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererJekyllDataSequenceBegin{% \markdownRendererJekyllDataSequenceBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataSequenceBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataSequenceBegin } + { 2 } +\ExplSyntaxOff \def\markdownRendererJekyllDataSequenceEnd{% \markdownRendererJekyllDataSequenceEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataSequenceEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataSequenceEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererJekyllDataBoolean{% \markdownRendererJekyllDataBooleanPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataBoolean } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataBoolean } + { 2 } +\ExplSyntaxOff \def\markdownRendererJekyllDataNumber{% \markdownRendererJekyllDataNumberPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataNumber } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataNumber } + { 2 } +\ExplSyntaxOff \def\markdownRendererJekyllDataString{% \markdownRendererJekyllDataStringPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataString } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataString } + { 2 } +\ExplSyntaxOff \def\markdownRendererJekyllDataEmpty{% \markdownRendererJekyllDataEmptyPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { jekyllDataEmpty } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { jekyllDataEmpty } + { 1 } +\ExplSyntaxOff \def\markdownRendererHeadingOne{% \markdownRendererHeadingOnePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headingOne } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headingOne } + { 1 } +\ExplSyntaxOff \def\markdownRendererHeadingTwo{% \markdownRendererHeadingTwoPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headingTwo } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headingTwo } + { 1 } +\ExplSyntaxOff \def\markdownRendererHeadingThree{% \markdownRendererHeadingThreePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headingThree } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headingThree } + { 1 } +\ExplSyntaxOff \def\markdownRendererHeadingFour{% \markdownRendererHeadingFourPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headingFour } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headingFour } + { 1 } +\ExplSyntaxOff \def\markdownRendererHeadingFive{% \markdownRendererHeadingFivePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headingFive } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headingFive } + { 1 } +\ExplSyntaxOff \def\markdownRendererHeadingSix{% \markdownRendererHeadingSixPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headingSix } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headingSix } + { 1 } +\ExplSyntaxOff \def\markdownRendererHorizontalRule{% \markdownRendererHorizontalRulePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { horizontalRule } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { horizontalRule } + { 0 } +\ExplSyntaxOff \def\markdownRendererFootnote{% \markdownRendererFootnotePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { footnote } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { footnote } + { 1 } +\ExplSyntaxOff \def\markdownRendererCite{% \markdownRendererCitePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { cite } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { cite } + { 1 } +\ExplSyntaxOff \def\markdownRendererTextCite{% \markdownRendererTextCitePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { textCite } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { textCite } + { 1 } +\ExplSyntaxOff \def\markdownRendererTable{% \markdownRendererTablePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { table } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { table } + { 3 } +\ExplSyntaxOff \def\markdownRendererInlineHtmlComment{% \markdownRendererInlineHtmlCommentPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { inlineHtmlComment } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { inlineHtmlComment } + { 1 } +\ExplSyntaxOff \def\markdownRendererBlockHtmlCommentBegin{% \markdownRendererBlockHtmlCommentBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { blockHtmlCommentBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { blockHtmlCommentBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererBlockHtmlCommentEnd{% \markdownRendererBlockHtmlCommentEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { blockHtmlCommentEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { blockHtmlCommentEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererInlineHtmlTag{% \markdownRendererInlineHtmlTagPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { inlineHtmlTag } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { inlineHtmlTag } + { 1 } +\ExplSyntaxOff \def\markdownRendererInputBlockHtmlElement{% \markdownRendererInputBlockHtmlElementPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { inputBlockHtmlElement } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { inputBlockHtmlElement } + { 1 } +\ExplSyntaxOff \def\markdownRendererAttributeIdentifier{% \markdownRendererAttributeIdentifierPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { attributeIdentifier } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { attributeIdentifier } + { 1 } +\ExplSyntaxOff \def\markdownRendererAttributeClassName{% \markdownRendererAttributeClassNamePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { attributeClassName } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { attributeClassName } + { 1 } +\ExplSyntaxOff \def\markdownRendererAttributeKeyValue{% \markdownRendererAttributeKeyValuePrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { attributeKeyValue } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { attributeKeyValue } + { 2 } +\ExplSyntaxOff \def\markdownRendererHeaderAttributeContextBegin{% \markdownRendererHeaderAttributeContextBeginPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headerAttributeContextBegin } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headerAttributeContextBegin } + { 0 } +\ExplSyntaxOff \def\markdownRendererHeaderAttributeContextEnd{% \markdownRendererHeaderAttributeContextEndPrototype}% +\ExplSyntaxOn +\seq_put_right:Nn + \g__markdown_renderers_seq + { headerAttributeContextEnd } +\prop_put:Nnn + \g__markdown_renderer_arities_prop + { headerAttributeContextEnd } + { 0 } +\ExplSyntaxOff +\ExplSyntaxOn +\keys_define:nn + { markdown/jekyllData } + { } +\ExplSyntaxOff \def\markdownRendererAttributeIdentifierPrototype#1{}% \def\markdownRendererAttributeClassNamePrototype#1{}% \def\markdownRendererAttributeKeyValuePrototype#1#2{}% @@ -313,16 +1504,8 @@ \def\markdownRendererBlockQuoteEndPrototype{}% \def\markdownRendererInputVerbatimPrototype#1{}% \def\markdownRendererInputFencedCodePrototype#1#2{}% -\def\markdownRendererJekyllDataBooleanPrototype#1#2{}% -\def\markdownRendererJekyllDataEmptyPrototype#1{}% -\def\markdownRendererJekyllDataNumberPrototype#1#2{}% -\def\markdownRendererJekyllDataStringPrototype#1#2{}% \def\markdownRendererJekyllDataBeginPrototype{}% \def\markdownRendererJekyllDataEndPrototype{}% -\def\markdownRendererJekyllDataSequenceBeginPrototype#1#2{}% -\def\markdownRendererJekyllDataSequenceEndPrototype{}% -\def\markdownRendererJekyllDataMappingBeginPrototype#1#2{}% -\def\markdownRendererJekyllDataMappingEndPrototype{}% \def\markdownRendererHeadingOnePrototype#1{}% \def\markdownRendererHeadingTwoPrototype#1{}% \def\markdownRendererHeadingThreePrototype#1{}% @@ -441,114 +1624,250 @@ \def\markdownRendererTickedBoxPrototype{[X]}% \def\markdownRendererHalfTickedBoxPrototype{[/]}% \def\markdownRendererUntickedBoxPrototype{[ ]}% -\def\markdownLuaOptions{{% -\ifx\markdownOptionBlankBeforeBlockquote\undefined\else - blankBeforeBlockquote = \markdownOptionBlankBeforeBlockquote, -\fi -\ifx\markdownOptionBlankBeforeCodeFence\undefined\else - blankBeforeCodeFence = \markdownOptionBlankBeforeCodeFence, -\fi -\ifx\markdownOptionBlankBeforeHeading\undefined\else - blankBeforeHeading = \markdownOptionBlankBeforeHeading, -\fi -\ifx\markdownOptionBreakableBlockquotes\undefined\else - breakableBlockquotes = \markdownOptionBreakableBlockquotes, -\fi - cacheDir = "\markdownOptionCacheDir", -\ifx\markdownOptionCitations\undefined\else - citations = \markdownOptionCitations, -\fi -\ifx\markdownOptionCitationNbsps\undefined\else - citationNbsps = \markdownOptionCitationNbsps, -\fi -\ifx\markdownOptionCodeSpans\undefined\else - codeSpans = \markdownOptionCodeSpans, -\fi -\ifx\markdownOptionContentBlocks\undefined\else - contentBlocks = \markdownOptionContentBlocks, -\fi -\ifx\markdownOptionContentBlocksLanguageMap\undefined\else - contentBlocksLanguageMap = - "\markdownOptionContentBlocksLanguageMap", -\fi -\ifx\markdownOptionDefinitionLists\undefined\else - definitionLists = \markdownOptionDefinitionLists, -\fi -\ifx\markdownOptionEagerCache\undefined\else - eagerCache = \markdownOptionEagerCache, -\fi -\ifx\markdownOptionFinalizeCache\undefined\else - finalizeCache = \markdownOptionFinalizeCache, -\fi - frozenCacheFileName = "\markdownOptionFrozenCacheFileName", - frozenCacheCounter = \the\markdownFrozenCacheCounter, -\ifx\markdownOptionFootnotes\undefined\else - footnotes = \markdownOptionFootnotes, -\fi -\ifx\markdownOptionFencedCode\undefined\else - fencedCode = \markdownOptionFencedCode, -\fi -\ifx\markdownOptionHardLineBreaks\undefined\else - hardLineBreaks = \markdownOptionHardLineBreaks, -\fi -\ifx\markdownOptionHashEnumerators\undefined\else - hashEnumerators = \markdownOptionHashEnumerators, -\fi -\ifx\markdownOptionHeaderAttributes\undefined\else - headerAttributes = \markdownOptionHeaderAttributes, -\fi -\ifx\markdownOptionHtml\undefined\else - html = \markdownOptionHtml, -\fi -\ifx\markdownOptionHybrid\undefined\else - hybrid = \markdownOptionHybrid, -\fi -\ifx\markdownOptionInlineFootnotes\undefined\else - inlineFootnotes = \markdownOptionInlineFootnotes, -\fi -\ifx\markdownOptionJekyllData\undefined\else - jekyllData = \markdownOptionJekyllData, -\fi -\ifx\markdownOptionPipeTables\undefined\else - pipeTables = \markdownOptionPipeTables, -\fi -\ifx\markdownOptionPreserveTabs\undefined\else - preserveTabs = \markdownOptionPreserveTabs, -\fi -\ifx\markdownOptionRelativeReferences\undefined\else - relativeReferences = \markdownOptionRelativeReferences, -\fi -\ifx\markdownOptionShiftHeadings\undefined\else - shiftHeadings = "\markdownOptionShiftHeadings", -\fi -\ifx\markdownOptionSlice\undefined\else - slice = "\markdownOptionSlice", -\fi -\ifx\markdownOptionSmartEllipses\undefined\else - smartEllipses = \markdownOptionSmartEllipses, -\fi -\ifx\markdownOptionStartNumber\undefined\else - startNumber = \markdownOptionStartNumber, -\fi -\ifx\markdownOptionStripIndent\undefined\else - stripIndent = \markdownOptionStripIndent, -\fi -\ifx\markdownOptionTableCaptions\undefined\else - tableCaptions = \markdownOptionTableCaptions, -\fi -\ifx\markdownOptionTaskLists\undefined\else - taskLists = \markdownOptionTaskLists, -\fi -\ifx\markdownOptionTeXComments\undefined\else - texComments = \markdownOptionTeXComments, -\fi -\ifx\markdownOptionTightLists\undefined\else - tightLists = \markdownOptionTightLists, -\fi -\ifx\markdownOptionUnderscores\undefined\else - underscores = \markdownOptionUnderscores, -\fi} -}% +\ExplSyntaxOn +\seq_new:N \g__markdown_jekyll_data_datatypes_seq +\tl_const:Nn \c__markdown_jekyll_data_sequence_tl { sequence } +\tl_const:Nn \c__markdown_jekyll_data_mapping_tl { mapping } +\tl_const:Nn \c__markdown_jekyll_data_scalar_tl { scalar } +\seq_new:N \g__markdown_jekyll_data_wildcard_absolute_address_seq +\cs_new:Nn \markdown_jekyll_data_push_address_segment:n + { + \seq_if_empty:NF + \g__markdown_jekyll_data_datatypes_seq + { + \seq_get_right:NN + \g__markdown_jekyll_data_datatypes_seq + \l_tmpa_tl + \tl_if_eq:NNTF + \l_tmpa_tl + \c__markdown_jekyll_data_sequence_tl + { + \seq_put_right:Nn + \g__markdown_jekyll_data_wildcard_absolute_address_seq + { * } + } + { + \seq_put_right:Nn + \g__markdown_jekyll_data_wildcard_absolute_address_seq + { #1 } + } + } + } +\tl_new:N \g__markdown_jekyll_data_wildcard_absolute_address_tl +\tl_new:N \g__markdown_jekyll_data_wildcard_relative_address_tl +\cs_new:Nn \markdown_jekyll_data_concatenate_address:NN + { + \seq_pop_left:NN #1 \l_tmpa_tl + \tl_set:Nx #2 { / \seq_use:Nn #1 { / } } + \seq_put_left:NV #1 \l_tmpa_tl + } +\cs_new:Nn \markdown_jekyll_data_update_address_tls: + { + \markdown_jekyll_data_concatenate_address:NN + \g__markdown_jekyll_data_wildcard_absolute_address_seq + \g__markdown_jekyll_data_wildcard_absolute_address_tl + \seq_get_right:NN + \g__markdown_jekyll_data_wildcard_absolute_address_seq + \g__markdown_jekyll_data_wildcard_relative_address_tl + } +\cs_new:Nn \markdown_jekyll_data_push:nN + { + \markdown_jekyll_data_push_address_segment:n + { #1 } + \seq_put_right:NV + \g__markdown_jekyll_data_datatypes_seq + #2 + \markdown_jekyll_data_update_address_tls: + } +\cs_new:Nn \markdown_jekyll_data_pop: + { + \seq_pop_right:NN + \g__markdown_jekyll_data_wildcard_absolute_address_seq + \l_tmpa_tl + \seq_pop_right:NN + \g__markdown_jekyll_data_datatypes_seq + \l_tmpa_tl + \markdown_jekyll_data_update_address_tls: + } +\cs_new:Nn \markdown_jekyll_data_set_keyval:nn + { + \keys_set_known:nn + { markdown/jekyllData } + { { #1 } = { #2 } } + } +\cs_generate_variant:Nn + \markdown_jekyll_data_set_keyval:nn + { Vn } +\cs_new:Nn \markdown_jekyll_data_set_keyvals:nn + { + \markdown_jekyll_data_push:nN + { #1 } + \c__markdown_jekyll_data_scalar_tl + \markdown_jekyll_data_set_keyval:Vn + \g__markdown_jekyll_data_wildcard_absolute_address_tl + { #2 } + \markdown_jekyll_data_set_keyval:Vn + \g__markdown_jekyll_data_wildcard_relative_address_tl + { #2 } + \markdown_jekyll_data_pop: + } +\def\markdownRendererJekyllDataSequenceBeginPrototype#1#2{ + \markdown_jekyll_data_push:nN + { #1 } + \c__markdown_jekyll_data_sequence_tl +} +\def\markdownRendererJekyllDataMappingBeginPrototype#1#2{ + \markdown_jekyll_data_push:nN + { #1 } + \c__markdown_jekyll_data_mapping_tl +} +\def\markdownRendererJekyllDataSequenceEndPrototype{ + \markdown_jekyll_data_pop: +} +\def\markdownRendererJekyllDataMappingEndPrototype{ + \markdown_jekyll_data_pop: +} +\def\markdownRendererJekyllDataBooleanPrototype#1#2{ + \markdown_jekyll_data_set_keyvals:nn + { #1 } + { #2 } +} +\def\markdownRendererJekyllDataEmptyPrototype#1{} +\def\markdownRendererJekyllDataNumberPrototype#1#2{ + \markdown_jekyll_data_set_keyvals:nn + { #1 } + { #2 } +} +\def\markdownRendererJekyllDataStringPrototype#1#2{ + \markdown_jekyll_data_set_keyvals:nn + { #1 } + { #2 } +} +\ExplSyntaxOff +\ExplSyntaxOn +\tl_new:N \g__markdown_formatted_lua_options_tl +\tl_const:Nn \c__markdown_lua_option_type_boolean { boolean } +\tl_const:Nn \c__markdown_lua_option_type_counter { counter } +\tl_const:Nn \c__markdown_lua_option_type_number { number } +\tl_const:Nn \c__markdown_lua_option_type_string { string } +\cs_new:Nn \__markdown_format_lua_options: + { + \tl_gclear:N + \g__markdown_formatted_lua_options_tl + \seq_map_function:NN + \g__markdown_lua_options_seq + \__markdown_format_lua_option:n + } +\cs_new:Nn \__markdown_format_lua_option:n + { + \__markdown_typecheck_lua_option:n { #1 } + \tl_set:Nn + \l_tmpb_tl + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownOption + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \prop_get:NnN + \g__markdown_lua_option_types_prop + { #1 } + \l_tmpb_tl + \cs_if_free:cTF + { \l_tmpa_tl } + { } + { + \tl_case:NnF + \l_tmpb_tl + { + \c__markdown_lua_option_type_string + { + \tl_gput_right:Nx + \g__markdown_formatted_lua_options_tl + { #1~=~" \cs:w \l_tmpa_tl \cs_end: ",~ } + } + \c__markdown_lua_option_type_counter + { + \tl_gput_right:Nx + \g__markdown_formatted_lua_options_tl + { #1~=~ \the \cs:w \l_tmpa_tl \cs_end: ,~ } + } + } + { + \tl_gput_right:Nx + \g__markdown_formatted_lua_options_tl + { #1~=~ \cs:w \l_tmpa_tl \cs_end: ,~ } + } + } + } +\msg_new:nnn + { markdown } + { undefined-lua-option } + { + Lua~option~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { failed-typecheck-for-boolean-lua-option } + { + Lua~option~#1~has~value~#2,~ + but~a~boolean~(true~or~false)~was~expected. + } +\cs_new:Nn \__markdown_typecheck_lua_option:n + { + \tl_set:Nn + \l_tmpb_tl + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownOption + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \prop_get:NnNTF + \g__markdown_lua_option_types_prop + { #1 } + \l_tmpb_tl + { + \cs_if_free:cTF + { \l_tmpa_tl } + { } + { + \tl_case:Nn + \l_tmpb_tl + { + \c__markdown_lua_option_type_boolean + { + \tl_case:cnF + { \l_tmpa_tl } + { + \c__markdown_lua_option_value_true { } + \c__markdown_lua_option_value_false { } + } + { + \msg_error:nnxx + { markdown } + { failed-typecheck-for-boolean-lua-option } + { #1 } + { \l_tmpa_tl } + } + } + } + } + } + { + \msg_error:nnn + { markdown } + { undefined-lua-option } + { #1 } + } + } +\let\markdownPrepareLuaOptions=\__markdown_format_lua_options: +\def\markdownLuaOptions{{ \g__markdown_formatted_lua_options_tl }} +\ExplSyntaxOff \def\markdownPrepare{% local lfs = require("lfs") local cacheDir = "\markdownOptionCacheDir" @@ -558,11 +1877,42 @@ local md = require("markdown") local convert = md.new(\markdownLuaOptions) }% -\def\markdownIfOption#1#2#3{% - \begingroup - \def\next{true}% - \expandafter\ifx\csname markdownOption#1\endcsname\next - \endgroup#2\else\endgroup#3\fi}% +\ExplSyntaxOn +\tl_const:Nn \c__markdown_lua_option_value_true { true } +\tl_const:Nn \c__markdown_lua_option_value_false { false } +\cs_new:Nn \__markdown_if_option:nTF + { + \tl_set:Nn + \l_tmpb_tl + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownOption + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \cs_if_free:cTF + { \l_tmpa_tl } + { + \prop_get:NnN + \g__markdown_default_lua_options_prop + { #1 } + \l_tmpb_tl + } + { + \tl_set:Nf + \l_tmpb_tl + { \cs:w \l_tmpa_tl \cs_end: } + } + \tl_if_eq:NNTF + \l_tmpb_tl + \c__markdown_lua_option_value_true + { #2 } + { #3 } + } +\let\markdownIfOption=\__markdown_if_option:nTF +\ExplSyntaxOff \csname newread\endcsname\markdownInputFileStream \csname newwrite\endcsname\markdownOutputFileStream \begingroup @@ -578,7 +1928,7 @@ |catcode`|%=12@ |gdef|markdownReadAndConvert#1#2{@ |begingroup@ - |markdownIfOption{FrozenCache}{}{@ + |markdownIfOption{frozenCache}{}{@ |immediate|openout|markdownOutputFileStream@ |markdownOptionInputTempFileName|relax@ |markdownInfo{Buffering markdown input into the temporary @ @@ -589,7 +1939,7 @@ |catcode`| =12@ |markdownMakeOther@ |def|markdownReadAndConvertStripPercentSign##1{@ - |markdownIfOption{StripPercentSigns}{@ + |markdownIfOption{stripPercentSigns}{@ |if##1%@ |expandafter|expandafter|expandafter@ |markdownReadAndConvertProcessLine@ @@ -606,13 +1956,13 @@ }@ |def|markdownReadAndConvertProcessLine##1#1##2#1##3|relax{@ |ifx|relax##3|relax@ - |markdownIfOption{FrozenCache}{}{@ + |markdownIfOption{frozenCache}{}{@ |immediate|write|markdownOutputFileStream{##1}@ }@ |else@ |def^^M{@ |markdownInfo{The ending token sequence was found}@ - |markdownIfOption{FrozenCache}{}{@ + |markdownIfOption{frozenCache}{}{@ |immediate|closeout|markdownOutputFileStream@ }@ |endgroup@ @@ -728,7 +2078,7 @@ |gdef|markdownInput#1{% |begingroup |catcode`|%=12 - |markdownIfOption{FrozenCache}{% + |markdownIfOption{frozenCache}{% |ifnum|markdownFrozenCacheCounter=0|relax |markdownInfo{Reading frozen cache from "|markdownOptionFrozenCacheFileName"}% @@ -742,6 +2092,7 @@ |markdownInfo{Including markdown document "#1"}% |openin|markdownInputFileStream#1 |closein|markdownInputFileStream + |markdownPrepareLuaOptions |markdownLuaExecute{% |markdownPrepare local file = assert(io.open("#1", "r"), @@ -749,7 +2100,7 @@ local input = assert(file:read("*a")) assert(file:close()) print(convert(input:gsub("\r\n?", "\n") .. "\n"))}% - |markdownIfOption{FinalizeCache}{% + |markdownIfOption{finalizeCache}{% |global|advance|markdownFrozenCacheCounter by 1|relax }% }% diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 8645918a346..a6c17ab3c2f 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -53,18 +53,22 @@ \newcommand\markdownSetup[1]{% \setkeys{markdownOptions}{#1}}% \newcommand\markdownSetupSnippet[2]{% - \@ifundefined - {markdownLaTeXSetupSnippet\markdownLaTeXThemeName#1}{% - \newtoks\next - \next={#2}% - \expandafter\let\csname markdownLaTeXSetupSnippet% - \markdownLaTeXThemeName#1\endcsname=\next - }{% + \markdownIfSnippetExists{#1}% + {% \markdownWarning {Redefined setup snippet \markdownLaTeXThemeName#1}% \csname markdownLaTeXSetupSnippet% \markdownLaTeXThemeName#1\endcsname={#2}% + }{% + \newtoks\next + \next={#2}% + \expandafter\let\csname markdownLaTeXSetupSnippet% + \markdownLaTeXThemeName#1\endcsname=\next }}% +\newcommand\markdownIfSnippetExists[3]{% + \@ifundefined + {markdownLaTeXSetupSnippet\markdownLaTeXThemeName#1}% + {#3}{#2}}% \newif\ifmarkdownLaTeXPlain \markdownLaTeXPlainfalse \define@key{markdownOptions}{plain}[true]{% @@ -89,14 +93,15 @@ \markdownLaTeXThemePackageName}{#1/}}% \@onlypreamble\KV@markdownOptions@theme \define@key{markdownOptions}{snippet}{% - \@ifundefined - {markdownLaTeXSetupSnippet#1}{% + \markdownIfSnippetExists{#1}% + {% + \expandafter\markdownSetup\expandafter{% + \the\csname markdownLaTeXSetupSnippet% + \markdownLaTeXThemeName#1\endcsname}% + }{% \markdownError {Can't invoke setup snippet #1}% {The setup snippet is undefined}% - }{% - \expandafter\markdownSetup\expandafter{% - \the\csname markdownLaTeXSetupSnippet#1\endcsname}% }% }% \define@key{markdownOptions}{helperScriptFileName}{% @@ -133,6 +138,8 @@ \def\markdownOptionDefinitionLists{#1}}% \define@key{markdownOptions}{eagerCache}[true]{% \def\markdownOptionEagerCache{#1}}% +\define@key{markdownOptions}{expectJekyllData}[true]{% + \def\markdownOptionExpectJekyllData{#1}}% \define@key{markdownOptions}{footnotes}[true]{% \def\markdownOptionFootnotes{#1}}% \define@key{markdownOptions}{fencedCode}[true]{% @@ -172,7 +179,7 @@ \define@key{markdownOptions}{taskLists}[true]{% \def\markdownOptionTaskLists{#1}}% \define@key{markdownOptions}{texComments}[true]{% - \def\markdownOptionTeXComments{#1}}% + \def\markdownOptionTexComments{#1}}% \define@key{markdownOptions}{tightLists}[true]{% \def\markdownOptionTightLists{#1}}% \define@key{markdownOptions}{underscores}[true]{% @@ -187,342 +194,97 @@ \DeclareOption{frozencache}{\markdownSetup{frozenCache}} \define@key{markdownOptions}{frozenCacheFileName}{% \def\markdownOptionFrozenCacheFileName{#1}}% -\define@key{markdownRenderers}{attributeIdentifier}{% - \renewcommand\markdownRendererAttributeIdentifier[1]{#1}}% -\define@key{markdownRenderers}{attributeClassName}{% - \renewcommand\markdownRendererAttributeClassName[1]{#1}}% -\define@key{markdownRenderers}{attributeKeyValue}{% - \renewcommand\markdownRendererAttributeKeyValue[2]{#1}}% -\define@key{markdownRenderers}{documentBegin}{% - \renewcommand\markdownRendererDocumentBegin{#1}}% -\define@key{markdownRenderers}{documentEnd}{% - \renewcommand\markdownRendererDocumentEnd{#1}}% -\define@key{markdownRenderers}{interblockSeparator}{% - \renewcommand\markdownRendererInterblockSeparator{#1}}% -\define@key{markdownRenderers}{lineBreak}{% - \renewcommand\markdownRendererLineBreak{#1}}% -\define@key{markdownRenderers}{ellipsis}{% - \renewcommand\markdownRendererEllipsis{#1}}% -\define@key{markdownRenderers}{headerAttributeContextBegin}{% - \renewcommand\markdownRendererHeaderAttributeContextBegin{#1}}% -\define@key{markdownRenderers}{headerAttributeContextEnd}{% - \renewcommand\markdownRendererHeaderAttributeContextEnd{#1}}% -\define@key{markdownRenderers}{nbsp}{% - \renewcommand\markdownRendererNbsp{#1}}% -\define@key{markdownRenderers}{leftBrace}{% - \renewcommand\markdownRendererLeftBrace{#1}}% -\define@key{markdownRenderers}{rightBrace}{% - \renewcommand\markdownRendererRightBrace{#1}}% -\define@key{markdownRenderers}{dollarSign}{% - \renewcommand\markdownRendererDollarSign{#1}}% -\define@key{markdownRenderers}{percentSign}{% - \renewcommand\markdownRendererPercentSign{#1}}% -\define@key{markdownRenderers}{ampersand}{% - \renewcommand\markdownRendererAmpersand{#1}}% -\define@key{markdownRenderers}{underscore}{% - \renewcommand\markdownRendererUnderscore{#1}}% -\define@key{markdownRenderers}{hash}{% - \renewcommand\markdownRendererHash{#1}}% -\define@key{markdownRenderers}{circumflex}{% - \renewcommand\markdownRendererCircumflex{#1}}% -\define@key{markdownRenderers}{backslash}{% - \renewcommand\markdownRendererBackslash{#1}}% -\define@key{markdownRenderers}{tilde}{% - \renewcommand\markdownRendererTilde{#1}}% -\define@key{markdownRenderers}{pipe}{% - \renewcommand\markdownRendererPipe{#1}}% -\define@key{markdownRenderers}{codeSpan}{% - \renewcommand\markdownRendererCodeSpan[1]{#1}}% -\define@key{markdownRenderers}{link}{% - \renewcommand\markdownRendererLink[4]{#1}}% -\define@key{markdownRenderers}{contentBlock}{% - \renewcommand\markdownRendererContentBlock[4]{#1}}% -\define@key{markdownRenderers}{contentBlockOnlineImage}{% - \renewcommand\markdownRendererContentBlockOnlineImage[4]{#1}}% -\define@key{markdownRenderers}{contentBlockCode}{% - \renewcommand\markdownRendererContentBlockCode[5]{#1}}% -\define@key{markdownRenderers}{image}{% - \renewcommand\markdownRendererImage[4]{#1}}% -\define@key{markdownRenderers}{ulBegin}{% - \renewcommand\markdownRendererUlBegin{#1}}% -\define@key{markdownRenderers}{ulBeginTight}{% - \renewcommand\markdownRendererUlBeginTight{#1}}% -\define@key{markdownRenderers}{ulItem}{% - \renewcommand\markdownRendererUlItem{#1}}% -\define@key{markdownRenderers}{ulItemEnd}{% - \renewcommand\markdownRendererUlItemEnd{#1}}% -\define@key{markdownRenderers}{ulEnd}{% - \renewcommand\markdownRendererUlEnd{#1}}% -\define@key{markdownRenderers}{ulEndTight}{% - \renewcommand\markdownRendererUlEndTight{#1}}% -\define@key{markdownRenderers}{olBegin}{% - \renewcommand\markdownRendererOlBegin{#1}}% -\define@key{markdownRenderers}{olBeginTight}{% - \renewcommand\markdownRendererOlBeginTight{#1}}% -\define@key{markdownRenderers}{olItem}{% - \renewcommand\markdownRendererOlItem{#1}}% -\define@key{markdownRenderers}{olItemWithNumber}{% - \renewcommand\markdownRendererOlItemWithNumber[1]{#1}}% -\define@key{markdownRenderers}{olItemEnd}{% - \renewcommand\markdownRendererOlItemEnd{#1}}% -\define@key{markdownRenderers}{olEnd}{% - \renewcommand\markdownRendererOlEnd{#1}}% -\define@key{markdownRenderers}{olEndTight}{% - \renewcommand\markdownRendererOlEndTight{#1}}% -\define@key{markdownRenderers}{dlBegin}{% - \renewcommand\markdownRendererDlBegin{#1}}% -\define@key{markdownRenderers}{dlBeginTight}{% - \renewcommand\markdownRendererDlBeginTight{#1}}% -\define@key{markdownRenderers}{dlItem}{% - \renewcommand\markdownRendererDlItem[1]{#1}}% -\define@key{markdownRenderers}{dlItemEnd}{% - \renewcommand\markdownRendererDlItemEnd{#1}}% -\define@key{markdownRenderers}{dlDefinitionBegin}{% - \renewcommand\markdownRendererDlDefinitionBegin{#1}}% -\define@key{markdownRenderers}{dlDefinitionEnd}{% - \renewcommand\markdownRendererDlDefinitionEnd{#1}}% -\define@key{markdownRenderers}{dlEnd}{% - \renewcommand\markdownRendererDlEnd{#1}}% -\define@key{markdownRenderers}{dlEndTight}{% - \renewcommand\markdownRendererDlEndTight{#1}}% -\define@key{markdownRenderers}{emphasis}{% - \renewcommand\markdownRendererEmphasis[1]{#1}}% -\define@key{markdownRenderers}{strongEmphasis}{% - \renewcommand\markdownRendererStrongEmphasis[1]{#1}}% -\define@key{markdownRenderers}{blockQuoteBegin}{% - \renewcommand\markdownRendererBlockQuoteBegin{#1}}% -\define@key{markdownRenderers}{blockQuoteEnd}{% - \renewcommand\markdownRendererBlockQuoteEnd{#1}}% -\define@key{markdownRenderers}{inputVerbatim}{% - \renewcommand\markdownRendererInputVerbatim[1]{#1}}% -\define@key{markdownRenderers}{inputFencedCode}{% - \renewcommand\markdownRendererInputFencedCode[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataBoolean}{% - \renewcommand\markdownRendererJekyllDataBoolean[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataEmpty}{% - \renewcommand\markdownRendererJekyllDataEmpty[1]{#1}}% -\define@key{markdownRenderers}{jekyllDataNumber}{% - \renewcommand\markdownRendererJekyllDataNumber[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataString}{% - \renewcommand\markdownRendererJekyllDataString[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataBegin}{% - \renewcommand\markdownRendererJekyllDataBegin{#1}}% -\define@key{markdownRenderers}{jekyllDataEnd}{% - \renewcommand\markdownRendererJekyllDataEnd{#1}}% -\define@key{markdownRenderers}{jekyllDataSequenceBegin}{% - \renewcommand\markdownRendererJekyllDataSequenceBegin[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataSequenceEnd}{% - \renewcommand\markdownRendererJekyllDataSequenceEnd{#1}}% -\define@key{markdownRenderers}{jekyllDataMappingBegin}{% - \renewcommand\markdownRendererJekyllDataMappingBegin[2]{#1}}% -\define@key{markdownRenderers}{jekyllDataMappingEnd}{% - \renewcommand\markdownRendererJekyllDataMappingEnd{#1}}% -\define@key{markdownRenderers}{headingOne}{% - \renewcommand\markdownRendererHeadingOne[1]{#1}}% -\define@key{markdownRenderers}{headingTwo}{% - \renewcommand\markdownRendererHeadingTwo[1]{#1}}% -\define@key{markdownRenderers}{headingThree}{% - \renewcommand\markdownRendererHeadingThree[1]{#1}}% -\define@key{markdownRenderers}{headingFour}{% - \renewcommand\markdownRendererHeadingFour[1]{#1}}% -\define@key{markdownRenderers}{headingFive}{% - \renewcommand\markdownRendererHeadingFive[1]{#1}}% -\define@key{markdownRenderers}{headingSix}{% - \renewcommand\markdownRendererHeadingSix[1]{#1}}% -\define@key{markdownRenderers}{horizontalRule}{% - \renewcommand\markdownRendererHorizontalRule{#1}}% -\define@key{markdownRenderers}{footnote}{% - \renewcommand\markdownRendererFootnote[1]{#1}}% -\define@key{markdownRenderers}{cite}{% - \renewcommand\markdownRendererCite[1]{#1}}% -\define@key{markdownRenderers}{textCite}{% - \renewcommand\markdownRendererTextCite[1]{#1}}% -\define@key{markdownRenderers}{table}{% - \renewcommand\markdownRendererTable[3]{#1}}% -\define@key{markdownRenderers}{inlineHtmlComment}{% - \renewcommand\markdownRendererInlineHtmlComment[1]{#1}}% -\define@key{markdownRenderers}{blockHtmlCommentBegin}{% - \renewcommand\markdownRendererBlockHtmlCommentBegin{#1}}% -\define@key{markdownRenderers}{blockHtmlCommentEnd}{% - \renewcommand\markdownRendererBlockHtmlCommentEnd{#1}}% -\define@key{markdownRenderers}{inlineHtmlTag}{% - \renewcommand\markdownRendererInlineHtmlTag[1]{#1}}% -\define@key{markdownRenderers}{inputBlockHtmlElement}{% - \renewcommand\markdownRendererInputBlockHtmlElement[1]{#1}}% -\define@key{markdownRenderers}{tickedBox}{% - \renewcommand\markdownRendererTickedBox{#1}}% -\define@key{markdownRenderers}{halfTickedBox}{% - \renewcommand\markdownRendererHalfTickedBox{#1}}% -\define@key{markdownRenderers}{untickedBox}{% - \renewcommand\markdownRendererUntickedBox{#1}}% -\define@key{markdownRendererPrototypes}{attributeIdentifier}{% - \renewcommand\markdownRendererAttributeIdentifierPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{attributeClassName}{% - \renewcommand\markdownRendererAttributeClassNamePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{attributeKeyValue}{% - \renewcommand\markdownRendererAttributeKeyValuePrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{documentBegin}{% - \renewcommand\markdownRendererDocumentBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{documentEnd}{% - \renewcommand\markdownRendererDocumentEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{interblockSeparator}{% - \renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}% -\define@key{markdownRendererPrototypes}{lineBreak}{% - \renewcommand\markdownRendererLineBreakPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ellipsis}{% - \renewcommand\markdownRendererEllipsisPrototype{#1}}% -\define@key{markdownRendererPrototypes}{headerAttributeContextBegin}{% - \renewcommand\markdownRendererHeaderAttributeContextBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{headerAttributeContextEnd}{% - \renewcommand\markdownRendererHeaderAttributeContextEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{nbsp}{% - \renewcommand\markdownRendererNbspPrototype{#1}}% -\define@key{markdownRendererPrototypes}{leftBrace}{% - \renewcommand\markdownRendererLeftBracePrototype{#1}}% -\define@key{markdownRendererPrototypes}{rightBrace}{% - \renewcommand\markdownRendererRightBracePrototype{#1}}% -\define@key{markdownRendererPrototypes}{dollarSign}{% - \renewcommand\markdownRendererDollarSignPrototype{#1}}% -\define@key{markdownRendererPrototypes}{percentSign}{% - \renewcommand\markdownRendererPercentSignPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ampersand}{% - \renewcommand\markdownRendererAmpersandPrototype{#1}}% -\define@key{markdownRendererPrototypes}{underscore}{% - \renewcommand\markdownRendererUnderscorePrototype{#1}}% -\define@key{markdownRendererPrototypes}{hash}{% - \renewcommand\markdownRendererHashPrototype{#1}}% -\define@key{markdownRendererPrototypes}{circumflex}{% - \renewcommand\markdownRendererCircumflexPrototype{#1}}% -\define@key{markdownRendererPrototypes}{backslash}{% - \renewcommand\markdownRendererBackslashPrototype{#1}}% -\define@key{markdownRendererPrototypes}{tilde}{% - \renewcommand\markdownRendererTildePrototype{#1}}% -\define@key{markdownRendererPrototypes}{pipe}{% - \renewcommand\markdownRendererPipePrototype{#1}}% -\define@key{markdownRendererPrototypes}{codeSpan}{% - \renewcommand\markdownRendererCodeSpanPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{link}{% - \renewcommand\markdownRendererLinkPrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{contentBlock}{% - \renewcommand\markdownRendererContentBlockPrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{contentBlockOnlineImage}{% - \renewcommand\markdownRendererContentBlockOnlineImagePrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{contentBlockCode}{% - \renewcommand\markdownRendererContentBlockCodePrototype[5]{#1}}% -\define@key{markdownRendererPrototypes}{image}{% - \renewcommand\markdownRendererImagePrototype[4]{#1}}% -\define@key{markdownRendererPrototypes}{ulBegin}{% - \renewcommand\markdownRendererUlBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulBeginTight}{% - \renewcommand\markdownRendererUlBeginTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulItem}{% - \renewcommand\markdownRendererUlItemPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulItemEnd}{% - \renewcommand\markdownRendererUlItemEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulEnd}{% - \renewcommand\markdownRendererUlEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{ulEndTight}{% - \renewcommand\markdownRendererUlEndTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olBegin}{% - \renewcommand\markdownRendererOlBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olBeginTight}{% - \renewcommand\markdownRendererOlBeginTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olItem}{% - \renewcommand\markdownRendererOlItemPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olItemWithNumber}{% - \renewcommand\markdownRendererOlItemWithNumberPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{olItemEnd}{% - \renewcommand\markdownRendererOlItemEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olEnd}{% - \renewcommand\markdownRendererOlEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{olEndTight}{% - \renewcommand\markdownRendererOlEndTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlBegin}{% - \renewcommand\markdownRendererDlBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlBeginTight}{% - \renewcommand\markdownRendererDlBeginTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlItem}{% - \renewcommand\markdownRendererDlItemPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{dlItemEnd}{% - \renewcommand\markdownRendererDlItemEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlDefinitionBegin}{% - \renewcommand\markdownRendererDlDefinitionBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlDefinitionEnd}{% - \renewcommand\markdownRendererDlDefinitionEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlEnd}{% - \renewcommand\markdownRendererDlEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{dlEndTight}{% - \renewcommand\markdownRendererDlEndTightPrototype{#1}}% -\define@key{markdownRendererPrototypes}{emphasis}{% - \renewcommand\markdownRendererEmphasisPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{strongEmphasis}{% - \renewcommand\markdownRendererStrongEmphasisPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{blockQuoteBegin}{% - \renewcommand\markdownRendererBlockQuoteBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{blockQuoteEnd}{% - \renewcommand\markdownRendererBlockQuoteEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{inputVerbatim}{% - \renewcommand\markdownRendererInputVerbatimPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{inputFencedCode}{% - \renewcommand\markdownRendererInputFencedCodePrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataBoolean}{% - \renewcommand\markdownRendererJekyllDataBooleanPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataEmpty}{% - \renewcommand\markdownRendererJekyllDataEmptyPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataNumber}{% - \renewcommand\markdownRendererJekyllDataNumberPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataString}{% - \renewcommand\markdownRendererJekyllDataStringPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataBegin}{% - \renewcommand\markdownRendererJekyllDataBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataEnd}{% - \renewcommand\markdownRendererJekyllDataEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataSequenceBegin}{% - \renewcommand\markdownRendererJekyllDataSequenceBeginPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataSequenceEnd}{% - \renewcommand\markdownRendererJekyllDataSequenceEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataMappingBegin}{% - \renewcommand\markdownRendererJekyllDataMappingBeginPrototype[2]{#1}}% -\define@key{markdownRendererPrototypes}{jekyllDataMappingEnd}{% - \renewcommand\markdownRendererJekyllDataMappingEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{headingOne}{% - \renewcommand\markdownRendererHeadingOnePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingTwo}{% - \renewcommand\markdownRendererHeadingTwoPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingThree}{% - \renewcommand\markdownRendererHeadingThreePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingFour}{% - \renewcommand\markdownRendererHeadingFourPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingFive}{% - \renewcommand\markdownRendererHeadingFivePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{headingSix}{% - \renewcommand\markdownRendererHeadingSixPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{horizontalRule}{% - \renewcommand\markdownRendererHorizontalRulePrototype{#1}}% -\define@key{markdownRendererPrototypes}{footnote}{% - \renewcommand\markdownRendererFootnotePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{cite}{% - \renewcommand\markdownRendererCitePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{textCite}{% - \renewcommand\markdownRendererTextCitePrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{table}{% - \renewcommand\markdownRendererTablePrototype[3]{#1}}% -\define@key{markdownRendererPrototypes}{inlineHtmlComment}{% - \renewcommand\markdownRendererInlineHtmlCommentPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{blockHtmlCommentBegin}{% - \renewcommand\markdownRendererBlockHtmlCommentBeginPrototype{#1}}% -\define@key{markdownRendererPrototypes}{blockHtmlCommentEnd}{% - \renewcommand\markdownRendererBlockHtmlCommentEndPrototype{#1}}% -\define@key{markdownRendererPrototypes}{inlineHtmlTag}{% - \renewcommand\markdownRendererInlineHtmlTagPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{inputBlockHtmlElement}{% - \renewcommand\markdownRendererInputBlockHtmlElementPrototype[1]{#1}}% -\define@key{markdownRendererPrototypes}{tickedBox}{% - \renewcommand\markdownRendererTickedBoxPrototype{#1}}% -\define@key{markdownRendererPrototypes}{halfTickedBox}{% - \renewcommand\markdownRendererHalfTickedBoxPrototype{#1}}% -\define@key{markdownRendererPrototypes}{untickedBox}{% - \renewcommand\markdownRendererUntickedBoxPrototype{#1}}% +\ExplSyntaxOn +\cs_new:Nn \__markdown_latex_define_renderers: + { + \seq_map_function:NN + \g__markdown_renderers_seq + \__markdown_latex_define_renderer:n + } +\cs_new:Nn \__markdown_latex_define_renderer:n + { + \tl_set:Nn + \l_tmpb_tl + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownRenderer + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + } + \prop_get:NnN + \g__markdown_renderer_arities_prop + { #1 } + \l_tmpb_tl + \__markdown_latex_define_renderer:ncV + { #1 } + { \l_tmpa_tl } + \l_tmpb_tl + } +\cs_new:Nn \__markdown_latex_define_renderer:nNn + { + \define@key + { markdownRenderers } + { #1 } + { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ##1 } + } + } +\cs_generate_variant:Nn + \__markdown_latex_define_renderer:nNn + { ncV } +\ExplSyntaxOff +\ExplSyntaxOn +\cs_new:Nn \__markdown_latex_define_renderer_prototypes: + { + \seq_map_function:NN + \g__markdown_renderers_seq + \__markdown_latex_define_renderer_prototype:n + } +\cs_new:Nn \__markdown_latex_define_renderer_prototype:n + { + \tl_set:Nn + \l_tmpb_tl + { \str_upper_case:n { #1 } } + \tl_set:Nx + \l_tmpa_tl + { + markdownRenderer + \tl_head:f { \l_tmpb_tl } + \tl_tail:n { #1 } + Prototype + } + \prop_get:NnN + \g__markdown_renderer_arities_prop + { #1 } + \l_tmpb_tl + \__markdown_latex_define_renderer_prototype:ncV + { #1 } + { \l_tmpa_tl } + \l_tmpb_tl + } +\cs_new:Nn \__markdown_latex_define_renderer_prototype:nNn + { + \define@key + { markdownRendererPrototypes } + { #1 } + { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ##1 } + } + } +\cs_generate_variant:Nn + \__markdown_latex_define_renderer_prototype:nNn + { ncV } +\ExplSyntaxOff \newcommand\markdownInfo[1]{\PackageInfo{markdown}{#1}}% \newcommand\markdownWarning[1]{\PackageWarning{markdown}{#1}}% \newcommand\markdownError[2]{\PackageError{markdown}{#1}{#2.}}% @@ -530,6 +292,10 @@ \def\markdownVersionSpace{ }% \ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v% \markdownVersion\markdownVersionSpace markdown renderer]% +\ExplSyntaxOn +\__markdown_latex_define_renderers: +\__markdown_latex_define_renderer_prototypes: +\ExplSyntaxOff \let\markdownInputPlainTeX\markdownInput \renewcommand\markdownInput[2][]{% \begingroup @@ -590,16 +356,11 @@ \define@key{markdownOptions}{rendererPrototypes}{% \setkeys{markdownRendererPrototypes}{#1}% \def\KV@prefix{KV@markdownOptions@}}% +\define@key{markdownOptions}{code}{#1}% \ifmarkdownLaTeXPlain\else -\RequirePackage{ifthen} - -\ifx\markdownOptionTightLists\undefined - \@ifclassloaded{beamer}{}{% - \RequirePackage{paralist}}% -\else - \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{% - \RequirePackage{paralist}}% -\fi +\markdownIfOption{tightLists}{ + \@ifclassloaded{beamer}{}{\RequirePackage{paralist}}% +}{} \@ifpackageloaded{paralist}{ \markdownSetup{rendererPrototypes={ ulBeginTight = {\begin{compactitem}}, @@ -616,7 +377,7 @@ olEndTight = {\markdownRendererOlEnd}, dlBeginTight = {\markdownRendererDlBegin}, dlEndTight = {\markdownRendererDlEnd}}}} -\RequirePackage{amsmath} +\RequirePackage{amsmath,ifthen} \@ifpackageloaded{unicode-math}{ \markdownSetup{rendererPrototypes={ untickedBox = {$\mdlgwhtsquare$}, @@ -1122,70 +883,6 @@ \fi\markdownLaTeXRenderTableCell} \fi \ExplSyntaxOn -\seq_new:N \g__markdown_jekyll_data_datatypes_seq -\tl_const:Nn \c__markdown_jekyll_data_sequence_tl { sequence } -\tl_const:Nn \c__markdown_jekyll_data_mapping_tl { mapping } -\tl_const:Nn \c__markdown_jekyll_data_scalar_tl { scalar } -\seq_new:N \g__markdown_jekyll_data_wildcard_absolute_address_seq -\cs_new:Nn \markdown_jekyll_data_push_address_segment:n - { - \seq_if_empty:NF - \g__markdown_jekyll_data_datatypes_seq - { - \seq_get_right:NN - \g__markdown_jekyll_data_datatypes_seq - \l_tmpa_tl - \tl_if_eq:NNTF - \l_tmpa_tl - \c__markdown_jekyll_data_sequence_tl - { - \seq_put_right:Nn - \g__markdown_jekyll_data_wildcard_absolute_address_seq - { * } - } - { - \seq_put_right:Nn - \g__markdown_jekyll_data_wildcard_absolute_address_seq - { #1 } - } - } - } -\tl_new:N \g__markdown_jekyll_data_wildcard_absolute_address_tl -\tl_new:N \g__markdown_jekyll_data_wildcard_relative_address_tl -\cs_new:Nn \markdown_jekyll_data_concatenate_address:NN - { - \seq_pop_left:NN #1 \l_tmpa_tl - \tl_set:Nx #2 { / \seq_use:Nn #1 { / } } - \seq_put_left:NV #1 \l_tmpa_tl - } -\cs_new:Nn \markdown_jekyll_data_update_address_tls: - { - \markdown_jekyll_data_concatenate_address:NN - \g__markdown_jekyll_data_wildcard_absolute_address_seq - \g__markdown_jekyll_data_wildcard_absolute_address_tl - \seq_get_right:NN - \g__markdown_jekyll_data_wildcard_absolute_address_seq - \g__markdown_jekyll_data_wildcard_relative_address_tl - } -\cs_new:Nn \markdown_jekyll_data_push:nN - { - \markdown_jekyll_data_push_address_segment:n - { #1 } - \seq_put_right:NV - \g__markdown_jekyll_data_datatypes_seq - #2 - \markdown_jekyll_data_update_address_tls: - } -\cs_new:Nn \markdown_jekyll_data_pop: - { - \seq_pop_right:NN - \g__markdown_jekyll_data_wildcard_absolute_address_seq - \l_tmpa_tl - \seq_pop_right:NN - \g__markdown_jekyll_data_datatypes_seq - \l_tmpa_tl - \markdown_jekyll_data_update_address_tls: - } \keys_define:nn { markdown/jekyllData } { @@ -1193,64 +890,6 @@ date .code:n = { \date{#1} }, title .code:n = { \title{#1} }, } -\cs_new:Nn \markdown_jekyll_data_set_keyval:nn - { - \keys_set_known:nn - { markdown/jekyllData } - { { #1 } = { #2 } } - } -\cs_generate_variant:Nn - \markdown_jekyll_data_set_keyval:nn - { Vn } -\cs_new:Nn \markdown_jekyll_data_set_keyvals:nn - { - \markdown_jekyll_data_push:nN - { #1 } - \c__markdown_jekyll_data_scalar_tl - \markdown_jekyll_data_set_keyval:Vn - \g__markdown_jekyll_data_wildcard_absolute_address_tl - { #2 } - \markdown_jekyll_data_set_keyval:Vn - \g__markdown_jekyll_data_wildcard_relative_address_tl - { #2 } - \markdown_jekyll_data_pop: - } -\markdownSetup{ - rendererPrototypes = { - jekyllDataSequenceBegin = { - \markdown_jekyll_data_push:nN - { #1 } - \c__markdown_jekyll_data_sequence_tl - }, - jekyllDataMappingBegin = { - \markdown_jekyll_data_push:nN - { #1 } - \c__markdown_jekyll_data_mapping_tl - }, - jekyllDataSequenceEnd = { - \markdown_jekyll_data_pop: - }, - jekyllDataMappingEnd = { - \markdown_jekyll_data_pop: - }, - jekyllDataBoolean = { - \markdown_jekyll_data_set_keyvals:nn - { #1 } - { #2 } - }, - jekyllDataEmpty = { }, - jekyllDataNumber = { - \markdown_jekyll_data_set_keyvals:nn - { #1 } - { #2 } - }, - jekyllDataString = { - \markdown_jekyll_data_set_keyvals:nn - { #1 } - { #2 } - }, - }, -} \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} \markdownSetup{ rendererPrototypes = { @@ -1271,7 +910,6 @@ }, }, } - \ExplSyntaxOff \newcommand\markdownMakeOther{% \count0=128\relax diff --git a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty index 92e9f8ffd68..fe77cc14fa0 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty @@ -53,7 +53,7 @@ \renewcommand\markdownRendererInputFencedCode[2]{% \def\next##1 ##2\relax{% \ifthenelse{\equal{##1}{dot}}{% - \markdownIfOption{FrozenCache}{}{% + \markdownIfOption{frozenCache}{}{% \immediate\write18{% if ! test -e #1.pdf.source || ! diff #1 #1.pdf.source; then diff --git a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty index 539d34bc5d6..9717c70a537 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_graphicx_http.sty @@ -62,7 +62,7 @@ \global\def\markdownRendererImagePrototype#1#2#3#4{^^A \begingroup \edef\filename{\markdown@witiko@graphicx@http@filename}^^A - \markdownIfOption{FrozenCache}{}{^^A + \markdownIfOption{frozenCache}{}{^^A \immediate\write18{^^A if printf '%s' "#3" | grep -q -E '^https?:'; then diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index f3c46b02906..6955982c3f2 100644 --- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua +++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua @@ -58,7 +58,7 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.14.1-0-gb933d81", + version = "2.15.0-0-g9296cf1", 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", @@ -89,6 +89,7 @@ defaultOptions.contentBlocks = false defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" defaultOptions.definitionLists = false defaultOptions.eagerCache = true +defaultOptions.expectJekyllData = false defaultOptions.fencedCode = false defaultOptions.finalizeCache = false defaultOptions.footnotes = false @@ -3477,8 +3478,6 @@ parsers.between = function(p, starter, ender) end parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more -parsers.Block = V("Block") - parsers.OnlineImageURL = parsers.leader * parsers.onlineimageurl @@ -3608,13 +3607,13 @@ function M.reader.new(writer, options) = create_parser("parse_blocks", function() return larsers.blocks - end, false) + end, true) - local parse_blocks_toplevel - = create_parser("parse_blocks_toplevel", + local parse_blocks_nested + = create_parser("parse_blocks_nested", function() - return larsers.blocks_toplevel - end, true) + return larsers.blocks_nested + end, false) local parse_inlines = create_parser("parse_inlines", @@ -3703,7 +3702,7 @@ function M.reader.new(writer, options) return writer.defer_call(function() local found = rawnotes[normalize_tag(ref)] if found then - return writer.note(parse_blocks_toplevel(found)) + return writer.note(parse_blocks_nested(found)) else return {"[", parse_inlines("^" .. ref), "]"} end @@ -4001,7 +4000,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline * parsers.contentblock_tail / writer.contentblock - larsers.DisplayHtml = (parsers.htmlcomment / parse_blocks) + larsers.DisplayHtml = (parsers.htmlcomment / parse_blocks_nested) / writer.block_html_comment + parsers.emptyelt_block / writer.block_html_element + parsers.openelt_exact("hr") / writer.block_html_element @@ -4019,21 +4018,40 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline expandtabs(code)) end - larsers.JekyllData = P("---") + larsers.JekyllData = Cmt( C((parsers.line - P("---") - P("..."))^0) + , function(s, i, text) + local data + local ran_ok, error = pcall(function() + local tinyyaml = require("markdown-tinyyaml") + data = tinyyaml.parse(text, {timestamps=false}) + end) + if ran_ok and data ~= nil then + return true, writer.jekyllData(data, function(s) + return parse_blocks_nested(s) + end, nil) + else + return false + end + end + ) + + larsers.UnexpectedJekyllData + = P("---") * parsers.blankline / 0 * #(-parsers.blankline) -- if followed by blank, it's an hrule - * C((parsers.line - P("---") - P("..."))^0) + * larsers.JekyllData * (P("---") + P("...")) - / function(text) - local tinyyaml = require("markdown-tinyyaml") - data = tinyyaml.parse(text,{timestamps=false}) - return writer.jekyllData(data, function(s) - return parse_blocks(s) - end, nil) - end + + larsers.ExpectedJekyllData + = ( P("---") + * parsers.blankline / 0 + * #(-parsers.blankline) -- if followed by blank, it's an hrule + )^-1 + * larsers.JekyllData + * (P("---") + P("..."))^-1 larsers.Blockquote = Cs(larsers.blockquote_body^1) - / parse_blocks_toplevel / writer.blockquote + / parse_blocks_nested / writer.blockquote larsers.HorizontalRule = ( parsers.lineof(parsers.asterisk) + parsers.lineof(parsers.dash) @@ -4043,15 +4061,6 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.Reference = parsers.define_reference_parser / register_link larsers.Paragraph = parsers.nonindentspace * Ct(parsers.Inline^1) - * parsers.newline - * ( parsers.blankline^1 - + #parsers.hash - + #(parsers.leader * parsers.more * parsers.space^-1) - ) - / writer.paragraph - - larsers.ToplevelParagraph - = parsers.nonindentspace * Ct(parsers.Inline^1) * ( parsers.newline * ( parsers.blankline^1 + #parsers.hash @@ -4092,7 +4101,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.TightListItem = function(starter) return -larsers.HorizontalRule * (Cs(starter / "" * larsers.tickbox^-1 * larsers.ListBlock * larsers.NestedList^-1) - / parse_blocks) + / parse_blocks_nested) * -(parsers.blanklines * parsers.indent) end @@ -4101,7 +4110,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline * Cs( starter / "" * larsers.tickbox^-1 * larsers.ListBlock * Cc("\n") * (larsers.NestedList + larsers.ListContinuationBlock^0) * (parsers.blanklines / "\n\n") - ) / parse_blocks + ) / parse_blocks_nested end larsers.BulletList = ( Ct(larsers.TightListItem(parsers.bullet)^1) * Cc(true) @@ -4138,12 +4147,12 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.DefinitionListItemLoose = C(parsers.line) * parsers.skipblanklines * Ct((parsers.defstart * parsers.indented_blocks(parsers.dlchunk) - / parse_blocks_toplevel)^1) + / parse_blocks_nested)^1) * Cc(false) / definition_list_item larsers.DefinitionListItemTight = C(parsers.line) * Ct((parsers.defstart * parsers.dlchunk - / parse_blocks)^1) + / parse_blocks_nested)^1) * Cc(true) / definition_list_item larsers.DefinitionList = ( Ct(larsers.DefinitionListItemLoose^1) * Cc(false) @@ -4218,17 +4227,22 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline local syntax = { "Blocks", - Blocks = larsers.Blank^0 * parsers.Block^-1 - * (larsers.Blank^0 / writer.interblocksep - * parsers.Block)^0 - * larsers.Blank^0 * parsers.eof, + Blocks = ( V("ExpectedJekyllData") + * (V("Blank")^0 / writer.interblocksep) + )^-1 + * V("Blank")^0 + * V("Block")^-1 + * (V("Blank")^0 / writer.interblocksep + * V("Block"))^0 + * V("Blank")^0 * parsers.eof, Blank = larsers.Blank, - JekyllData = larsers.JekyllData, + UnexpectedJekyllData = larsers.UnexpectedJekyllData, + ExpectedJekyllData = larsers.ExpectedJekyllData, Block = V("ContentBlock") - + V("JekyllData") + + V("UnexpectedJekyllData") + V("Blockquote") + V("PipeTable") + V("Verbatim") @@ -4357,7 +4371,11 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline end if not options.jekyllData then - syntax.JekyllData = parsers.fail + syntax.UnexpectedJekyllData = parsers.fail + end + + if not options.jekyllData or not options.expectJekyllData then + syntax.ExpectedJekyllData = parsers.fail end if options.preserveTabs then @@ -4376,9 +4394,9 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline syntax.AutoLinkRelativeReference = parsers.fail end - local blocks_toplevel_t = util.table_copy(syntax) - blocks_toplevel_t.Paragraph = larsers.ToplevelParagraph - larsers.blocks_toplevel = Ct(blocks_toplevel_t) + local blocks_nested_t = util.table_copy(syntax) + blocks_nested_t.ExpectedJekyllData = parsers.fail + larsers.blocks_nested = Ct(blocks_nested_t) larsers.blocks = Ct(syntax) @@ -4418,7 +4436,7 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline local salt = table.concat(opt_string, ",") .. "," .. metadata.version local output local function convert(input) - local document = parse_blocks_toplevel(input) + local document = parse_blocks(input) return util.rope_to_string(writer.document(document)) end if options.eagerCache or options.finalizeCache then -- cgit v1.2.3