-Table 2.2: Demonstration of pipe table syntax.
-
-
-
-
This is a bullet list:
-
-
The first item of a bullet list
-
that spans several paragraphs,
-
-
-
the second item of a bullet list,
-
-
the third item of a bullet list.
-
This is a compact bullet list:
-
-
The first item of a bullet list,
-
-
the second item of a bullet list,
-
-
the third item of a bullet list.
-
This is an ordered list:
-
-5.
The first item of an ordered list
-
that spans several paragraphs,
-
-6.
the second item of an ordered list,
-
-7.
the third item of an ordered list.
-
This is a fancy ordered list:
-
-e)
The first item of an ordered list
-
that spans several paragraphs,
-
- f)
the second item of an ordered list,
-
-g)
the third item of an ordered list.
-
This is an ordered list using hash enumerators:
-
-1.
The first item of an ordered list
-
-
that spans several paragraphs,
-
-1.
the second item of an ordered list,
-
-2.
the third item of an ordered list.
-
This is a compact ordered list:
-
-5.
The first item of an ordered list,
-
-6.
the second item of an ordered list,
-
-7.
the third item of an ordered list.
-
This is a compact ordered list using hash enumerators:
-
-1.
The first item of an ordered list,
-
-2.
the second item of an ordered list,
-
-3.
the third item of an ordered list.
-
This is a compact fancy ordered list using hash enumerators:
-
-1.
The first item of an ordered list,
-
-2.
the second item of an ordered list,
-
-3.
the third item of an ordered list.
-
This is a task list:
-
-
Some unfinished task
-
-
Some half-finished task
-
-
Some finished task
-
-
An item of an unordered list
-
- 1.
□ Some unfinished subtask
-
- 2.
⊡ Some half-finished subtask
-
- 3.
⊠ Some finished subtask
-
- 4.
An item of an ordered list
-
-
-
This is a definition list:
-
-
-Term 1
-
Definition 1 with some removed text
-
-
-Term 2
-
Definition 2
-
-
-Some code, part of Definition 2
-
-
Third paragraph of Definition 2.
-
Definition 3
-
-
-
This is a compact definition list:
-
-Term 1
Definition 1
-
-Term 2
Definition 2
-
Definition 3
-
-
-
This is a superscript and a subscript.
-
This is a block quote:
-
-
This is the first level of quoting.
-
-
This is nested blockquote.
-
Back to the first level.
-
-
Here is a note reference2
-and another.3 Here
-is an inline note.4
-
This is raw TeX code:
-
-
-
-
-
Here are some non-ASCII characters: ěščřžýáíé.
-
Here is some HTML code mixed with Markdown. In TeX, the HTML code will be
-silently ignored, whereas in TeX4ht, the HTML code will be passed through to the
-output:
-
Subsequent paragraphs are indented to show that they belong to the previous note.
-
-
-Some code
-
-
The whole paragraph can be indented, or just the first line. In this way, multi-paragraph notes
-work like multi-paragraph list items.
-
4Inlines notes are easier to write, since you don’t have to pick an identifier and move down to
-type the note.
-
-
-
\ No newline at end of file
diff --git a/macros/generic/markdown/examples/latex-xetex.pdf b/macros/generic/markdown/examples/latex-xetex.pdf
deleted file mode 100644
index cfbebde5e3..0000000000
Binary files a/macros/generic/markdown/examples/latex-xetex.pdf and /dev/null differ
diff --git a/macros/generic/markdown/latexmkrc b/macros/generic/markdown/latexmkrc
deleted file mode 100644
index a9b6a23ef6..0000000000
--- a/macros/generic/markdown/latexmkrc
+++ /dev/null
@@ -1,5 +0,0 @@
-$pdflatex = 'lualatex --shell-escape %O %S';
-$makeindex = 'makeindex -s %R.ist %O -o %D %S';
-$pdf_mode = 1;
-$postscript_mode = 0;
-$dvi_mode = 0;
diff --git a/macros/generic/markdown/markdown.dtx b/macros/generic/markdown/markdown.dtx
index b165924476..5b3f73cb8e 100644
--- a/macros/generic/markdown/markdown.dtx
+++ b/macros/generic/markdown/markdown.dtx
@@ -1,6 +1,6 @@
% \iffalse
%<*driver>
-\documentclass[nohyperref]{ltxdockit}
+\documentclass{ltxdockit}
\usepackage[american]{babel}
\usepackage{amsmath,btxdockit,doc,fancyvrb,graphicx,hologo,microtype,minted}
@@ -1145,11 +1145,11 @@ local md5 = require("md5")
%
%: A library that provides access to the filesystem via \acro{os}-specific
% syscalls. It is used by the plain \TeX{} code to create the cache
-% directory specified by the \mref{markdownOptionCacheDir} macro before
-% interfacing with the \pkg{Lunamark} library. \pkg{Lua File System} is
-% included in all releases of Lua\TeX{} (\TeX Live${}\geq{}2008$).
+% directory specified by the \Opt{cacheDir} option before interfacing with
+% the \pkg{Lunamark} library. \pkg{Lua File System} is included in all
+% releases of Lua\TeX{} (\TeX Live${}\geq{}2008$).
%
-% The plain \TeX{} code makes use of the \luamref{isdir} method that was added
+% The plain \TeX{} code makes use of the `isdir` method that was added
% to the \pkg{Lua File System} library by the Lua\TeX{} engine
% developers~[@luatex21, Section 4.2.4].
%
@@ -1159,7 +1159,7 @@ local md5 = require("md5")
% Unless you convert markdown documents to \TeX{} manually using the Lua
% command-line interface (see Section <#sec:lua-cli-interface>), the plain
% \TeX{} part of the package will require that either the Lua\TeX{}
-% \mref{directlua} primitive or the shell access file stream 18 is available in
+% `\directlua` primitive or the shell access file stream 18 is available in
% your \TeX{} engine. If only the shell access file stream is available in your
% \TeX{} engine (as is the case with \hologo{pdfTeX} and \Hologo{XeTeX}) or if
% you enforce the use of shell using the \mref{markdownMode} macro, then unless
@@ -1202,18 +1202,17 @@ local md5 = require("md5")
%
% \pkg{url}
%
-%: A package that provides the \mref{url} macro for the typesetting of
-% links.
+%: A package that provides the `\url` macro for the typesetting of links.
%
% \pkg{graphicx}
%
-%: A package that provides the \mref{includegraphics} macro for the typesetting
+%: A package that provides the `\includegraphics` macro for the typesetting
% of images.
%
% \pkg{paralist}
%
-%: A package that provides the \envmref{compactitem}, \envmref{compactenum}, and
-% \envmref{compactdesc} macros for the typesetting of tight bulleted lists,
+%: A package that provides the `compactitem`, `compactenum`, and
+% `compactdesc` macros for the typesetting of tight bulleted lists,
% ordered lists, and definition lists.
%
% \pkg{ifthen}
@@ -1224,18 +1223,18 @@ local md5 = require("md5")
%
% \pkg{fancyvrb}
%
-%: A package that provides the \mref{VerbatimInput} macros for the verbatim
+%: A package that provides the `\VerbatimInput` macros for the verbatim
% inclusion of files containing code.
%
% \pkg{csvsimple}
%
-%: A package that provides the \mref{csvautotabular} macro for typesetting
+%: A package that provides the `\csvautotabular` macro for typesetting
% \acro{csv} files in the default renderer prototypes for iA\,Writer
% content blocks.
%
% \pkg{gobble}
%
-%: A package that provides the \mref{\@gobblethree} \TeX{} command that
+%: A package that provides the `\@gobblethree` \TeX{} command that
% is used in the default renderer prototype for citations. The package
% is included in \TeX Live${}\geq{}2016$.
%
@@ -1680,7 +1679,7 @@ local walkable_syntax = {
% \luamref{reader->insert_pattern} with `"Inline after Emph"` (or `"Inline
% before Link"`) and `pattern` as the arguments.
%
-% The \luamdef{reader->add_special_character} method adds a new character with
+% The \luamref{reader->add_special_character} method adds a new character with
% special meaning to the grammar of markdown. The method receives the character
% as its only argument.
%
@@ -2569,7 +2568,7 @@ defaultOptions.debugExtensionsFileName = "debug-extensions.json"
The frozen cache makes it possible to later typeset a plain \TeX{}
document that contains markdown documents without invoking Lua using
- the \mref{markdownOptionFrozenCache} plain \TeX{} option. As a result, the
+ the \Opt{frozenCache} plain \TeX{} option. As a result, the
plain \TeX{} document becomes more portable, but further changes in the
order and the content of markdown documents will not be reflected.
@@ -3048,7 +3047,7 @@ following content:
convert = markdown.new({fencedCode = true})
input = "A paragraph." .. newline ..
"```" .. newline ..
- "A code fence." .. newline ..
+ "A fenced code." .. newline ..
"```" .. newline
tex.sprint(convert(input))
@@ -3056,7 +3055,7 @@ following content:
fencedCode = true, blankBeforeCodeFence = true})
input = "A paragraph." .. newline ..
"```" .. newline ..
- "Not a code fence." .. newline ..
+ "Not a fenced code." .. newline ..
"```" .. newline
tex.sprint(convert(input)) }
\bye
@@ -3071,10 +3070,10 @@ following text:
> A paragraph.
>
> ```
-> A code fence.
+> A fenced code.
> ```
>
-> A paragraph. ``` Not a code fence. ```
+> A paragraph. ``` Not a fenced code. ```
##### Lua CLI Example {.unnumbered}
@@ -3129,7 +3128,7 @@ following content:
\markdownBegin
A paragraph.
```
-A code fence.
+A fenced code.
```
\markdownEnd
@@ -3137,7 +3136,7 @@ A code fence.
\markdownBegin
A paragraph.
```
-Not a code fence.
+Not a fenced code.
```
\markdownEnd
@@ -3153,10 +3152,10 @@ following text:
> A paragraph.
>
> ```
-> A code fence.
+> A fenced code.
> ```
>
-> A paragraph. ``` Not a code fence. ```
+> A paragraph. ``` Not a fenced code. ```
##### \LaTeX{} Example {.unnumbered}
@@ -3170,14 +3169,14 @@ following content:
\begin{markdown}
A paragraph.
```
-A code fence.
+A fenced code.
```
\end{markdown}
\begin{markdown*}{blankBeforeCodeFence}
A paragraph.
```
-Not a code fence.
+Not a fenced code.
```
\end{markdown*}
@@ -3193,10 +3192,10 @@ following text:
> A paragraph.
>
> ```
-> A code fence.
+> A fenced code.
> ```
>
-> A paragraph. ``` Not a code fence. ```
+> A paragraph. ``` Not a fenced code. ```
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -3210,7 +3209,7 @@ following content:
\startmarkdown
A paragraph.
```
-A code fence.
+A fenced code.
```
\stopmarkdown
@@ -3218,7 +3217,7 @@ A code fence.
\startmarkdown
A paragraph.
```
-Not a code fence.
+Not a fenced code.
```
\stopmarkdown
@@ -3234,10 +3233,10 @@ following text:
> A paragraph.
>
> ```
-> A code fence.
+> A fenced code.
> ```
>
-> A paragraph. ``` Not a code fence. ```
+> A paragraph. ``` Not a fenced code. ```
%
%<*tex>
@@ -3260,6 +3259,85 @@ defaultOptions.blankBeforeCodeFence = false
%
%<*manual-options>
+#### Option `blankBeforeDivFence`
+
+`blankBeforeDivFence` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{blankBeforeDivFence}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Require a blank line before the closing fence of a fenced div.
+
+ false
+
+ : Do not require a blank line before the closing fence of a fenced div.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\documentclass{article}
+\usepackage[fencedDivs]{markdown}
+\begin{document}
+
+\begin{markdown}
+A paragraph.
+::: {.identifier}
+A fenced div.
+:::
+\end{markdown}
+
+\begin{markdown*}{blankBeforeDivFence}
+A paragraph.
+```
+Not a fenced div.
+```
+\end{markdown*}
+
+\end{document}
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> A paragraph.
+>
+> A fenced div.
+>
+> A paragraph. ::: {.identifier} Not a fenced div. :::
+
+%
+%<*tex>
+% \fi
+% \begin{macrocode}
+\@@_add_lua_option:nnn
+ { blankBeforeDivFence }
+ { boolean }
+ { false }
+% \end{macrocode}
+% \iffalse
+%
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.blankBeforeDivFence = false
+% \end{macrocode}
+% \par
+% \iffalse
+%
+%<*manual-options>
+
#### Option `blankBeforeHeading`
`blankBeforeHeading` (default value: `false`)
@@ -3492,6 +3570,100 @@ defaultOptions.blankBeforeHeading = false
%
%<*manual-options>
+#### Option `bracketedSpans`
+
+`bracketedSpans` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{bracketedSpans}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the Pandoc bracketed spans extension:
+
+ ``` md
+ [This is *some text*]{.class key="val"}
+ ``````
+
+: false
+
+ : Disable the Pandoc bracketed spans extension:
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\documentclass{article}
+\usepackage[bracketedSpans]{markdown}
+\usepackage{expl3}
+\ExplSyntaxOn
+\markdownSetup{
+ renderers = {
+ bracketedSpanAttributeContextBegin = {
+ \group_begin:
+ \color_group_begin:
+ \markdownSetup{
+ renderers = {
+ attributeKeyValue = {
+ \str_if_eq:nnT
+ { #1 }
+ { color }
+ {
+ \color_select:n { #2 }
+ }
+ },
+ },
+ }
+ },
+ bracketedSpanAttributeContextEnd = {
+ \color_group_end:
+ \group_end:
+ },
+ },
+}
+\ExplSyntaxOff
+\begin{document}
+\begin{markdown}
+Here is some [colored text]{color=red}.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is some [colored text]{color=red}.
+
+%
+%<*tex>
+% \fi
+% \begin{macrocode}
+\@@_add_lua_option:nnn
+ { bracketedSpans }
+ { boolean }
+ { false }
+% \end{macrocode}
+% \iffalse
+%
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.bracketedSpans = false
+% \end{macrocode}
+% \par
+% \iffalse
+%
+%<*manual-options>
+
#### Option `breakableBlockquotes`
`breakableBlockquotes` (default value: `false`)
@@ -4694,196 +4866,45 @@ defaultOptions.eagerCache = true
%
%<*manual-options>
-#### Option `extensions`
+#### Option `expectJekyllData`
-`extensions` (default value: `{}`)
+`expectJekyllData` (default value: `false`)
% \fi
-% \begin{markdown}
+% \markdownBegin
%
-% \Valitem[\{\}]{extensions}{filenames}
+% \Optitem[false]{expectJekyllData}{\opt{true}, \opt{false}}
%
-: The filenames of user-defined syntax extensions that will be applied to the
- markdown reader. If the \pkg{kpathsea} library is available, files will be
- searched for not only in the current working directory but also in the
- \TeX{} directory structure.
+: false
-% A user-defined syntax extension is a Lua file in the following format:
-%
-% ``` lua
-% local strike_through = {
-% api_version = 2,
-% grammar_version = 2,
-% finalize_grammar = function(reader)
-% local nonspacechar = lpeg.P(1) - lpeg.S("\t ")
-% local doubleslashes = lpeg.P("//")
-% local function between(p, starter, ender)
-% ender = lpeg.B(nonspacechar) * ender
-% return (starter * #nonspacechar
-% * lpeg.Ct(p * (p - ender)^0) * ender)
-% end
-%
-% local read_strike_through = between(
-% lpeg.V("Inline"), doubleslashes, doubleslashes
-% ) / function(s) return {"\\st{", s, "}"} end
-%
-% reader.insert_pattern("Inline after Emph", read_strike_through,
-% "StrikeThrough")
-% reader.add_special_character("/")
-% end
-% }
-%
-% return strike_through
-% ```````
-%
-% The `api_version` and `grammar_version` fields specify the version of the
-% user-defined syntax extension API and the markdown grammar for which
-% the extension was written. See the current API and grammar versions
-% below:
-%
-% \end{markdown}
-% \iffalse
-%
-%<*lua>
-% \fi
-% \begin{macrocode}
-metadata.user_extension_api_version = 2
-metadata.grammar_version = 2
-% \end{macrocode}
-% \iffalse
-%
-%<*manual-options>
-% \fi
-% \begin{markdown}
-%
-% Any changes to the syntax extension API or grammar will cause the
-% corresponding current version to be incremented. After Markdown 3.0.0,
-% any changes to the API and the grammar will be either backwards-compatible
-% or constitute a breaking change that will cause the major version of the
-% Markdown package to increment (to 4.0.0).
-%
-% The `finalize_grammar` field is a function that finalizes the grammar of
-% markdown using the interface of a Lua \luamref{reader} object, such as
-% the \luamref{reader->insert_pattern} and
-% \luamref{reader->add_special_character} methods,
-% see Section <#luauserextensions>.
-%
-% \end{markdown}
-% \iffalse
+ : 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{} Example {.unnumbered}
+ ~~~~~ 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}
+ ~~~~~~~~~~~
-Using a text editor, create a text document named `strike-through.lua` with the
-following content:
-``` lua
-local strike_through = {
- api_version = 2,
- grammar_version = 2,
- finalize_grammar = function(reader)
- local nonspacechar = lpeg.P(1) - lpeg.S("\t ")
- local doubleslashes = lpeg.P("//")
- local function between(p, starter, ender)
- ender = lpeg.B(nonspacechar) * ender
- return (starter * #nonspacechar
- * lpeg.Ct(p * (p - ender)^0) * ender)
- end
-
- local read_strike_through = between(
- lpeg.V("Inline"), doubleslashes, doubleslashes
- ) / function(s) return {"\\st{", s, "}"} end
-
- reader.insert_pattern("Inline after Emph", read_strike_through,
- "StrikeThrough")
- reader.add_special_character("/")
- end
-}
-
-return strike_through
-```````
-Using a text editor, create also a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage{soul}
-\usepackage[extension = strike-through.lua]{markdown}
-\begin{document}
-\begin{markdown}
-This is //a lunar roving vehicle// strike-through text.
-\end{markdown}
-\end{document}
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> This is ~~a lunar roving vehicle~~ strike-through text.
-
-%
-%<*tex>
-% \fi
-% \begin{macrocode}
-\cs_generate_variant:Nn
- \@@_add_lua_option:nnn
- { nnV }
-\@@_add_lua_option:nnV
- { extensions }
- { clist }
- \c_empty_clist
-% \end{macrocode}
-% \iffalse
-%
-%<*lua,lua-cli>
-% \fi
-% \begin{macrocode}
-defaultOptions.extensions = {}
-% \end{macrocode}
-% \par
-% \iffalse
-%
-%<*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
+: true
: When the \Opt{jekyllData} option is enabled, then a markdown document may
begin directly with \acro{yaml} metadata and may contain nothing but
@@ -4969,6 +4990,157 @@ defaultOptions.expectJekyllData = false
%
%<*manual-options>
+#### Option `extensions`
+
+`extensions` (default value: `{}`)
+
+% \fi
+% \begin{markdown}
+%
+% \Valitem[\{\}]{extensions}{filenames}
+%
+: The filenames of user-defined syntax extensions that will be applied to the
+ markdown reader. If the \pkg{kpathsea} library is available, files will be
+ searched for not only in the current working directory but also in the
+ \TeX{} directory structure.
+
+% A user-defined syntax extension is a Lua file in the following format:
+%
+% ``` lua
+% local strike_through = {
+% api_version = 2,
+% grammar_version = 2,
+% finalize_grammar = function(reader)
+% local nonspacechar = lpeg.P(1) - lpeg.S("\t ")
+% local doubleslashes = lpeg.P("//")
+% local function between(p, starter, ender)
+% ender = lpeg.B(nonspacechar) * ender
+% return (starter * #nonspacechar
+% * lpeg.Ct(p * (p - ender)^0) * ender)
+% end
+%
+% local read_strike_through = between(
+% lpeg.V("Inline"), doubleslashes, doubleslashes
+% ) / function(s) return {"\\st{", s, "}"} end
+%
+% reader.insert_pattern("Inline after Emph", read_strike_through,
+% "StrikeThrough")
+% reader.add_special_character("/")
+% end
+% }
+%
+% return strike_through
+% ```````
+%
+% The `api_version` and `grammar_version` fields specify the version of the
+% user-defined syntax extension API and the markdown grammar for which
+% the extension was written. See the current API and grammar versions
+% below:
+%
+% \end{markdown}
+% \iffalse
+%
+%<*lua>
+% \fi
+% \begin{macrocode}
+metadata.user_extension_api_version = 2
+metadata.grammar_version = 2
+% \end{macrocode}
+% \iffalse
+%
+%<*manual-options>
+% \fi
+% \begin{markdown}
+%
+% Any changes to the syntax extension API or grammar will cause the
+% corresponding current version to be incremented. After Markdown 3.0.0,
+% any changes to the API and the grammar will be either backwards-compatible
+% or constitute a breaking change that will cause the major version of the
+% Markdown package to increment (to 4.0.0).
+%
+% The `finalize_grammar` field is a function that finalizes the grammar of
+% markdown using the interface of a Lua \luamref{reader} object, such as
+% the \luamref{reader->insert_pattern} and
+% \luamref{reader->add_special_character} methods,
+% see Section <#luauserextensions>.
+%
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `strike-through.lua` with the
+following content:
+``` lua
+local strike_through = {
+ api_version = 2,
+ grammar_version = 2,
+ finalize_grammar = function(reader)
+ local nonspacechar = lpeg.P(1) - lpeg.S("\t ")
+ local doubleslashes = lpeg.P("//")
+ local function between(p, starter, ender)
+ ender = lpeg.B(nonspacechar) * ender
+ return (starter * #nonspacechar
+ * lpeg.Ct(p * (p - ender)^0) * ender)
+ end
+
+ local read_strike_through = between(
+ lpeg.V("Inline"), doubleslashes, doubleslashes
+ ) / function(s) return {"\\st{", s, "}"} end
+
+ reader.insert_pattern("Inline after Emph", read_strike_through,
+ "StrikeThrough")
+ reader.add_special_character("/")
+ end
+}
+
+return strike_through
+```````
+Using a text editor, create also a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{soul}
+\usepackage[extension = strike-through.lua]{markdown}
+\begin{document}
+\begin{markdown}
+This is //a lunar roving vehicle// strike-through text.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is ~~a lunar roving vehicle~~ strike-through text.
+
+%
+%<*tex>
+% \fi
+% \begin{macrocode}
+\cs_generate_variant:Nn
+ \@@_add_lua_option:nnn
+ { nnV }
+\@@_add_lua_option:nnV
+ { extensions }
+ { clist }
+ \c_empty_clist
+% \end{macrocode}
+% \iffalse
+%
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.extensions = {}
+% \end{macrocode}
+% \par
+% \iffalse
+%
+%<*manual-options>
+
#### Option `fancyLists`
`fancyLists` (default value: `false`)
@@ -5237,22 +5409,99 @@ defaultOptions.fencedCode = false
%
%<*manual-options>
-#### Option `finalizeCache`
+#### Option `fencedDivs`
-`finalizeCache` (default value: `false`)
+`fencedDivs` (default value: `false`)
% \fi
% \begin{markdown}
%
-% \Optitem[false]{finalizeCache}{\opt{true}, \opt{false}}
+% \Optitem[false]{fencedDivs}{\opt{true}, \opt{false}}
%
-: Whether an output file specified with the \Opt{frozenCacheFileName} option
- (frozen cache) that contains a mapping between an enumeration of markdown
- documents and their auxiliary cache files will be created.
+: true
- The frozen cache makes it possible to later typeset a plain \TeX{}
- document that contains markdown documents without invoking Lua using
- the \mref{markdownOptionFrozenCache} plain \TeX{} option. As a result, the
+ : Enable the Pandoc fenced divs extension:
+
+ ``` md
+ ::::: {#special .sidebar}
+ Here is a paragraph.
+
+ And another.
+ :::::
+ ``````
+
+: false
+
+ : Disable the Pandoc fenced divs extension:
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+```` tex
+\documentclass{article}
+\usepackage[fencedDivs]{markdown}
+\begin{document}
+\begin{markdown}{slice=special}
+Here is a regular paragraph.
+
+::::: {#special}
+Here is a special paragraph.
+:::::
+
+And here is another regular paragraph.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is a special paragraph.
+
+%
+%<*tex>
+% \fi
+% \begin{macrocode}
+\@@_add_lua_option:nnn
+ { fencedDivs }
+ { boolean }
+ { false }
+% \end{macrocode}
+% \iffalse
+%
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.fencedDivs = false
+% \end{macrocode}
+% \par
+% \iffalse
+%
+%<*manual-options>
+
+#### Option `finalizeCache`
+
+`finalizeCache` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{finalizeCache}{\opt{true}, \opt{false}}
+%
+: Whether an output file specified with the \Opt{frozenCacheFileName} option
+ (frozen cache) that contains a mapping between an enumeration of markdown
+ documents and their auxiliary cache files will be created.
+
+ The frozen cache makes it possible to later typeset a plain \TeX{}
+ document that contains markdown documents without invoking Lua using
+ the \Opt{frozenCache} plain \TeX{} option. As a result, the
plain \TeX{} document becomes more portable, but further changes in the
order and the content of markdown documents will not be reflected.
@@ -5401,186 +5650,6 @@ defaultOptions.finalizeCache = false
%
%<*manual-options>
-#### Option `notes`
-
-`notes` (default value: `false`)
-
-% \fi
-% \begin{markdown}
-%
-% \Optitem[false]{notes}{\opt{true}, \opt{false}}
-%
-: true
-
- : Enable the Pandoc note syntax extension:
-
- ``` md
- Here is a note reference,[^1] and another.[^longnote]
-
- [^1]: Here is the note.
-
- [^longnote]: Here's one with multiple blocks.
-
- Subsequent paragraphs are indented to show that they
- belong to the previous note.
-
- { some.code }
-
- The whole paragraph can be indented, or just the
- first line. In this way, multi-paragraph notes
- work like multi-paragraph list items.
-
- This paragraph won't be part of the note, because it
- isn't indented.
- ``````
-
-: false
-
- : Disable the Pandoc note syntax extension.
-
-% \end{markdown}
-% \iffalse
-
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage[notes]{markdown}
-\begin{document}
-\begin{markdown}
-Here is a note reference,[^1] and another.[^longnote]
-
-[^1]: Here is the note.
-
-[^longnote]: Here's one with multiple blocks.
-
- Subsequent paragraphs are indented to show that they
-belong to the previous note.
-
- { some.code }
-
- The whole paragraph can be indented, or just the
- first line. In this way, multi-paragraph notes
- work like multi-paragraph list items.
-
-This paragraph won't be part of the note, because it
-isn't indented.
-\end{markdown}
-\end{document}
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> Here is a note reference,[^1] and another.[^longnote]
->
-> [^1]: Here is the note.
->
-> [^longnote]: Here's one with multiple blocks.
->
-> Subsequent paragraphs are indented to show that they
-> belong to the previous note.
->
-> { some.code }
->
-> The whole paragraph can be indented, or just the
-> first line. In this way, multi-paragraph notes
-> work like multi-paragraph list items.
->
-> This paragraph won't be part of the note, because it
-> isn't indented.
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown[notes = yes]
-\starttext
-\startmarkdown
-Here is a note reference,[^1] and another.[^longnote]
-
-[^1]: Here is the note.
-
-[^longnote]: Here's one with multiple blocks.
-
- Subsequent paragraphs are indented to show that they
-belong to the previous note.
-
- { some.code }
-
- The whole paragraph can be indented, or just the
- first line. In this way, multi-paragraph notes
- work like multi-paragraph list items.
-
-This paragraph won't be part of the note, because it
-isn't indented.
-\stopmarkdown
-\stoptext
-````````
-Next, invoke LuaTeX from the terminal:
-``` sh
-context document.tex
-`````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> Here is a note reference,[^1] and another.[^longnote]
->
-> [^1]: Here is the note.
->
-> [^longnote]: Here's one with multiple blocks.
->
-> Subsequent paragraphs are indented to show that they
-> belong to the previous note.
->
-> { some.code }
->
-> The whole paragraph can be indented, or just the
-> first line. In this way, multi-paragraph notes
-> work like multi-paragraph list items.
->
-> This paragraph won't be part of the note, because it
-> isn't indented.
-
-%
-%<*tex>
-% \fi
-% \begin{markdown}
-%
-% The footnotes option has been deprecated and will be removed in
-% Markdown 3.0.0.
-%
-% \end{markdown}
-% \begin{macrocode}
-\@@_add_lua_option:nnn
- { footnotes }
- { boolean }
- { false }
-\@@_add_lua_option:nnn
- { notes }
- { boolean }
- { false }
-% \end{macrocode}
-% \iffalse
-%
-%<*lua,lua-cli>
-% \fi
-% \begin{macrocode}
-defaultOptions.footnotes = false
-defaultOptions.notes = false
-% \end{macrocode}
-% \par
-% \iffalse
-%
-%<*manual-options>
-
#### Option `frozenCacheCounter`
`frozenCacheCounter` (default value: `0`)
@@ -5883,12 +5952,6 @@ defaultOptions.hashEnumerators = false
===================
``````
- These HTML attributes have currently no effect other than enabling
-% content slicing, see the \Opt{slice} option.
-% \iffalse
- [content slicing](#slice).
-% \fi
-
: false
: Disable the assignment of HTML attributes to headings.
@@ -6663,18 +6726,198 @@ defaultOptions.jekyllData = false
%
%<*manual-options>
-#### Option `pipeTables` {#pipe-tables}
+#### Option `notes`
-`pipeTables` (default value: `false`)
+`notes` (default value: `false`)
% \fi
% \begin{markdown}
%
-% \Optitem[false]{pipeTables}{\opt{true}, \opt{false}}
+% \Optitem[false]{notes}{\opt{true}, \opt{false}}
%
: true
- : Enable the \acro{PHP} Markdown pipe table syntax extension:
+ : Enable the Pandoc note syntax extension:
+
+ ``` md
+ Here is a note reference,[^1] and another.[^longnote]
+
+ [^1]: Here is the note.
+
+ [^longnote]: Here's one with multiple blocks.
+
+ Subsequent paragraphs are indented to show that they
+ belong to the previous note.
+
+ { some.code }
+
+ The whole paragraph can be indented, or just the
+ first line. In this way, multi-paragraph notes
+ work like multi-paragraph list items.
+
+ This paragraph won't be part of the note, because it
+ isn't indented.
+ ``````
+
+: false
+
+ : Disable the Pandoc note syntax extension.
+
+% \end{markdown}
+% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[notes]{markdown}
+\begin{document}
+\begin{markdown}
+Here is a note reference,[^1] and another.[^longnote]
+
+[^1]: Here is the note.
+
+[^longnote]: Here's one with multiple blocks.
+
+ Subsequent paragraphs are indented to show that they
+belong to the previous note.
+
+ { some.code }
+
+ The whole paragraph can be indented, or just the
+ first line. In this way, multi-paragraph notes
+ work like multi-paragraph list items.
+
+This paragraph won't be part of the note, because it
+isn't indented.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is a note reference,[^1] and another.[^longnote]
+>
+> [^1]: Here is the note.
+>
+> [^longnote]: Here's one with multiple blocks.
+>
+> Subsequent paragraphs are indented to show that they
+> belong to the previous note.
+>
+> { some.code }
+>
+> The whole paragraph can be indented, or just the
+> first line. In this way, multi-paragraph notes
+> work like multi-paragraph list items.
+>
+> This paragraph won't be part of the note, because it
+> isn't indented.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\setupmarkdown[notes = yes]
+\starttext
+\startmarkdown
+Here is a note reference,[^1] and another.[^longnote]
+
+[^1]: Here is the note.
+
+[^longnote]: Here's one with multiple blocks.
+
+ Subsequent paragraphs are indented to show that they
+belong to the previous note.
+
+ { some.code }
+
+ The whole paragraph can be indented, or just the
+ first line. In this way, multi-paragraph notes
+ work like multi-paragraph list items.
+
+This paragraph won't be part of the note, because it
+isn't indented.
+\stopmarkdown
+\stoptext
+````````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+`````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Here is a note reference,[^1] and another.[^longnote]
+>
+> [^1]: Here is the note.
+>
+> [^longnote]: Here's one with multiple blocks.
+>
+> Subsequent paragraphs are indented to show that they
+> belong to the previous note.
+>
+> { some.code }
+>
+> The whole paragraph can be indented, or just the
+> first line. In this way, multi-paragraph notes
+> work like multi-paragraph list items.
+>
+> This paragraph won't be part of the note, because it
+> isn't indented.
+
+%
+%<*tex>
+% \fi
+% \begin{markdown}
+%
+% The footnotes option has been deprecated and will be removed in
+% Markdown 3.0.0.
+%
+% \end{markdown}
+% \begin{macrocode}
+\@@_add_lua_option:nnn
+ { footnotes }
+ { boolean }
+ { false }
+\@@_add_lua_option:nnn
+ { notes }
+ { boolean }
+ { false }
+% \end{macrocode}
+% \iffalse
+%
+%<*lua,lua-cli>
+% \fi
+% \begin{macrocode}
+defaultOptions.footnotes = false
+defaultOptions.notes = false
+% \end{macrocode}
+% \par
+% \iffalse
+%
+%<*manual-options>
+
+#### Option `pipeTables` {#pipe-tables}
+
+`pipeTables` (default value: `false`)
+
+% \fi
+% \begin{markdown}
+%
+% \Optitem[false]{pipeTables}{\opt{true}, \opt{false}}
+%
+: true
+
+ : Enable the \acro{PHP} Markdown pipe table syntax extension:
``` md
| Right | Left | Default | Center |
@@ -7132,7 +7375,7 @@ defaultOptions.shiftHeadings = 0
%
%<*manual-options>
-#### Option `slice` {#slice}
+#### Option `slice`
`slice` (default value: `^ $`)
@@ -9042,7 +9285,7 @@ pdftex --shell-escape document.tex
% \input markdown
% ```````
% \noindent It is expected that the special plain \TeX{} characters have the
-% expected category codes, when \mref{input}ting the file.
+% expected category codes, when `\input`ting the file.
%
%### Typesetting Markdown {#textypesetting}
%
@@ -9208,7 +9451,7 @@ following code in your plain \TeX{} document:
%#### Finalizing and Freezing the Cache
% The \mdef{markdownOptionFinalizeCache} option corresponds to the Lua
% interface \Opt{finalizeCache} option, which creates an output file
-% \mref{markdownOptionFrozenCacheFileName} (frozen cache) that contains a mapping
+% \Opt{frozenCacheFileName} (frozen cache) that contains a mapping
% between an enumeration of the markdown documents in the plain \TeX{} document
% and their auxiliary files cached in the \Opt{cacheDir} directory.
%
@@ -9221,7 +9464,7 @@ following code in your plain \TeX{} document:
% \fi
%
The \mdef{markdownOptionFrozenCache} option uses the mapping previously
-% created by the \mref{markdownOptionFinalizeCache} option,
+% created by the \Opt{finalizeCache} option,
% \iffalse
created by the Lua interface \Opt{finalizeCache} option,
% \fi
@@ -9255,12 +9498,12 @@ options is as follows:
1. Remove the \Opt{cacheDir} cache directory with stale auxiliary cache
files.
-% 2. Enable the \mref{markdownOptionFinalizeCache} option.
+% 2. Enable the \Opt{finalizeCache} option.
% \iffalse
2. Enable the \Opt{finalizeCache} option.
% \fi
3. Typeset the plain \TeX{} document to populate and finalize the cache.
-4. Enable the \mref{markdownOptionFrozenCache} option.
+4. Enable the \Opt{frozenCache} option.
5. Publish the source code of the plain \TeX{} document and the
\Opt{cacheDir} directory.
@@ -9279,13 +9522,13 @@ For more information, see the examples for the \Opt{finalizeCache} option.
%
% The \mdef{markdownOptionHelperScriptFileName} macro sets the filename of the
% helper Lua script file that is created during the conversion from markdown to
-% plain \TeX{} in \TeX{} engines without the \mref{directlua} primitive. It
-% defaults to \mref{jobname}`.markdown.lua`, where \mref{jobname} is the base name
+% plain \TeX{} in \TeX{} engines without the `\directlua` primitive. It
+% defaults to `\jobname.markdown.lua`, where `\jobname` is the base name
% of the document being typeset.
%
% The expansion of this macro must not contain quotation marks (`"`) or
% backslash symbols (`\`). Mind that \TeX{} engines tend to
-% put quotation marks around \mref{jobname}, when it contains spaces.
+% put quotation marks around `\jobname`, when it contains spaces.
%
% \end{markdown}
% \begin{macrocode}
@@ -9297,10 +9540,10 @@ For more information, see the examples for the \Opt{finalizeCache} option.
% \par
% \begin{markdown}
%
-% The \mref{markdownOptionHelperScriptFileName} macro has been deprecated and
+% The \Opt{helperScriptFileName} macro has been deprecated and
% will be removed in Markdown 3.0.0. To control the filename of the helper Lua
-% script file, use the \mref{g_luabridge_helper_script_filename_str} macro
-% from the \pkg{lt3luabridge} package.
+% script file, use the `\g_luabridge_helper_script_filename_str` macro from the
+% \pkg{lt3luabridge} package.
%
% \end{markdown}
% \begin{macrocode}
@@ -9314,8 +9557,8 @@ For more information, see the examples for the \Opt{finalizeCache} option.
%
% The \mdef{markdownOptionInputTempFileName} macro sets the filename of the
% temporary input file that is created during the buffering of markdown text
-% from a \TeX{} source. It defaults to \mref{jobname}`.markdown.in`. The same
-% limitations as in the case of the \mref{markdownOptionHelperScriptFileName}
+% from a \TeX{} source. It defaults to `\jobname.markdown.in`. The same
+% limitations as in the case of the \Opt{helperScriptFileName}
% macro apply here.
%
% \end{markdown}
@@ -9331,8 +9574,8 @@ For more information, see the examples for the \Opt{finalizeCache} option.
% The \mdef{markdownOptionOutputTempFileName} macro sets the filename of the
% temporary output file that is created during the conversion from markdown to
% plain \TeX{} in \mref{markdownMode} other than `2` It defaults to
-% \mref{jobname}`.markdown.out`. The same limitations apply here as in the case
-% of the \mref{markdownOptionHelperScriptFileName} macro.
+% `\jobname.markdown.out`. The same limitations apply here as in the case
+% of the \Opt{helperScriptFileName} macro.
%
% \end{markdown}
% \begin{macrocode}
@@ -9344,7 +9587,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
% \par
% \begin{markdown}
%
-% The \mref{markdownOptionOutputTempFileName} macro has been deprecated and
+% The \Opt{outputTempFileName} macro has been deprecated and
% will be removed in Markdown 3.0.0.
%
% \end{markdown}
@@ -9360,8 +9603,8 @@ For more information, see the examples for the \Opt{finalizeCache} option.
% The \mdef{markdownOptionErrorTempFileName} macro sets the filename of the
% temporary output file that is created when a Lua error is encountered during
% the conversion from markdown to plain \TeX{} in \mref{markdownMode} other than
-% `2`. It defaults to \mref{jobname}`.markdown.err`. The same limitations
-% apply here as in the case of the \mref{markdownOptionHelperScriptFileName}
+% `2`. It defaults to `\jobname.markdown.err`. The same limitations
+% apply here as in the case of the \Opt{helperScriptFileName}
% macro.
%
% \end{markdown}
@@ -9374,10 +9617,10 @@ For more information, see the examples for the \Opt{finalizeCache} option.
% \par
% \begin{markdown}
%
-% The \mref{markdownOptionErrorTempFileName} macro has been deprecated and
+% The \Opt{errorTempFileName} macro has been deprecated and
% will be removed in Markdown 3.0.0. To control the filename of the temporary
-% file for Lua errors, use the \mref{g_luabridge_error_output_filename_str}
-% macro from the \pkg{lt3luabridge} package.
+% file for Lua errors, use the `\g_luabridge_error_output_filename_str` macro
+% from the \pkg{lt3luabridge} package.
%
% \end{markdown}
% \begin{macrocode}
@@ -9398,7 +9641,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
% your \TeX{} engine for the package to function correctly. We need this macro
% to make the Lua implementation aware where it should store the helper files.
% The same limitations apply here as in the case of the
-% \mref{markdownOptionHelperScriptFileName} macro.
+% \Opt{helperScriptFileName} macro.
%
% \end{markdown}
% \begin{macrocode}
@@ -9419,7 +9662,7 @@ For more information, see the examples for the \Opt{finalizeCache} option.
%
% For the macros that correspond to the non-boolean options recognized by the
% Lua interface, the same limitations apply here in the case of the
-% \mref{markdownOptionHelperScriptFileName} macro.
+% \Opt{helperScriptFileName} macro.
%
% \end{markdown}
% \begin{macrocode}
@@ -9690,19 +9933,34 @@ In this section, I will describe the individual token renderers.
\prop_new:N \g_@@_renderer_arities_prop
\ExplSyntaxOff
% \end{macrocode}
+% \par
+%
% \iffalse
%
%<*manual-tokens>
% \fi
+%
% \begin{markdown}
-#### Tickbox Renderers
-The macros named \mdef{markdownRendererTickedBox},
-\mdef{markdownRendererHalfTickedBox}, and \mdef{markdownRendererUntickedBox}
-represent ticked and unticked boxes, respectively. These macros will either be
-produced, when the \Opt{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.
+#### Attribute Renderers
+The following macros are only produced, when the \Opt{headerAttributes} option
+is enabled.
+
+\mdef{markdownRendererAttributeIdentifier} represents the \meta{identifier} of
+a markdown element (`id="`\meta{identifier}`"` in HTML and `#`\meta{identifier}
+in Markdown's \Opt{headerAttributes} syntax extension). The macro receives a
+single attribute that corresponds to the \meta{identifier}.
+
+\mdef{markdownRendererAttributeClassName} represents the \meta{class name} of a
+markdown element (`class="`\meta{class name} ...`"` in HTML and
+`.`\meta{class name} in Markdown's \Opt{headerAttributes} syntax extension).
+The macro receives a single attribute that corresponds to the \meta{class
+name}.
+
+\mdef{markdownRendererAttributeKeyValue} represents a HTML attribute in the form
+\meta{key}`=`\meta{value} that is neither an identifier nor a class name.
+The macro receives two attributes that correspond to the \meta{key} and the
+\meta{value}, respectively.
% \end{markdown}
%
@@ -9714,17 +9972,35 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[taskLists]{markdown}
+\usepackage[headerAttributes, underscores=false]{markdown}
\markdownSetup{
renderers = {
- untickedBox = No,
- tickedBox = Yes,
+ 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}
-- [ ] you can't.
-- [x] I can!
+
+# First top-level heading {jane=doe}
+
+## A subheading {#identifier}
+
+# Second top-level heading {.class_name}
+
\end{markdown}
\end{document}
```````
@@ -9735,72 +10011,55 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> - No you can't.
-> - Yes I can!
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown[taskLists = yes]
-\def\markdownRendererUntickedBox{No}
-\def\markdownRendererTickedBox{Yes}
-\starttext
-\startmarkdown
-- [ ] you can't.
-- [x] I can!
-\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:
-
-> - No you can't.
-> - Yes I can!
+> # First top-level heading
+>
+> *(Key: Jane, Value: Doe)*
+>
+> ## A subheading
+>
+> *(Identifier: identifier)*
+>
+> # Second top-level heading
+>
+> *(Class name: class\_name)*
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererTickedBox{%
- \markdownRendererTickedBoxPrototype}%
+\def\markdownRendererAttributeIdentifier{%
+ \markdownRendererAttributeIdentifierPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { tickedBox }
+ { attributeIdentifier }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { tickedBox }
- { 0 }
+ { attributeIdentifier }
+ { 1 }
\ExplSyntaxOff
-\def\markdownRendererHalfTickedBox{%
- \markdownRendererHalfTickedBoxPrototype}%
+\def\markdownRendererAttributeClassName{%
+ \markdownRendererAttributeClassNamePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { halfTickedBox }
+ { attributeClassName }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { halfTickedBox }
- { 0 }
+ { attributeClassName }
+ { 1 }
\ExplSyntaxOff
-\def\markdownRendererUntickedBox{%
- \markdownRendererUntickedBoxPrototype}%
+\def\markdownRendererAttributeKeyValue{%
+ \markdownRendererAttributeKeyValuePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { untickedBox }
+ { attributeKeyValue }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { untickedBox }
- { 0 }
+ { attributeKeyValue }
+ { 2 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -9812,147 +10071,27 @@ following text:
%
% \begin{markdown}
-#### Markdown Document Renderers
-The \mdef{markdownRendererDocumentBegin} and \mdef{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.
+#### Block Quote Renderers
+The \mdef{markdownRendererBlockQuoteBegin} macro represents the beginning of
+a block quote. The macro receives no arguments.
% \end{markdown}
%
% \iffalse
-
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `nested.md` with the
-following content:
-``` md
-This is a *nested* markdown document.
-```
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\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:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> *(The beginning of a document)*
->
-> Hello *world*!
->
-> *(The beginning of a nested document)*
->
-> This is a *nested* markdown document.
->
-> *(The end of a nested document)*
->
-> _Foo_ bar!
->
-> *(The end of a document)*
->
-> *(The beginning of a document)*
->
-> Bar baz!
->
-> *(The end of a document)*
-
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererDocumentBegin{%
- \markdownRendererDocumentBeginPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { documentBegin }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { documentBegin }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererDocumentEnd{%
- \markdownRendererDocumentEndPrototype}%
+\def\markdownRendererBlockQuoteBegin{%
+ \markdownRendererBlockQuoteBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { documentEnd }
+ { blockQuoteBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { documentEnd }
+ { blockQuoteBegin }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -9965,9 +10104,8 @@ following text:
%
% \begin{markdown}
-#### Interblock Separator Renderer
-The \mdef{markdownRendererInterblockSeparator} macro represents a separator
-between two markdown block elements. The macro receives no arguments.
+The \mdef{markdownRendererBlockQuoteEnd} macro represents the end of a block
+quote. The macro receives no arguments.
% \end{markdown}
%
@@ -9979,15 +10117,24 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
-\def\markdownRendererInterblockSeparator{%
- \par
- {\it(The end of a block)}%
+\def\markdownRendererBlockQuoteBegin{%
+ \begingroup
+ \vskip\parindent
+ \leftskip=2\parindent
+ \parindent=0pt
+}
+\def\markdownRendererBlockQuoteEnd{%
\par
+ \vskip\parindent
+ \endgroup
}
\markdownBegin
-Hello *world*!
+A quote from William Shakespeare's King Lear:
-_Foo_ bar!
+> 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
```````
@@ -9998,11 +10145,12 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Hello *world*!
+> A quote from William Shakespeare's King Lear:
>
-> *(The end of a block)*
->
-> _Foo_ bar!
+> > This is the excellent foppery of the world that when we are
+> > sick in fortune—often the surfeit of our own behavior—we
+> > make guilty of our disasters the sun, the moon, and the
+> > stars [...]
##### \LaTeX{} Example {.unnumbered}
@@ -10013,18 +10161,18 @@ following content:
\usepackage{markdown}
\markdownSetup{
renderers = {
- interblockSeparator = {%
- \par
- \emph{(The end of a block)}%
- \par
- },
+ blockQuoteBegin = {\begin{quote}},
+ blockQuoteEnd = {\end{quote}},
},
}
\begin{document}
\begin{markdown}
-Hello *world*!
+A quote from William Shakespeare's King Lear:
-_Foo_ bar!
+> 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}
```````
@@ -10035,11 +10183,12 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Hello *world*!
+> A quote from William Shakespeare's King Lear:
>
-> *(The end of a block)*
->
-> _Foo_ bar!
+> > This is the excellent foppery of the world that when we are
+> > sick in fortune—often the surfeit of our own behavior—we
+> > make guilty of our disasters the sun, the moon, and the
+> > stars [...]
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -10047,16 +10196,16 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\def\markdownRendererInterblockSeparator{%
- \par
- \emph{(The end of a block)}%
- \par
-}
+\def\markdownRendererBlockQuoteBegin{\startquotation}
+\def\markdownRendererBlockQuoteEnd{\stopquotation}
\starttext
\startmarkdown
-Hello *world*!
+A quote from William Shakespeare's King Lear:
-_Foo_ bar!
+> 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
```````
@@ -10067,26 +10216,27 @@ context document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Hello *world*!
+> A quote from William Shakespeare's King Lear:
>
-> *(The end of a block)*
->
-> _Foo_ bar!
+> > 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 [...]
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererInterblockSeparator{%
- \markdownRendererInterblockSeparatorPrototype}%
+\def\markdownRendererBlockQuoteEnd{%
+ \markdownRendererBlockQuoteEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { interblockSeparator }
+ { blockQuoteEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { interblockSeparator }
+ { blockQuoteEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -10099,140 +10249,74 @@ following text:
%
% \begin{markdown}
-#### Line Break Renderer
-The \mdef{markdownRendererLineBreak} macro represents a forced line break.
-The macro receives no arguments.
+#### Bracketed Spans Context Renderers
+The following macros are only produced, when the \Opt{bracketedSpans} option is
+enabled.
+
+The \mdef{markdownRendererBracketedSpanAttributeContextBegin} and
+\mdef{markdownRendererBracketedSpanAttributeContextEnd} macros represent the
+beginning and the end of an inline bracketed span in which the attributes of
+the span apply. The macros receive no arguments.
% \end{markdown}
%
% \iffalse
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownRendererLineBreak{%
- \par
- {\it(A forced linebreak)}%
- \par
-}
-\markdownInput{example.md}
-\bye
-```````
-Using a text editor, create a text document named `example.md` with the
-following content. Note the two spaces at the end of the first line, which
-specify a hard linebreak. Due to the limitations of the \TeX{} input
-processor, hard linebreaks would be ignored if we typed them directly into the
-`document.tex` document.
-
-
Hello world! _Foo_ bar!
-
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> Hello *world*!
->
-> *(A forced linebreak)*
->
-> _Foo_ bar!
-
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage{markdown}
+\usepackage[bracketedSpans]{markdown}
\markdownSetup{
renderers = {
- lineBreak = {%
- \par
- \emph{(A forced linebreak)}%
- \par
- },
+ fencedDivAttributeContextBegin = {(},
+ fencedDivAttributeContextEnd = {)},
},
}
\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:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> Hello *world*!
->
-> *(A forced linebreak)*
->
-> _Foo_ bar!
+\begin{markdown}
-##### \Hologo{ConTeXt} Example {.unnumbered}
+[foo [bar]{#identifier}]{key=value} [baz]{.class_name}
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\def\markdownRendererLineBreak{%
- \par
- \emph{(A forced linebreak)}%
- \par
-}
-\starttext
-\markdownInput{example.md}
-\stoptext
+\end{markdown}
+\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:
``` sh
-luatex document.tex
+lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Hello *world*!
->
-> *(A forced linebreak)*
->
-> _Foo_ bar!
+> (foo (bar)) (baz)
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererLineBreak{%
- \markdownRendererLineBreakPrototype}%
+\def\markdownRendererBracketedSpanAttributeContextBegin{%
+ \markdownRendererBracketedSpanAttributeContextBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { lineBreak }
+ { bracketedSpanAttributeContextBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { lineBreak }
+ { bracketedSpanAttributeContextBegin }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererBracketedSpanAttributeContextEnd{%
+ \markdownRendererBracketedSpanAttributeContextEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { bracketedSpanAttributeContextEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { bracketedSpanAttributeContextEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -10245,105 +10329,28 @@ following text:
%
% \begin{markdown}
-#### Ellipsis Renderer
-The \mdef{markdownRendererEllipsis} macro replaces any occurance of ASCII
-ellipses in the input text. This macro will only be produced, when the
-\Opt{smartEllipses} option is enabled. The macro receives no arguments.
+#### Bullet List Renderers
+The \mdef{markdownRendererUlBegin} macro represents the beginning of a
+bulleted list that contains an item with several paragraphs of text (the
+list is not tight). The macro receives no arguments.
% \end{markdown}
%
% \iffalse
-
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownOptionSmartEllipses{true}
-\def\markdownRendererEllipsis{{\it SHAZAM}!}
-\markdownBegin
-The secret word is ...
-\markdownEnd
-\bye
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> The secret word is *SHAZAM*!
-
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage[smartEllipses]{markdown}
-\markdownSetup{
- renderers = {
- ellipsis = \emph{SHAZAM}!,
- },
-}
-\begin{document}
-\begin{markdown}
-The secret word is ...
-\end{markdown}
-\end{document}
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> The secret word is *SHAZAM*!
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown[smartEllipses = yes]
-\def\markdownRendererEllipsis{\emph{SHAZAM}!}
-\starttext
-\startmarkdown
-The secret word is ...
-\stopmarkdown
-\stoptext
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-context document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> Hello *world*!
->
-> *(The end of a block)*
->
-> _Foo_ bar!
-
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererEllipsis{%
- \markdownRendererEllipsisPrototype}%
+\def\markdownRendererUlBegin{%
+ \markdownRendererUlBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ellipsis }
+ { ulBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ellipsis }
+ { ulBegin }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -10356,79 +10363,60 @@ following text:
%
% \begin{markdown}
-#### Non-Breaking Space Renderer
-The \mdef{markdownRendererNbsp} macro represents a non-breaking space.
+The \mdef{markdownRendererUlBeginTight} macro represents the beginning of a
+bulleted list that contains no item with several paragraphs of text (the list
+is tight). This macro will only be produced, when the \Opt{tightLists} option
+is disabled. The macro receives no arguments.
% \end{markdown}
%
% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlBeginTight{%
+ \markdownRendererUlBeginTightPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { ulBeginTight }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { ulBeginTight }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.bib` with the
-following content:
-``` bib
-@book{knuth:tex,
- author = "Knuth, Donald Ervin",
- title = "The \TeX book, volume A of Computers and typesetting",
- publisher = "Addison-Wesley",
- year = "1984"
-}
-```````
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage[
- citations,
- citationNbsps,
-]{markdown}
-\markdownSetup{
- renderers = {
- nbsp = {$\cdot$},
- },
-}
-\begin{document}
-
-\begin{markdown}
-The TeXbook [@knuth:tex, p. 123 and 130] is good.
-\end{markdown}
-
-\bibliographystyle{plain}
-\bibliography{document.bib}
-
-\end{document}
-```````
-Next, invoke LuaTeX and BibTeX from the terminal:
-``` sh
-lualatex document.tex
-bibtex document.aux
-lualatex document.tex
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> The TeXbook [1, p.·123·and·130] is good.
->
-> ### References
-> [1] Donald Ervin Knuth. _The TeXbook, volume A of Computers and typesetting._
-> Addison-Wesley, 1984.
+The \mdef{markdownRendererUlItem} macro represents an item in a bulleted
+list. The macro receives no arguments.
+% \end{markdown}
+%
+% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererNbsp{%
- \markdownRendererNbspPrototype}%
+\def\markdownRendererUlItem{%
+ \markdownRendererUlItemPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { nbsp }
+ { ulItem }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { nbsp }
+ { ulItem }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -10441,27 +10429,75 @@ following text:
%
% \begin{markdown}
-#### Special Character Renderers
-The following macros replace any special plain \TeX{} characters, including
+The \mdef{markdownRendererUlItemEnd} macro represents the end of an item in a
+bulleted list. The macro receives no arguments.
+
+% \end{markdown}
+%
% \iffalse
-the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text:
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererUlItemEnd{%
+ \markdownRendererUlItemEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { ulItemEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { ulItemEnd }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-- \mdef{markdownRendererAmpersand} replaces the ampersand (`&`).
-- \mdef{markdownRendererBackslash} replaces the backslash (`\`).
-- \mdef{markdownRendererCircumflex} replaces the circumflex (`^`).
-- \mdef{markdownRendererDollarSign} replaces the dollar sign (`$`).
-- \mdef{markdownRendererHash} replaces the hash sign (`#`).
-- \mdef{markdownRendererLeftBrace} replaces the left brace (`{`).
-- \mdef{markdownRendererPercentSign} replaces the percent sign (`%`).
-- \mdef{markdownRendererPipe} replaces the pipe character (`|`).
-- \mdef{markdownRendererRightBrace} replaces the right brace (`}`).
-- \mdef{markdownRendererTilde} replaces the tilde (`~`).
-- \mdef{markdownRendererUnderscore} replaces the underscore (`_`).
+The \mdef{markdownRendererUlEnd} macro represents the end of a bulleted list
+that contains an item with several paragraphs of text (the list is not
+tight). The macro receives no arguments.
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
% \fi
-% the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text.
-% These macros will only be produced, when the \Opt{hybrid} option is
-% `false`.
+%
+% \begin{macrocode}
+\def\markdownRendererUlEnd{%
+ \markdownRendererUlEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { ulEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { ulEnd }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererUlEndTight} macro represents the end of a bulleted
+list that contains no item with several paragraphs of text (the list is
+tight). This macro will only be produced, when the \Opt{tightLists} option is
+disabled. The macro receives no arguments.
% \end{markdown}
%
@@ -10470,14 +10506,49 @@ the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text:
##### Plain \TeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
-following content. We will make the tilde behave as if it were written in
-\TeX{}, where it represents a non-breaking space.
+following content:
``` tex
\input markdown
-\def\markdownRendererTilde{~}
+\def\markdownOptionTightLists{true}
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererUlBeginTight{ (}
+\def\markdownRendererUlItem{%
+ \def\markdownRendererUlItem{%
+ ,
+ \def\markdownRendererUlItem{, and }%
+ }%
+}
+\def\markdownRendererUlItemEnd{}
+\def\markdownRendererUlEndTight{).}
+
\markdownBegin
-Bartel~Leendert van~der~Waerden
+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:
@@ -10485,27 +10556,69 @@ 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:
+following text:
-> Bartel·Leendert van·der·Waerden
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> - This is the first item.
+>
+> - This is the second item.
+>
+> - This is the third item.
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
-following content. We will make the tilde behave as if it were written in
-\TeX{}, where it represents a non-breaking space.
+following content:
``` tex
\documentclass{article}
-\usepackage{markdown}
-\markdownSetup{
+\usepackage[tightLists]{markdown}
+\begin{document}
+
+\begin{markdown*}{
renderers = {
- tilde = ~,
- },
+ interblockSeparator = {},
+ ulBeginTight = { (},
+ ulItem = {%
+ \def\markdownRendererUlItem{%
+ ,
+ \def\markdownRendererUlItem{, and }%
+ }%
+ },
+ ulItemEnd = {},
+ ulEndTight = {).},
+ },
}
-\begin{document}
-\begin{markdown}
-Bartel~Leendert van~der~Waerden
-\end{markdown}
+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:
@@ -10513,22 +10626,65 @@ 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
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
+following text:
+
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> - This is the first item.
+>
+> - This is the second item.
+>
+> - This is the third item.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
-following content. We will make the tilde behave as if it were written in
-\TeX{}, where it represents a non-breaking space.
+following content:
``` tex
\usemodule[t][markdown]
-\def\markdownRendererTilde{~}
+\setupmarkdown[tightLists = yes]
\starttext
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererUlBeginTight{ (}
+\def\markdownRendererUlItem{%
+ \def\markdownRendererUlItem{%
+ ,
+ \def\markdownRendererUlItem{, and }%
+ }%
+}
+\def\markdownRendererUlItemEnd{}
+\def\markdownRendererUlEndTight{).}
+
\startmarkdown
-Bartel~Leendert van~der~Waerden
+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:
@@ -10536,135 +10692,67 @@ 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:
+following text:
-> Bartel·Leendert van·der·Waerden
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> - This is the first item.
+>
+> - This is the second item.
+>
+> - This is the third item.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererLeftBrace{%
- \markdownRendererLeftBracePrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { leftBrace }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { leftBrace }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererRightBrace{%
- \markdownRendererRightBracePrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { rightBrace }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { rightBrace }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererDollarSign{%
- \markdownRendererDollarSignPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { dollarSign }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { dollarSign }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererPercentSign{%
- \markdownRendererPercentSignPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { percentSign }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { percentSign }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererAmpersand{%
- \markdownRendererAmpersandPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { ampersand }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { ampersand }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererUnderscore{%
- \markdownRendererUnderscorePrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { underscore }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { underscore }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererHash{%
- \markdownRendererHashPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { hash }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { hash }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererCircumflex{%
- \markdownRendererCircumflexPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { circumflex }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { circumflex }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererBackslash{%
- \markdownRendererBackslashPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { backslash }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { backslash }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererTilde{%
- \markdownRendererTildePrototype}%
+\def\markdownRendererUlEndTight{%
+ \markdownRendererUlEndTightPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { tilde }
+ { ulEndTight }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { tilde }
+ { ulEndTight }
{ 0 }
\ExplSyntaxOff
-\def\markdownRendererPipe{%
- \markdownRendererPipePrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+#### Code Block Renderers
+The \mdef{markdownRendererInputVerbatim} macro represents a code
+block. The macro receives a single argument that corresponds to the
+filename of a file contaning the code block contents.
+
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererInputVerbatim{%
+ \markdownRendererInputVerbatimPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { pipe }
+ { inputVerbatim }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { pipe }
- { 0 }
+ { inputVerbatim }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -10676,75 +10764,65 @@ following text, where the middot (`·`) denotes a non-breaking space:
%
% \begin{markdown}
-#### Code Span Renderer
-The \mdef{markdownRendererCodeSpan} macro represents inline code span in the
-input text. It receives a single argument that corresponds to the inline
-code span.
+The \mdef{markdownRendererInputFencedCode} macro represents a fenced code
+block. This macro will only be produced, when the \Opt{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.
% \end{markdown}
%
% \iffalse
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\input lmfonts
-
-\def\markdownRendererCodeSpan#1{#1}
-
-\markdownBegin
-`$\sqrt{-1}$ *equals* $i$`
-
-$\sqrt{-1}$ *equals* $i$
-\markdownEnd
-
-\def\markdownOptionHybrid{true}
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$
-\markdownEnd
-
-\bye
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> \$\\sqrt{-1}\$ \*equals\* \$i\$.
->
-> \$\\sqrt{-1}\$ *equals* \$i\$.
->
-> √-̅1̅ *equals* $i$.
-
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[smartEllipses]{markdown}
+\usepackage{verbatim}
+\usepackage[hyphens]{url}
+\usepackage[fencedCode]{markdown}
\markdownSetup{
renderers = {
- codeSpan = {#1},
+ 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}
-`$\sqrt{-1}$ *equals* $i$`
+The following code
-$\sqrt{-1}$ *equals* $i$
-\end{markdown}
+ 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])
-\begin{markdown*}{hybrid}
-$\sqrt{-1}$ *equals* $i$
-\end{markdown*}
+The following code
+~~~ Python
+>>> foo([4, 2, 1, 3])
+[1, 2, 3, 4]
+~~~~~~~~~~
+\end{markdown}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
@@ -10752,64 +10830,45 @@ Next, invoke LuaTeX from the terminal:
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> \$\\sqrt{-1}\$ \*equals\* \$i\$.
->
-> \$\\sqrt{-1}\$ *equals* \$i\$.
->
-> √-̅1̅ *equals* $i$.
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\def\markdownRendererCodeSpan#1{#1}
-\starttext
-
-\startmarkdown
-`$\sqrt{-1}$ *equals* $i$`
-
-$\sqrt{-1}$ *equals* $i$
-\stopmarkdown
-
-\setupmarkdown[hybrid = yes]
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$
-\stopmarkdown
-
-\bye
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-context document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
+following text except for the filename, which may differ:
-> \$\\sqrt{-1}\$ \*equals\* \$i\$.
->
-> \$\\sqrt{-1}\$ *equals* \$i\$.
->
-> √-̅1̅ *equals* $i$.
+> The following code is contained in file
+> `./_markdown_document/882453149edcf288976647f6fe147ada.verbatim`:
+> ``` py
+> def foo(bar):
+> if len(bar) <= 1:
+> return bar[:1]
+> elif len(bar) == 2:
+> return sorted(bar)
+> else:
+> baz = bar[len(bar) // 2]
+> return (
+> foo([qux for qux in bar if qux < baz]) + [baz] +
+> foo([qux for qux in bar if qux > baz])
+> )
+> ``````
+> The following code in Python contained in file
+> `./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim`:
+> ``` py
+> >>> foo([4, 2, 1, 3])
+> [1, 2, 3, 4]
+> ``````
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererCodeSpan{%
- \markdownRendererCodeSpanPrototype}%
+\def\markdownRendererInputFencedCode{%
+ \markdownRendererInputFencedCodePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { codeSpan }
+ { inputFencedCode }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { codeSpan }
- { 1 }
+ { inputFencedCode }
+ { 2 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -10818,14 +10877,12 @@ following text:
%
%<*manual-tokens>
% \fi
-%
% \begin{markdown}
-#### Link Renderer
-The \mdef{markdownRendererLink} macro represents a hyperlink. It receives
-four arguments: the label, the fully escaped \acro{uri} that can be directly
-typeset, the raw \acro{uri} that can be used outside typesetting, and the
-title of the link.
+#### Code Span Renderer
+The \mdef{markdownRendererCodeSpan} macro represents inline code span in the
+input text. It receives a single argument that corresponds to the inline
+code span.
% \end{markdown}
%
@@ -10837,15 +10894,21 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
-\def\markdownRendererLink#1#2#3#4{%
- #1 {\tt#2} titled {\it#4}%
-}
+\input lmfonts
+
+\def\markdownRendererCodeSpan#1{#1}
+
\markdownBegin
-Please visit [the link][ctan].
+`$\sqrt{-1}$ *equals* $i$`
- [ctan]: https://ctan.org/
- (the Comprehensive TeX Archive Network)
+$\sqrt{-1}$ *equals* $i$
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$
\markdownEnd
+
\bye
```````
Next, invoke LuaTeX from the terminal:
@@ -10855,8 +10918,11 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Please visit the link titled *the Comprehensive TeX
-> Archive Network*.
+> \$\\sqrt{-1}\$ \*equals\* \$i\$.
+>
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
##### \LaTeX{} Example {.unnumbered}
@@ -10864,21 +10930,24 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage{markdown}
+\usepackage[smartEllipses]{markdown}
\markdownSetup{
renderers = {
- link = {%
- #1 \texttt{#2} titled \emph{#4}%
- },
+ codeSpan = {#1},
},
}
\begin{document}
+
\begin{markdown}
-Please visit [the link][ctan].
+`$\sqrt{-1}$ *equals* $i$`
- [ctan]: https://ctan.org/
- (the Comprehensive TeX Archive Network)
+$\sqrt{-1}$ *equals* $i$
\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown*}
+
\end{document}
```````
Next, invoke LuaTeX from the terminal:
@@ -10888,8 +10957,11 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Please visit the link titled *the Comprehensive TeX
-> Archive Network*.
+> \$\\sqrt{-1}\$ \*equals\* \$i\$.
+>
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -10897,17 +10969,21 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\def\markdownRendererLink#1#2#3#4{%
- #1 {\tt#2} titled \emph{#4}%
-}
+\def\markdownRendererCodeSpan#1{#1}
\starttext
+
\startmarkdown
-Please visit [the link][ctan].
+`$\sqrt{-1}$ *equals* $i$`
- [ctan]: https://ctan.org/
- (the Comprehensive TeX Archive Network)
+$\sqrt{-1}$ *equals* $i$
\stopmarkdown
-\stoptext
+
+\setupmarkdown[hybrid = yes]
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$
+\stopmarkdown
+
+\bye
```````
Next, invoke LuaTeX from the terminal:
``` sh
@@ -10916,24 +10992,27 @@ context document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Please visit the link titled *the Comprehensive TeX
-> Archive Network*.
+> \$\\sqrt{-1}\$ \*equals\* \$i\$.
+>
+> \$\\sqrt{-1}\$ *equals* \$i\$.
+>
+> √-̅1̅ *equals* $i$.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererLink{%
- \markdownRendererLinkPrototype}%
+\def\markdownRendererCodeSpan{%
+ \markdownRendererCodeSpanPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { link }
+ { codeSpan }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { link }
- { 4 }
+ { codeSpan }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -10945,136 +11024,46 @@ following text:
%
% \begin{markdown}
-#### Image Renderer
-The \mdef{markdownRendererImage} macro represents an image. It receives
-four arguments: the label, the fully escaped \acro{uri} that can be directly
-typeset, the raw \acro{uri} that can be used outside typesetting, and the
-title of the link.
+#### Content Block Renderers {#texcontentblockrenderers}
+
+The \mdef{markdownRendererContentBlock} macro represents an iA\,Writer content
+block. It receives four arguments: the local file or online image filename
+extension cast to the lower case, the fully escaped \acro{uri} that can be
+directly typeset, the raw \acro{uri} that can be used outside typesetting,
+and the title of the content block.
% \end{markdown}
%
% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererContentBlock{%
+ \markdownRendererContentBlockPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { contentBlock }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { contentBlock }
+ { 4 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage{markdown}
-\begingroup
-\catcode`\@=11
-\catcode`\%=12
-\catcode`\^^A=14
-\global\def\markdownRendererImage#1#2#3#4{^^A
- \immediate\write18{^^A
-```
-``` sh
- 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
-```
-``` tex
- }^^A
- {^^A
- \everyeof={\noexpand}^^A
- \edef\filename{\@@input"\jobname.fetched" }^^A
- \includegraphics[width=\textwidth]{\filename}^^A
- }^^A
-}
-\endgroup
-\begin{document}
-\begin{markdown}
-![TUGboat](https://tug.org/tugboat/noword.jpg)
-\end{markdown}
-\end{document}
-``````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex --shell-escape document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following content. This assumes that you use a Unix-like operating system with
-Bourne or Bourne again shell as the default shell of the current user. It also
-assumes that the `md5sum`, `wget`, and `convert` binaries are installed and
-that the \TeX{} engine has shell access.
-
-> ![TUGboat](https://tug.org/tugboat/noword.jpg "The Communications of the TeX Users Group")
-
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererImage{%
- \markdownRendererImagePrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { image }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { image }
- { 4 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-#### Content Block Renderers {#texcontentblockrenderers}
-
-The \mdef{markdownRendererContentBlock} macro represents an iA\,Writer content
-block. It receives four arguments: the local file or online image filename
-extension cast to the lower case, the fully escaped \acro{uri} that can be
-directly typeset, the raw \acro{uri} that can be used outside typesetting,
-and the title of the content block.
-
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererContentBlock{%
- \markdownRendererContentBlockPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { contentBlock }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { contentBlock }
- { 4 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-The \mdef{markdownRendererContentBlockOnlineImage} macro represents an
-iA\,Writer online image content block. The macro receives the same arguments
-as \mref{markdownRendererContentBlock}.
+The \mdef{markdownRendererContentBlockOnlineImage} macro represents an
+iA\,Writer online image content block. The macro receives the same arguments
+as \mref{markdownRendererContentBlock}.
% \end{markdown}
%
@@ -11300,9 +11289,12 @@ following text:
%
% \begin{markdown}
-#### Bullet List Renderers
-The \mdef{markdownRendererUlBegin} macro represents the beginning of a
-bulleted list that contains an item with several paragraphs of text (the
+#### Definition List Renderers
+The following macros are only produced, when the \Opt{definitionLists} option
+is enabled.
+
+The \mdef{markdownRendererDlBegin} macro represents the beginning of a
+definition list that contains an item with several paragraphs of text (the
list is not tight). The macro receives no arguments.
% \end{markdown}
@@ -11313,15 +11305,15 @@ list is not tight). The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererUlBegin{%
- \markdownRendererUlBeginPrototype}%
+\def\markdownRendererDlBegin{%
+ \markdownRendererDlBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ulBegin }
+ { dlBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ulBegin }
+ { dlBegin }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11334,10 +11326,10 @@ list is not tight). The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererUlBeginTight} macro represents the beginning of a
-bulleted list that contains no item with several paragraphs of text (the list
-is tight). This macro will only be produced, when the \Opt{tightLists} option
-is disabled. The macro receives no arguments.
+The \mdef{markdownRendererDlBeginTight} macro represents the beginning of a
+definition list that contains an item with several paragraphs of text (the
+list is not tight). This macro will only be produced, when the
+\Opt{tightLists} option is disabled. The macro receives no arguments.
% \end{markdown}
%
@@ -11347,15 +11339,15 @@ is disabled. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererUlBeginTight{%
- \markdownRendererUlBeginTightPrototype}%
+\def\markdownRendererDlBeginTight{%
+ \markdownRendererDlBeginTightPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ulBeginTight }
+ { dlBeginTight }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ulBeginTight }
+ { dlBeginTight }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11368,8 +11360,9 @@ is disabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererUlItem} macro represents an item in a bulleted
-list. The macro receives no arguments.
+The \mdef{markdownRendererDlItem} macro represents a term in a definition
+list. The macro receives a single argument that corresponds to the term
+being defined.
% \end{markdown}
%
@@ -11379,15 +11372,47 @@ list. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererUlItem{%
- \markdownRendererUlItemPrototype}%
+\def\markdownRendererDlItem{%
+ \markdownRendererDlItemPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ulItem }
+ { dlItem }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ulItem }
+ { dlItem }
+ { 1 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlItemEnd} macro represents the end of a list of
+definitions for a single term.
+
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlItemEnd{%
+ \markdownRendererDlItemEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { dlItemEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { dlItemEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11400,8 +11425,9 @@ list. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererUlItemEnd} macro represents the end of an item in a
-bulleted list. The macro receives no arguments.
+The \mdef{markdownRendererDlDefinitionBegin} macro represents the beginning
+of a definition in a definition list. There can be several definitions for
+a single term.
% \end{markdown}
%
@@ -11411,15 +11437,15 @@ bulleted list. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererUlItemEnd{%
- \markdownRendererUlItemEndPrototype}%
+\def\markdownRendererDlDefinitionBegin{%
+ \markdownRendererDlDefinitionBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ulItemEnd }
+ { dlDefinitionBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ulItemEnd }
+ { dlDefinitionBegin }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11432,8 +11458,41 @@ bulleted list. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererUlEnd} macro represents the end of a bulleted list
-that contains an item with several paragraphs of text (the list is not
+The \mdef{markdownRendererDlDefinitionEnd} macro represents the end of a
+definition in a definition list. There can be several definitions for a
+single term.
+
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererDlDefinitionEnd{%
+ \markdownRendererDlDefinitionEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { dlDefinitionEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { dlDefinitionEnd }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererDlEnd} macro represents the end of a definition
+list that contains an item with several paragraphs of text (the list is not
tight). The macro receives no arguments.
% \end{markdown}
@@ -11444,15 +11503,15 @@ tight). The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererUlEnd{%
- \markdownRendererUlEndPrototype}%
+\def\markdownRendererDlEnd{%
+ \markdownRendererDlEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ulEnd }
+ { dlEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ulEnd }
+ { dlEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11465,10 +11524,10 @@ tight). The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererUlEndTight} macro represents the end of a bulleted
-list that contains no item with several paragraphs of text (the list is
-tight). This macro will only be produced, when the \Opt{tightLists} option is
-disabled. The macro receives no arguments.
+The \mdef{markdownRendererDlEndTight} macro represents the end of a
+definition list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the \Opt{tightLists}
+option is disabled. The macro receives no arguments.
% \end{markdown}
%
@@ -11480,44 +11539,80 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
+\def\markdownOptionDefinitionLists{true}
\def\markdownOptionTightLists{true}
-\def\markdownRendererInterblockSeparator{}
-\def\markdownRendererUlBeginTight{ (}
-\def\markdownRendererUlItem{%
- \def\markdownRendererUlItem{%
+\def\markdownRendererInterblockSeparator{%
+ :%
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererDlBeginTight{%
+ \begingroup
+ \parindent=0pt
+}
+\def\markdownRendererDlItem#1{%
+ \par{\bf#1}%
+ \def\markdownRendererDlDefinitionEnd{%
,
- \def\markdownRendererUlItem{, and }%
+ \def\markdownRendererDlDefinitionEnd{%
+ , and
+ \def\markdownRendererDlDefinitionEnd{.}%
+ }%
}%
}
-\def\markdownRendererUlItemEnd{}
-\def\markdownRendererUlEndTight{).}
+\def\markdownRendererDlItemEnd{}
+\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em}
+\def\markdownRendererDlEndTight{\endgroup}
\markdownBegin
-This is a tight list
+This is a tight definition list
-- the first item
-- the second item
-- the third item
+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{%
- :\par
\def\markdownRendererInterblockSeparator{\par}%
}
-\def\markdownRendererUlBegin{}
-\def\markdownRendererUlItem{--\kern 0.5em}
-\def\markdownRendererUlItemEnd{.\par}
-\def\markdownRendererUlEnd{}
+\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 list
+This is a loose definition list
-- This is the first item
+Coffee
-- This is the second item
+: black hot drink
-- This is the third item
+: 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
@@ -11529,15 +11624,24 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is a tight list (the first item, the second item, and the third item).
+> This is a tight definition list:
>
-> This is a loose list:
->
-> - This is the first item.
->
-> - This is the second item.
->
-> - This is the third item.
+> **Coffee**
+>
+> - black hot drink,
+> - prepared from roasted coffee beans, and
+> - one of the most traded agricultural commodities in the world.
+>
+> **Milk**
+>
+> - white cold drink,
+> - nutrient-rich, and
+> - produced on an industrial scale.
+>
+> This is a loose definition list. Coffee is a black hot drink, prepared from
+> roasted coffee beans, and one of the most traded agricultural commodities in
+> the world. Milk is a white cold drink, nutrient-rich, and produced on an
+> industrial scale.
##### \LaTeX{} Example {.unnumbered}
@@ -11545,49 +11649,82 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[tightLists]{markdown}
+\usepackage[definitionLists, tightLists]{markdown}
\begin{document}
\begin{markdown*}{
renderers = {
- interblockSeparator = {},
- ulBeginTight = { (},
- ulItem = {%
- \def\markdownRendererUlItem{%
+ interblockSeparator = {%
+ :%
+ \def\markdownRendererInterblockSeparator{\par}%
+ },
+ dlBeginTight = {\begin{description}},
+ dlItem = {%
+ \item[#1]
+ \begin{itemize}
+ \def\markdownRendererDlDefinitionEnd{%
,
- \def\markdownRendererUlItem{, and }%
+ \def\markdownRendererDlDefinitionEnd{%
+ , and
+ \def\markdownRendererDlDefinitionEnd{.}%
+ }%
}%
},
- ulItemEnd = {},
- ulEndTight = {).},
- },
+ dlItemEnd = {\end{itemize}},
+ dlDefinitionBegin = \item,
+ dlEndTight = {\end{description}},
+ },
}
-This is a tight list
+This is a tight definition list
-- the first item
-- the second item
-- the third item
+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 = {%
- :\par
\def\markdownRendererInterblockSeparator{\par}%
},
- ulBeginTight = {\begin{itemize}},
- ulItem = {\item},
- ulItemEnd = {.},
- ulEnd = {\end{itemize}},
- },
+ dlBegin = {},
+ dlItem = {%
+ . #1 is a
+ \def\markdownRendererDlDefinitionBegin{%
+ \def\markdownRendererDlDefinitionBegin{%
+ ,
+ \def\markdownRendererDlDefinitionBegin{, and }%
+ }%
+ }%
+ },
+ dlItemEnd = {},
+ dlDefinitionEnd = {},
+ dlEnd = {.},
+ },
}
-This is a loose list
+This is a loose definition list
-- This is the first item
+Coffee
-- This is the second item
+: black hot drink
-- This is the third item
+: 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}
@@ -11599,15 +11736,24 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is a tight list (the first item, the second item, and the third item).
+> This is a tight definition list:
>
-> This is a loose list:
->
-> - This is the first item.
->
-> - This is the second item.
->
-> - This is the third item.
+> **Coffee**
+>
+> - black hot drink,
+> - prepared from roasted coffee beans, and
+> - one of the most traded agricultural commodities in the world.
+>
+> **Milk**
+>
+> - white cold drink,
+> - nutrient-rich, and
+> - produced on an industrial scale.
+>
+> This is a loose definition list. Coffee is a black hot drink, prepared from
+> roasted coffee beans, and one of the most traded agricultural commodities in
+> the world. Milk is a white cold drink, nutrient-rich, and produced on an
+> industrial scale.
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -11615,45 +11761,82 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\setupmarkdown[tightLists = yes]
+\setupmarkdown
+ [
+ definitionLists = yes,
+ tightLists = yes,
+ ]
\starttext
-\def\markdownRendererInterblockSeparator{}
-\def\markdownRendererUlBeginTight{ (}
-\def\markdownRendererUlItem{%
- \def\markdownRendererUlItem{%
+\def\markdownRendererInterblockSeparator{%
+ :%
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererDlBeginTight{}
+\def\markdownRendererDlItem#1{%
+ \par{\bf#1}%
+ \startitemize
+ \def\markdownRendererDlDefinitionEnd{%
,
- \def\markdownRendererUlItem{, and }%
+ \def\markdownRendererDlDefinitionEnd{%
+ , and
+ \def\markdownRendererDlDefinitionEnd{.}%
+ }%
}%
}
-\def\markdownRendererUlItemEnd{}
-\def\markdownRendererUlEndTight{).}
+\def\markdownRendererDlItemEnd{\stopitemize}
+\def\markdownRendererDlDefinitionBegin{\item}
+\def\markdownRendererDlEndTight{}
\startmarkdown
-This is a tight list
+This is a tight definition list
-- the first item
-- the second item
-- the third item
+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{%
- :\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
+\def\markdownRendererDlBegin{}
+\def\markdownRendererDlItem#1{%
+ . #1 is a
+ \def\markdownRendererDlDefinitionBegin{%
+ \def\markdownRendererDlDefinitionBegin{%
+ ,
+ \def\markdownRendererDlDefinitionBegin{, and }%
+ }%
+ }%
+}
+\def\markdownRendererDlItemEnd{}
+\def\markdownRendererDlDefinitionEnd{}
+\def\markdownRendererDlEnd{.}
-- This is the second item
+\startmarkdown
+This is a loose definition list
-- This is the third item
+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
@@ -11665,30 +11848,39 @@ context document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is a tight list (the first item, the second item, and the third item).
+> This is a tight definition list:
>
-> This is a loose list:
->
-> - This is the first item.
->
-> - This is the second item.
->
-> - This is the third item.
+> **Coffee**
+>
+> - black hot drink,
+> - prepared from roasted coffee beans, and
+> - one of the most traded agricultural commodities in the world.
+>
+> **Milk**
+>
+> - white cold drink,
+> - nutrient-rich, and
+> - produced on an industrial scale.
+>
+> This is a loose definition list. Coffee is a black hot drink, prepared from
+> roasted coffee beans, and one of the most traded agricultural commodities in
+> the world. Milk is a white cold drink, nutrient-rich, and produced on an
+> industrial scale.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererUlEndTight{%
- \markdownRendererUlEndTightPrototype}%
+\def\markdownRendererDlEndTight{%
+ \markdownRendererDlEndTightPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { ulEndTight }
+ { dlEndTight }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { ulEndTight }
+ { dlEndTight }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11701,29 +11893,105 @@ following text:
%
% \begin{markdown}
-#### Ordered List Renderers
-The \mdef{markdownRendererOlBegin} macro represents the beginning of an
-ordered list that contains an item with several paragraphs of text (the
-list is not tight). This macro will only be produced, when the \Opt{fancyLists}
-option is disabled. The macro receives no arguments.
+#### Ellipsis Renderer
+The \mdef{markdownRendererEllipsis} macro replaces any occurance of ASCII
+ellipses in the input text. This macro will only be produced, when the
+\Opt{smartEllipses} option is enabled. The macro receives no arguments.
% \end{markdown}
%
% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionSmartEllipses{true}
+\def\markdownRendererEllipsis{{\it SHAZAM}!}
+\markdownBegin
+The secret word is ...
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The secret word is *SHAZAM*!
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[smartEllipses]{markdown}
+\markdownSetup{
+ renderers = {
+ ellipsis = \emph{SHAZAM}!,
+ },
+}
+\begin{document}
+\begin{markdown}
+The secret word is ...
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The secret word is *SHAZAM*!
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\setupmarkdown[smartEllipses = yes]
+\def\markdownRendererEllipsis{\emph{SHAZAM}!}
+\starttext
+\startmarkdown
+The secret word is ...
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlBegin{%
- \markdownRendererOlBeginPrototype}%
+\def\markdownRendererEllipsis{%
+ \markdownRendererEllipsisPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olBegin }
+ { ellipsis }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olBegin }
+ { ellipsis }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11736,30 +12004,115 @@ option is disabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererOlBeginTight} macro represents the beginning of an
-ordered list that contains no item with several paragraphs of text (the
-list is tight). This macro will only be produced, when the \Opt{tightLists}
-option is enabled and the \Opt{fancyLists} option is disabled. The macro
-receives no arguments.
+#### Emphasis Renderers
+The \mdef{markdownRendererEmphasis} macro represents an emphasized span of
+text. The macro receives a single argument that corresponds to the emphasized
+span of text.
% \end{markdown}
%
% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererEmphasis#1{{\it#1}}
+\def\markdownRendererStrongEmphasis#1{{\bf#1}}
+\markdownBegin
+This is *emphasis*.
+
+This is **strong emphasis**.
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is *emphasis*.
+>
+> This is **strong emphasis**.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ emphasis = {\emph{#1}},
+ strongEmphasis = {\textbf{#1}},
+ },
+}
+\begin{document}
+\begin{markdown}
+This is *emphasis*.
+
+This is **strong emphasis**.
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is *emphasis*.
+>
+> This is **strong emphasis**.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererEmphasis#1{\emph{#1}}
+\def\markdownRendererStrongEmphasis#1{\bold{#1}}
+\starttext
+\startmarkdown
+This is *emphasis*.
+
+This is **strong emphasis**.
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is *emphasis*.
+>
+> This is **strong emphasis**.
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlBeginTight{%
- \markdownRendererOlBeginTightPrototype}%
+\def\markdownRendererEmphasis{%
+ \markdownRendererEmphasisPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olBeginTight }
+ { emphasis }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olBeginTight }
- { 0 }
+ { emphasis }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -11771,13 +12124,9 @@ receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererFancyOlBegin} macro represents the beginning of a
-fancy ordered list that contains an item with several paragraphs of text (the
-list is not tight). This macro will only be produced, when the \Opt{fancyLists}
-option is enabled. The macro receives two arguments: the style of the list item
-labels (`Decimal`, `LowerRoman`, `UpperRoman`, `LowerAlpha`, and `UpperAlpha`),
-and the style of delimiters between list item labels and texts (`Default`,
-`OneParen`, and `Period`).
+The \mdef{markdownRendererStrongEmphasis} macro represents a strongly
+emphasized span of text. The macro receives a single argument that
+corresponds to the emphasized span of text.
% \end{markdown}
%
@@ -11787,16 +12136,16 @@ and the style of delimiters between list item labels and texts (`Default`,
% \fi
%
% \begin{macrocode}
-\def\markdownRendererFancyOlBegin{%
- \markdownRendererFancyOlBeginPrototype}%
+\def\markdownRendererStrongEmphasis{%
+ \markdownRendererStrongEmphasisPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { fancyOlBegin }
+ { strongEmphasis }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { fancyOlBegin }
- { 2 }
+ { strongEmphasis }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -11808,32 +12157,115 @@ and the style of delimiters between list item labels and texts (`Default`,
%
% \begin{markdown}
-The \mdef{markdownRendererFancyOlBeginTight} macro represents the beginning of
-a fancy ordered list that contains no item with several paragraphs of text (the
-list is tight). This macro will only be produced, when the \Opt{fancyLists}
-and \Opt{tightLists} options are enabled. The macro receives two arguments: the
-style of the list item labels, and the style of delimiters between list
-item labels and texts. See the \mref{markdownRendererFancyOlBegin} macro for
-the valid style values.
+#### Fenced Div Context Renderers
+The following macros are only produced, when the \Opt{fencedDiv} option is
+enabled.
+
+The \mdef{markdownRendererFencedDivAttributeContextBegin} and
+\mdef{markdownRendererFencedDivAttributeContextEnd} macros represent the beginning
+and the end of a div in which the attributes of the div apply. The macros
+receive no arguments.
% \end{markdown}
%
% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[fencedDiv]{markdown}
+\markdownSetup{
+ renderers = {
+ fencedDivAttributeContextBegin = {%
+ \par
+ \emph{(The beginning of a fenced div attribute context)}
+ \par
+ },
+ fencedDivAttributeContextEnd = {%
+ \par
+ \emph{(The end of a fenced div attribute context)}
+ \par
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+
+::: {key=value}
+
+foo
+
+:::: {#identifier}
+
+bar
+
+::::
+
+:::
+
+::: {.class_name}
+
+baz
+
+:::
+
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> *(The beginning of a fenced div attribute context)*
+>
+> foo
+>
+> *(The beginning of a fenced div attribute context)*
+>
+> bar
+>
+> *(The end of a fenced div attribute context)*
+>
+> *(The end of a fenced div attribute context)*
+>
+> *(The beginning of a fenced div attribute context)*
+>
+> baz
+>
+> *(The end of a fenced div attribute context)*
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererFancyOlBeginTight{%
- \markdownRendererFancyOlBeginTightPrototype}%
+\def\markdownRendererFencedDivAttributeContextBegin{%
+ \markdownRendererFencedDivAttributeContextBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { fancyOlBeginTight }
+ { fencedDivAttributeContextBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { fancyOlBeginTight }
- { 2 }
+ { fencedDivAttributeContextBegin }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererFencedDivAttributeContextEnd{%
+ \markdownRendererFencedDivAttributeContextEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { fencedDivAttributeContextEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { fencedDivAttributeContextEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -11845,28 +12277,98 @@ the valid style values.
%
% \begin{markdown}
-The \mdef{markdownRendererOlItem} macro represents an item in an ordered list.
-This macro will only be produced, when the \Opt{startNumber} option is
-disabled and the \Opt{fancyLists} option is disabled. The macro receives no
-arguments.
+#### Header Attribute Context Renderers
+The following macros are only produced, when the \Opt{headerAttributes} option
+is enabled.
+
+The \mdef{markdownRendererHeaderAttributeContextBegin} and
+\mdef{markdownRendererHeaderAttributeContextEnd} macros represent the beginning
+and the end of a section in which the attributes of a heading apply. The macros
+receive no arguments.
% \end{markdown}
%
% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[headerAttributes]{markdown}
+\markdownSetup{
+ renderers = {
+ headerAttributeContextBegin = {%
+ \par
+ \emph{(The beginning of a header attribute context)}
+ \par
+ },
+ headerAttributeContextEnd = {%
+ \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:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> # First top-level heading
+>
+> *(The beginning of a header attribute context)*
+>
+> ## A subheading
+>
+> *(The end of a header attribute context)*
+>
+> *(The beginning of a header attribute context)*
+>
+> # Second top-level heading
+>
+> *(The end of a header attribute context)*
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlItem{%
- \markdownRendererOlItemPrototype}%
+\def\markdownRendererHeaderAttributeContextBegin{%
+ \markdownRendererHeaderAttributeContextBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olItem }
+ { headerAttributeContextBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olItem }
+ { headerAttributeContextBegin }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererHeaderAttributeContextEnd{%
+ \markdownRendererHeaderAttributeContextEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { headerAttributeContextEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { headerAttributeContextEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11879,9 +12381,9 @@ arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererOlItemEnd} macro represents the end of an item in
-an ordered list. This macro will only be produced, when the \Opt{fancyLists}
-option is disabled. The macro receives no arguments.
+#### Heading Renderers
+The \mdef{markdownRendererHeadingOne} macro represents a first level heading.
+The macro receives a single argument that corresponds to the heading text.
% \end{markdown}
%
@@ -11891,16 +12393,16 @@ option is disabled. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlItemEnd{%
- \markdownRendererOlItemEndPrototype}%
+\def\markdownRendererHeadingOne{%
+ \markdownRendererHeadingOnePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olItemEnd }
+ { headingOne }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olItemEnd }
- { 0 }
+ { headingOne }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -11912,10 +12414,9 @@ option is disabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererOlItemWithNumber} macro represents an item in an
-ordered list. This macro will only be produced, when the \Opt{startNumber}
-option is enabled and the \Opt{fancyLists} option is disabled. The macro
-receives a single numeric argument that corresponds to the item number.
+The \mdef{markdownRendererHeadingTwo} macro represents a second level
+heading. The macro receives a single argument that corresponds to the heading
+text.
% \end{markdown}
%
@@ -11925,15 +12426,15 @@ receives a single numeric argument that corresponds to the item number.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlItemWithNumber{%
- \markdownRendererOlItemWithNumberPrototype}%
+\def\markdownRendererHeadingTwo{%
+ \markdownRendererHeadingTwoPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olItemWithNumber }
+ { headingTwo }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olItemWithNumber }
+ { headingTwo }
{ 1 }
\ExplSyntaxOff
% \end{macrocode}
@@ -11946,10 +12447,9 @@ receives a single numeric argument that corresponds to the item number.
%
% \begin{markdown}
-The \mdef{markdownRendererFancyOlItem} macro represents an item in a fancy
-ordered list. This macro will only be produced, when the \Opt{startNumber}
-option is disabled and the \Opt{fancyLists} option is enabled. The macro receives
-no arguments.
+The \mdef{markdownRendererHeadingThree} macro represents a third level
+heading. The macro receives a single argument that corresponds to the heading
+text.
% \end{markdown}
%
@@ -11959,16 +12459,16 @@ no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererFancyOlItem{%
- \markdownRendererFancyOlItemPrototype}%
+\def\markdownRendererHeadingThree{%
+ \markdownRendererHeadingThreePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { fancyOlItem }
+ { headingThree }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { fancyOlItem }
- { 0 }
+ { headingThree }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -11980,9 +12480,9 @@ no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererFancyOlItemEnd} macro represents the end of an item in
-a fancy ordered list. This macro will only be produced, when the \Opt{fancyLists}
-option is enabled. The macro receives no arguments.
+The \mdef{markdownRendererHeadingFour} macro represents a fourth level
+heading. The macro receives a single argument that corresponds to the heading
+text.
% \end{markdown}
%
@@ -11992,16 +12492,16 @@ option is enabled. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererFancyOlItemEnd{%
- \markdownRendererFancyOlItemEndPrototype}%
+\def\markdownRendererHeadingFour{%
+ \markdownRendererHeadingFourPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { fancyOlItemEnd }
+ { headingFour }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { fancyOlItemEnd }
- { 0 }
+ { headingFour }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -12013,10 +12513,9 @@ option is enabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererFancyOlItemWithNumber} macro represents an item in a
-fancy ordered list. This macro will only be produced, when the \Opt{startNumber}
-and \Opt{fancyLists} options are enabled. The macro receives a single numeric
-argument that corresponds to the item number.
+The \mdef{markdownRendererHeadingFive} macro represents a fifth level
+heading. The macro receives a single argument that corresponds to the heading
+text.
% \end{markdown}
%
@@ -12026,15 +12525,15 @@ argument that corresponds to the item number.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererFancyOlItemWithNumber{%
- \markdownRendererFancyOlItemWithNumberPrototype}%
+\def\markdownRendererHeadingFive{%
+ \markdownRendererHeadingFivePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { fancyOlItemWithNumber }
+ { headingFive }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { fancyOlItemWithNumber }
+ { headingFive }
{ 1 }
\ExplSyntaxOff
% \end{macrocode}
@@ -12047,29 +12546,129 @@ argument that corresponds to the item number.
%
% \begin{markdown}
-The \mdef{markdownRendererOlEnd} macro represents the end of an ordered list
-that contains an item with several paragraphs of text (the list is not
-tight). This macro will only be produced, when the \Opt{fancyLists} option is
-disabled. The macro receives no arguments.
+The \mdef{markdownRendererHeadingSix} macro represents a sixth level
+heading. The macro receives a single argument that corresponds to the heading
+text.
% \end{markdown}
%
% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererHeadingOne{1}
+\def\markdownRendererHeadingTwo{2}
+\def\markdownRendererHeadingThree{3}
+\def\markdownRendererHeadingFour{4}
+\def\markdownRendererHeadingFive{5}
+\def\markdownRendererHeadingSix{6}
+\markdownBegin
+######
+#####
+#####
+###
+######
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> 65536
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ interblockSeparator = {},
+ headingOne = 1,
+ headingTwo = 2,
+ headingThree = 3,
+ headingFour = 4,
+ headingFive = 5,
+ headingSix = 6,
+ },
+}
+\begin{document}
+\begin{markdown}
+######
+#####
+#####
+###
+######
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> 65536
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererHeadingOne{1}
+\def\markdownRendererHeadingTwo{2}
+\def\markdownRendererHeadingThree{3}
+\def\markdownRendererHeadingFour{4}
+\def\markdownRendererHeadingFive{5}
+\def\markdownRendererHeadingSix{6}
+\starttext
+\startmarkdown
+######
+#####
+#####
+###
+######
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> 65536
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlEnd{%
- \markdownRendererOlEndPrototype}%
+\def\markdownRendererHeadingSix{%
+ \markdownRendererHeadingSixPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olEnd }
+ { headingSix }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olEnd }
- { 0 }
+ { headingSix }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -12081,63 +12680,110 @@ disabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererOlEndTight} macro represents the end of an ordered
-list that contains no item with several paragraphs of text (the list is
-tight). This macro will only be produced, when the \Opt{tightLists} option is
-enabled and the \Opt{fancyLists} option is disabled. The macro receives no
-arguments.
+#### HTML Comment Renderers
+
+The \mdef{markdownRendererInlineHtmlComment} macro represents the contents of an
+inline \acro{HTML} comment. This macro will only be produced, when the
+\Opt{html} option is enabled. The macro receives a single argument that
+corresponds to the contents of the \acro{HTML} comment.
+
+The \mdef{markdownRendererBlockHtmlCommentBegin} and
+\mdef{markdownRendererBlockHtmlCommentEnd} macros represent the beginning
+and the end of a block \acro{HTML} comment. The macros receive no arguments.
% \end{markdown}
%
% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[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.
+
+
+We can render block HTML comments as blockquotes:
+
+
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+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.
+>
+> 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
+
+The horizontal margins should contain the following text:
+
+> Side notes are displayed in the horizontal margins next to the relevant
+> passages, which makes them *easier for the reader to find* than notes.
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererOlEndTight{%
- \markdownRendererOlEndTightPrototype}%
+\def\markdownRendererInlineHtmlComment{%
+ \markdownRendererInlineHtmlCommentPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { olEndTight }
+ { inlineHtmlComment }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { olEndTight }
+ { inlineHtmlComment }
+ { 1 }
+\ExplSyntaxOff
+\def\markdownRendererBlockHtmlCommentBegin{%
+ \markdownRendererBlockHtmlCommentBeginPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { blockHtmlCommentBegin }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { blockHtmlCommentBegin }
{ 0 }
\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-The \mdef{markdownRendererFancyOlEnd} macro represents the end of a fancy
-ordered list that contains an item with several paragraphs of text (the list
-is not tight). This macro will only be produced, when the \Opt{fancyLists}
-option is enabled. The macro receives no arguments.
-
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererFancyOlEnd{%
- \markdownRendererFancyOlEndPrototype}%
+\def\markdownRendererBlockHtmlCommentEnd{%
+ \markdownRendererBlockHtmlCommentEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { fancyOlEnd }
+ { blockHtmlCommentEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { fancyOlEnd }
+ { blockHtmlCommentEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -12150,97 +12796,21 @@ option is enabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererFancyOlEndTight} macro represents the end of a
-fancy ordered list that contains no item with several paragraphs of text (the
-list is tight). This macro will only be produced, when the \Opt{fancyLists}
-and \Opt{tightLists} options are enabled. The macro receives no arguments.
+#### HTML Tag and Element Renderers
-% \end{markdown}
-%
-% \iffalse
+The \mdef{markdownRendererInlineHtmlTag} macro represents an opening, closing,
+or empty inline \acro{HTML} tag. This macro will only be produced, when the
+\Opt{html} option is enabled. The macro receives a single argument that
+corresponds to the contents of the \acro{HTML} tag.
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownOptionTightLists{true}
-\def\markdownOptionStartNumber{true}
-
-\def\markdownRendererInterblockSeparator{}
-\def\markdownRendererOlBeginTight{ (}
-\def\markdownRendererOlItemWithNumber#1{%
- \ifnum #1=1\relax
- the first
- \else
- \ifnum #1=2\relax
- , the second
- \else
- , and the third
- \fi
- \fi
-}
-\def\markdownRendererOlItemEnd{}
-\def\markdownRendererOlEndTight{).}
-
-\markdownBegin
-This is a tight list
-
-1. item
-2. item
-3. item
-\markdownEnd
-
-\def\markdownRendererInterblockSeparator{%
- :\par
- \def\markdownRendererInterblockSeparator{\par}%
-}
-\def\markdownRendererOlBegin{}
-\def\markdownRendererOlItemWithNumber#1{%
- #1.\kern 0.5em%
- This is the
- \ifnum #1=1\relax
- first
- \else
- \ifnum #1=2\relax
- second
- \else
- third
- \fi
- \fi
-}
-\def\markdownRendererOlItemEnd{.\par}
-\def\markdownRendererOlEnd{}
-
-\markdownBegin
-This is a loose list
-
-1. item
-
-2. item
-
-3. item
-\markdownEnd
-
-\bye
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
+The \mdef{markdownRendererInputBlockHtmlElement} macro represents a block
+\acro{HTML} element. This macro will only be produced, when the \Opt{html}
+option is enabled. The macro receives a single argument that filename of a file
+containing the contents of the \acro{HTML} element.
-> This is a tight list (the first item, the second item, and the third item).
->
-> This is a loose list:
->
-> 1. This is the first item.
->
-> 2. This is the second item.
->
-> 3. This is the third item.
+% \end{markdown}
+%
+% \iffalse
##### \LaTeX{} Example {.unnumbered}
@@ -12248,324 +12818,61 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[tightLists, startNumber]{markdown}
-\begin{document}
-
-\begin{markdown*}{
- renderers = {
- interblockSeparator = {},
- olBeginTight = { (},
- olItemWithNumber = {%
- \ifnum #1=1\relax
- the first
- \else
- \ifnum #1=2\relax
- , the second
- \else
- , and the third
- \fi
- \fi
- },
- olItemEnd = {},
- olEndTight = {).},
- },
-}
-This is a tight list
-
-1. item
-2. item
-3. item
-\end{markdown*}
-
-\begin{markdown*}{
+\usepackage[html]{markdown}
+\usepackage{marginnote}
+\usepackage{verbatim}
+\markdownSetup{
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}},
- },
+ inlineHtmlTag = {\textbf{#1}},
+ inputBlockHtmlElement = {\verbatiminput{#1}},
+ },
}
-This is a loose list
-
-1. item
-
-2. item
-
-3. item
-\end{markdown*}
+\begin{document}
+\begin{markdown}
+_Hello,_ world!
+
_Hello,_ world!
+\end{markdown}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
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).
->
-> This is a loose list:
->
-> 1. This is the first item.
->
-> 2. This is the second item.
->
-> 3. This is the third item.
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown
- [
- tightLists = yes,
- startNumber = yes,
- ]
-\starttext
-
-\def\markdownRendererInterblockSeparator{}
-\def\markdownRendererOlBeginTight{ (}
-\def\markdownRendererOlItemWithNumber#1{%
- \ifnum #1=1\relax
- the first
- \else
- \ifnum #1=2\relax
- , the second
- \else
- , and the third
- \fi
- \fi
-}
-\def\markdownRendererOlItemEnd{}
-\def\markdownRendererOlEndTight{).}
-
-\startmarkdown
-This is a tight list
-
-1. item
-2. item
-3. item
-\stopmarkdown
-
-\def\markdownRendererInterblockSeparator{%
- :\par
- \def\markdownRendererInterblockSeparator{\par}%
-}
-\def\markdownRendererOlBegin{\startitemize}
-\def\markdownRendererOlItemWithNumber#1{%
- \sym{#1.}
- This is the
- \ifnum #1=1\relax
- first
- \else
- \ifnum #1=2\relax
- second
- \else
- third
- \fi
- \fi
-}
-\def\markdownRendererOlItemEnd{.\par}
-\def\markdownRendererOlEnd{\stopitemize}
-
-\startmarkdown
-This is a loose list
-
-1. item
-
-2. item
-
-3. item
-\stopmarkdown
-
-\stoptext
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-context document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
+following body text:
-> This is a tight list (the first item, the second item, and the third item).
+> ****_Hello,_ world!** **
>
-> This is a loose list:
->
-> 1. This is the first item.
->
-> 2. This is the second item.
->
-> 3. This is the third item.
-
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererFancyOlEndTight{%
- \markdownRendererFancyOlEndTightPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { fancyOlEndTight }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { fancyOlEndTight }
- { 0 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-#### Definition List Renderers
-The following macros are only produced, when the \Opt{definitionLists} option
-is enabled.
-
-The \mdef{markdownRendererDlBegin} macro represents the beginning of a
-definition list that contains an item with several paragraphs of text (the
-list is not tight). The macro receives no arguments.
-
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererDlBegin{%
- \markdownRendererDlBeginPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { dlBegin }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { dlBegin }
- { 0 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-The \mdef{markdownRendererDlBeginTight} macro represents the beginning of a
-definition list that contains an item with several paragraphs of text (the
-list is not tight). This macro will only be produced, when the
-\Opt{tightLists} option is disabled. The macro receives no arguments.
-
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererDlBeginTight{%
- \markdownRendererDlBeginTightPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { dlBeginTight }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { dlBeginTight }
- { 0 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-The \mdef{markdownRendererDlItem} macro represents a term in a definition
-list. The macro receives a single argument that corresponds to the term
-being defined.
+>
_Hello,_ world!
-% \end{markdown}
-%
-% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererDlItem{%
- \markdownRendererDlItemPrototype}%
+\def\markdownRendererInlineHtmlTag{%
+ \markdownRendererInlineHtmlTagPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { dlItem }
+ { inlineHtmlTag }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { dlItem }
+ { inlineHtmlTag }
{ 1 }
\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-The \mdef{markdownRendererDlItemEnd} macro represents the end of a list of
-definitions for a single term.
-
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererDlItemEnd{%
- \markdownRendererDlItemEndPrototype}%
+\def\markdownRendererInputBlockHtmlElement{%
+ \markdownRendererInputBlockHtmlElementPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { dlItemEnd }
+ { inputBlockHtmlElement }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { dlItemEnd }
- { 0 }
+ { inputBlockHtmlElement }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -12577,94 +12884,85 @@ definitions for a single term.
%
% \begin{markdown}
-The \mdef{markdownRendererDlDefinitionBegin} macro represents the beginning
-of a definition in a definition list. There can be several definitions for
-a single term.
+#### Image Renderer
+The \mdef{markdownRendererImage} macro represents an image. It receives
+four arguments: the label, the fully escaped \acro{uri} that can be directly
+typeset, the raw \acro{uri} that can be used outside typesetting, and the
+title of the link.
% \end{markdown}
%
% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererDlDefinitionBegin{%
- \markdownRendererDlDefinitionBeginPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { dlDefinitionBegin }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { dlDefinitionBegin }
- { 0 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-The \mdef{markdownRendererDlDefinitionEnd} macro represents the end of a
-definition in a definition list. There can be several definitions for a
-single term.
+##### \LaTeX{} Example {.unnumbered}
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererDlDefinitionEnd{%
- \markdownRendererDlDefinitionEndPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { dlDefinitionEnd }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { dlDefinitionEnd }
- { 0 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\begingroup
+\catcode`\@=11
+\catcode`\%=12
+\catcode`\^^A=14
+\global\def\markdownRendererImage#1#2#3#4{^^A
+ \immediate\write18{^^A
+```
+``` sh
+ 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
+```
+``` tex
+ }^^A
+ {^^A
+ \everyeof={\noexpand}^^A
+ \edef\filename{\@@input"\jobname.fetched" }^^A
+ \includegraphics[width=\textwidth]{\filename}^^A
+ }^^A
+}
+\endgroup
+\begin{document}
+\begin{markdown}
+![TUGboat](https://tug.org/tugboat/noword.jpg)
+\end{markdown}
+\end{document}
+``````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following content. This assumes that you use a Unix-like operating system with
+Bourne or Bourne again shell as the default shell of the current user. It also
+assumes that the `md5sum`, `wget`, and `convert` binaries are installed and
+that the \TeX{} engine has shell access.
-The \mdef{markdownRendererDlEnd} macro represents the end of a definition
-list that contains an item with several paragraphs of text (the list is not
-tight). The macro receives no arguments.
+> ![TUGboat](https://tug.org/tugboat/noword.jpg "The Communications of the TeX Users Group")
-% \end{markdown}
-%
-% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererDlEnd{%
- \markdownRendererDlEndPrototype}%
+\def\markdownRendererImage{%
+ \markdownRendererImagePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { dlEnd }
+ { image }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { dlEnd }
- { 0 }
+ { image }
+ { 4 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -12676,10 +12974,9 @@ tight). The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererDlEndTight} macro represents the end of a
-definition list that contains no item with several paragraphs of text (the
-list is tight). This macro will only be produced, when the \Opt{tightLists}
-option is disabled. The macro receives no arguments.
+#### Interblock Separator Renderer
+The \mdef{markdownRendererInterblockSeparator} macro represents a separator
+between two markdown block elements. The macro receives no arguments.
% \end{markdown}
%
@@ -12691,82 +12988,16 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
-\def\markdownOptionDefinitionLists{true}
-\def\markdownOptionTightLists{true}
-
-\def\markdownRendererInterblockSeparator{%
- :%
- \def\markdownRendererInterblockSeparator{\par}%
-}
-\def\markdownRendererDlBeginTight{%
- \begingroup
- \parindent=0pt
-}
-\def\markdownRendererDlItem#1{%
- \par{\bf#1}%
- \def\markdownRendererDlDefinitionEnd{%
- ,
- \def\markdownRendererDlDefinitionEnd{%
- , and
- \def\markdownRendererDlDefinitionEnd{.}%
- }%
- }%
-}
-\def\markdownRendererDlItemEnd{}
-\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em}
-\def\markdownRendererDlEndTight{\endgroup}
-
-\markdownBegin
-This is a tight definition list
-
-Coffee
-: black hot drink
-: prepared from roasted coffee beans
-: one of the most traded agricultural commodities in the world
-
-Milk
-: white cold drink
-: nutrient-rich
-: produced on an industrial scale
-\markdownEnd
-
\def\markdownRendererInterblockSeparator{%
- \def\markdownRendererInterblockSeparator{\par}%
-}
-\def\markdownRendererDlBegin{}
-\def\markdownRendererDlItem#1{%
- . #1 is a
- \def\markdownRendererDlDefinitionBegin{%
- \def\markdownRendererDlDefinitionBegin{%
- ,
- \def\markdownRendererDlDefinitionBegin{, and }%
- }%
- }%
+ \par
+ {\it(The end of a block)}%
+ \par
}
-\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
+Hello *world*!
-: produced on an industrial scale
+_Foo_ bar!
\markdownEnd
-
\bye
```````
Next, invoke LuaTeX from the terminal:
@@ -12776,24 +13007,11 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is a tight definition list:
->
-> **Coffee**
->
-> - black hot drink,
-> - prepared from roasted coffee beans, and
-> - one of the most traded agricultural commodities in the world.
->
-> **Milk**
->
-> - white cold drink,
-> - nutrient-rich, and
-> - produced on an industrial scale.
+> Hello *world*!
>
-> 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.
+> *(The end of a block)*
+>
+> _Foo_ bar!
##### \LaTeX{} Example {.unnumbered}
@@ -12801,86 +13019,166 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[definitionLists, tightLists]{markdown}
-\begin{document}
-
-\begin{markdown*}{
+\usepackage{markdown}
+\markdownSetup{
renderers = {
interblockSeparator = {%
- :%
- \def\markdownRendererInterblockSeparator{\par}%
- },
- dlBeginTight = {\begin{description}},
- dlItem = {%
- \item[#1]
- \begin{itemize}
- \def\markdownRendererDlDefinitionEnd{%
- ,
- \def\markdownRendererDlDefinitionEnd{%
- , and
- \def\markdownRendererDlDefinitionEnd{.}%
- }%
- }%
+ \par
+ \emph{(The end of a block)}%
+ \par
},
- dlItemEnd = {\end{itemize}},
- dlDefinitionBegin = \item,
- dlEndTight = {\end{description}},
},
}
-This is a tight definition list
+\begin{document}
+\begin{markdown}
+Hello *world*!
-Coffee
-: black hot drink
-: prepared from roasted coffee beans
-: one of the most traded agricultural commodities in the world
+_Foo_ bar!
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
-Milk
-: white cold drink
-: nutrient-rich
-: produced on an industrial scale
-\end{markdown*}
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
-\begin{markdown*}{
- renderers = {
- interblockSeparator = {%
- \def\markdownRendererInterblockSeparator{\par}%
- },
- dlBegin = {},
- dlItem = {%
- . #1 is a
- \def\markdownRendererDlDefinitionBegin{%
- \def\markdownRendererDlDefinitionBegin{%
- ,
- \def\markdownRendererDlDefinitionBegin{, and }%
- }%
- }%
- },
- dlItemEnd = {},
- dlDefinitionEnd = {},
- dlEnd = {.},
- },
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererInterblockSeparator{%
+ \par
+ \emph{(The end of a block)}%
+ \par
}
-This is a loose definition list
+\starttext
+\startmarkdown
+Hello *world*!
+
+_Foo_ bar!
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> Hello *world*!
+>
+> *(The end of a block)*
+>
+> _Foo_ bar!
+
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererInterblockSeparator{%
+ \markdownRendererInterblockSeparatorPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { interblockSeparator }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { interblockSeparator }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-Coffee
+#### Line Break Renderer
+The \mdef{markdownRendererLineBreak} macro represents a forced line break.
+The macro receives no arguments.
-: black hot drink
+% \end{markdown}
+%
+% \iffalse
-: prepared from roasted coffee beans
+##### Plain \TeX{} Example {.unnumbered}
-: one of the most traded agricultural commodities in the world
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererLineBreak{%
+ \par
+ {\it(A forced linebreak)}%
+ \par
+}
+\markdownInput{example.md}
+\bye
+```````
+Using a text editor, create a text document named `example.md` with the
+following content. Note the two spaces at the end of the first line, which
+specify a hard linebreak. Due to the limitations of the \TeX{} input
+processor, hard linebreaks would be ignored if we typed them directly into the
+`document.tex` document.
-Milk
+
Hello world! _Foo_ bar!
-: white cold drink
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
-: nutrient-rich
+> Hello *world*!
+>
+> *(A forced linebreak)*
+>
+> _Foo_ bar!
-: produced on an industrial scale
-\end{markdown*}
+##### \LaTeX{} Example {.unnumbered}
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ lineBreak = {%
+ \par
+ \emph{(A forced linebreak)}%
+ \par
+ },
+ },
+}
+\begin{document}
+\markdownInput{example.md}
\end{document}
```````
+Using a text editor, create a text document named `example.md` with the
+following content. Note the two spaces at the end of the first line, which
+specify a hard linebreak. Due to the limitations of the \TeX{} input
+processor, hard linebreaks would be ignored if we typed them directly into the
+`document.tex` document.
+
+
Hello world! _Foo_ bar!
+
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
@@ -12888,24 +13186,11 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is a tight definition list:
->
-> **Coffee**
->
-> - black hot drink,
-> - prepared from roasted coffee beans, and
-> - one of the most traded agricultural commodities in the world.
->
-> **Milk**
->
-> - white cold drink,
-> - nutrient-rich, and
-> - produced on an industrial scale.
+> Hello *world*!
>
-> 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.
+> *(A forced linebreak)*
+>
+> _Foo_ bar!
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -12913,126 +13198,50 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\setupmarkdown
- [
- definitionLists = yes,
- tightLists = yes,
- ]
-\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\markdownRendererLineBreak{%
+ \par
+ \emph{(A forced linebreak)}%
+ \par
}
-\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
-
+\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:
``` sh
-context 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:
->
-> **Coffee**
->
-> - black hot drink,
-> - prepared from roasted coffee beans, and
-> - one of the most traded agricultural commodities in the world.
->
-> **Milk**
->
-> - white cold drink,
-> - nutrient-rich, and
-> - produced on an industrial scale.
+> Hello *world*!
>
-> 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.
+> *(A forced linebreak)*
+>
+> _Foo_ bar!
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererDlEndTight{%
- \markdownRendererDlEndTightPrototype}%
+\def\markdownRendererLineBreak{%
+ \markdownRendererLineBreakPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { dlEndTight }
+ { lineBreak }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { dlEndTight }
+ { lineBreak }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -13045,10 +13254,11 @@ following text:
%
% \begin{markdown}
-#### Emphasis Renderers
-The \mdef{markdownRendererEmphasis} macro represents an emphasized span of
-text. The macro receives a single argument that corresponds to the emphasized
-span of text.
+#### Link Renderer
+The \mdef{markdownRendererLink} macro represents a hyperlink. It receives
+four arguments: the label, the fully escaped \acro{uri} that can be directly
+typeset, the raw \acro{uri} that can be used outside typesetting, and the
+title of the link.
% \end{markdown}
%
@@ -13060,12 +13270,14 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
-\def\markdownRendererEmphasis#1{{\it#1}}
-\def\markdownRendererStrongEmphasis#1{{\bf#1}}
+\def\markdownRendererLink#1#2#3#4{%
+ #1 {\tt#2} titled {\it#4}%
+}
\markdownBegin
-This is *emphasis*.
+Please visit [the link][ctan].
-This is **strong emphasis**.
+ [ctan]: https://ctan.org/
+ (the Comprehensive TeX Archive Network)
\markdownEnd
\bye
```````
@@ -13076,9 +13288,8 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is *emphasis*.
->
-> This is **strong emphasis**.
+> Please visit the link titled *the Comprehensive TeX
+> Archive Network*.
##### \LaTeX{} Example {.unnumbered}
@@ -13089,15 +13300,17 @@ following content:
\usepackage{markdown}
\markdownSetup{
renderers = {
- emphasis = {\emph{#1}},
- strongEmphasis = {\textbf{#1}},
+ link = {%
+ #1 \texttt{#2} titled \emph{#4}%
+ },
},
}
\begin{document}
\begin{markdown}
-This is *emphasis*.
+Please visit [the link][ctan].
-This is **strong emphasis**.
+ [ctan]: https://ctan.org/
+ (the Comprehensive TeX Archive Network)
\end{markdown}
\end{document}
```````
@@ -13108,9 +13321,8 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is *emphasis*.
->
-> This is **strong emphasis**.
+> Please visit the link titled *the Comprehensive TeX
+> Archive Network*.
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -13118,13 +13330,15 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\def\markdownRendererEmphasis#1{\emph{#1}}
-\def\markdownRendererStrongEmphasis#1{\bold{#1}}
+\def\markdownRendererLink#1#2#3#4{%
+ #1 {\tt#2} titled \emph{#4}%
+}
\starttext
\startmarkdown
-This is *emphasis*.
+Please visit [the link][ctan].
-This is **strong emphasis**.
+ [ctan]: https://ctan.org/
+ (the Comprehensive TeX Archive Network)
\stopmarkdown
\stoptext
```````
@@ -13135,25 +13349,24 @@ context document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> This is *emphasis*.
->
-> This is **strong emphasis**.
+> Please visit the link titled *the Comprehensive TeX
+> Archive Network*.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererEmphasis{%
- \markdownRendererEmphasisPrototype}%
+\def\markdownRendererLink{%
+ \markdownRendererLinkPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { emphasis }
+ { link }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { emphasis }
- { 1 }
+ { link }
+ { 4 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13165,28 +13378,148 @@ following text:
%
% \begin{markdown}
-The \mdef{markdownRendererStrongEmphasis} macro represents a strongly
-emphasized span of text. The macro receives a single argument that
-corresponds to the emphasized span of text.
+#### Markdown Document Renderers
+The \mdef{markdownRendererDocumentBegin} and \mdef{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.
% \end{markdown}
%
% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `nested.md` with the
+following content:
+``` md
+This is a *nested* markdown document.
+```
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\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:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> *(The beginning of a document)*
+>
+> Hello *world*!
+>
+> *(The beginning of a nested document)*
+>
+> This is a *nested* markdown document.
+>
+> *(The end of a nested document)*
+>
+> _Foo_ bar!
+>
+> *(The end of a document)*
+>
+> *(The beginning of a document)*
+>
+> Bar baz!
+>
+> *(The end of a document)*
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererStrongEmphasis{%
- \markdownRendererStrongEmphasisPrototype}%
+\def\markdownRendererDocumentBegin{%
+ \markdownRendererDocumentBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { strongEmphasis }
+ { documentBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { strongEmphasis }
- { 1 }
+ { documentBegin }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererDocumentEnd{%
+ \markdownRendererDocumentEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { documentEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { documentEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13198,27 +13531,79 @@ corresponds to the emphasized span of text.
%
% \begin{markdown}
-#### Block Quote Renderers
-The \mdef{markdownRendererBlockQuoteBegin} macro represents the beginning of
-a block quote. The macro receives no arguments.
+#### Non-Breaking Space Renderer
+The \mdef{markdownRendererNbsp} macro represents a non-breaking space.
% \end{markdown}
%
% \iffalse
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.bib` with the
+following content:
+``` bib
+@book{knuth:tex,
+ author = "Knuth, Donald Ervin",
+ title = "The \TeX book, volume A of Computers and typesetting",
+ publisher = "Addison-Wesley",
+ year = "1984"
+}
+```````
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[
+ citations,
+ citationNbsps,
+]{markdown}
+\markdownSetup{
+ renderers = {
+ nbsp = {$\cdot$},
+ },
+}
+\begin{document}
+
+\begin{markdown}
+The TeXbook [@knuth:tex, p. 123 and 130] is good.
+\end{markdown}
+
+\bibliographystyle{plain}
+\bibliography{document.bib}
+
+\end{document}
+```````
+Next, invoke LuaTeX and BibTeX from the terminal:
+``` sh
+lualatex document.tex
+bibtex document.aux
+lualatex document.tex
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> The TeXbook [1, p.·123·and·130] is good.
+>
+> ### References
+> [1] Donald Ervin Knuth. _The TeXbook, volume A of Computers and typesetting._
+> Addison-Wesley, 1984.
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererBlockQuoteBegin{%
- \markdownRendererBlockQuoteBeginPrototype}%
+\def\markdownRendererNbsp{%
+ \markdownRendererNbspPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { blockQuoteBegin }
+ { nbsp }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { blockQuoteBegin }
+ { nbsp }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -13231,8 +13616,10 @@ a block quote. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererBlockQuoteEnd} macro represents the end of a block
-quote. The macro receives no arguments.
+#### Note Renderer
+The \mdef{markdownRendererNote} macro represents a note. This macro
+will only be produced, when the \Opt{notes} option is enabled. The
+macro receives a single argument that corresponds to the note text.
% \end{markdown}
%
@@ -13244,24 +13631,14 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
-\def\markdownRendererBlockQuoteBegin{%
- \begingroup
- \vskip\parindent
- \leftskip=2\parindent
- \parindent=0pt
-}
-\def\markdownRendererBlockQuoteEnd{%
- \par
- \vskip\parindent
- \endgroup
-}
+\def\markdownOptionNotes{true}
+\def\markdownRendererNote#1{ (and \lowercase{#1})}
\markdownBegin
-A quote from William Shakespeare's King Lear:
+This is some text[^1] and this is some other text[^2].
+
+ [^1]: this is a note
-> 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 [...]
+ [^2]: this is some other note
\markdownEnd
\bye
```````
@@ -13272,12 +13649,8 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> A quote from William Shakespeare's King Lear:
->
-> > This is the excellent foppery of the world that when we are
-> > sick in fortune—often the surfeit of our own behavior—we
-> > make guilty of our disasters the sun, the moon, and the
-> > stars [...]
+> This is some text (and this is a note) and this is some other
+> text (and this is some other note).
##### \LaTeX{} Example {.unnumbered}
@@ -13285,21 +13658,19 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage{markdown}
+\usepackage[notes]{markdown}
\markdownSetup{
renderers = {
- blockQuoteBegin = {\begin{quote}},
- blockQuoteEnd = {\end{quote}},
+ note = { (and \MakeLowercase{#1})},
},
}
\begin{document}
\begin{markdown}
-A quote from William Shakespeare's King Lear:
+This is some text[^1] and this is some other text[^2].
-> 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 [...]
+ [^1]: this is a note
+
+ [^2]: this is some other note
\end{markdown}
\end{document}
```````
@@ -13310,12 +13681,8 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> A quote from William Shakespeare's King Lear:
->
-> > This is the excellent foppery of the world that when we are
-> > sick in fortune—often the surfeit of our own behavior—we
-> > make guilty of our disasters the sun, the moon, and the
-> > stars [...]
+> This is some text (and this is a note) and this is some other
+> text (and this is some other note).
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -13323,16 +13690,15 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\def\markdownRendererBlockQuoteBegin{\startquotation}
-\def\markdownRendererBlockQuoteEnd{\stopquotation}
+\setupmarkdown[notes = yes]
+\def\markdownRendererNote#1{ (and \lowercase{#1})}
\starttext
\startmarkdown
-A quote from William Shakespeare's King Lear:
+This is some text[^1] and this is some other text[^2].
-> 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 [...]
+ [^1]: this is a note
+
+ [^2]: this is some other note
\stopmarkdown
\stoptext
```````
@@ -13343,28 +13709,64 @@ context document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> A quote from William Shakespeare's King Lear:
->
-> > This is the excellent foppery of the world that when we are
-> > sick in fortune—often the surfeit of our own behavior—we
-> > make guilty of our disasters the sun, the moon, and the
-> > stars [...]
+> This is some text (and this is a note) and this is some other
+> text (and this is some other note).
%
%<*tex>
% \fi
+% \begin{markdown}
+%
+% The \mdef{markdownRendererFootnote} and
+% \mdef{markdownRendererFootnotePrototype} macros have been deprecated
+% and will be removed in Markdown 3.0.0.
%
+% \end{markdown}
% \begin{macrocode}
-\def\markdownRendererBlockQuoteEnd{%
- \markdownRendererBlockQuoteEndPrototype}%
\ExplSyntaxOn
+\cs_new:Npn
+ \markdownRendererNote
+ {
+ \cs_if_exist:NTF
+ \markdownRendererFootnote
+ {
+ \markdownWarning
+ {
+ Footnote~renderer~has~been~deprecated,~
+ to~be~removed~in~Markdown~3.0.0
+ }
+ \markdownRendererFootnote
+ }
+ {
+ \cs_if_exist:NTF
+ \markdownRendererFootnotePrototype
+ {
+ \markdownWarning
+ {
+ Footnote~renderer~prototype~has~been~deprecated,~
+ to~be~removed~in~Markdown~3.0.0
+ }
+ \markdownRendererFootnotePrototype
+ }
+ {
+ \markdownRendererNotePrototype
+ }
+ }
+ }
\seq_gput_right:Nn
\g_@@_renderers_seq
- { blockQuoteEnd }
+ { footnote }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { blockQuoteEnd }
- { 0 }
+ { footnote }
+ { 1 }
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { note }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { note }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13376,10 +13778,11 @@ following text:
%
% \begin{markdown}
-#### Code Block Renderers
-The \mdef{markdownRendererInputVerbatim} macro represents a code
-block. The macro receives a single argument that corresponds to the
-filename of a file contaning the code block contents.
+#### Ordered List Renderers
+The \mdef{markdownRendererOlBegin} macro represents the beginning of an
+ordered list that contains an item with several paragraphs of text (the
+list is not tight). This macro will only be produced, when the \Opt{fancyLists}
+option is disabled. The macro receives no arguments.
% \end{markdown}
%
@@ -13389,16 +13792,16 @@ filename of a file contaning the code block contents.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererInputVerbatim{%
- \markdownRendererInputVerbatimPrototype}%
+\def\markdownRendererOlBegin{%
+ \markdownRendererOlBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { inputVerbatim }
+ { olBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { inputVerbatim }
- { 1 }
+ { olBegin }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13410,110 +13813,103 @@ filename of a file contaning the code block contents.
%
% \begin{markdown}
-The \mdef{markdownRendererInputFencedCode} macro represents a fenced code
-block. This macro will only be produced, when the \Opt{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.
+The \mdef{markdownRendererOlBeginTight} macro represents the beginning of an
+ordered list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the \Opt{tightLists}
+option is enabled and the \Opt{fancyLists} option is disabled. The macro
+receives no arguments.
% \end{markdown}
%
% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererOlBeginTight{%
+ \markdownRendererOlBeginTightPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { olBeginTight }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { olBeginTight }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage{verbatim}
-\usepackage[hyphens]{url}
-\usepackage[fencedCode]{markdown}
-\markdownSetup{
- renderers = {
- interblockSeparator = {
- \def\markdownRendererInterblockSeparator{%
- \par
- \def\markdownRendererInterblockSeparator{%
- \def\markdownRendererInterblockSeparator{%
- \par
- }%
- }%
- }%
- },
- inputVerbatim = {
- is contained in file \url{#1}:%
- \verbatiminput{#1}%
- },
- inputFencedCode = {
- in #2 \markdownRendererInputVerbatim{#1}%
- },
- },
-}
-\begin{document}
-\begin{markdown}
-The following code
-
- def foo(bar):
- if len(bar) <= 1:
- return bar[0]
- elif len(bar) == 2:
- return sorted(bar)
- else:
- baz = len(bar) // 2
- return foo(bar[baz:], bar[:baz])
-
-The following code
-
-~~~ Python
->>> foo([4, 2, 1, 3])
-[1, 2, 3, 4]
-~~~~~~~~~~
-\end{markdown}
-\end{document}
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text except for the filename, which may differ:
+The \mdef{markdownRendererFancyOlBegin} macro represents the beginning of a
+fancy ordered list that contains an item with several paragraphs of text (the
+list is not tight). This macro will only be produced, when the \Opt{fancyLists}
+option is enabled. The macro receives two arguments: the style of the list item
+labels (`Decimal`, `LowerRoman`, `UpperRoman`, `LowerAlpha`, and `UpperAlpha`),
+and the style of delimiters between list item labels and texts (`Default`,
+`OneParen`, and `Period`).
-> The following code is contained in file
-> `./_markdown_document/882453149edcf288976647f6fe147ada.verbatim`:
-> ``` py
-> def foo(bar):
-> if len(bar) <= 1:
-> return bar[:1]
-> elif len(bar) == 2:
-> return sorted(bar)
-> else:
-> baz = bar[len(bar) // 2]
-> return (
-> foo([qux for qux in bar if qux < baz]) + [baz] +
-> foo([qux for qux in bar if qux > baz])
-> )
-> ``````
-> The following code in Python contained in file
-> `./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim`:
-> ``` py
-> >>> foo([4, 2, 1, 3])
-> [1, 2, 3, 4]
-> ``````
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererFancyOlBegin{%
+ \markdownRendererFancyOlBeginPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { fancyOlBegin }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { fancyOlBegin }
+ { 2 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererFancyOlBeginTight} macro represents the beginning of
+a fancy ordered list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the \Opt{fancyLists}
+and \Opt{tightLists} options are enabled. The macro receives two arguments: the
+style of the list item labels, and the style of delimiters between list
+item labels and texts. See the \mref{markdownRendererFancyOlBegin} macro for
+the valid style values.
+% \end{markdown}
+%
+% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererInputFencedCode{%
- \markdownRendererInputFencedCodePrototype}%
+\def\markdownRendererFancyOlBeginTight{%
+ \markdownRendererFancyOlBeginTightPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { inputFencedCode }
+ { fancyOlBeginTight }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { inputFencedCode }
+ { fancyOlBeginTight }
{ 2 }
\ExplSyntaxOff
% \end{macrocode}
@@ -13523,13 +13919,13 @@ following text except for the filename, which may differ:
%
%<*manual-tokens>
% \fi
+%
% \begin{markdown}
-#### 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.
+The \mdef{markdownRendererOlItem} macro represents an item in an ordered list.
+This macro will only be produced, when the \Opt{startNumber} option is
+disabled and the \Opt{fancyLists} option is disabled. The macro receives no
+arguments.
% \end{markdown}
%
@@ -13539,15 +13935,15 @@ option is enabled. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataBegin{%
- \markdownRendererJekyllDataBeginPrototype}%
+\def\markdownRendererOlItem{%
+ \markdownRendererOlItemPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataBegin }
+ { olItem }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataBegin }
+ { olItem }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -13560,9 +13956,9 @@ option is enabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataEnd} macro represents the end of a
-\acro{yaml} document. This macro will only be produced when the
-\Opt{jekyllData} option is enabled. The macro receives no arguments.
+The \mdef{markdownRendererOlItemEnd} macro represents the end of an item in
+an ordered list. This macro will only be produced, when the \Opt{fancyLists}
+option is disabled. The macro receives no arguments.
% \end{markdown}
%
@@ -13572,15 +13968,15 @@ The \mdef{markdownRendererJekyllDataEnd} macro represents the end of a
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataEnd{%
- \markdownRendererJekyllDataEndPrototype}%
+\def\markdownRendererOlItemEnd{%
+ \markdownRendererOlItemEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataEnd }
+ { olItemEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataEnd }
+ { olItemEnd }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -13593,11 +13989,10 @@ The \mdef{markdownRendererJekyllDataEnd} macro represents the end of a
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataMappingBegin} macro represents the
-beginning of a mapping in a \acro{yaml} document. This macro will only be
-produced when the \Opt{jekyllData} option is enabled. The macro receives two
-arguments: the scalar key in the parent structure, cast to a string following
-\acro{yaml} serialization rules, and the number of items in the mapping.
+The \mdef{markdownRendererOlItemWithNumber} macro represents an item in an
+ordered list. This macro will only be produced, when the \Opt{startNumber}
+option is enabled and the \Opt{fancyLists} option is disabled. The macro
+receives a single numeric argument that corresponds to the item number.
% \end{markdown}
%
@@ -13607,16 +14002,16 @@ arguments: the scalar key in the parent structure, cast to a string following
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataMappingBegin{%
- \markdownRendererJekyllDataMappingBeginPrototype}%
+\def\markdownRendererOlItemWithNumber{%
+ \markdownRendererOlItemWithNumberPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataMappingBegin }
+ { olItemWithNumber }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataMappingBegin }
- { 2 }
+ { olItemWithNumber }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13628,9 +14023,10 @@ arguments: the scalar key in the parent structure, cast to a string following
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataMappingEnd} macro represents the
-end of a mapping in a \acro{yaml} document. This macro will only be produced
-when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
+The \mdef{markdownRendererFancyOlItem} macro represents an item in a fancy
+ordered list. This macro will only be produced, when the \Opt{startNumber}
+option is disabled and the \Opt{fancyLists} option is enabled. The macro receives
+no arguments.
% \end{markdown}
%
@@ -13640,15 +14036,15 @@ when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataMappingEnd{%
- \markdownRendererJekyllDataMappingEndPrototype}%
+\def\markdownRendererFancyOlItem{%
+ \markdownRendererFancyOlItemPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataMappingEnd }
+ { fancyOlItem }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataMappingEnd }
+ { fancyOlItem }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -13661,11 +14057,9 @@ when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataSequenceBegin} macro represents the
-beginning of a sequence in a \acro{yaml} document. This macro will only be
-produced when the \Opt{jekyllData} option is enabled. The macro receives two
-arguments: the scalar key in the parent structure, cast to a string following
-\acro{yaml} serialization rules, and the number of items in the sequence.
+The \mdef{markdownRendererFancyOlItemEnd} macro represents the end of an item in
+a fancy ordered list. This macro will only be produced, when the \Opt{fancyLists}
+option is enabled. The macro receives no arguments.
% \end{markdown}
%
@@ -13675,16 +14069,16 @@ arguments: the scalar key in the parent structure, cast to a string following
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataSequenceBegin{%
- \markdownRendererJekyllDataSequenceBeginPrototype}%
+\def\markdownRendererFancyOlItemEnd{%
+ \markdownRendererFancyOlItemEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataSequenceBegin }
+ { fancyOlItemEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataSequenceBegin }
- { 2 }
+ { fancyOlItemEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13696,9 +14090,10 @@ arguments: the scalar key in the parent structure, cast to a string following
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataSequenceEnd} macro represents the
-end of a sequence in a \acro{yaml} document. This macro will only be produced
-when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
+The \mdef{markdownRendererFancyOlItemWithNumber} macro represents an item in a
+fancy ordered list. This macro will only be produced, when the \Opt{startNumber}
+and \Opt{fancyLists} options are enabled. The macro receives a single numeric
+argument that corresponds to the item number.
% \end{markdown}
%
@@ -13708,16 +14103,16 @@ when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataSequenceEnd{%
- \markdownRendererJekyllDataSequenceEndPrototype}%
+\def\markdownRendererFancyOlItemWithNumber{%
+ \markdownRendererFancyOlItemWithNumberPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataSequenceEnd }
+ { fancyOlItemWithNumber }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataSequenceEnd }
- { 0 }
+ { fancyOlItemWithNumber }
+ { 1 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13729,11 +14124,10 @@ when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataBoolean} macro represents a boolean scalar
-value in a \acro{yaml} document. This macro will only be produced when the
-\Opt{jekyllData} option is enabled. The macro receives two arguments: the
-scalar key in the parent structure, and the scalar value, both cast to a string
-following \acro{yaml} serialization rules.
+The \mdef{markdownRendererOlEnd} macro represents the end of an ordered list
+that contains an item with several paragraphs of text (the list is not
+tight). This macro will only be produced, when the \Opt{fancyLists} option is
+disabled. The macro receives no arguments.
% \end{markdown}
%
@@ -13743,16 +14137,16 @@ following \acro{yaml} serialization rules.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataBoolean{%
- \markdownRendererJekyllDataBooleanPrototype}%
+\def\markdownRendererOlEnd{%
+ \markdownRendererOlEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataBoolean }
+ { olEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataBoolean }
- { 2 }
+ { olEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13764,11 +14158,11 @@ following \acro{yaml} serialization rules.
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataNumber} macro represents a numeric scalar
-value in a \acro{yaml} document. This macro will only be produced when the
-\Opt{jekyllData} option is enabled. The macro receives two arguments: the
-scalar key in the parent structure, and the scalar value, both cast to a string
-following \acro{yaml} serialization rules.
+The \mdef{markdownRendererOlEndTight} macro represents the end of an ordered
+list that contains no item with several paragraphs of text (the list is
+tight). This macro will only be produced, when the \Opt{tightLists} option is
+enabled and the \Opt{fancyLists} option is disabled. The macro receives no
+arguments.
% \end{markdown}
%
@@ -13778,16 +14172,16 @@ following \acro{yaml} serialization rules.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataNumber{%
- \markdownRendererJekyllDataNumberPrototype}%
+\def\markdownRendererOlEndTight{%
+ \markdownRendererOlEndTightPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataNumber }
+ { olEndTight }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataNumber }
- { 2 }
+ { olEndTight }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13799,11 +14193,10 @@ following \acro{yaml} serialization rules.
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataString} macro represents a string scalar
-value in a \acro{yaml} document. This macro will only be produced when the
-\Opt{jekyllData} option is enabled. The macro receives two arguments: the
-scalar key in the parent structure, cast to a string following \acro{yaml}
-serialization rules, and the scalar value.
+The \mdef{markdownRendererFancyOlEnd} macro represents the end of a fancy
+ordered list that contains an item with several paragraphs of text (the list
+is not tight). This macro will only be produced, when the \Opt{fancyLists}
+option is enabled. The macro receives no arguments.
% \end{markdown}
%
@@ -13813,16 +14206,16 @@ serialization rules, and the scalar value.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererJekyllDataString{%
- \markdownRendererJekyllDataStringPrototype}%
+\def\markdownRendererFancyOlEnd{%
+ \markdownRendererFancyOlEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { jekyllDataString }
+ { fancyOlEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { jekyllDataString }
- { 2 }
+ { fancyOlEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -13834,59 +14227,79 @@ serialization rules, and the scalar value.
%
% \begin{markdown}
-The \mdef{markdownRendererJekyllDataEmpty} macro represents an empty scalar
-value in a \acro{yaml} document. This macro will only be produced when the
-\Opt{jekyllData} option is enabled. The macro receives one argument: the
-scalar key in the parent structure, cast to a string following \acro{yaml}
-serialization rules.
+The \mdef{markdownRendererFancyOlEndTight} macro represents the end of a
+fancy ordered list that contains no item with several paragraphs of text (the
+list is tight). This macro will only be produced, when the \Opt{fancyLists}
+and \Opt{tightLists} options are enabled. The macro receives no arguments.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionTightLists{true}
+\def\markdownOptionStartNumber{true}
+
+\def\markdownRendererInterblockSeparator{}
+\def\markdownRendererOlBeginTight{ (}
+\def\markdownRendererOlItemWithNumber#1{%
+ \ifnum #1=1\relax
+ the first
+ \else
+ \ifnum #1=2\relax
+ , the second
+ \else
+ , and the third
+ \fi
+ \fi
+}
+\def\markdownRendererOlItemEnd{}
+\def\markdownRendererOlEndTight{).}
+
+\markdownBegin
+This is a tight list
+
+1. item
+2. item
+3. item
+\markdownEnd
+
+\def\markdownRendererInterblockSeparator{%
+ :\par
+ \def\markdownRendererInterblockSeparator{\par}%
+}
+\def\markdownRendererOlBegin{}
+\def\markdownRendererOlItemWithNumber#1{%
+ #1.\kern 0.5em%
+ This is the
+ \ifnum #1=1\relax
+ first
+ \else
+ \ifnum #1=2\relax
+ second
+ \else
+ third
+ \fi
+ \fi
+}
+\def\markdownRendererOlItemEnd{.\par}
+\def\markdownRendererOlEnd{}
+
+\markdownBegin
+This is a loose list
-% 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
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererJekyllDataEmpty{%
- \markdownRendererJekyllDataEmptyPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { jekyllDataEmpty }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { jekyllDataEmpty }
- { 1 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
+1. item
-##### Plain \TeX{} Example {.unnumbered}
+2. item
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\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
----
+3. item
\markdownEnd
+
\bye
```````
Next, invoke LuaTeX from the terminal:
@@ -13896,7 +14309,15 @@ luatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Jane Doe is 99 years old.
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> 1. This is the first item.
+>
+> 2. This is the second item.
+>
+> 3. This is the third item.
##### \LaTeX{} Example {.unnumbered}
@@ -13904,22 +14325,66 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[jekyllData]{markdown}
-\markdownSetup{
+\usepackage[tightLists, startNumber]{markdown}
+\begin{document}
+
+\begin{markdown*}{
renderers = {
- jekyllDataString = {\gdef\name{#2}},
- jekyllDataNumber = {\gdef\age{#2}},
- jekyllDataEnd = {\name{} is \age{} years old.},
- }
+ interblockSeparator = {},
+ olBeginTight = { (},
+ olItemWithNumber = {%
+ \ifnum #1=1\relax
+ the first
+ \else
+ \ifnum #1=2\relax
+ , the second
+ \else
+ , and the third
+ \fi
+ \fi
+ },
+ olItemEnd = {},
+ olEndTight = {).},
+ },
}
-\begin{document}
+This is a tight list
-\begin{markdown}
----
-name: Jane Doe
-age: 99
----
-\end{markdown}
+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}
```````
@@ -13930,7 +14395,15 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Jane Doe is 99 years old.
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> 1. This is the first item.
+>
+> 2. This is the second item.
+>
+> 3. This is the third item.
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -13938,18 +14411,66 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\setupmarkdown[jekyllData = yes]
-\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}}
-\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}}
-\def\markdownRendererJekyllDataEnd{%
- \name{} is \age{} years old.}
+\setupmarkdown
+ [
+ tightLists = yes,
+ startNumber = yes,
+ ]
\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
----
-name: Jane Doe
-age: 99
----
+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
@@ -13961,67 +14482,31 @@ context document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> Jane Doe is 99 years old.
-
-% \fi
-%
-% \begin{markdown}
-
-#### Heading Renderers
-The \mdef{markdownRendererHeadingOne} macro represents a first level heading.
-The macro receives a single argument that corresponds to the heading text.
-
-% \end{markdown}
-%
-% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererHeadingOne{%
- \markdownRendererHeadingOnePrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { headingOne }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { headingOne }
- { 1 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-
-The \mdef{markdownRendererHeadingTwo} macro represents a second level
-heading. The macro receives a single argument that corresponds to the heading
-text.
-
-% \end{markdown}
-%
-% \iffalse
+> This is a tight list (the first item, the second item, and the third item).
+>
+> This is a loose list:
+>
+> 1. This is the first item.
+>
+> 2. This is the second item.
+>
+> 3. This is the third item.
+
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererHeadingTwo{%
- \markdownRendererHeadingTwoPrototype}%
+\def\markdownRendererFancyOlEndTight{%
+ \markdownRendererFancyOlEndTightPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { headingTwo }
+ { fancyOlEndTight }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { headingTwo }
- { 1 }
+ { fancyOlEndTight }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -14033,60 +14518,91 @@ text.
%
% \begin{markdown}
-The \mdef{markdownRendererHeadingThree} macro represents a third level
-heading. The macro receives a single argument that corresponds to the heading
-text.
+#### Parenthesized Citations Renderer
+The \mdef{markdownRendererCite} macro represents a string of one or more
+parenthetical citations. This macro will only be produced, when the
+\Opt{citations} option is enabled. The macro receives the parameter
+`{`\meta{number of citations}`}` followed by \meta{suppress author}
+`{`\meta{prenote}`}{`\meta{postnote}`}{`\meta{name}`}` repeated
+\meta{number of citations} times. The \meta{suppress author} parameter is
+either the token `-`, when the author's name is to be suppressed, or `+`
+otherwise.
% \end{markdown}
%
% \iffalse
-%
-%<*tex>
-% \fi
-%
-% \begin{macrocode}
-\def\markdownRendererHeadingThree{%
- \markdownRendererHeadingThreePrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { headingThree }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { headingThree }
- { 1 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
-% \fi
-%
-% \begin{markdown}
-The \mdef{markdownRendererHeadingFour} macro represents a fourth level
-heading. The macro receives a single argument that corresponds to the heading
-text.
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[citations]{markdown}
+\newcount\citationsCounter
+\newcount\citationsTotal
+\makeatletter
+\def\citations#1#2#3#4{%
+ a parenthesized citation \emph{#4}
+ \advance\citationsCounter by 1\relax
+ \ifx\relax#2\relax
+ \ifx\relax#3\relax\else
+ with a postfix \emph{#3}%
+ \fi
+ \else
+ with a prefix \emph{#2}%
+ \ifx\relax#3\relax\else
+ \ and a postfix \emph{#3}%
+ \fi
+ \fi
+ \ifnum\citationsCounter>\citationsTotal\relax
+ .%
+ \expandafter\@gobble
+ \else
+ , and
+ \fi\citations}
+\makeatother
+\markdownSetup{
+ renderers = {
+ cite = {%
+ \citationsCounter=1%
+ \citationsTotal=#1%
+ This is
+ \expandafter\citations
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+[see @abrahams90, pp. 12; @eijkhout91, pp. 34]
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is a parenthesized citation *abrahams90* with a prefix see
+> and a postfix *pp. 12*, and a citation *eijkhout91* with a
+> postfix *pp. 34*.
-% \end{markdown}
-%
-% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererHeadingFour{%
- \markdownRendererHeadingFourPrototype}%
+\def\markdownRendererCite{%
+ \markdownRendererCitePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { headingFour }
+ { cite }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { headingFour }
+ { cite }
{ 1 }
\ExplSyntaxOff
% \end{macrocode}
@@ -14099,9 +14615,12 @@ text.
%
% \begin{markdown}
-The \mdef{markdownRendererHeadingFive} macro represents a fifth level
-heading. The macro receives a single argument that corresponds to the heading
-text.
+#### Raw Content Renderers
+The \mdef{markdownRendererInputRawInline} macro represents an inline raw span.
+The macro receives two arguments: the filename of a file contaning the inline
+raw span contents and the raw attribute that designates the format of the
+inline raw span. This macro will only be produced, when the \Opt{rawAttribute}
+option is enabled.
% \end{markdown}
%
@@ -14111,16 +14630,16 @@ text.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererHeadingFive{%
- \markdownRendererHeadingFivePrototype}%
+\def\markdownRendererInputRawInline{%
+ \markdownRendererInputRawInlinePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { headingFive }
+ { inputRawInline }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { headingFive }
- { 1 }
+ { inputRawInline }
+ { 2 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -14132,129 +14651,77 @@ text.
%
% \begin{markdown}
-The \mdef{markdownRendererHeadingSix} macro represents a sixth level
-heading. The macro receives a single argument that corresponds to the heading
-text.
+The \mdef{markdownRendererInputRawBlock} macro represents a raw block. The
+macro receives two arguments: the filename of a file contaning the raw block
+and the raw attribute that designates the format of the raw block. This macro
+will only be produced, when the \Opt{rawAttribute} and \Opt{fencedCode} options
+are enabled.
% \end{markdown}
%
% \iffalse
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownRendererInterblockSeparator{}
-\def\markdownRendererHeadingOne{1}
-\def\markdownRendererHeadingTwo{2}
-\def\markdownRendererHeadingThree{3}
-\def\markdownRendererHeadingFour{4}
-\def\markdownRendererHeadingFive{5}
-\def\markdownRendererHeadingSix{6}
-\markdownBegin
-######
-#####
-#####
-###
-######
-\markdownEnd
-\bye
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> 65536
-
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
-``` tex
+```` tex
\documentclass{article}
-\usepackage{markdown}
+\usepackage[rawAttribute, fencedCode]{markdown}
+\usepackage{expl3}
+\ExplSyntaxOn
+\cs_new:Nn
+ \display_raw_content:nn
+ {
+ % If the raw attribute is TeX, execute the content as a TeX document.
+ \str_if_eq:nnTF
+ { #2 }
+ { tex }
+ { \markdownEscape { #1 } }
+ % Otherwise, ignore the content.
+ { }
+ }
\markdownSetup{
renderers = {
- interblockSeparator = {},
- headingOne = 1,
- headingTwo = 2,
- headingThree = 3,
- headingFour = 4,
- headingFive = 5,
- headingSix = 6,
+ rawInline = { \display_raw_content:nn { #1 } { #2 } },
+ rawBlock = { \display_raw_content:nn { #1 } { #2 } }
},
}
+\ExplSyntaxOff
\begin{document}
\begin{markdown}
-######
-#####
-#####
-###
-######
-\end{markdown}
-\end{document}
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> 65536
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\def\markdownRendererInterblockSeparator{}
-\def\markdownRendererHeadingOne{1}
-\def\markdownRendererHeadingTwo{2}
-\def\markdownRendererHeadingThree{3}
-\def\markdownRendererHeadingFour{4}
-\def\markdownRendererHeadingFive{5}
-\def\markdownRendererHeadingSix{6}
-\starttext
-\startmarkdown
-######
-#####
-#####
-###
-######
-\stopmarkdown
-\stoptext
-```````
+`$H_2 O$`{=tex} is a liquid.
+
+``` {=html}
+
Here is some HTML content that will be ignored.
+```
+\end{markdown}
+\end{document}
+````
Next, invoke LuaTeX from the terminal:
``` sh
-context document.tex
+lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
-> 65536
+> H~2~O is a liquid.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererHeadingSix{%
- \markdownRendererHeadingSixPrototype}%
+\def\markdownRendererInputRawBlock{%
+ \markdownRendererInputRawBlockPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { headingSix }
+ { inputRawBlock }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { headingSix }
- { 1 }
+ { inputRawBlock }
+ { 2 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -14266,9 +14733,27 @@ following text:
%
% \begin{markdown}
-#### Thematic Break Renderer
-The \mdef{markdownRendererThematicBreak} macro represents a thematic break.
-The macro receives no arguments.
+#### Special Character Renderers
+The following macros replace any special plain \TeX{} characters, including
+% \iffalse
+the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text:
+
+- \mdef{markdownRendererAmpersand} replaces the ampersand (`&`).
+- \mdef{markdownRendererBackslash} replaces the backslash (`\`).
+- \mdef{markdownRendererCircumflex} replaces the circumflex (`^`).
+- \mdef{markdownRendererDollarSign} replaces the dollar sign (`$`).
+- \mdef{markdownRendererHash} replaces the hash sign (`#`).
+- \mdef{markdownRendererLeftBrace} replaces the left brace (`{`).
+- \mdef{markdownRendererPercentSign} replaces the percent sign (`%`).
+- \mdef{markdownRendererPipe} replaces the pipe character (`|`).
+- \mdef{markdownRendererRightBrace} replaces the right brace (`}`).
+- \mdef{markdownRendererTilde} replaces the tilde (`~`).
+- \mdef{markdownRendererUnderscore} replaces the underscore (`_`).
+
+% \fi
+% the active pipe character (`|`) of \Hologo{ConTeXt}, in the input text.
+% These macros will only be produced, when the \Opt{hybrid} option is
+% `false`.
% \end{markdown}
%
@@ -14277,16 +14762,13 @@ The macro receives no arguments.
##### Plain \TeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
-following content:
+following content. We will make the tilde behave as if it were written in
+\TeX{}, where it represents a non-breaking space.
``` tex
\input markdown
-\def\markdownRendererThematicBreak{\vfil\break}
+\def\markdownRendererTilde{~}
\markdownBegin
-This is the first page.
-
-***
-
-This is the second page.
+Bartel~Leendert van~der~Waerden
\markdownEnd
\bye
```````
@@ -14295,33 +14777,26 @@ Next, invoke LuaTeX from the terminal:
luatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
-following text:
+following text, where the middot (`·`) denotes a non-breaking space:
-> This is the first page.
->
-> ***
->
-> This is the second page.
+> Bartel·Leendert van·der·Waerden
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
-following content:
+following content. We will make the tilde behave as if it were written in
+\TeX{}, where it represents a non-breaking space.
``` tex
\documentclass{article}
\usepackage{markdown}
\markdownSetup{
renderers = {
- thematicBreak = \newpage,
+ tilde = ~,
},
}
\begin{document}
\begin{markdown}
-This is the first page.
-
-***
-
-This is the second page.
+Bartel~Leendert van~der~Waerden
\end{markdown}
\end{document}
```````
@@ -14330,28 +14805,21 @@ Next, invoke LuaTeX from the terminal:
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
-following text:
+following text, where the middot (`·`) denotes a non-breaking space:
-> This is the first page.
->
-> ***
->
-> This is the second page.
+> Bartel·Leendert van·der·Waerden
##### \Hologo{ConTeXt} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
-following content:
+following content. We will make the tilde behave as if it were written in
+\TeX{}, where it represents a non-breaking space.
``` tex
\usemodule[t][markdown]
-\def\markdownRendererThematicBreak{\page[yes]}
+\def\markdownRendererTilde{~}
\starttext
\startmarkdown
-This is the first page.
-
-***
-
-This is the second page.
+Bartel~Leendert van~der~Waerden
\stopmarkdown
\stoptext
```````
@@ -14360,68 +14828,134 @@ Next, invoke LuaTeX from the terminal:
context document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
-following text:
+following text, where the middot (`·`) denotes a non-breaking space:
-> This is the first page.
->
-> ***
->
-> This is the second page.
+> Bartel·Leendert van·der·Waerden
%
%<*tex>
% \fi
-% \begin{markdown}
-%
-% The \mdef{markdownRendererHorizontalRule} and
-% \mdef{markdownRendererHorizontalRulePrototype} macros have been deprecated
-% and will be removed in Markdown 3.0.0.
%
-% \end{markdown}
% \begin{macrocode}
+\def\markdownRendererLeftBrace{%
+ \markdownRendererLeftBracePrototype}%
\ExplSyntaxOn
-\cs_new:Npn
- \markdownRendererThematicBreak
- {
- \cs_if_exist:NTF
- \markdownRendererHorizontalRule
- {
- \markdownWarning
- {
- Horizontal~rule~renderer~has~been~deprecated,~
- to~be~removed~in~Markdown~3.0.0
- }
- \markdownRendererHorizontalRule
- }
- {
- \cs_if_exist:NTF
- \markdownRendererHorizontalRulePrototype
- {
- \markdownWarning
- {
- Horizontal~rule~renderer~prototype~has~been~deprecated,~
- to~be~removed~in~Markdown~3.0.0
- }
- \markdownRendererHorizontalRulePrototype
- }
- {
- \markdownRendererThematicBreakPrototype
- }
- }
- }
\seq_gput_right:Nn
\g_@@_renderers_seq
- { horizontalRule }
+ { leftBrace }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { horizontalRule }
+ { leftBrace }
{ 0 }
+\ExplSyntaxOff
+\def\markdownRendererRightBrace{%
+ \markdownRendererRightBracePrototype}%
+\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { thematicBreak }
+ { rightBrace }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { thematicBreak }
+ { rightBrace }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererDollarSign{%
+ \markdownRendererDollarSignPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { dollarSign }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { dollarSign }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererPercentSign{%
+ \markdownRendererPercentSignPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { percentSign }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { percentSign }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererAmpersand{%
+ \markdownRendererAmpersandPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { ampersand }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { ampersand }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererUnderscore{%
+ \markdownRendererUnderscorePrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { underscore }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { underscore }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererHash{%
+ \markdownRendererHashPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { hash }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { hash }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererCircumflex{%
+ \markdownRendererCircumflexPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { circumflex }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { circumflex }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererBackslash{%
+ \markdownRendererBackslashPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { backslash }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { backslash }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererTilde{%
+ \markdownRendererTildePrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { tilde }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { tilde }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererPipe{%
+ \markdownRendererPipePrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { pipe }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { pipe }
{ 0 }
\ExplSyntaxOff
% \end{macrocode}
@@ -14432,12 +14966,13 @@ following text:
%<*manual-tokens>
% \fi
%
-% \begin{markdown}
-
-#### Note Renderer
-The \mdef{markdownRendererNote} macro represents a note. This macro
-will only be produced, when the \Opt{notes} option is enabled. The
-macro receives a single argument that corresponds to the note text.
+% \begin{markdown}
+
+#### Strike-Through Renderer
+The \mdef{markdownRendererStrikeThrough} macro represents a strike-through span of
+text. The macro receives a single argument that corresponds to the striked-out
+span of text. This macro will only be produced, when the \Opt{strikeThrough}
+option is enabled.
% \end{markdown}
%
@@ -14449,14 +14984,11 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
-\def\markdownOptionNotes{true}
-\def\markdownRendererNote#1{ (and \lowercase{#1})}
+\def\markdownOptionStrikeThrough{true}
+\input soulutf8.sty
+\def\markdownRendererStrikeThrough#1{\st{#1}}
\markdownBegin
-This is some text[^1] and this is some other text[^2].
-
- [^1]: this is a note
-
- [^2]: this is some other note
+This is ~~a lunar roving vehicle~~ strike-through text.
\markdownEnd
\bye
```````
@@ -14467,8 +14999,7 @@ 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 note) and this is some other
-> text (and this is some other note).
+> This is ~~a lunar roving vehicle~~ strike-through text.
##### \LaTeX{} Example {.unnumbered}
@@ -14476,19 +15007,16 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[notes]{markdown}
+\usepackage[strikeThrough]{markdown}
+\usepackage{soulutf8}
\markdownSetup{
renderers = {
- note = { (and \MakeLowercase{#1})},
+ strikeThrough = {\st{#1}},
},
}
\begin{document}
\begin{markdown}
-This is some text[^1] and this is some other text[^2].
-
- [^1]: this is a note
-
- [^2]: this is some other note
+This is ~~a lunar roving vehicle~~ strike-through text.
\end{markdown}
\end{document}
```````
@@ -14499,8 +15027,7 @@ 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 note) and this is some other
-> text (and this is some other note).
+> This is ~~a lunar roving vehicle~~ strike-through text.
##### \Hologo{ConTeXt} Example {.unnumbered}
@@ -14508,15 +15035,11 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
-\setupmarkdown[notes = yes]
-\def\markdownRendererNote#1{ (and \lowercase{#1})}
+\setupmarkdown[strikeThrough = yes]
+\def\markdownRendererStrikeThrough#1{\overstrikes{#1}}
\starttext
\startmarkdown
-This is some text[^1] and this is some other text[^2].
-
- [^1]: this is a note
-
- [^2]: this is some other note
+This is ~~a lunar roving vehicle~~ strike-through text.
\stopmarkdown
\stoptext
```````
@@ -14527,63 +15050,22 @@ 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 note) and this is some other
-> text (and this is some other note).
+> This is ~~a lunar roving vehicle~~ strike-through text.
%
%<*tex>
% \fi
-% \begin{markdown}
-%
-% The \mdef{markdownRendererFootnote} and
-% \mdef{markdownRendererFootnotePrototype} macros have been deprecated
-% and will be removed in Markdown 3.0.0.
%
-% \end{markdown}
% \begin{macrocode}
+\def\markdownRendererStrikeThrough{%
+ \markdownRendererStrikeThroughPrototype}%
\ExplSyntaxOn
-\cs_new:Npn
- \markdownRendererNote
- {
- \cs_if_exist:NTF
- \markdownRendererFootnote
- {
- \markdownWarning
- {
- Footnote~renderer~has~been~deprecated,~
- to~be~removed~in~Markdown~3.0.0
- }
- \markdownRendererFootnote
- }
- {
- \cs_if_exist:NTF
- \markdownRendererFootnotePrototype
- {
- \markdownWarning
- {
- Footnote~renderer~prototype~has~been~deprecated,~
- to~be~removed~in~Markdown~3.0.0
- }
- \markdownRendererFootnotePrototype
- }
- {
- \markdownRendererNotePrototype
- }
- }
- }
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { footnote }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { footnote }
- { 1 }
\seq_gput_right:Nn
\g_@@_renderers_seq
- { note }
+ { strikeThrough }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { note }
+ { strikeThrough }
{ 1 }
\ExplSyntaxOff
% \end{macrocode}
@@ -14596,63 +15078,53 @@ following text:
%
% \begin{markdown}
-#### Parenthesized Citations Renderer
-The \mdef{markdownRendererCite} macro represents a string of one or more
-parenthetical citations. This macro will only be produced, when the
-\Opt{citations} option is enabled. The macro receives the parameter
-`{`\meta{number of citations}`}` followed by \meta{suppress author}
-`{`\meta{prenote}`}{`\meta{postnote}`}{`\meta{name}`}` repeated
-\meta{number of citations} times. The \meta{suppress author} parameter is
-either the token `-`, when the author's name is to be suppressed, or `+`
-otherwise.
+#### Subscript Renderer
+The \mdef{markdownRendererSubscript} macro represents a subscript span of
+text. The macro receives a single argument that corresponds to the subscript
+span of text. This macro will only be produced, when the \Opt{subscripts}
+option is enabled.
% \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\markdownOptionSubscripts{true}
+\def\markdownRendererSubscript#1{ (#1 moles) and }
+\markdownBegin
+H~2~O is a liquid.
+\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:
+
+> H (2 moles) and O is a liquid.
+
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[citations]{markdown}
-\newcount\citationsCounter
-\newcount\citationsTotal
-\makeatletter
-\def\citations#1#2#3#4{%
- a parenthesized citation \emph{#4}
- \advance\citationsCounter by 1\relax
- \ifx\relax#2\relax
- \ifx\relax#3\relax\else
- with a postfix \emph{#3}%
- \fi
- \else
- with a prefix \emph{#2}%
- \ifx\relax#3\relax\else
- \ and a postfix \emph{#3}%
- \fi
- \fi
- \ifnum\citationsCounter>\citationsTotal\relax
- .%
- \expandafter\@gobble
- \else
- , and
- \fi\citations}
-\makeatother
+\usepackage[subscripts]{markdown}
\markdownSetup{
renderers = {
- cite = {%
- \citationsCounter=1%
- \citationsTotal=#1%
- This is
- \expandafter\citations
- },
+ subscript = { (#1 moles) and },
},
}
\begin{document}
\begin{markdown}
-[see @abrahams90, pp. 12; @eijkhout91, pp. 34]
+H~2~O is a liquid.
\end{markdown}
\end{document}
```````
@@ -14663,26 +15135,46 @@ 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*.
+> H (2 moles) and O is a liquid.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\setupmarkdown[subscripts = yes]
+\def\markdownRendererSubscript#1{ (#1 moles) and }
+\starttext
+\startmarkdown
+H~2~O is a liquid.
+\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:
+
+> H (2 moles) and O is a liquid.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererCite{%
- \markdownRendererCitePrototype}%
+\def\markdownRendererSubscript{%
+ \markdownRendererSubscriptPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { cite }
+ { subscript }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { cite }
+ { subscript }
{ 1 }
-\ExplSyntaxOff
% \end{macrocode}
% \par
%
@@ -14693,59 +15185,53 @@ following text:
%
% \begin{markdown}
-#### Text Citations Renderer
-The \mdef{markdownRendererTextCite} macro represents a string of one or more
-text citations. This macro will only be produced, when the
-\Opt{citations} option is enabled. The macro receives parameters in the same
-format as the \mref{markdownRendererCite} macro.
+#### Superscript Renderer
+The \mdef{markdownRendererSuperscript} macro represents a superscript span of
+text. The macro receives a single argument that corresponds to the superscript
+span of text. This macro will only be produced, when the \Opt{superscripts}
+option is enabled.
% \end{markdown}
%
% \iffalse
-##### \LaTeX{} Example {.unnumbered}
+##### Plain \TeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
-\documentclass{article}
-\usepackage[citations]{markdown}
-\newcount\citationsCounter
-\newcount\citationsTotal
-\makeatletter
-\def\citations#1#2#3#4{%
- a text citation \emph{#4}
- \advance\citationsCounter by 1\relax
- \ifx\relax#2\relax
- \ifx\relax#3\relax\else
- with a postfix \emph{#3}%
- \fi
- \else
- with a prefix \emph{#2}%
- \ifx\relax#3\relax\else
- \ and a postfix \emph{#3}%
- \fi
- \fi
- \ifnum\citationsCounter>\citationsTotal\relax
- .%
- \expandafter\@gobble
- \else
- , and
- \fi\citations}
-\makeatother
+\input markdown
+\def\markdownOptionSuperscripts{true}
+\def\markdownRendererSuperscript#1{ taken to the power of #1}
+\markdownBegin
+2^10^ is 1024.
+\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:
+
+> 2 taken to the power of 10 is 1024.
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[superscripts]{markdown}
\markdownSetup{
renderers = {
- textCite = {%
- \citationsCounter=1%
- \citationsTotal=#1%
- This is
- \expandafter\citations
- },
+ superscript = { taken to the power of #1},
},
}
\begin{document}
\begin{markdown}
-@abrahams90 [pp. 12; also @eijkhout91]
+2^10^ is 1024.
\end{markdown}
\end{document}
```````
@@ -14756,23 +15242,45 @@ 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*.
+> 2 taken to the power of 10 is 1024.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\setupmarkdown[superscripts = yes]
+\def\markdownRendererSuperscript#1{ taken to the power of #1}
+\starttext
+\startmarkdown
+2^10^ is 1024.
+\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:
+
+> 2 taken to the power of 10 is 1024.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererTextCite{%
- \markdownRendererTextCitePrototype}%
+\def\markdownRendererSuperscript{%
+ \markdownRendererSuperscriptPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { textCite }
+ { superscript }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { textCite }
+ { superscript }
{ 1 }
\ExplSyntaxOff
% \end{macrocode}
@@ -14912,16 +15420,11 @@ following text:
%
% \begin{markdown}
-#### HTML Comment Renderers
-
-The \mdef{markdownRendererInlineHtmlComment} macro represents the contents of an
-inline \acro{HTML} comment. This macro will only be produced, when the
-\Opt{html} option is enabled. The macro receives a single argument that
-corresponds to the contents of the \acro{HTML} comment.
-
-The \mdef{markdownRendererBlockHtmlCommentBegin} and
-\mdef{markdownRendererBlockHtmlCommentEnd} macros represent the beginning
-and the end of a block \acro{HTML} comment. The macros receive no arguments.
+#### Text Citations Renderer
+The \mdef{markdownRendererTextCite} macro represents a string of one or more
+text citations. This macro will only be produced, when the
+\Opt{citations} option is enabled. The macro receives parameters in the same
+format as the \mref{markdownRendererCite} macro.
% \end{markdown}
%
@@ -14933,91 +15436,72 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[html]{markdown}
-\usepackage{marginnote}
+\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 = {
- inlineHtmlComment = {\marginnote{#1}},
- blockHtmlCommentBegin = {\begin{quote}},
- blockHtmlCommentEnd = {\end{quote}},
+ textCite = {%
+ \citationsCounter=1%
+ \citationsTotal=#1%
+ This is
+ \expandafter\citations
+ },
},
}
\begin{document}
\begin{markdown}
-A useful use of inline HTML comments are side notes.
-
-
-We can render block HTML comments as blockquotes:
-
-
+@abrahams90 [pp. 12; also @eijkhout91]
\end{markdown}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
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.
->
-> 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
-
-The horizontal margins should contain the following text:
+following text:
-> Side notes are displayed in the horizontal margins next to the relevant
-> passages, which makes them *easier for the reader to find* than notes.
+> This is a text citation *abrahams90* with a postfix *pp. 12*,
+> and a citation *eijkhout91* with a prefix *also*.
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererInlineHtmlComment{%
- \markdownRendererInlineHtmlCommentPrototype}%
+\def\markdownRendererTextCite{%
+ \markdownRendererTextCitePrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { inlineHtmlComment }
+ { textCite }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { inlineHtmlComment }
+ { textCite }
{ 1 }
\ExplSyntaxOff
-\def\markdownRendererBlockHtmlCommentBegin{%
- \markdownRendererBlockHtmlCommentBeginPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { blockHtmlCommentBegin }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { blockHtmlCommentBegin }
- { 0 }
-\ExplSyntaxOff
-\def\markdownRendererBlockHtmlCommentEnd{%
- \markdownRendererBlockHtmlCommentEndPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { blockHtmlCommentEnd }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { blockHtmlCommentEnd }
- { 0 }
-\ExplSyntaxOff
% \end{macrocode}
% \par
%
@@ -15028,83 +15512,163 @@ The horizontal margins should contain the following text:
%
% \begin{markdown}
-#### HTML Tag and Element Renderers
-
-The \mdef{markdownRendererInlineHtmlTag} macro represents an opening, closing,
-or empty inline \acro{HTML} tag. This macro will only be produced, when the
-\Opt{html} option is enabled. The macro receives a single argument that
-corresponds to the contents of the \acro{HTML} tag.
-
-The \mdef{markdownRendererInputBlockHtmlElement} macro represents a block
-\acro{HTML} element. This macro will only be produced, when the \Opt{html}
-option is enabled. The macro receives a single argument that filename of a file
-containing the contents of the \acro{HTML} element.
+#### Thematic Break Renderer
+The \mdef{markdownRendererThematicBreak} macro represents a thematic break.
+The macro receives no arguments.
% \end{markdown}
%
% \iffalse
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownRendererThematicBreak{\vfil\break}
+\markdownBegin
+This is the first page.
+
+***
+
+This is the second page.
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is the first page.
+>
+> ***
+>
+> This is the second page.
+
##### \LaTeX{} Example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[html]{markdown}
-\usepackage{marginnote}
-\usepackage{verbatim}
+\usepackage{markdown}
\markdownSetup{
renderers = {
- inlineHtmlTag = {\textbf{#1}},
- inputBlockHtmlElement = {\verbatiminput{#1}},
+ thematicBreak = \newpage,
},
}
\begin{document}
\begin{markdown}
-_Hello,_ world!
+This is the first page.
-
_Hello,_ world!
+***
+
+This is the second page.
\end{markdown}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
-lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
-following body text:
+following text:
-> ****_Hello,_ world!** **
+> This is the first page.
>
->
_Hello,_ world!
+> ***
+>
+> This is the second page.
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\def\markdownRendererThematicBreak{\page[yes]}
+\starttext
+\startmarkdown
+This is the first page.
+
+***
+
+This is the second page.
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> This is the first page.
+>
+> ***
+>
+> This is the second page.
%
%<*tex>
% \fi
+% \begin{markdown}
%
+% The \mdef{markdownRendererHorizontalRule} and
+% \mdef{markdownRendererHorizontalRulePrototype} macros have been deprecated
+% and will be removed in Markdown 3.0.0.
+%
+% \end{markdown}
% \begin{macrocode}
-\def\markdownRendererInlineHtmlTag{%
- \markdownRendererInlineHtmlTagPrototype}%
\ExplSyntaxOn
+\cs_new:Npn
+ \markdownRendererThematicBreak
+ {
+ \cs_if_exist:NTF
+ \markdownRendererHorizontalRule
+ {
+ \markdownWarning
+ {
+ Horizontal~rule~renderer~has~been~deprecated,~
+ to~be~removed~in~Markdown~3.0.0
+ }
+ \markdownRendererHorizontalRule
+ }
+ {
+ \cs_if_exist:NTF
+ \markdownRendererHorizontalRulePrototype
+ {
+ \markdownWarning
+ {
+ Horizontal~rule~renderer~prototype~has~been~deprecated,~
+ to~be~removed~in~Markdown~3.0.0
+ }
+ \markdownRendererHorizontalRulePrototype
+ }
+ {
+ \markdownRendererThematicBreakPrototype
+ }
+ }
+ }
\seq_gput_right:Nn
\g_@@_renderers_seq
- { inlineHtmlTag }
+ { horizontalRule }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { inlineHtmlTag }
- { 1 }
-\ExplSyntaxOff
-\def\markdownRendererInputBlockHtmlElement{%
- \markdownRendererInputBlockHtmlElementPrototype}%
-\ExplSyntaxOn
+ { horizontalRule }
+ { 0 }
\seq_gput_right:Nn
\g_@@_renderers_seq
- { inputBlockHtmlElement }
+ { thematicBreak }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { inputBlockHtmlElement }
- { 1 }
+ { thematicBreak }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -15116,25 +15680,13 @@ following body text:
%
% \begin{markdown}
-#### Attribute Renderers
-The following macros are only produced, when the \Opt{headerAttributes} option
-is enabled.
-
-\mdef{markdownRendererAttributeIdentifier} represents the \meta{identifier} of
-a markdown element (`id="`\meta{identifier}`"` in HTML and `#`\meta{identifier}
-in Markdown's \Opt{headerAttributes} syntax extension). The macro receives a
-single attribute that corresponds to the \meta{identifier}.
-
-\mdef{markdownRendererAttributeClassName} represents the \meta{class name} of a
-markdown element (`class="`\meta{class name} ...`"` in HTML and
-`.`\meta{class name} in Markdown's \Opt{headerAttributes} syntax extension).
-The macro receives a single attribute that corresponds to the \meta{class
-name}.
-
-\mdef{markdownRendererAttributeKeyValue} represents a HTML attribute in the form
-\meta{key}`=`\meta{value} that is neither an identifier nor a class name.
-The macro receives two attributes that correspond to the \meta{key} and the
-\meta{value}, respectively.
+#### Tickbox Renderers
+The macros named \mdef{markdownRendererTickedBox},
+\mdef{markdownRendererHalfTickedBox}, and \mdef{markdownRendererUntickedBox}
+represent ticked and unticked boxes, respectively. These macros will either be
+produced, when the \Opt{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.
% \end{markdown}
%
@@ -15146,35 +15698,17 @@ Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
-\usepackage[headerAttributes, underscores=false]{markdown}
+\usepackage[taskLists]{markdown}
\markdownSetup{
renderers = {
- attributeIdentifier = {%
- \par
- \emph{(Identifier: #1)}
- \par
- },
- attributeClassName = {%
- \par
- \emph{(Class name: #1)}
- \par
- },
- attributeKeyValue = {%
- \par
- \emph{(Key: #1, Value: #2)}
- \par
- },
+ untickedBox = No,
+ tickedBox = Yes,
},
}
\begin{document}
\begin{markdown}
-
-# First top-level heading {jane=doe}
-
-## A subheading {#identifier}
-
-# Second top-level heading {.class_name}
-
+- [ ] you can't.
+- [x] I can!
\end{markdown}
\end{document}
```````
@@ -15185,55 +15719,72 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> # First top-level heading
->
-> *(Key: Jane, Value: Doe)*
->
-> ## A subheading
->
-> *(Identifier: identifier)*
->
-> # Second top-level heading
->
-> *(Class name: class\_name)*
+> - No you can't.
+> - Yes I can!
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\setupmarkdown[taskLists = yes]
+\def\markdownRendererUntickedBox{No}
+\def\markdownRendererTickedBox{Yes}
+\starttext
+\startmarkdown
+- [ ] you can't.
+- [x] I can!
+\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:
+
+> - No you can't.
+> - Yes I can!
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererAttributeIdentifier{%
- \markdownRendererAttributeIdentifierPrototype}%
+\def\markdownRendererTickedBox{%
+ \markdownRendererTickedBoxPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { attributeIdentifier }
+ { tickedBox }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { attributeIdentifier }
- { 1 }
+ { tickedBox }
+ { 0 }
\ExplSyntaxOff
-\def\markdownRendererAttributeClassName{%
- \markdownRendererAttributeClassNamePrototype}%
+\def\markdownRendererHalfTickedBox{%
+ \markdownRendererHalfTickedBoxPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { attributeClassName }
+ { halfTickedBox }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { attributeClassName }
- { 1 }
+ { halfTickedBox }
+ { 0 }
\ExplSyntaxOff
-\def\markdownRendererAttributeKeyValue{%
- \markdownRendererAttributeKeyValuePrototype}%
+\def\markdownRendererUntickedBox{%
+ \markdownRendererUntickedBoxPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { attributeKeyValue }
+ { untickedBox }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { attributeKeyValue }
- { 2 }
+ { untickedBox }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -15245,99 +15796,98 @@ following text:
%
% \begin{markdown}
-#### Header Attribute Context Renderers
-The following macros are only produced, when the \Opt{headerAttributes} option
-is enabled.
+#### YAML Metadata Renderers {#yamlmetadatarenderers}
-The \mdef{markdownRendererHeaderAttributeContextBegin} and
-\mdef{markdownRendererHeaderAttributeContextEnd} macros represent the beginning
-and the end of a section in which the attributes of a heading apply. The macros
-receive no arguments.
+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.
% \end{markdown}
%
% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererJekyllDataBegin{%
+ \markdownRendererJekyllDataBeginPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { jekyllDataBegin }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { jekyllDataBegin }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererJekyllDataEnd} macro represents the end of a
+\acro{yaml} document. This macro will only be produced when the
+\Opt{jekyllData} option is enabled. The macro receives no arguments.
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` 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:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> # First top-level heading
->
-> *(The beginning of a header attribute context)*
->
-> ## A subheading
->
-> *(The end of a header attribute context)*
->
-> *(The beginning of a header attribute context)*
->
-> # Second top-level heading
->
-> *(The end of a header attribute context)*
-
+% \end{markdown}
+%
+% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererHeaderAttributeContextBegin{%
- \markdownRendererHeaderAttributeContextBeginPrototype}%
+\def\markdownRendererJekyllDataEnd{%
+ \markdownRendererJekyllDataEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { headerAttributeContextBegin }
+ { jekyllDataEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { headerAttributeContextBegin }
+ { jekyllDataEnd }
{ 0 }
\ExplSyntaxOff
-\def\markdownRendererHeaderAttributeContextEnd{%
- \markdownRendererHeaderAttributeContextEndPrototype}%
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
+The \mdef{markdownRendererJekyllDataMappingBegin} macro represents the
+beginning of a mapping in a \acro{yaml} document. This macro will only be
+produced when the \Opt{jekyllData} option is enabled. The macro receives two
+arguments: the scalar key in the parent structure, cast to a string following
+\acro{yaml} serialization rules, and the number of items in the mapping.
+
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererJekyllDataMappingBegin{%
+ \markdownRendererJekyllDataMappingBeginPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { headerAttributeContextEnd }
+ { jekyllDataMappingBegin }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { headerAttributeContextEnd }
- { 0 }
+ { jekyllDataMappingBegin }
+ { 2 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -15349,105 +15899,28 @@ following text:
%
% \begin{markdown}
-#### Strike-Through Renderer
-The \mdef{markdownRendererStrikeThrough} macro represents a strike-through span of
-text. The macro receives a single argument that corresponds to the striked-out
-span of text. This macro will only be produced, when the \Opt{strikeThrough}
-option is enabled.
+The \mdef{markdownRendererJekyllDataMappingEnd} macro represents the
+end of a mapping in a \acro{yaml} document. This macro will only be produced
+when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
% \end{markdown}
%
% \iffalse
-
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownOptionStrikeThrough{true}
-\input soulutf8.sty
-\def\markdownRendererStrikeThrough#1{\st{#1}}
-\markdownBegin
-This is ~~a lunar roving vehicle~~ strike-through text.
-\markdownEnd
-\bye
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> This is ~~a lunar roving vehicle~~ strike-through text.
-
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage[strikeThrough]{markdown}
-\usepackage{soulutf8}
-\markdownSetup{
- renderers = {
- strikeThrough = {\st{#1}},
- },
-}
-\begin{document}
-\begin{markdown}
-This is ~~a lunar roving vehicle~~ strike-through text.
-\end{markdown}
-\end{document}
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-lualatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> This is ~~a lunar roving vehicle~~ strike-through text.
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown[strikeThrough = yes]
-\def\markdownRendererStrikeThrough#1{\overstrikes{#1}}
-\starttext
-\startmarkdown
-This is ~~a lunar roving vehicle~~ strike-through text.
-\stopmarkdown
-\stoptext
-```````
-Next, invoke LuaTeX from the terminal:
-``` sh
-context document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> This is ~~a lunar roving vehicle~~ strike-through text.
-
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererStrikeThrough{%
- \markdownRendererStrikeThroughPrototype}%
+\def\markdownRendererJekyllDataMappingEnd{%
+ \markdownRendererJekyllDataMappingEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { strikeThrough }
+ { jekyllDataMappingEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { strikeThrough }
- { 1 }
+ { jekyllDataMappingEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -15459,103 +15932,63 @@ following text:
%
% \begin{markdown}
-#### Superscript Renderer
-The \mdef{markdownRendererSuperscript} macro represents a superscript span of
-text. The macro receives a single argument that corresponds to the superscript
-span of text. This macro will only be produced, when the \Opt{superscripts}
-option is enabled.
+The \mdef{markdownRendererJekyllDataSequenceBegin} macro represents the
+beginning of a sequence in a \acro{yaml} document. This macro will only be
+produced when the \Opt{jekyllData} option is enabled. The macro receives two
+arguments: the scalar key in the parent structure, cast to a string following
+\acro{yaml} serialization rules, and the number of items in the sequence.
% \end{markdown}
%
% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererJekyllDataSequenceBegin{%
+ \markdownRendererJekyllDataSequenceBeginPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { jekyllDataSequenceBegin }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { jekyllDataSequenceBegin }
+ { 2 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownOptionSuperscripts{true}
-\def\markdownRendererSuperscript#1{ taken to the power of #1}
-\markdownBegin
-2^10^ is 1024.
-\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:
-
-> 2 taken to the power of 10 is 1024.
-
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage[superscripts]{markdown}
-\markdownSetup{
- renderers = {
- superscript = { taken to the power of #1},
- },
-}
-\begin{document}
-\begin{markdown}
-2^10^ is 1024.
-\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:
-
-> 2 taken to the power of 10 is 1024.
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown[superscripts = yes]
-\def\markdownRendererSuperscript#1{ taken to the power of #1}
-\starttext
-\startmarkdown
-2^10^ is 1024.
-\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:
-
-> 2 taken to the power of 10 is 1024.
+The \mdef{markdownRendererJekyllDataSequenceEnd} macro represents the
+end of a sequence in a \acro{yaml} document. This macro will only be produced
+when the \Opt{jekyllData} option is enabled. The macro receives no arguments.
+% \end{markdown}
+%
+% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererSuperscript{%
- \markdownRendererSuperscriptPrototype}%
+\def\markdownRendererJekyllDataSequenceEnd{%
+ \markdownRendererJekyllDataSequenceEndPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { superscript }
+ { jekyllDataSequenceEnd }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { superscript }
- { 1 }
+ { jekyllDataSequenceEnd }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -15567,103 +16000,66 @@ following text:
%
% \begin{markdown}
-#### Subscript Renderer
-The \mdef{markdownRendererSubscript} macro represents a subscript span of
-text. The macro receives a single argument that corresponds to the subscript
-span of text. This macro will only be produced, when the \Opt{subscripts}
-option is enabled.
+The \mdef{markdownRendererJekyllDataBoolean} macro represents a boolean scalar
+value in a \acro{yaml} document. This macro will only be produced when the
+\Opt{jekyllData} option is enabled. The macro receives two arguments: the
+scalar key in the parent structure, and the scalar value, both cast to a string
+following \acro{yaml} serialization rules.
% \end{markdown}
%
% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererJekyllDataBoolean{%
+ \markdownRendererJekyllDataBooleanPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { jekyllDataBoolean }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { jekyllDataBoolean }
+ { 2 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
-##### Plain \TeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\input markdown
-\def\markdownOptionSubscripts{true}
-\def\markdownRendererSubscript#1{ (#1 moles) and }
-\markdownBegin
-H~2~O is a liquid.
-\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:
-
-> H (2 moles) and O is a liquid.
-
-##### \LaTeX{} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\documentclass{article}
-\usepackage[subscripts]{markdown}
-\markdownSetup{
- renderers = {
- subscript = { (#1 moles) and },
- },
-}
-\begin{document}
-\begin{markdown}
-H~2~O is a liquid.
-\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:
-
-> H (2 moles) and O is a liquid.
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\setupmarkdown[subscripts = yes]
-\def\markdownRendererSubscript#1{ (#1 moles) and }
-\starttext
-\startmarkdown
-H~2~O is a liquid.
-\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:
-
-> H (2 moles) and O is a liquid.
+The \mdef{markdownRendererJekyllDataNumber} macro represents a numeric scalar
+value in a \acro{yaml} document. This macro will only be produced when the
+\Opt{jekyllData} option is enabled. The macro receives two arguments: the
+scalar key in the parent structure, and the scalar value, both cast to a string
+following \acro{yaml} serialization rules.
+% \end{markdown}
+%
+% \iffalse
%
%<*tex>
% \fi
%
% \begin{macrocode}
-\def\markdownRendererSubscript{%
- \markdownRendererSubscriptPrototype}%
+\def\markdownRendererJekyllDataNumber{%
+ \markdownRendererJekyllDataNumberPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { subscript }
+ { jekyllDataNumber }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { subscript }
- { 1 }
+ { jekyllDataNumber }
+ { 2 }
+\ExplSyntaxOff
% \end{macrocode}
% \par
%
@@ -15674,12 +16070,11 @@ following text:
%
% \begin{markdown}
-#### Raw Content Renderers
-The \mdef{markdownRendererInputRawInline} macro represents an inline raw span.
-The macro receives two arguments: the filename of a file contaning the inline
-raw span contents and the raw attribute that designates the format of the
-inline raw span. This macro will only be produced, when the \Opt{rawAttribute}
-option is enabled.
+The \mdef{markdownRendererJekyllDataString} macro represents a string scalar
+value in a \acro{yaml} document. This macro will only be produced when the
+\Opt{jekyllData} option is enabled. The macro receives two arguments: the
+scalar key in the parent structure, cast to a string following \acro{yaml}
+serialization rules, and the scalar value.
% \end{markdown}
%
@@ -15689,15 +16084,15 @@ option is enabled.
% \fi
%
% \begin{macrocode}
-\def\markdownRendererInputRawInline{%
- \markdownRendererInputRawInlinePrototype}%
+\def\markdownRendererJekyllDataString{%
+ \markdownRendererJekyllDataStringPrototype}%
\ExplSyntaxOn
\seq_gput_right:Nn
\g_@@_renderers_seq
- { inputRawInline }
+ { jekyllDataString }
\prop_gput:Nnn
\g_@@_renderer_arities_prop
- { inputRawInline }
+ { jekyllDataString }
{ 2 }
\ExplSyntaxOff
% \end{macrocode}
@@ -15710,53 +16105,95 @@ option is enabled.
%
% \begin{markdown}
-The \mdef{markdownRendererInputRawBlock} macro represents a raw block. The
-macro receives two arguments: the filename of a file contaning the raw block
-and the raw attribute that designates the format of the raw block. This macro
-will only be produced, when the \Opt{rawAttribute} and \Opt{fencedCode} options
-are enabled.
+The \mdef{markdownRendererJekyllDataEmpty} macro represents an empty scalar
+value in a \acro{yaml} document. This macro will only be produced when the
+\Opt{jekyllData} option is enabled. The macro receives one argument: 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
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererJekyllDataEmpty{%
+ \markdownRendererJekyllDataEmptyPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { jekyllDataEmpty }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { jekyllDataEmpty }
+ { 1 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+
+##### 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}
+\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:
+``` 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
+``` tex
\documentclass{article}
-\usepackage[rawAttribute, fencedCode]{markdown}
-\usepackage{expl3}
-\ExplSyntaxOn
-\cs_new:Nn
- \display_raw_content:nn
- {
- % If the raw attribute is TeX, execute the content as a TeX document.
- \str_if_eq:nnTF
- { #2 }
- { tex }
- { \markdownEscape { #1 } }
- % Otherwise, ignore the content.
- { }
- }
+\usepackage[jekyllData]{markdown}
\markdownSetup{
renderers = {
- rawInline = { \display_raw_content:nn { #1 } { #2 } },
- rawBlock = { \display_raw_content:nn { #1 } { #2 } }
- },
+ jekyllDataString = {\gdef\name{#2}},
+ jekyllDataNumber = {\gdef\age{#2}},
+ jekyllDataEnd = {\name{} is \age{} years old.},
+ }
}
-\ExplSyntaxOff
\begin{document}
-\begin{markdown}
-`$H_2 O$`{=tex} is a liquid.
-``` {=html}
-
Here is some HTML content that will be ignored.
-```
+\begin{markdown}
+---
+name: Jane Doe
+age: 99
+---
\end{markdown}
+
\end{document}
-````
+```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
@@ -15764,30 +16201,39 @@ lualatex document.tex
A PDF document named `document.pdf` should be produced and contain the
following text:
-> H~2~O is a liquid.
+> 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]
+\setupmarkdown[jekyllData = yes]
+\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:
+``` 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}
-\def\markdownRendererInputRawBlock{%
- \markdownRendererInputRawBlockPrototype}%
-\ExplSyntaxOn
-\seq_gput_right:Nn
- \g_@@_renderers_seq
- { inputRawBlock }
-\prop_gput:Nnn
- \g_@@_renderer_arities_prop
- { inputRawBlock }
- { 2 }
-\ExplSyntaxOff
-% \end{macrocode}
-% \par
-%
-% \iffalse
-%
-%<*manual-tokens>
% \fi
%
% \begin{markdown}
@@ -16056,8 +16502,8 @@ following text:
% \end{macrocode}
% \begin{markdown}
%
-% The \mdef{markdownRendererFootnote} and
-% \mdef{markdownRendererFootnotePrototype} macros have been deprecated
+% The \mref{markdownRendererFootnote} and
+% \mref{markdownRendererFootnotePrototype} macros have been deprecated
% and will be removed in Markdown 3.0.0.
%
% \end{markdown}
@@ -16067,8 +16513,8 @@ following text:
% \end{macrocode}
% \begin{markdown}
%
-% The \mdef{markdownRendererHorizontalRule} and
-% \mdef{markdownRendererHorizontalRulePrototype} macros have been deprecated
+% The \mref{markdownRendererHorizontalRule} and
+% \mref{markdownRendererHorizontalRulePrototype} macros have been deprecated
% and will be removed in Markdown 3.0.0.
%
% \end{markdown}
@@ -16181,7 +16627,7 @@ following text:
% as follows:
%
% - `0` – Shell escape via the 18 output file stream
-% - `1` – Shell escape via the Lua \luamref{os.execute} method
+% - `1` – Shell escape via the Lua `os.execute` method
% - `2` – Direct Lua access
% - `3` – The \pkg{lt3luabridge} Lua package
%
@@ -16223,6 +16669,7 @@ following text:
}
}
}
+\ExplSyntaxOff
% \end{macrocode}
% \par
% \begin{markdown}
@@ -16307,8 +16754,8 @@ pdflatex --shell-escape document.tex
% Section <#sec:texinterface>).
%
% The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see
-% Section <#sec:texinterfacelogging>) to use the \LaTeX{} \mref{PackageInfo},
-% \mref{PackageWarning}, and \mref{PackageError} macros.
+% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`,
+% `\PackageWarning`, and `\PackageError` macros.
%
% \end{markdown}
% \begin{macrocode}
@@ -16327,7 +16774,7 @@ pdflatex --shell-escape document.tex
% \end{Verbatim}
% \begin{markdown}
% where \meta{options} are the \LaTeX{} interface options (see Section
-% <#sec:latexoptions>). Note that \meta{options} inside the \mref{usepackage}
+% <#sec:latexoptions>). Note that \meta{options} inside the `\usepackage`
% macro may not set the `markdownRenderers` (see Section
% <#sec:latexrenderers>) and `markdownRendererPrototypes` (see Section
% <#sec:latexrendererprototypes>) keys. This limitation is due to the way
@@ -16354,8 +16801,8 @@ pdflatex --shell-escape document.tex
% \end{macrocode}
% \markdownBegin
%
-% You may prepend your own code to the \mref{markdown} macro and append your own
-% code to the \mref{endmarkdown} macro to produce special effects before and after
+% You may prepend your own code to the \mdef{markdown} macro and append your own
+% code to the \mdef{endmarkdown} macro to produce special effects before and after
% the \envmref{markdown} \LaTeX{} environment (and likewise for the starred
% version).
%
@@ -16597,7 +17044,7 @@ without low-level programming.
% *name* is *qualified* and contains no underscores, and a value is qualified
% if and only if it contains at least one forward slash. Themes are inspired by
% the Beamer \LaTeX{} package, which provides similar functionality with its
-% \mref{usetheme} macro [@tantau21, Section 15.1].
+% `\usetheme` macro [@tantau21, Section 15.1].
%
% Theme names must be qualified to minimize naming conflicts between different
% themes intended for a single \LaTeX{} document class or for a single \LaTeX{}
@@ -16615,7 +17062,7 @@ without low-level programming.
% package named `markdownthemewitiko_beamer_MU.sty`.
%
% If the \LaTeX{} option with key `theme` is (repeatedly) specified in the
-% \mref{usepackage} macro, the loading of the theme(s) will be postponed in
+% `\usepackage` macro, the loading of the theme(s) will be postponed in
% first-in-first-out order until after the Markdown \LaTeX{} package has been
% loaded. Otherwise, the theme(s) will be loaded immediately. For example,
% there is a theme named `witiko/dot`, which typesets fenced code blocks with
@@ -16796,7 +17243,7 @@ Example themes provided with the Markdown package include:
% ```
The theme requires a Unix-like operating system with GNU Diffutils and
Graphviz installed. The theme also requires shell access unless the
- \mref{markdownOptionFrozenCache} plain \TeX{} option is enabled.
+ \Opt{frozenCache} plain \TeX{} option is enabled.
% \markdownEnd
% \iffalse
@@ -16889,7 +17336,7 @@ conference article:
The theme requires the \pkg{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
- \mref{markdownOptionFrozenCache} plain \TeX{} option is enabled.
+ \Opt{frozenCache} plain \TeX{} option is enabled.
% \markdownEnd
% \iffalse
@@ -17231,7 +17678,7 @@ The following ordered list will be preceded by roman numerals:
% \par
% \begin{markdown}
%
-% The \mref{markdownOptionFinalizeCache} and \mref{markdownOptionFrozenCache} plain
+% The \Opt{finalizeCache} and \Opt{frozenCache} plain
% \TeX{} options are exposed through \LaTeX{} options with keys `finalizeCache`
% and `frozenCache`.
%
@@ -17263,8 +17710,8 @@ The following ordered list will be preceded by roman numerals:
% \begin{markdown}
%
% The following example \LaTeX{} code showcases a possible configuration of
-% plain \TeX{} interface options \mref{markdownOptionHybrid},
-% \mref{markdownOptionSmartEllipses}, and \mref{markdownOptionCacheDir}.
+% plain \TeX{} interface options \Opt{hybrid}, \Opt{smartEllipses}, and
+% \Opt{cacheDir}.
% ``` tex
% \markdownSetup{
% hybrid,
@@ -17411,7 +17858,7 @@ The following ordered list will be preceded by roman numerals:
% \begin{markdown}
%
% The following example \LaTeX{} code showcases a possible configuration of the
-% \mref{markdownRendererImagePrototype} and \mref{markdownRendererCodeSpanPrototype}
+% `\markdownRendererImagePrototype` and `\markdownRendererCodeSpanPrototype`
% markdown token renderer prototypes.
% ``` tex
% \markdownSetup{
@@ -17498,7 +17945,7 @@ texexec --passon=--shell-escape document.tex
%
% The \Hologo{ConTeXt} implementation redefines the plain \TeX{} logging macros
% (see Section <#sec:texinterfacelogging>) to use the \Hologo{ConTeXt}
-% \mref{writestatus} macro.
+% `\writestatus` macro.
%
% \end{markdown}
% \begin{macrocode}
@@ -17517,7 +17964,7 @@ texexec --passon=--shell-escape document.tex
% \usemodule[t][markdown]
% ```````
% \noindent It is expected that the special plain \TeX{} characters have the
-% expected category codes, when \mref{input}ting the file.
+% expected category codes, when `\input`ting the file.
%
%### Typesetting Markdown
% The interface exposes the \mdef{startmarkdown} and \mdef{stopmarkdown} macro
@@ -20402,7 +20849,6 @@ function M.writer.new(options)
self.escaped_uri_chars = {
["{"] = "\\markdownRendererLeftBrace{}",
["}"] = "\\markdownRendererRightBrace{}",
- ["%"] = "\\markdownRendererPercentSign{}",
["\\"] = "\\markdownRendererBackslash{}",
}
self.escaped_minimal_strings = {
@@ -20759,9 +21205,39 @@ function M.writer.new(options)
% \par
% \begin{markdown}
%
+% Define \luamdef{writer->attributes} as a function that will transform
+% input attributes `attr` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.attributes(attr)
+ local buf = {}
+
+ table.sort(attr)
+ local key, value
+ for i = 1, #attr do
+ if attr[i]:sub(1, 1) == "#" then
+ table.insert(buf, {"\\markdownRendererAttributeIdentifier{",
+ attr[i]:sub(2), "}"})
+ elseif attr[i]:sub(1, 1) == "." then
+ table.insert(buf, {"\\markdownRendererAttributeClassName{",
+ attr[i]:sub(2), "}"})
+ else
+ key, value = attr[i]:match("([^= ]+)%s*=%s*(.*)")
+ table.insert(buf, {"\\markdownRendererAttributeKeyValue{",
+ key, "}{", value, "}"})
+ end
+ end
+
+ return buf
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
% Define \luamdef{writer->active\_attributes} as a stack of attributes
% of the headings that are currently active. The
-% \luamref{writer->active\_headings} member variable is mutable.
+% \luamdef{writer->active\_headings} member variable is mutable.
%
% \end{markdown}
% \begin{macrocode}
@@ -20771,7 +21247,7 @@ function M.writer.new(options)
% \begin{markdown}
%
% Define \luamdef{writer->heading} as a function that will transform an
-% input heading `s` at level `level` with identifiers `identifiers` to the
+% input heading `s` at level `level` with attributes `attributes` to the
% output format.
%
% \end{markdown}
@@ -20853,21 +21329,7 @@ function M.writer.new(options)
end
if self.is_writing then
- table.sort(attributes)
- local key, value
- for i = 1, #attributes do
- if attributes[i]:sub(1, 1) == "#" then
- table.insert(buf, {"\\markdownRendererAttributeIdentifier{",
- attributes[i]:sub(2), "}"})
- elseif attributes[i]:sub(1, 1) == "." then
- table.insert(buf, {"\\markdownRendererAttributeClassName{",
- attributes[i]:sub(2), "}"})
- else
- key, value = attributes[i]:match("([^= ]+)%s*=%s*(.*)")
- table.insert(buf, {"\\markdownRendererAttributeKeyValue{",
- key, "}{", value, "}"})
- end
- end
+ table.insert(buf, self.attributes(attributes))
end
local cmd
@@ -21015,7 +21477,8 @@ parsers.doubletildes = P("~~")
parsers.fourspaces = P(" ")
parsers.any = P(1)
-parsers.fail = parsers.any - 1
+parsers.succeed = P(true)
+parsers.fail = P(false)
parsers.escapable = S("!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~")
parsers.anyescaped = parsers.backslash / "" * parsers.escapable
@@ -21232,14 +21695,31 @@ local function captures_geq_length(_,i,a,b)
return #a >= #b and i
end
-parsers.infostring = (parsers.linechar - (parsers.backtick
- + parsers.space^1 * (parsers.newline + parsers.eof)))^0
+parsers.tilde_infostring
+ = C((parsers.linechar
+ - (parsers.spacechar^1 * parsers.newline))^0)
+ * parsers.optionalspace
+ * (parsers.newline + parsers.eof)
+
+parsers.backtick_infostring
+ = C((parsers.linechar
+ - (parsers.backtick
+ + parsers.spacechar^1 * parsers.newline))^0)
+ * parsers.optionalspace
+ * (parsers.newline + parsers.eof)
local fenceindent
-parsers.fencehead = function(char)
+parsers.fencehead = function(char, infostring)
+ return C(parsers.nonindentspace) / function(s) fenceindent = #s end
+ * Cg(char^3, "fencelength")
+ * parsers.optionalspace * infostring
+end
+
+parsers.fencehead_with_attributes
+ = function(char)
return C(parsers.nonindentspace) / function(s) fenceindent = #s end
* Cg(char^3, "fencelength")
- * parsers.optionalspace * C(parsers.infostring)
+ * parsers.optionalspace * Ct(parsers.attributes)
* parsers.optionalspace * (parsers.newline + parsers.eof)
end
@@ -21503,12 +21983,14 @@ parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more
% \end{markdown}
% \begin{macrocode}
parsers.TildeFencedCode
- = parsers.fencehead(parsers.tilde)
+ = parsers.fencehead(parsers.tilde,
+ parsers.tilde_infostring)
* Cs(parsers.fencedline(parsers.tilde)^0)
* parsers.fencetail(parsers.tilde)
parsers.BacktickFencedCode
- = parsers.fencehead(parsers.backtick)
+ = parsers.fencehead(parsers.backtick,
+ parsers.backtick_infostring)
* Cs(parsers.fencedline(parsers.backtick)^0)
* parsers.fencetail(parsers.backtick)
@@ -21578,7 +22060,7 @@ function M.reader.new(writer, options)
% \begin{markdown}
%
% Create a \luamdef{reader->parsers} hash table that stores \acro{peg} patterns
-% that depend on the received `options`. Make \luamdef{reader->parsers} inherit
+% that depend on the received `options`. Make \luamref{reader->parsers} inherit
% from the global \luamref{parsers} table.
%
% \end{markdown}
@@ -21804,14 +22286,6 @@ function M.reader.new(writer, options)
% \par
% \begin{markdown}
%
-%#### Parsers Used for Notes (local)
-%
-% \end{markdown}
-% \begin{macrocode}
-% \end{macrocode}
-% \par
-% \begin{markdown}
-%
%#### Helpers for Links and References (local)
%
% \end{markdown}
@@ -22220,7 +22694,7 @@ function M.reader.new(writer, options)
% \begin{markdown}
%
% Create a local writable copy of the global read-only
-% \luamdef{walkable_syntax} hash table. This table can be used by user-defined
+% \luamref{walkable_syntax} hash table. This table can be used by user-defined
% syntax extensions to insert new \acro{peg} patterns into existing rules
% of the \acro{peg} grammar of markdown using
% the \luamref{reader->insert_pattern} method. Furthermore, built-in syntax
@@ -22300,12 +22774,12 @@ function M.reader.new(writer, options)
local syntax =
{ "Blocks",
- Blocks = ( V("ExpectedJekyllData")
- * (V("Blank")^0 / writer.interblocksep)
- )^-1
+ Blocks = V("InitializeState")
+ * ( V("ExpectedJekyllData")
+ * (V("Blank")^0 / writer.interblocksep))^-1
* V("Blank")^0
* V("Block")^-1
- * (V("Blank")^0 / writer.interblocksep
+ * ( V("Blank")^0 / writer.interblocksep
* V("Block"))^0
* V("Blank")^0 * parsers.eof,
@@ -22344,23 +22818,37 @@ function M.reader.new(writer, options)
Smart = parsers.Smart,
Symbol = parsers.Symbol,
SpecialChar = parsers.fail,
+ InitializeState = parsers.succeed,
}
% \end{macrocode}
% \par
% \begin{markdown}
%
% Define \luamref{reader->update_rule} as a function that receives two
-% arguments: a left-hand side terminal symbol and a \acro{peg} pattern.
-% The function (re)defines \luamref{walkable_syntax}`[`left-hand side terminal
-% symbol`]` to be equal to pattern.
+% arguments: a left-hand side terminal symbol and a function that accepts
+% the current \acro{peg} pattern in \luamref{walkable_syntax}`[`left-hand side
+% terminal symbol`]` if defined or `nil` otherwise and returns a
+% \acro{peg} pattern that will (re)define \luamref{walkable_syntax}`[`left-hand
+% side terminal symbol`]`.
%
% \end{markdown}
% \begin{macrocode}
- self.update_rule = function(rule_name, pattern)
+ self.update_rule = function(rule_name, get_pattern)
assert(current_extension_name ~= nil)
assert(syntax[rule_name] ~= nil,
[[Rule ]] .. rule_name .. [[ -> ... does not exist in markdown grammar]])
- local accountable_pattern = { pattern, current_extension_name, rule_name }
+ local previous_pattern
+ local extension_name
+ if walkable_syntax[rule_name] then
+ local previous_accountable_pattern = walkable_syntax[rule_name][1]
+ previous_pattern = previous_accountable_pattern[1]
+ extension_name = previous_accountable_pattern[2] .. ", " .. current_extension_name
+ else
+ previous_pattern = nil
+ extension_name = current_extension_name
+ end
+ local pattern = get_pattern(previous_pattern)
+ local accountable_pattern = { pattern, extension_name, rule_name }
walkable_syntax[rule_name] = { accountable_pattern }
end
% \end{macrocode}
@@ -22390,6 +22878,19 @@ function M.reader.new(writer, options)
% \par
% \begin{markdown}
%
+% Add method \luamdef{reader->initialize_named_group} that defines named groups
+% with a default capture value.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.initialize_named_group = function(name, value)
+ syntax.InitializeState = syntax.InitializeState
+ * Cg(Ct("") / value, name)
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
% Apply syntax extensions.
%
% \end{markdown}
@@ -22556,7 +23057,10 @@ function M.reader.new(writer, options)
local inlines_t = util.table_copy(syntax)
inlines_t[1] = "Inlines"
- inlines_t.Inlines = parsers.Inline^0 * (parsers.spacing^0 * parsers.eof / "")
+ inlines_t.Inlines = V("InitializeState")
+ * parsers.Inline^0
+ * ( parsers.spacing^0
+ * parsers.eof / "")
parsers.inlines = Ct(inlines_t)
local inlines_no_link_t = util.table_copy(inlines_t)
@@ -22665,7 +23169,7 @@ end
%
%### Built-In Syntax Extensions {#luabuiltinextensions}
%
-% Create \luamdef{extensions} hash table that contains built-in syntax
+% Create \luamref{extensions} hash table that contains built-in syntax
% extensions. Syntax extensions are functions that produce objects with two
% methods: `extend_writer` and `extend_reader`. The `extend_writer` object
% takes a \luamref{writer} object as the only parameter and mutates it.
@@ -22678,6 +23182,50 @@ M.extensions = {}
% \end{macrocode}
% \begin{markdown}
%
+%#### Bracketed Spans
+%
+% The \luamdef{extensions.bracketed_spans} function implements the Pandoc
+% bracketed spans syntax extension.
+%
+% \end{markdown}
+% \begin{macrocode}
+M.extensions.bracketed_spans = function()
+ return {
+ name = "built-in bracketed_spans syntax extension",
+ extend_writer = function(self)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->span} as a function that will transform an input
+% bracketed span `s` with attributes `attr` to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.span(s, attr)
+ return {"\\markdownRendererBracketedSpanAttributeContextBegin",
+ self.attributes(attr),
+ s,
+ "\\markdownRendererBracketedSpanAttributeContextEnd{}"}
+ end
+ end, extend_reader = function(self)
+ local parsers = self.parsers
+ local writer = self.writer
+
+ local Span = parsers.between(parsers.Inline,
+ parsers.lbracket,
+ parsers.rbracket)
+ * Ct(parsers.attributes)
+ / writer.span
+
+ self.insert_pattern("Inline after Emph",
+ Span, "Span")
+ end
+ }
+end
+% \end{macrocode}
+% \begin{markdown}
+%
%#### Citations
%
% The \luamdef{extensions.citations} function implements the Pandoc citation
@@ -22726,7 +23274,7 @@ M.extensions.citations = function(citation_nbsps)
% \begin{markdown}
%
% Define \luamdef{writer->citation} as a function that will transform an input
-% citation name `c` to the output format. If \luamref{writer->hybrid} is `true`,
+% citation name `c` to the output format. If option \Opt{hybrid} is enabled,
% use the \luamref{writer->escape_minimal} function. Otherwise, use the
% \luamref{escape_citation} function.
%
@@ -23052,9 +23600,9 @@ end
%
%#### Definition Lists
%
-% The \luamdef{extensions.definition_lists} function implements the definition
-% list syntax extension. If the `tight_lists` parameter is `true`, tight lists
-% will produce special right item renderers.
+% The \luamdef{extensions.definition_lists} function implements the Pandoc
+% definition list syntax extension. If the `tight_lists` parameter is `true`,
+% tight lists will produce special right item renderers.
%
% \end{markdown}
% \begin{macrocode}
@@ -23094,56 +23642,257 @@ M.extensions.definition_lists = function(tight_lists)
return {"\\markdownRendererDlBeginTight\n", buffer,
"\n\\markdownRendererDlEndTight"}
else
- return {"\\markdownRendererDlBegin\n", buffer,
- "\n\\markdownRendererDlEnd"}
+ return {"\\markdownRendererDlBegin\n", buffer,
+ "\n\\markdownRendererDlEnd"}
+ end
+ end
+ end, extend_reader = function(self)
+ local parsers = self.parsers
+ local writer = self.writer
+
+ local defstartchar = S("~:")
+
+ local defstart = ( defstartchar * #parsers.spacing
+ * (parsers.tab + parsers.space^-3)
+ + parsers.space * defstartchar * #parsers.spacing
+ * (parsers.tab + parsers.space^-2)
+ + parsers.space * parsers.space * defstartchar
+ * #parsers.spacing
+ * (parsers.tab + parsers.space^-1)
+ + parsers.space * parsers.space * parsers.space
+ * defstartchar * #parsers.spacing
+ )
+
+ local dlchunk = Cs(parsers.line * (parsers.indentedline - parsers.blankline)^0)
+
+ local function definition_list_item(term, defs, _)
+ return { term = self.parser_functions.parse_inlines(term),
+ definitions = defs }
+ end
+
+ local DefinitionListItemLoose
+ = C(parsers.line) * parsers.skipblanklines
+ * Ct((defstart
+ * parsers.indented_blocks(dlchunk)
+ / self.parser_functions.parse_blocks_nested)^1)
+ * Cc(false) / definition_list_item
+
+ local DefinitionListItemTight
+ = C(parsers.line)
+ * Ct((defstart * dlchunk
+ / self.parser_functions.parse_blocks_nested)^1)
+ * Cc(true) / definition_list_item
+
+ local DefinitionList
+ = ( Ct(DefinitionListItemLoose^1) * Cc(false)
+ + Ct(DefinitionListItemTight^1)
+ * (parsers.skipblanklines
+ * -DefinitionListItemLoose * Cc(true))
+ ) / writer.definitionlist
+
+ self.insert_pattern("Block after Heading",
+ DefinitionList, "DefinitionList")
+ end
+ }
+end
+% \end{macrocode}
+% \begin{markdown}
+%
+%#### Fancy Lists
+%
+% The \luamdef{extensions.fancy_lists} function implements the Pandoc fancy
+% list syntax extension.
+%
+% \end{markdown}
+% \begin{macrocode}
+M.extensions.fancy_lists = function()
+ return {
+ name = "built-in fancy_lists syntax extension",
+ extend_writer = function(self)
+ local options = self.options
+
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->fancylist} as a function that will transform an
+% input ordered list to the output format, where:
+%
+%- `items` is an array of the list items,
+%- `tight` specifies, whether the list is tight or not,
+%- `startnum` is the number of the first list item,
+%- `numstyle` is the style of the list item labels from among the following:
+% - `Decimal` -- decimal arabic numbers,
+% - `LowerRoman` -- lower roman numbers,
+% - `UpperRoman` -- upper roman numbers,
+% - `LowerAlpha` -- lower ASCII alphabetic characters, and
+% - `UpperAlpha` -- upper ASCII alphabetic characters, and
+%- `numdelim` is the style of delimiters between list item labels and
+% texts from among the following:
+% - `Default` -- default style,
+% - `OneParen` -- parentheses, and
+% - `Period` -- periods.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.fancylist(items,tight,startnum,numstyle,numdelim)
+ if not self.is_writing then return "" end
+ local buffer = {}
+ local num = startnum
+ for _,item in ipairs(items) do
+ buffer[#buffer + 1] = self.fancyitem(item,num)
+ if num ~= nil then
+ num = num + 1
+ end
+ end
+ local contents = util.intersperse(buffer,"\n")
+ if tight and options.tightLists then
+ return {"\\markdownRendererFancyOlBeginTight{",
+ numstyle,"}{",numdelim,"}",contents,
+ "\n\\markdownRendererFancyOlEndTight "}
+ else
+ return {"\\markdownRendererFancyOlBegin{",
+ numstyle,"}{",numdelim,"}",contents,
+ "\n\\markdownRendererFancyOlEnd "}
+ end
+ end
+% \end{macrocode}
+% \begin{markdown}
+%
+% Define \luamdef{writer->fancyitem} as a function that will transform an
+% input fancy ordered list item to the output format, where `s` is the text of
+% the list item. If the optional parameter `num` is present, it is the number
+% of the list item.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.fancyitem(s,num)
+ if num ~= nil then
+ return {"\\markdownRendererFancyOlItemWithNumber{",num,"}",s,
+ "\\markdownRendererFancyOlItemEnd "}
+ else
+ return {"\\markdownRendererFancyOlItem ",s,"\\markdownRendererFancyOlItemEnd "}
end
end
end, extend_reader = function(self)
local parsers = self.parsers
+ local options = self.options
local writer = self.writer
- local defstartchar = S("~:")
-
- local defstart = ( defstartchar * #parsers.spacing
- * (parsers.tab + parsers.space^-3)
- + parsers.space * defstartchar * #parsers.spacing
+ local label = parsers.dig + parsers.letter
+ local numdelim = parsers.period + parsers.rparent
+ local enumerator = C(label^3 * numdelim) * #parsers.spacing
+ + C(label^2 * numdelim) * #parsers.spacing
+ * (parsers.tab + parsers.space^1)
+ + C(label * numdelim) * #parsers.spacing
* (parsers.tab + parsers.space^-2)
- + parsers.space * parsers.space * defstartchar
+ + parsers.space * C(label^2 * numdelim)
+ * #parsers.spacing
+ + parsers.space * C(label * numdelim)
* #parsers.spacing
* (parsers.tab + parsers.space^-1)
- + parsers.space * parsers.space * parsers.space
- * defstartchar * #parsers.spacing
- )
+ + parsers.space * parsers.space * C(label^1
+ * numdelim) * #parsers.spacing
+ local starter = parsers.bullet + enumerator
- local dlchunk = Cs(parsers.line * (parsers.indentedline - parsers.blankline)^0)
+ local NestedList = Cs((parsers.optionallyindentedline
+ - starter)^1)
+ / function(a) return "\001"..a end
- local function definition_list_item(term, defs, _)
- return { term = self.parser_functions.parse_inlines(term),
- definitions = defs }
+ local ListBlockLine = parsers.optionallyindentedline
+ - parsers.blankline - (parsers.indent^-1
+ * starter)
+
+ local ListBlock = parsers.line * ListBlockLine^0
+
+ local ListContinuationBlock = parsers.blanklines * (parsers.indent / "")
+ * ListBlock
+
+ local TightListItem = function(starter)
+ return -parsers.ThematicBreak
+ * (Cs(starter / "" * parsers.tickbox^-1 * ListBlock * NestedList^-1)
+ / self.parser_functions.parse_blocks_nested)
+ * -(parsers.blanklines * parsers.indent)
end
- local DefinitionListItemLoose
- = C(parsers.line) * parsers.skipblanklines
- * Ct((defstart
- * parsers.indented_blocks(dlchunk)
- / self.parser_functions.parse_blocks_nested)^1)
- * Cc(false) / definition_list_item
+ local LooseListItem = function(starter)
+ return -parsers.ThematicBreak
+ * Cs( starter / "" * parsers.tickbox^-1 * ListBlock * Cc("\n")
+ * (NestedList + ListContinuationBlock^0)
+ * (parsers.blanklines / "\n\n")
+ ) / self.parser_functions.parse_blocks_nested
+ end
- local DefinitionListItemTight
- = C(parsers.line)
- * Ct((defstart * dlchunk
- / self.parser_functions.parse_blocks_nested)^1)
- * Cc(true) / definition_list_item
+ local function roman2number(roman)
+ local romans = { ["L"] = 50, ["X"] = 10, ["V"] = 5, ["I"] = 1 }
+ local numeral = 0
- local DefinitionList
- = ( Ct(DefinitionListItemLoose^1) * Cc(false)
- + Ct(DefinitionListItemTight^1)
- * (parsers.skipblanklines
- * -DefinitionListItemLoose * Cc(true))
- ) / writer.definitionlist
+ local i = 1
+ local len = string.len(roman)
+ while i < len do
+ local z1, z2 = romans[ string.sub(roman, i, i) ], romans[ string.sub(roman, i+1, i+1) ]
+ if z1 < z2 then
+ numeral = numeral + (z2 - z1)
+ i = i + 2
+ else
+ numeral = numeral + z1
+ i = i + 1
+ end
+ end
+ if i <= len then numeral = numeral + romans[ string.sub(roman,i,i) ] end
+ return numeral
+ end
- self.insert_pattern("Block after Heading",
- DefinitionList, "DefinitionList")
+ local function sniffstyle(itemprefix)
+ local numstr, delimend = itemprefix:match("^([A-Za-z0-9]*)([.)]*)")
+ local numdelim
+ if delimend == ")" then
+ numdelim = "OneParen"
+ elseif delimend == "." then
+ numdelim = "Period"
+ else
+ numdelim = "Default"
+ end
+ numstr = numstr or itemprefix
+
+ local num
+ num = numstr:match("^([IVXL]+)")
+ if num then
+ return roman2number(num), "UpperRoman", numdelim
+ end
+ num = numstr:match("^([ivxl]+)")
+ if num then
+ return roman2number(string.upper(num)), "LowerRoman", numdelim
+ end
+ num = numstr:match("^([A-Z])")
+ if num then
+ return string.byte(num) - string.byte("A") + 1, "UpperAlpha", numdelim
+ end
+ num = numstr:match("^([a-z])")
+ if num then
+ return string.byte(num) - string.byte("a") + 1, "LowerAlpha", numdelim
+ end
+ return math.floor(tonumber(numstr) or 1), "Decimal", numdelim
+ end
+
+ local function fancylist(items,tight,start)
+ local startnum, numstyle, numdelim = sniffstyle(start)
+ return writer.fancylist(items,tight,
+ options.startNumber and startnum,
+ numstyle or "Decimal",
+ numdelim or "Default")
+ end
+
+ local FancyList = Cg(enumerator, "listtype") *
+ ( Ct(TightListItem(Cb("listtype"))
+ * TightListItem(enumerator)^0)
+ * Cc(true) * parsers.skipblanklines * -enumerator
+ + Ct(LooseListItem(Cb("listtype"))
+ * LooseListItem(enumerator)^0)
+ * Cc(false) * parsers.skipblanklines
+ ) * Cb("listtype") / fancylist
+
+ self.update_rule("OrderedList", function() return FancyList end)
end
}
end
@@ -23154,8 +23903,8 @@ end
%
% The \luamdef{extensions.fenced_code} function implements the commonmark
% fenced code block syntax extension. When the `blank_before_code_fence`
-% parameter is `true`, the syntax extension requires between a paragraph and
-% the following fenced code block.
+% parameter is `true`, the syntax extension requires a blank line between a
+% paragraph and the following fenced code block.
%
% \end{markdown}
% \begin{macrocode}
@@ -23186,12 +23935,12 @@ M.extensions.fenced_code = function(blank_before_code_fence)
local writer = self.writer
local FencedCode = (parsers.TildeFencedCode
- + parsers.BacktickFencedCode)
- / function(infostring, code)
- local expanded_code = self.expandtabs(code)
- return writer.fencedCode(expanded_code,
- infostring)
- end
+ + parsers.BacktickFencedCode)
+ / function(infostring, code)
+ local expanded_code = self.expandtabs(code)
+ return writer.fencedCode(expanded_code,
+ infostring)
+ end
self.insert_pattern("Block after Verbatim",
FencedCode, "FencedCode")
@@ -23200,12 +23949,18 @@ M.extensions.fenced_code = function(blank_before_code_fence)
if blank_before_code_fence then
fencestart = parsers.fail
else
- fencestart = parsers.fencehead(parsers.backtick)
- + parsers.fencehead(parsers.tilde)
+ fencestart = parsers.fencehead(parsers.backtick,
+ parsers.backtick_infostring)
+ + parsers.fencehead(parsers.tilde,
+ parsers.tilde_infostring)
end
- local EndlineExceptions = parsers.EndlineExceptions + fencestart
- self.update_rule("EndlineExceptions", EndlineExceptions)
+ self.update_rule("EndlineExceptions", function(previous_pattern)
+ if previous_pattern == nil then
+ previous_pattern = parsers.EndlineExceptions
+ end
+ return previous_pattern + fencestart
+ end)
self.add_special_character("~")
end
@@ -23214,91 +23969,133 @@ end
% \end{macrocode}
% \begin{markdown}
%
-%#### Notes
+%#### Fenced Divs
%
-% The \luamdef{extensions.notes} function implements the Pandoc note
-% and inline note syntax extensions. When the `note` parameter is
-% `true`, the Pandoc note syntax extension will be enabled. When the
-% `inline_notes` parameter is `true`, the Pandoc inline note syntax
-% extension will be enabled.
+% The \luamdef{extensions.fenced_divs} function implements the Pandoc fenced
+% divs syntax extension. When the `blank_before_div_fence` parameter is `true`,
+% the syntax extension requires a blank line between a paragraph and the
+% following fenced code block.
%
% \end{markdown}
% \begin{macrocode}
-M.extensions.notes = function(notes, inline_notes)
- assert(notes or inline_notes)
+M.extensions.fenced_divs = function(blank_before_div_fence)
return {
- name = "built-in notes syntax extension",
+ name = "built-in fenced_divs syntax extension",
extend_writer = function(self)
% \end{macrocode}
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->note} as a function that will transform an
-% input note `s` to the output format.
+% Define \luamdef{writer->div} as a function that will transform an input
+% fenced div with content `c` and with attributes `attr` to the output format.
%
% \end{markdown}
% \begin{macrocode}
- function self.note(s)
- return {"\\markdownRendererNote{",s,"}"}
+ function self.div(c, attr)
+ return {"\\markdownRendererFencedDivAttributeContextBegin",
+ self.attributes(attr),
+ c,
+ "\\markdownRendererFencedDivAttributeContextEnd"}
end
end, extend_reader = function(self)
local parsers = self.parsers
local writer = self.writer
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define basic patterns for matching the opening and the closing tag of a div.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local fenced_div_infostring
+ = C((parsers.linechar
+ - ( parsers.spacechar^1
+ * parsers.colon^1))^1)
- if inline_notes then
- local InlineNote
- = parsers.circumflex
- * (parsers.tag / self.parser_functions.parse_inlines_no_inline_note)
- / writer.note
-
- self.insert_pattern("Inline after Emph",
- InlineNote, "InlineNote")
- end
- if notes then
- local function strip_first_char(s)
- return s:sub(2)
- end
-
- local RawNoteRef
- = #(parsers.lbracket * parsers.circumflex)
- * parsers.tag / strip_first_char
+ local fenced_div_begin = parsers.nonindentspace
+ * parsers.colon^3
+ * parsers.optionalspace
+ * fenced_div_infostring
+ * ( parsers.spacechar^1
+ * parsers.colon^1)^0
+ * parsers.optionalspace
+ * (parsers.newline + parsers.eof)
- local rawnotes = {}
+ local fenced_div_end = parsers.nonindentspace
+ * parsers.colon^3
+ * parsers.optionalspace
+ * (parsers.newline + parsers.eof)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Initialize a named group named `div_level` for tracking how deep we are
+% nested in divs.
+%
+% \end{markdown}
+% \begin{macrocode}
+ self.initialize_named_group("div_level", "0")
- -- like indirect_link
- local function lookup_note(ref)
- return writer.defer_call(function()
- local found = rawnotes[self.normalize_tag(ref)]
- if found then
- return writer.note(
- self.parser_functions.parse_blocks_nested(found))
- else
- return {"[",
- self.parser_functions.parse_inlines("^" .. ref), "]"}
- end
- end)
+ local function increment_div_level(increment)
+ local function update_div_level(s, i, current_level) -- luacheck: ignore s i
+ current_level = tonumber(current_level)
+ local next_level = tostring(current_level + increment)
+ return true, next_level
end
- local function register_note(ref,rawnote)
- rawnotes[self.normalize_tag(ref)] = rawnote
- return ""
- end
+ return Cg( Cmt(Cb("div_level"), update_div_level)
+ , "div_level")
+ end
- local NoteRef = RawNoteRef / lookup_note
+ local FencedDiv = fenced_div_begin * increment_div_level(1)
+ * parsers.skipblanklines
+ * Ct( (V("Block") - fenced_div_end)^-1
+ * ( parsers.blanklines
+ / function()
+ return writer.interblocksep
+ end
+ * (V("Block") - fenced_div_end))^0)
+ * parsers.skipblanklines
+ * fenced_div_end * increment_div_level(-1)
+ / function (infostring, div)
+ local attr = lpeg.match(Ct(parsers.attributes), infostring)
+ if attr == nil then
+ attr = {"." .. infostring}
+ end
+ return div, attr
+ end
+ / writer.div
- local NoteBlock
- = parsers.leader * RawNoteRef * parsers.colon
- * parsers.spnl * parsers.indented_blocks(parsers.chunk)
- / register_note
+ self.insert_pattern("Block after Verbatim",
+ FencedDiv, "FencedDiv")
- local Blank = NoteBlock + parsers.Blank
- self.update_rule("Blank", Blank)
+ self.add_special_character(":")
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% If the `blank_before_div_fence` parameter is `false`, we will have the
+% closing div at the beginning of a line break the current paragraph if
+% we are currently nested in a div.
+%
+% \end{markdown}
+% \begin{macrocode}
+ if not blank_before_div_fence then
+ local function check_div_level(s, i, current_level) -- luacheck: ignore s i
+ current_level = tonumber(current_level)
+ return current_level > 0
+ end
- self.insert_pattern("Inline after Emph",
- NoteRef, "NoteRef")
+ local is_inside_div = Cmt(Cb("div_level"), check_div_level)
+ local fencestart = is_inside_div * fenced_div_end
+ self.update_rule("EndlineExceptions", function(previous_pattern)
+ if previous_pattern == nil then
+ previous_pattern = parsers.EndlineExceptions
+ end
+ return previous_pattern + fencestart
+ end)
end
-
- self.add_special_character("^")
end
}
end
@@ -23307,8 +24104,8 @@ end
%
%#### Header Attributes
%
-% The \luamdef{extensions.header_attributes} function implements a syntax
-% extension that enables the assignment of HTML attributes to headings.
+% The \luamdef{extensions.header_attributes} function implements the Pandoc
+% header attributes syntax extension.
%
% \end{markdown}
% \begin{macrocode}
@@ -23363,164 +24160,98 @@ M.extensions.header_attributes = function()
/ writer.heading
local Heading = AtxHeading + SetextHeading
- self.update_rule("Heading", Heading)
+ self.update_rule("Heading", function() return Heading end)
end
}
end
% \end{macrocode}
% \begin{markdown}
%
-%#### YAML Metadata
+%#### Notes
%
-% The \luamdef{extensions.jekyll_data} function implements the Pandoc
-% `yaml_metadata_block` syntax extension for entering metadata in \acro{yaml}.
-% When the `expect_jekyll_data` parameter is `true`, then a markdown document
-% may begin directly with \acro{yaml} metadata and may contain nothing but
-% \acro{yaml} metadata
+% The \luamdef{extensions.notes} function implements the Pandoc note
+% and inline note syntax extensions. When the `note` parameter is
+% `true`, the Pandoc note syntax extension will be enabled. When the
+% `inline_notes` parameter is `true`, the Pandoc inline note syntax
+% extension will be enabled.
%
% \end{markdown}
% \begin{macrocode}
-M.extensions.jekyll_data = function(expect_jekyll_data)
+M.extensions.notes = function(notes, inline_notes)
+ assert(notes or inline_notes)
return {
- name = "built-in jekyll_data syntax extension",
+ name = "built-in notes syntax extension",
extend_writer = function(self)
% \end{macrocode}
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->jekyllData} as a function that will transform an
-% input \acro{yaml} table `d` to the output format. The table is the value for
-% the key `p` in the parent table; if `p` is nil, then the table has no parent.
-% All scalar keys and values encountered in the table will be cast to a string
-% following \acro{yaml} serialization rules. String values will also be
-% transformed using the function `t`.
+% Define \luamdef{writer->note} as a function that will transform an
+% input note `s` to the output format.
%
% \end{markdown}
% \begin{macrocode}
- function self.jekyllData(d, t, p)
- if not self.is_writing then return "" end
+ function self.note(s)
+ return {"\\markdownRendererNote{",s,"}"}
+ end
+ end, extend_reader = function(self)
+ local parsers = self.parsers
+ local writer = self.writer
- local buf = {}
+ if inline_notes then
+ local InlineNote
+ = parsers.circumflex
+ * (parsers.tag / self.parser_functions.parse_inlines_no_inline_note)
+ / writer.note
- local keys = {}
- for k, _ in pairs(d) do
- table.insert(keys, k)
+ self.insert_pattern("Inline after Emph",
+ InlineNote, "InlineNote")
+ end
+ if notes then
+ local function strip_first_char(s)
+ return s:sub(2)
end
- table.sort(keys)
- if not p then
- table.insert(buf, "\\markdownRendererJekyllDataBegin")
- end
+ local RawNoteRef
+ = #(parsers.lbracket * parsers.circumflex)
+ * parsers.tag / strip_first_char
- if #d > 0 then
- table.insert(buf, "\\markdownRendererJekyllDataSequenceBegin{")
- table.insert(buf, self.uri(p or "null"))
- table.insert(buf, "}{")
- table.insert(buf, #keys)
- table.insert(buf, "}")
- else
- table.insert(buf, "\\markdownRendererJekyllDataMappingBegin{")
- table.insert(buf, self.uri(p or "null"))
- table.insert(buf, "}{")
- table.insert(buf, #keys)
- table.insert(buf, "}")
- end
+ local rawnotes = {}
- for _, k in ipairs(keys) do
- local v = d[k]
- local typ = type(v)
- k = tostring(k or "null")
- if typ == "table" and next(v) ~= nil then
- table.insert(
- buf,
- self.jekyllData(v, t, k)
- )
- else
- k = self.uri(k)
- v = tostring(v)
- if typ == "boolean" then
- table.insert(buf, "\\markdownRendererJekyllDataBoolean{")
- table.insert(buf, k)
- table.insert(buf, "}{")
- table.insert(buf, v)
- table.insert(buf, "}")
- elseif typ == "number" then
- table.insert(buf, "\\markdownRendererJekyllDataNumber{")
- table.insert(buf, k)
- table.insert(buf, "}{")
- table.insert(buf, v)
- table.insert(buf, "}")
- elseif typ == "string" then
- table.insert(buf, "\\markdownRendererJekyllDataString{")
- table.insert(buf, k)
- table.insert(buf, "}{")
- table.insert(buf, t(v))
- table.insert(buf, "}")
- elseif typ == "table" then
- table.insert(buf, "\\markdownRendererJekyllDataEmpty{")
- table.insert(buf, k)
- table.insert(buf, "}")
+ -- like indirect_link
+ local function lookup_note(ref)
+ return writer.defer_call(function()
+ local found = rawnotes[self.normalize_tag(ref)]
+ if found then
+ return writer.note(
+ self.parser_functions.parse_blocks_nested(found))
else
- error(format("Unexpected type %s for value of " ..
- "YAML key %s", typ, k))
+ return {"[",
+ self.parser_functions.parse_inlines("^" .. ref), "]"}
end
- end
- end
-
- if #d > 0 then
- table.insert(buf, "\\markdownRendererJekyllDataSequenceEnd")
- else
- table.insert(buf, "\\markdownRendererJekyllDataMappingEnd")
+ end)
end
- if not p then
- table.insert(buf, "\\markdownRendererJekyllDataEnd")
+ local function register_note(ref,rawnote)
+ rawnotes[self.normalize_tag(ref)] = rawnote
+ return ""
end
- return buf
- end
- end, extend_reader = function(self)
- local parsers = self.parsers
- local writer = self.writer
-
- local JekyllData
- = Cmt( C((parsers.line - P("---") - P("..."))^0)
- , function(s, i, text) -- luacheck: ignore s i
- local data
- local ran_ok, _ = 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 self.parser_functions.parse_blocks_nested(s)
- end, nil)
- else
- return false
- end
- end
- )
+ local NoteRef = RawNoteRef / lookup_note
- local UnexpectedJekyllData
- = P("---")
- * parsers.blankline / 0
- * #(-parsers.blankline) -- if followed by blank, it's thematic break
- * JekyllData
- * (P("---") + P("..."))
+ local NoteBlock
+ = parsers.leader * RawNoteRef * parsers.colon
+ * parsers.spnl * parsers.indented_blocks(parsers.chunk)
+ / register_note
- local ExpectedJekyllData
- = ( P("---")
- * parsers.blankline / 0
- * #(-parsers.blankline) -- if followed by blank, it's thematic break
- )^-1
- * JekyllData
- * (P("---") + P("..."))^-1
+ local Blank = NoteBlock + parsers.Blank
+ self.update_rule("Blank", function() return Blank end)
- self.insert_pattern("Block before Blockquote",
- UnexpectedJekyllData, "UnexpectedJekyllData")
- if expect_jekyll_data then
- self.update_rule("ExpectedJekyllData", ExpectedJekyllData)
+ self.insert_pattern("Inline after Emph",
+ NoteRef, "NoteRef")
end
+
+ self.add_special_character("^")
end
}
end
@@ -23530,7 +24261,7 @@ end
%#### Pipe Tables
%
% The \luamdef{extensions.pipe_table} function implements the \acro{PHP}
-% Markdown table syntax extension (affectionately known as pipe tables). When
+% Markdown table syntax extension (also known as pipe tables in Pandoc). When
% the `table_captions` parameter is `true`, the function also implements the
% Pandoc `table_captions` syntax extension for table captions.
%
@@ -23708,7 +24439,7 @@ M.extensions.raw_attribute = function()
% \begin{markdown}
%
% Define \luamdef{writer->rawInline} as a function that will transform an
-% input inline raw span `s` with the raw attribute `i` to the output format.
+% input inline raw span `s` with the raw attribute `attr` to the output format.
%
% \end{markdown}
% \begin{macrocode}
@@ -23725,7 +24456,7 @@ M.extensions.raw_attribute = function()
% \begin{markdown}
%
% Define \luamdef{writer->rawBlock} as a function that will transform an
-% input raw block `s` with the raw attribute `i` to the output format.
+% input raw block `s` with the raw attribute `attr` to the output format.
%
% \end{markdown}
% \begin{macrocode}
@@ -23756,17 +24487,17 @@ M.extensions.raw_attribute = function()
if options.fencedCode then
local RawBlock = (parsers.TildeFencedCode
- + parsers.BacktickFencedCode)
- / function(infostring, code)
- local expanded_code = self.expandtabs(code)
- local attr = lpeg.match(raw_attribute, infostring)
- if attr then
- return writer.rawBlock(expanded_code, attr)
- else
- return writer.fencedCode(expanded_code,
- infostring)
- end
+ + parsers.BacktickFencedCode)
+ / function(infostring, code)
+ local expanded_code = self.expandtabs(code)
+ local attr = lpeg.match(raw_attribute, infostring)
+ if attr then
+ return writer.rawBlock(expanded_code, attr)
+ else
+ return writer.fencedCode(expanded_code,
+ infostring)
end
+ end
self.insert_pattern("Block after Verbatim",
RawBlock, "RawBlock")
@@ -23819,47 +24550,6 @@ end
% \end{macrocode}
% \begin{markdown}
%
-%#### Superscripts
-%
-% The \luamdef{extensions.superscripts} function implements the Pandoc
-% superscript syntax extension.
-%
-% \end{markdown}
-% \begin{macrocode}
-M.extensions.superscripts = function()
- return {
- name = "built-in superscripts syntax extension",
- extend_writer = function(self)
-% \end{macrocode}
-% \par
-% \begin{markdown}
-%
-% Define \luamdef{writer->superscript} as a function that will transform
-% a superscript span `s` of input text to the output format.
-%
-% \end{markdown}
-% \begin{macrocode}
- function self.superscript(s)
- return {"\\markdownRendererSuperscript{",s,"}"}
- end
- end, extend_reader = function(self)
- local parsers = self.parsers
- local writer = self.writer
-
- local Superscript = (
- parsers.between(parsers.Str, parsers.circumflex, parsers.circumflex)
- ) / writer.superscript
-
- self.insert_pattern("Inline after Emph",
- Superscript, "Superscript")
-
- self.add_special_character("^")
- end
- }
-end
-% \end{macrocode}
-% \begin{markdown}
-%
%#### Subscripts
%
% The \luamdef{extensions.subscripts} function implements the Pandoc
@@ -23901,201 +24591,197 @@ end
% \end{macrocode}
% \begin{markdown}
%
-%#### Fancy Lists
+%#### Superscripts
%
-% The \luamdef{extensions.fancy_lists} function implements the Pandoc fancy
-% list extension.
+% The \luamdef{extensions.superscripts} function implements the Pandoc
+% superscript syntax extension.
%
% \end{markdown}
% \begin{macrocode}
-M.extensions.fancy_lists = function()
+M.extensions.superscripts = function()
return {
- name = "built-in fancy_lists syntax extension",
+ name = "built-in superscripts syntax extension",
extend_writer = function(self)
- local options = self.options
-
-% \end{macrocode}
-% \par
-% \begin{markdown}
-%
-% Define \luamdef{writer->fancylist} as a function that will transform an
-% input ordered list to the output format, where:
-%
-%- `items` is an array of the list items,
-%- `tight` specifies, whether the list is tight or not,
-%- `startnum` is the number of the first list item,
-%- `numstyle` is the style of the list item labels from among the following:
-% - `Decimal` -- decimal arabic numbers,
-% - `LowerRoman` -- lower roman numbers,
-% - `UpperRoman` -- upper roman numbers,
-% - `LowerAlpha` -- lower ASCII alphabetic characters, and
-% - `UpperAlpha` -- upper ASCII alphabetic characters, and
-%- `numdelim` is the style of delimiters between list item labels and
-% texts from among the following:
-% - `Default` -- default style,
-% - `OneParen` -- parentheses, and
-% - `Period` -- periods.
-%
-% \end{markdown}
-% \begin{macrocode}
- function self.fancylist(items,tight,startnum,numstyle,numdelim)
- if not self.is_writing then return "" end
- local buffer = {}
- local num = startnum
- for _,item in ipairs(items) do
- buffer[#buffer + 1] = self.fancyitem(item,num)
- if num ~= nil then
- num = num + 1
- end
- end
- local contents = util.intersperse(buffer,"\n")
- if tight and options.tightLists then
- return {"\\markdownRendererFancyOlBeginTight{",
- numstyle,"}{",numdelim,"}",contents,
- "\n\\markdownRendererFancyOlEndTight "}
- else
- return {"\\markdownRendererFancyOlBegin{",
- numstyle,"}{",numdelim,"}",contents,
- "\n\\markdownRendererFancyOlEnd "}
- end
- end
% \end{macrocode}
+% \par
% \begin{markdown}
%
-% Define \luamdef{writer->fancyitem} as a function that will transform an
-% input fancy ordered list item to the output format, where `s` is the text of
-% the list item. If the optional parameter `num` is present, it is the number
-% of the list item.
+% Define \luamdef{writer->superscript} as a function that will transform
+% a superscript span `s` of input text to the output format.
%
% \end{markdown}
% \begin{macrocode}
- function self.fancyitem(s,num)
- if num ~= nil then
- return {"\\markdownRendererFancyOlItemWithNumber{",num,"}",s,
- "\\markdownRendererFancyOlItemEnd "}
- else
- return {"\\markdownRendererFancyOlItem ",s,"\\markdownRendererFancyOlItemEnd "}
- end
+ function self.superscript(s)
+ return {"\\markdownRendererSuperscript{",s,"}"}
end
end, extend_reader = function(self)
local parsers = self.parsers
- local options = self.options
local writer = self.writer
- local label = parsers.dig + parsers.letter
- local numdelim = parsers.period + parsers.rparent
- local enumerator = C(label^3 * numdelim) * #parsers.spacing
- + C(label^2 * numdelim) * #parsers.spacing
- * (parsers.tab + parsers.space^1)
- + C(label * numdelim) * #parsers.spacing
- * (parsers.tab + parsers.space^-2)
- + parsers.space * C(label^2 * numdelim)
- * #parsers.spacing
- + parsers.space * C(label * numdelim)
- * #parsers.spacing
- * (parsers.tab + parsers.space^-1)
- + parsers.space * parsers.space * C(label^1
- * numdelim) * #parsers.spacing
- local starter = parsers.bullet + enumerator
-
- local NestedList = Cs((parsers.optionallyindentedline
- - starter)^1)
- / function(a) return "\001"..a end
+ local Superscript = (
+ parsers.between(parsers.Str, parsers.circumflex, parsers.circumflex)
+ ) / writer.superscript
- local ListBlockLine = parsers.optionallyindentedline
- - parsers.blankline - (parsers.indent^-1
- * starter)
+ self.insert_pattern("Inline after Emph",
+ Superscript, "Superscript")
- local ListBlock = parsers.line * ListBlockLine^0
+ self.add_special_character("^")
+ end
+ }
+end
+% \end{macrocode}
+% \begin{markdown}
+%
+%#### YAML Metadata
+%
+% The \luamdef{extensions.jekyll_data} function implements the Pandoc
+% `yaml_metadata_block` syntax extension. When the `expect_jekyll_data`
+% parameter is `true`, then a markdown document may begin directly with
+% \acro{yaml} metadata and may contain nothing but \acro{yaml} metadata.
+%
+% \end{markdown}
+% \begin{macrocode}
+M.extensions.jekyll_data = function(expect_jekyll_data)
+ return {
+ name = "built-in jekyll_data syntax extension",
+ extend_writer = function(self)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->jekyllData} as a function that will transform an
+% input \acro{yaml} table `d` to the output format. The table is the value for
+% the key `p` in the parent table; if `p` is nil, then the table has no parent.
+% All scalar keys and values encountered in the table will be cast to a string
+% following \acro{yaml} serialization rules. String values will also be
+% transformed using the function `t`.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.jekyllData(d, t, p)
+ if not self.is_writing then return "" end
- local ListContinuationBlock = parsers.blanklines * (parsers.indent / "")
- * ListBlock
+ local buf = {}
- local TightListItem = function(starter)
- return -parsers.ThematicBreak
- * (Cs(starter / "" * parsers.tickbox^-1 * ListBlock * NestedList^-1)
- / self.parser_functions.parse_blocks_nested)
- * -(parsers.blanklines * parsers.indent)
- end
+ local keys = {}
+ for k, _ in pairs(d) do
+ table.insert(keys, k)
+ end
+ table.sort(keys)
- local LooseListItem = function(starter)
- return -parsers.ThematicBreak
- * Cs( starter / "" * parsers.tickbox^-1 * ListBlock * Cc("\n")
- * (NestedList + ListContinuationBlock^0)
- * (parsers.blanklines / "\n\n")
- ) / self.parser_functions.parse_blocks_nested
- end
+ if not p then
+ table.insert(buf, "\\markdownRendererJekyllDataBegin")
+ end
- local function roman2number(roman)
- local romans = { ["L"] = 50, ["X"] = 10, ["V"] = 5, ["I"] = 1 }
- local numeral = 0
+ if #d > 0 then
+ table.insert(buf, "\\markdownRendererJekyllDataSequenceBegin{")
+ table.insert(buf, self.uri(p or "null"))
+ table.insert(buf, "}{")
+ table.insert(buf, #keys)
+ table.insert(buf, "}")
+ else
+ table.insert(buf, "\\markdownRendererJekyllDataMappingBegin{")
+ table.insert(buf, self.uri(p or "null"))
+ table.insert(buf, "}{")
+ table.insert(buf, #keys)
+ table.insert(buf, "}")
+ end
- local i = 1
- local len = string.len(roman)
- while i < len do
- local z1, z2 = romans[ string.sub(roman, i, i) ], romans[ string.sub(roman, i+1, i+1) ]
- if z1 < z2 then
- numeral = numeral + (z2 - z1)
- i = i + 2
+ for _, k in ipairs(keys) do
+ local v = d[k]
+ local typ = type(v)
+ k = tostring(k or "null")
+ if typ == "table" and next(v) ~= nil then
+ table.insert(
+ buf,
+ self.jekyllData(v, t, k)
+ )
else
- numeral = numeral + z1
- i = i + 1
+ k = self.uri(k)
+ v = tostring(v)
+ if typ == "boolean" then
+ table.insert(buf, "\\markdownRendererJekyllDataBoolean{")
+ table.insert(buf, k)
+ table.insert(buf, "}{")
+ table.insert(buf, v)
+ table.insert(buf, "}")
+ elseif typ == "number" then
+ table.insert(buf, "\\markdownRendererJekyllDataNumber{")
+ table.insert(buf, k)
+ table.insert(buf, "}{")
+ table.insert(buf, v)
+ table.insert(buf, "}")
+ elseif typ == "string" then
+ table.insert(buf, "\\markdownRendererJekyllDataString{")
+ table.insert(buf, k)
+ table.insert(buf, "}{")
+ table.insert(buf, t(v))
+ table.insert(buf, "}")
+ elseif typ == "table" then
+ table.insert(buf, "\\markdownRendererJekyllDataEmpty{")
+ table.insert(buf, k)
+ table.insert(buf, "}")
+ else
+ error(format("Unexpected type %s for value of " ..
+ "YAML key %s", typ, k))
+ end
end
end
- if i <= len then numeral = numeral + romans[ string.sub(roman,i,i) ] end
- return numeral
- end
- local function sniffstyle(itemprefix)
- local numstr, delimend = itemprefix:match("^([A-Za-z0-9]*)([.)]*)")
- local numdelim
- if delimend == ")" then
- numdelim = "OneParen"
- elseif delimend == "." then
- numdelim = "Period"
+ if #d > 0 then
+ table.insert(buf, "\\markdownRendererJekyllDataSequenceEnd")
else
- numdelim = "Default"
+ table.insert(buf, "\\markdownRendererJekyllDataMappingEnd")
end
- numstr = numstr or itemprefix
- local num
- num = numstr:match("^([IVXL]+)")
- if num then
- return roman2number(num), "UpperRoman", numdelim
- end
- num = numstr:match("^([ivxl]+)")
- if num then
- return roman2number(string.upper(num)), "LowerRoman", numdelim
- end
- num = numstr:match("^([A-Z])")
- if num then
- return string.byte(num) - string.byte("A") + 1, "UpperAlpha", numdelim
- end
- num = numstr:match("^([a-z])")
- if num then
- return string.byte(num) - string.byte("a") + 1, "LowerAlpha", numdelim
+ if not p then
+ table.insert(buf, "\\markdownRendererJekyllDataEnd")
end
- return math.floor(tonumber(numstr) or 1), "Decimal", numdelim
- end
- local function fancylist(items,tight,start)
- local startnum, numstyle, numdelim = sniffstyle(start)
- return writer.fancylist(items,tight,
- options.startNumber and startnum,
- numstyle or "Decimal",
- numdelim or "Default")
+ return buf
end
+ end, extend_reader = function(self)
+ local parsers = self.parsers
+ local writer = self.writer
- local FancyList = Cg(enumerator, "listtype") *
- ( Ct(TightListItem(Cb("listtype"))
- * TightListItem(enumerator)^0)
- * Cc(true) * parsers.skipblanklines * -enumerator
- + Ct(LooseListItem(Cb("listtype"))
- * LooseListItem(enumerator)^0)
- * Cc(false) * parsers.skipblanklines
- ) * Cb("listtype") / fancylist
+ local JekyllData
+ = Cmt( C((parsers.line - P("---") - P("..."))^0)
+ , function(s, i, text) -- luacheck: ignore s i
+ local data
+ local ran_ok, _ = 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 self.parser_functions.parse_blocks_nested(s)
+ end, nil)
+ else
+ return false
+ end
+ end
+ )
+
+ local UnexpectedJekyllData
+ = P("---")
+ * parsers.blankline / 0
+ * #(-parsers.blankline) -- if followed by blank, it's thematic break
+ * JekyllData
+ * (P("---") + P("..."))
- self.update_rule("OrderedList", FancyList)
+ local ExpectedJekyllData
+ = ( P("---")
+ * parsers.blankline / 0
+ * #(-parsers.blankline) -- if followed by blank, it's thematic break
+ )^-1
+ * JekyllData
+ * (P("---") + P("..."))^-1
+
+ self.insert_pattern("Block before Blockquote",
+ UnexpectedJekyllData, "UnexpectedJekyllData")
+ if expect_jekyll_data then
+ self.update_rule("ExpectedJekyllData", function() return ExpectedJekyllData end)
+ end
end
}
end
@@ -24132,6 +24818,11 @@ function M.new(options)
% \begin{macrocode}
local extensions = {}
+ if options.bracketedSpans then
+ local bracketed_spans_extension = M.extensions.bracketed_spans()
+ table.insert(extensions, bracketed_spans_extension)
+ end
+
if options.contentBlocks then
local content_blocks_extension = M.extensions.content_blocks(
options.contentBlocksLanguageMap)
@@ -24150,6 +24841,12 @@ function M.new(options)
table.insert(extensions, fenced_code_extension)
end
+ if options.fencedDivs then
+ local fenced_div_extension = M.extensions.fenced_divs(
+ options.blankBeforeDivFence)
+ table.insert(extensions, fenced_div_extension)
+ end
+
if options.headerAttributes then
local header_attributes_extension = M.extensions.header_attributes()
table.insert(extensions, header_attributes_extension)
@@ -24870,14 +25567,14 @@ end
%
% The \mdef{markdownPrepare} macro contains the Lua code that is executed prior
% to any conversion from markdown to plain \TeX{}. It exposes the
-% \luamref{convert} function for the use by any further Lua code.
+% `convert` function for the use by any further Lua code.
%
% \end{markdown}
% \begin{macrocode}
\def\markdownPrepare{%
% \end{macrocode}
% \begin{markdown}
-% First, ensure that the \mref{markdownOptionCacheDir} directory exists.
+% First, ensure that the \Opt{cacheDir} directory exists.
% \end{markdown}
% \begin{macrocode}
local lfs = require("lfs")
@@ -24973,7 +25670,7 @@ end
% \begin{markdown}
%
% The \mref{markdownReadAndConvert} macro is largely a rewrite of the
-% \Hologo{LaTeX2e} \mref{filecontents} macro to plain \TeX{}.
+% \Hologo{LaTeX2e} `\filecontents` macro to plain \TeX{}.
%
% \end{markdown}
% \begin{macrocode}
@@ -24985,7 +25682,7 @@ end
% backslash as an ordinary character inside the macro definition. Likewise,
% swap the character codes of the percent sign (`\%`) and the ampersand (`@`),
% so that we can remove percent signs from the beginning of lines when
-% \mref{markdownOptionStripPercentSigns} is enabled.
+% \Opt{stripPercentSigns} is enabled.
% \end{markdown}
% \begin{macrocode}
\catcode`\^^M=13%
@@ -24999,7 +25696,7 @@ end
% \end{macrocode}
% \begin{markdown}
% If we are not reading markdown documents from the frozen cache,
-% open the \mref{markdownOptionInputTempFileName} file for writing.
+% open the \Opt{inputTempFileName} file for writing.
% \end{markdown}
% \begin{macrocode}
|markdownIfOption{frozenCache}{}{@
@@ -25024,7 +25721,7 @@ end
% \begin{markdown}
% The \mdef{markdownReadAndConvertStripPercentSigns} macro will process the
% individual lines of output, stipping away leading percent signs (`\%`) when
-% \mref{markdownOptionStripPercentSigns} is enabled.
+% \Opt{stripPercentSigns} is enabled.
% Notice the use of the comments (`@`) to ensure that the entire macro is at
% a single line and therefore no (active) newline symbols
% (`^^M`) are produced.
@@ -25060,7 +25757,7 @@ end
% \begin{markdown}
% If we are not reading markdown documents from the frozen cache and the ending
% token sequence does not appear in the line, store the line in the
-% \mref{markdownOptionInputTempFileName} file.
+% \Opt{inputTempFileName} file.
% If we are reading markdown documents from the frozen cache and the
% ending token sequence does not appear in the line, gobble the line.
% \end{markdown}
@@ -25073,10 +25770,10 @@ end
% \end{macrocode}
% \begin{markdown}
% When the ending token sequence appears in the line, make the next newline
-% character close the \mref{markdownOptionInputTempFileName} file, return the
+% character close the \Opt{inputTempFileName} file, return the
% character categories back to the former state, convert the
-% \mref{markdownOptionInputTempFileName} file from markdown to plain \TeX{},
-% \mref{input} the result of the conversion, and expand the ending control
+% \Opt{inputTempFileName} file from markdown to plain \TeX{},
+% `\input` the result of the conversion, and expand the ending control
% sequence.
% \end{markdown}
% \begin{macrocode}
@@ -25181,10 +25878,10 @@ end
% whether the shell access is enabled (`1`), disabled (`0`), or restricted
% (`2`).
%
-% Inherit the value of the the \mref{pdfshellescape} (Lua\TeX{}, \Hologo{pdfTeX})
-% or the \mref{shellescape} (\Hologo{XeTeX}) commands. If neither of these
+% Inherit the value of the the `\pdfshellescape` (Lua\TeX{}, \Hologo{pdfTeX})
+% or the `\shellescape` (\Hologo{XeTeX}) commands. If neither of these
% commands is defined and Lua is available, attempt to access the
-% \luamref{status.shell_escape} configuration item.
+% `status.shell_escape` configuration item.
%
% If you cannot detect, whether the shell access is enabled, act as if it were.
%
@@ -25210,7 +25907,7 @@ end
%
% The \mdef{markdownExecuteDirect} macro executes the code it has received as
% its first argument by writing it to the output file stream 18, if Lua is
-% unavailable, or by using the Lua \luamref{os.execute} method otherwise.
+% unavailable, or by using the Lua `os.execute` method otherwise.
%
% \end{markdown}
% \begin{macrocode}
@@ -25245,8 +25942,8 @@ end
%
% The \mdef{markdownLuaExecute} macro executes the Lua code it has received as
% its first argument. The Lua code may not directly interact with the \TeX{}
-% engine, but it can use the \luamref{print} function in the same manner it
-% would use the \luamref{tex.print} method.
+% engine, but it can use the `print` function in the same manner it
+% would use the `tex.print` method.
%
% \end{markdown}
% \begin{macrocode}
@@ -25262,7 +25959,7 @@ end
|gdef|markdownLuaExecute#1{%
% \end{macrocode}
% \begin{markdown}
-% Create the file \mref{markdownOptionHelperScriptFileName} and fill it with the
+% Create the file \Opt{helperScriptFileName} and fill it with the
% input Lua code prepended with \pkg{kpathsea} initialization, so that Lua
% modules from the \TeX{} distribution are available.
% \end{markdown}
@@ -25279,7 +25976,7 @@ end
end)
% \end{macrocode}
% \begin{markdown}
-% If there was an error, use the file \mref{markdownOptionErrorTempFileName} to
+% If there was an error, use the file \Opt{errorTempFileName} to
% store the error message.
% \end{markdown}
% \begin{macrocode}
@@ -25299,9 +25996,9 @@ end
|immediate|closeout|markdownOutputFileStream
% \end{macrocode}
% \begin{markdown}
-% Execute the generated \mref{markdownOptionHelperScriptFileName} Lua script using
+% Execute the generated \Opt{helperScriptFileName} Lua script using
% the \TeX{}Lua binary and store the output in the
-% \mref{markdownOptionOutputTempFileName} file.
+% \Opt{outputTempFileName} file.
% \end{markdown}
% \begin{macrocode}
|markdownInfo{Executing a helper Lua script from the file
@@ -25313,7 +26010,7 @@ end
/|markdownOptionOutputTempFileName"}%
% \end{macrocode}
% \begin{markdown}
-% \mref{input} the generated \mref{markdownOptionOutputTempFileName} file.
+% `\input` the generated \Opt{outputTempFileName} file.
% \end{markdown}
% \begin{macrocode}
|input|markdownOptionOutputTempFileName|relax}%
@@ -25340,8 +26037,8 @@ end
% \begin{markdown}
%
% The direct Lua access version of the \mref{markdownLuaExecute} macro is defined
-% in terms of the \mref{directlua} primitive. The \luamref{print} function is set as
-% an alias to the \luamref{tex.print} method in order to mimic the behaviour of the
+% in terms of the `\directlua` primitive. The `print` function is set as
+% an alias to the `tex.print` method in order to mimic the behaviour of the
% \mref{markdownLuaExecute} definition from Section <#sec:luabridge>,
%
% \end{markdown}
@@ -25520,8 +26217,8 @@ end
%
%### Logging Facilities
% The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see
-% Section <#sec:texinterfacelogging>) to use the \LaTeX{} \mref{PackageInfo},
-% \mref{PackageWarning}, and \mref{PackageError} macros.
+% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`,
+% `\PackageWarning`, and `\PackageError` macros.
%
% \end{markdown}
% \begin{macrocode}
@@ -25660,7 +26357,7 @@ end
%
% If the infostring starts with `dot …`, we redefine the fenced code block
% token renderer prototype, so that it typesets the code block via Graphviz
-% tools if and only if the \mref{markdownOptionFrozenCache} plain \TeX{} option is
+% tools if and only if the \Opt{frozenCache} plain \TeX{} option is
% disabled and the code block has not been previously typeset:
%
% \end{markdown}
@@ -25723,8 +26420,8 @@ end
% \end{macrocode}
% \begin{markdown}
%
-% We define the \mref{markdown@witiko@graphicx@http@counter} counter to enumerate
-% the images for caching and the \mref{markdown@witiko@graphicx@http@filename}
+% We define the \mdef{markdown@witiko@graphicx@http@counter} counter to enumerate
+% the images for caching and the \mdef{markdown@witiko@graphicx@http@filename}
% command, which will store the pathname of the file containing the pathname
% of the downloaded image file.
%
@@ -25738,7 +26435,7 @@ end
% \end{macrocode}
% \begin{markdown}
%
-% We define the \mref{markdown@witiko@graphicx@http@download} command, which will
+% We define the \mdef{markdown@witiko@graphicx@http@download} command, which will
% receive two arguments that correspond to the URL of the online image and to
% the pathname, where the online image should be downloaded. The command will
% produce a shell command that tries to downloads the online image to the
@@ -25774,7 +26471,7 @@ end
% \begin{markdown}
%
% The image will be downloaded only if the image URL has the http or https
-% protocols and the \mref{markdownOptionFrozenCache} plain \TeX{} option is disabled:
+% protocols and the \Opt{frozenCache} plain \TeX{} option is disabled:
%
% \end{markdown}
% \begin{macrocode}
@@ -25786,7 +26483,7 @@ end
% \end{macrocode}
% \begin{markdown}
%
-% The image will be downloaded to the pathname \mref{markdownOptionCacheDir}`/`\meta{the MD5 digest of the image URL}`.`\meta{the suffix of the
% image URL}:
%
@@ -26255,7 +26952,7 @@ end
% \begin{markdown}
%
% If identifier attributes appear at the beginning of a section, we make the
-% next heading produce the \mref{label} macro.
+% next heading produce the `\label` macro.
%
% \end{markdown}
% \begin{macrocode}
@@ -26439,9 +27136,9 @@ end
% \begin{markdown}
%
%#### Citations
-% Here is a basic implementation for citations that uses the \LaTeX{} \mref{cite}
-% macro. There are also implementations that use the \pkg{natbib} \mref{citep},
-% and \mref{citet} macros, and the Bib\LaTeX{} \mref{autocites} and \mref{textcites}
+% Here is a basic implementation for citations that uses the \LaTeX{} `\cite`
+% macro. There are also implementations that use the \pkg{natbib} `\citep`,
+% and `\citet` macros, and the Bib\LaTeX{} `\autocites` and `\textcites`
% macros. These implementations will be used, when the respective packages are
% loaded.
%
@@ -26849,8 +27546,8 @@ end
%
%#### YAML Metadata {#latexyamlmetadata}
%
-% The default setup of \acro{yaml} metadata will invoke the \mref{title},
-% \mref{author}, and \mref{date} macros when scalar values for keys that
+% The default setup of \acro{yaml} metadata will invoke the `\title`,
+% `\author`, and `\date` macros when scalar values for keys that
% correspond to the `title`, `author`, and `date` relative wildcards are
% encountered, respectively.
%
@@ -26868,10 +27565,10 @@ end
% \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
+% the `\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
% macro until after the beginning of the document. Otherwise, we will use
-% the \mref{maketitle} macro straight away.
+% the `\maketitle` macro straight away.
%
% \end{markdown}
% \begin{macrocode}
@@ -26984,7 +27681,7 @@ end
% after supplying the missing plain \TeX{} macros.
%
% When buffering user input, we should disable the bytes with the high bit set,
-% since these are made active by the \mref{enableregime} macro. We will do this
+% since these are made active by the `\enableregime` macro. We will do this
% by redefining the \mref{markdownMakeOther} macro accordingly. The code is
% courtesy of Scott Pakin, the creator of the \pkg{filecontents} \LaTeX{}
% package.
@@ -27169,7 +27866,7 @@ end
% \begin{markdown}
%
% The code fence infostring is used as a name from the \Hologo{ConTeXt}
-% \mref{definetyping} macro. This allows the user to set up code highlighting
+% `\definetyping` macro. This allows the user to set up code highlighting
% mapping as follows:
% ````` tex
% % Map the `TEX` syntax highlighter to the `latex` infostring.
diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html
index 8f66e86c6e..4d62b54fc2 100644
--- a/macros/generic/markdown/markdown.html
+++ b/macros/generic/markdown/markdown.html
@@ -84,7 +84,7 @@
Markdown Package User Manual
Vít Novotný
-
2.18.0-0-gd8ae860 2022-10-30
+
2.19.0-0-g80fcf20 2022-12-23
The frozen cache makes it possible to later typeset a plain TeX document that contains markdown
documents without invoking Lua using the
-\markdownOptionFrozenCache plain frozenCache plain TeX option. As a result, the plain TeX document becomes more portable, but
further changes in the order and the content of markdown documents will
@@ -1451,7 +1451,7 @@ class="sourceCode tex"> convert = markdown.new({fencedCode = true}) input = "A paragraph." .. newline .. "```" .. newline ..
- "A code fence." .. newline ..
+ "A fenced code." .. newline .. "```" .. newline tex.sprint(convert(input))
@@ -1459,7 +1459,7 @@ class="sourceCode tex"> fencedCode = true, blankBeforeCodeFence = true}) input = "A paragraph." .. newline .. "```" .. newline ..
- "Not a code fence." .. newline ..
+ "Not a fenced code." .. newline .. "```" .. newline tex.sprint(convert(input)) }\bye
@@ -1470,8 +1470,8 @@ class="sourceCode sh">Lua CLI Example
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
@@ -1708,26 +1762,26 @@ contain the following text:
class="tex">TeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\input markdown
-
-\markdownBegin
-A paragraph.
-A heading.
-==========
-\markdownEnd
-
-\def\markdownOptionBlankBeforeHeading{true}
-\markdownBegin
-A paragraph.
-Not a heading.
-==============
-\markdownEnd
-
-\bye
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
@@ -1902,26 +2027,26 @@ contain the following text:
class="tex">TeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\input markdown
-
-\markdownBegin
-> A single
-
-> block quote.
-\markdownEnd
-
-\def\markdownOptionBreakableBlockquotes{true}
-\markdownBegin
-> A block quote.
-
-> Another block quote.
-\markdownEnd
-
-\bye
+
\input markdown
+
+\markdownBegin
+> A single
+
+> block quote.
+\markdownEnd
+
+\def\markdownOptionBreakableBlockquotes{true}
+\markdownBegin
+> A block quote.
+
+> Another block quote.
+\markdownEnd
+
+\bye
Next, invoke LuaTeX from the terminal:
-
luatex document.tex
+
luatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -1935,31 +2060,31 @@ contain the following text:
Another block quote.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-> A single
-
-> block quote.
-\end{markdown}
-
-\begin{markdown*}{breakableBlockquotes}
-> A block quote.
-
-> Another block quote.
-\end{markdown*}
-
-\end{document}
+
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+> A single
+
+> block quote.
+\end{markdown}
+
+\begin{markdown*}{breakableBlockquotes}
+> A block quote.
+
+> Another block quote.
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-
lualatex document.tex
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -1977,27 +2102,27 @@ contain the following text:
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-> A single
-
-> block quote.
-\stopmarkdown
-
-\setupmarkdown[breakableBlockquotes = yes]
-\startmarkdown
-> A block quote.
-
-> Another block quote.
-\stopmarkdown
-
-\stoptext
+
\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+> A single
+
+> block quote.
+\stopmarkdown
+
+\setupmarkdown[breakableBlockquotes = yes]
+\startmarkdown
+> A block quote.
+
+> Another block quote.
+\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:
@@ -2011,8 +2136,8 @@ contain the following text:
Another block quote.
-
2.2.1.9 Option
+
2.2.1.11 Option
citationNbsps
citationNbsps (default value: true)
@@ -2033,41 +2158,41 @@ syntax extension.
-
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"
-}
+
@book{knuth:tex,
+author = "Knuth, Donald Ervin",
+title = "The \TeX book, volume A of Computers and typesetting",
+publisher = "Addison-Wesley",
+year = "1984"
+}
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage[citations]{markdown}
-\begin{document}
-
-\begin{markdown}
-The TeXbook [@knuth:tex, p. 123 and 130] is good.
-\end{markdown}
-
-\begin{markdown*}{citationNbsps = false}
-The TeXbook [@knuth:tex, p. 123 and 130] is good.
-\end{markdown*}
-
-\bibliographystyle{plain}
-\bibliography{document.bib}
-\end{document}
+
\documentclass{article}
+\usepackage[citations]{markdown}
+\begin{document}
+
+\begin{markdown}
+The TeXbook [@knuth:tex, p. 123 and 130] is good.
+\end{markdown}
+
+\begin{markdown*}{citationNbsps = false}
+The TeXbook [@knuth:tex, p. 123 and 130] is good.
+\end{markdown*}
+
+\bibliographystyle{plain}
+\bibliography{document.bib}
+\end{document}
A PDF document named document.pdf should be produced and
contain the following text, where the middot (·) denotes a
non-breaking space:
@@ -2080,8 +2205,8 @@ href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2">1
Donald·Ervin Knuth. The TeXbook, volume A of Computers and
typesetting. Addison-Wesley, 1984.
Here is a simple parenthetical citation [@doe99] and here
-is a string of several [see @doe99, pp. 33-35; also
-@smith04, chap. 1].
-
-A parenthetical citation can have a [prenote @doe99] and
-a [@smith04 postnote]. The name of the author can be
-suppressed by inserting a dash before the name of an
-author as follows [-@smith04].
-
-Here is a simple text citation @doe99 and here is
-a string of several @doe99 [pp. 33-35; also @smith04,
-chap. 1]. Here is one with the name of the author
-suppressed -@doe99.
+
Here is a simple parenthetical citation [@doe99] and here
+is a string of several [see @doe99, pp. 33-35; also
+@smith04, chap. 1].
+
+A parenthetical citation can have a [prenote @doe99] and
+a [@smith04 postnote]. The name of the author can be
+suppressed by inserting a dash before the name of an
+author as follows [-@smith04].
+
+Here is a simple text citation @doe99 and here is
+a string of several @doe99 [pp. 33-35; also @smith04,
+chap. 1]. Here is one with the name of the author
+suppressed -@doe99.
@book{knuth:tex,
-author = "Knuth, Donald Ervin",
-title = "The \TeX book, volume A of Computers and typesetting",
-publisher = "Addison-Wesley",
-year = "1984"
-}
+
@book{knuth:tex,
+author = "Knuth, Donald Ervin",
+title = "The \TeX book, volume A of Computers and typesetting",
+publisher = "Addison-Wesley",
+year = "1984"
+}
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage[backend=biber]{biblatex}
-\addbibresource{document.bib}
-\usepackage[citations]{markdown}
-\begin{document}
-
-\begin{markdown}
-The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.
-\end{markdown}
-
-\printbibliography
-\end{document}
+
\documentclass{article}
+\usepackage[backend=biber]{biblatex}
+\addbibresource{document.bib}
+\usepackage[citations]{markdown}
+\begin{document}
+
+\begin{markdown}
+The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.
+\end{markdown}
+
+\printbibliography
+\end{document}
Use the `printf()` function.
-``There is a literal backtick (`) here.``
+
Use the `printf()` function.
+``There is a literal backtick (`) here.``
@@ -2189,28 +2314,28 @@ quotation mark ligatures in texts that do not contain code spans:
Lua Module Example
Using a text editor, create a text document named
document.tex with the following content:
-
\input markdown
-\input lmfonts
-\directlua{
- local markdown = require("markdown")
- local convert = markdown.new()
- local input =
- "``This is a code span.'' " ..
- "``This is no longer a code span.''"
- tex.sprint(convert(input)) }
-\par
-\directlua{
- local markdown = require("markdown")
- local convert = markdown.new({codeSpans = false})
- local input =
- "``This is a quote.'' " ..
- "``This is another quote.''"
- tex.sprint(convert(input)) }
-\bye
+
\input markdown
+\input lmfonts
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new()
+ local input =
+ "``This is a code span.'' " ..
+ "``This is no longer a code span.''"
+ tex.sprint(convert(input)) }
+\par
+\directlua{
+ local markdown = require("markdown")
+ local convert = markdown.new({codeSpans = false})
+ local input =
+ "``This is a quote.'' " ..
+ "``This is another quote.''"
+ tex.sprint(convert(input)) }
+\bye
Then, invoke LuaTeX from the terminal:
-
luatex document.tex
+
luatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -2221,22 +2346,22 @@ span.’’
Lua CLI Example
Using a text editor, create a text document named
document.tex with the following content:
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
@@ -2256,24 +2381,24 @@ contain the following text:
class="tex">TeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\input markdown
-
-\markdownBegin
-``This is a code span.''
-``This is no longer a code span.''
-\markdownEnd
-
-\def\markdownOptionCodeSpans{false}
-\markdownBegin
-``This is a quote.''
-``This is another quote.''
-\markdownEnd
-
-\bye
+
\input markdown
+
+\markdownBegin
+``This is a code span.''
+``This is no longer a code span.''
+\markdownEnd
+
+\def\markdownOptionCodeSpans{false}
+\markdownBegin
+``This is a quote.''
+``This is another quote.''
+\markdownEnd
+
+\bye
Next, invoke LuaTeX from the terminal:
-
luatex document.tex
+
luatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -2281,29 +2406,29 @@ contain the following text:
span.’’
“This is a quote.” “This is another quote.”
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-``This is a code span.''
-``This is no longer a code span.''
-\end{markdown}
-
-\begin{markdown*}{codeSpans=false}
-``This is a quote.''
-``This is another quote.''
-\end{markdown*}
-
-\end{document}
+
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+``This is a code span.''
+``This is no longer a code span.''
+\end{markdown}
+
+\begin{markdown*}{codeSpans=false}
+``This is a quote.''
+``This is another quote.''
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-
lualatex document.tex
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -2315,25 +2440,25 @@ span.’’
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-``This is a code span.''
-``This is no longer a code span.''
-\stopmarkdown
-
-\setupmarkdown[codeSpans = no]
-\startmarkdown
-``This is a quote.''
-``This is another quote.''
-\stopmarkdown
-
-\stoptext
+
\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+``This is a code span.''
+``This is no longer a code span.''
+\stopmarkdown
+
+\setupmarkdown[codeSpans = no]
+\startmarkdown
+``This is a quote.''
+``This is another quote.''
+\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:
@@ -2341,8 +2466,8 @@ contain the following text:
span.’’
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
@@ -2807,89 +2932,29 @@ title="Kpathsea - TeX Users Group">Kpathsea.
A TeX document named
hello.tex should be produced and contain the following
code:
-
Hello \markdownRendererEmphasis{world}!\relax
+
Hello \markdownRendererEmphasis{world}!\relax
Invoke LuaTeX from the terminal again, this time with the
eagerCache option enabled:
A TeX document named
hello.tex should be produced and contain the following
code:
-
\input ./⟨hash⟩.md.tex\relax
+
\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.16 Option
-extensions
+
Hello \markdownRendererEmphasis{world}!\relax
+
2.2.1.18 Option
+expectJekyllData
-
extensions (default value: {})
-
-
The filenames of user-defined syntax extensions that will be applied
-to the markdown reader. If the kpathsea
-library is available, files will be searched for not only in the current
-working directory but also in the TeX directory structure.
-
-
-
LaTeX Example
-
Using a text editor, create a text document named
-strike-through.lua with the following content:
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
This is a lunar roving vehicle strike-through text.
-
-
2.2.1.17 Option
-expectJekyllData
-
-
expectJekyllData (default value:
-false)
+
expectJekyllData (default value:
+false)
false
@@ -2899,26 +2964,26 @@ 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}
+
\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}
\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}
+
\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
+
name: Jane Doe
+age:99
Using a text editor, create also a text document named
document.tex with the following content:
A PDF document named document.pdf should be produced and
contain the following text:
Jane Doe is 99 years old.
-
2.2.1.18 Option
+
2.2.1.19 Option
+extensions
+
+
extensions (default value: {})
+
+
The filenames of user-defined syntax extensions that will be applied
+to the markdown reader. If the kpathsea
+library is available, files will be searched for not only in the current
+working directory but also in the TeX directory structure.
+
+
+
LaTeX Example
+
Using a text editor, create a text document named
+strike-through.lua with the following content:
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>
+ ```
\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}
+
\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
+
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>
+
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]
-\setupmarkdown[fencedCode = yes]
-\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
+
\usemodule[t][markdown]
+\setupmarkdown[fencedCode = yes]
+\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
+
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.20 Option
+
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.22 Option
+fencedDivs
+
+
fencedDivs (default value: false)
+
+
+
true
+
+
Enable the Pandoc fenced divs extension:
+
::::: {#special .sidebar}
+Here is a paragraph.
+
+And another.
+:::::
+
+
+
+
+
+
false
+
+
Disable the Pandoc fenced divs extension:
+
+
+
+
+
LaTeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\documentclass{article}
+\usepackage[fencedDivs]{markdown}
+\begin{document}
+\begin{markdown}{slice=special}
+Here is a regular paragraph.
+
+::::: {#special}
+Here is a special paragraph.
+:::::
+
+And here is another regular paragraph.
+\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:
+
+
Here is a special paragraph.
+
+
2.2.1.23 Option
finalizeCache
finalizeCache (default value: false)
@@ -3213,7 +3392,7 @@ their auxiliary cache files will be created.
The frozen cache makes it possible to later typeset a plain TeX document that contains markdown
documents without invoking Lua using the
-\markdownOptionFrozenCache plain frozenCache plain TeX option. As a result, the plain TeX document becomes more portable, but
further changes in the order and the content of markdown documents will
@@ -3224,31 +3403,31 @@ not be reflected.
class="tex">TeX Example
Using a text editor, create a text document named
document.tex with the following content:
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:
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
@@ -3256,37 +3435,37 @@ contents of the frozen cache using the
the document without accessing the shell or invoking Lua, but the change
in the content of the markdown document from “Hello world!” to
“Hi world!” was not reflected.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
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:
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
@@ -3298,33 +3477,33 @@ in the content of the markdown document from “Hello world!” to
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex with the following content:
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:
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
@@ -3332,130 +3511,8 @@ contents of the frozen cache using the
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.21 Option
-notes
-
-
notes (default value: false)
-
-
-
true
-
-
Enable the Pandoc note syntax extension:
-
Here is a note reference,[^1] and another.[^longnote]
-
-[^1]: Here is the note.
-
-[^longnote]: Here's one with multiple blocks.
-
- Subsequent paragraphs are indented to show that they
-belong to the previous note.
-
- { some.code }
-
- The whole paragraph can be indented, or just the
- first line. In this way, multi-paragraph notes
- work like multi-paragraph list items.
-
-This paragraph won't be part of the note, because it
-isn't indented.
-
-
-
-
-
-
false
-
-
Disable the Pandoc note syntax extension.
-
-
-
-
-
LaTeX Example
-
Using a text editor, create a text document named
-document.tex with the following content:
-
\documentclass{article}
-\usepackage[notes]{markdown}
-\begin{document}
-\begin{markdown}
-Here is a note reference,[^1] and another.[^longnote]
-
-[^1]: Here is the note.
-
-[^longnote]: Here's one with multiple blocks.
-
- Subsequent paragraphs are indented to show that they
-belong to the previous note.
-
- { some.code }
-
- The whole paragraph can be indented, or just the
- first line. In this way, multi-paragraph notes
- 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:
This paragraph won’t be part of the note, because it isn’t
-indented.
-
-
ConTeXt Example
-
Using a text editor, create a text document named
-document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[notes = yes]
-\starttext
-\startmarkdown
-Here is a note reference,[^1] and another.[^longnote]
-
-[^1]: Here is the note.
-
-[^longnote]: Here's one with multiple blocks.
-
- Subsequent paragraphs are indented to show that they
-belong to the previous note.
-
- { some.code }
-
- The whole paragraph can be indented, or just the
- first line. In this way, multi-paragraph notes
- 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:
This paragraph won’t be part of the note, because it isn’t
-indented.
-
-
2.2.1.22 Option
+
2.2.1.24 Option
frozenCacheCounter
frozenCacheCounter (default value: 0)
@@ -3474,25 +3531,25 @@ markdown document number ⟨number⟩.
Lua Module Example
Using a text editor, create a text document named
document.tex with the following content:
-
\input markdown
-\directlua{
- local markdown = require("markdown")
- local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
- local firstInput = "Hello"
- local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
- local secondInput = "*world*!"
- tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }
-\bye
-
Then, invoke LuaTeX from the terminal:
luatex document.tex
+class="sourceCode tex">\input markdown
+\directlua{
+ local markdown = require("markdown")
+ local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
+ local firstInput = "Hello"
+ local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
+ local secondInput = "*world*!"
+ tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }
+\bye
+
Then, invoke LuaTeX from the terminal:
+
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.23 Option
+
2.2.1.25 Option
hardLineBreaks
hardLineBreaks (default value: false)
@@ -3514,33 +3571,33 @@ of spaces.
-
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
+class="sourceCode 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:
@@ -3549,8 +3606,8 @@ 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.
Using a text editor, create a text document named
content.md with the following content:
-
<div>
-*Is there block tag support?*
-</div>
-*Is there <inlinetag="tag"></inline> support?*
-_Is there <!-- comment --> support?_
-_Is there <? HTML instruction ?> support?_
+class="sourceCode html"><div>
+*Is there block tag support?*
+</div>
+*Is there <inlinetag="tag"></inline> support?*
+_Is there <!-- comment --> support?_
+_Is there <? HTML instruction ?> support?_
+
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
@@ -3795,33 +3850,33 @@ contain the following text:
class="tex">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
+class="sourceCode 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:
@@ -3831,37 +3886,37 @@ comment –> support. There is no <? HTML instruction ?>
support.
There is support. There is support. There is support.
-
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
+class="sourceCode 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:
@@ -3871,37 +3926,37 @@ comment –> support. There is no <? HTML instruction ?>
support.
There is support. There is support. There is support.
-
ConConTeXt 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
-
-\setupmarkdown[html = yes]
-\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
+class="sourceCode 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
+
+\setupmarkdown[html = yes]
+\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:
@@ -3911,8 +3966,8 @@ comment –> support. There is no <? HTML instruction ?>
support.
There is support. There is support. There is support.
-
2.2.1.27 Option
+
2.2.1.29 Option
hybrid
hybrid (default value: false)
@@ -3948,27 +4003,27 @@ prepared with this package in mind.
Example
Using a text editor, create a text document named
document.tex with the following content:
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
@@ -4016,85 +4071,85 @@ contain the following text:
class="tex">TeX Example
Using a text editor, create a text document named
document.tex with the following content:
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.]
@@ -4119,54 +4174,54 @@ class="sourceCode md">
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage[inlineNotes]{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
+class="sourceCode tex">\documentclass{article}
+\usepackage[inlineNotes]{markdown}
+\begin{document}
+\begin{markdown}
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+\end{markdown}
+\end{document}
+
Next, invoke LuaTeX from the terminal:
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[inlineNotes = yes]
-\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
+class="sourceCode tex">\usemodule[t][markdown]
+\setupmarkdown[inlineNotes = yes]
+\starttext
+\startmarkdown
+Here is an inline note.^[Inlines notes are easier to
+write, since you don't have to pick an identifier and
+move down to type the note.]
+\stopmarkdown
+\stoptext
+
Next, invoke LuaTeX from the terminal:
+
context document.tex
A PDF document named document.pdf should be produced and
contain the following text:
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.
+---
@@ -4205,105 +4260,227 @@ for entering metadata in yaml.
class="tex">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
+class="sourceCode 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
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage[jekyllData]{markdown}
-\markdownSetup{
- jekyllDataRenderers = {
- name = {\gdef\name{#1}},
- code = {\gdef\age{#1}},
- },
- 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
+class="sourceCode tex">\documentclass{article}
+\usepackage[jekyllData]{markdown}
+\markdownSetup{
+ jekyllDataRenderers = {
+ name = {\gdef\name{#1}},
+ code = {\gdef\age{#1}},
+ },
+ 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.
-
ConConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[jekyllData = yes]
-\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
+class="sourceCode tex">\usemodule[t][markdown]
+\setupmarkdown[jekyllData = yes]
+\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.30 Option
+
2.2.1.32 Option
+notes
+
+
notes (default value: false)
+
+
+
true
+
+
Enable the Pandoc note syntax extension:
+
Here is a note reference,[^1] and another.[^longnote]
+
+[^1]: Here is the note.
+
+[^longnote]: Here's one with multiple blocks.
+
+ Subsequent paragraphs are indented to show that they
+belong to the previous note.
+
+ { some.code }
+
+ The whole paragraph can be indented, or just the
+ first line. In this way, multi-paragraph notes
+ work like multi-paragraph list items.
+
+This paragraph won't be part of the note, because it
+isn't indented.
+
+
+
+
+
+
false
+
+
Disable the Pandoc note syntax extension.
+
+
+
+
+
LaTeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\documentclass{article}
+\usepackage[notes]{markdown}
+\begin{document}
+\begin{markdown}
+Here is a note reference,[^1] and another.[^longnote]
+
+[^1]: Here is the note.
+
+[^longnote]: Here's one with multiple blocks.
+
+ Subsequent paragraphs are indented to show that they
+belong to the previous note.
+
+ { some.code }
+
+ The whole paragraph can be indented, or just the
+ first line. In this way, multi-paragraph notes
+ 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:
This paragraph won’t be part of the note, because it isn’t
+indented.
+
+
ConTeXt Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\usemodule[t][markdown]
+\setupmarkdown[notes = yes]
+\starttext
+\startmarkdown
+Here is a note reference,[^1] and another.[^longnote]
+
+[^1]: Here is the note.
+
+[^longnote]: Here's one with multiple blocks.
+
+ Subsequent paragraphs are indented to show that they
+belong to the previous note.
+
+ { some.code }
+
+ The whole paragraph can be indented, or just the
+ first line. In this way, multi-paragraph notes
+ 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:
To enable raw blocks, the fencedCode
option must also be enabled:
-
Here is a mathematical formula:
-``` {=tex}
-\[distance[i] =
- \begin{dcases}
- a & b \\
- c & d
- \end{dcases}
-\]
-```
+
Here is a mathematical formula:
+``` {=tex}
+\[distance[i] =
+ \begin{dcases}
+ a & b \\
+ c & d
+ \end{dcases}
+\]
+```
The rawAttribute option is a good
alternative to the hybrid option. Unlike
the hybrid option, which affects the
@@ -4500,33 +4677,33 @@ allows you to isolate the parts of your documents that use TeX:
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage[rawAttribute, fencedCode]{markdown}
-\usepackage{expl3}
-\begin{document}
-\begin{markdown}
-`$H_2 O$`{=tex} is a liquid.
-
-``` {=html}
-<p>Here is some HTML content that will be ignored.</p>
-```
-\end{markdown}
-\end{document}
+
\documentclass{article}
+\usepackage[rawAttribute, fencedCode]{markdown}
+\usepackage{expl3}
+\begin{document}
+\begin{markdown}
+`$H_2 O$`{=tex} is a liquid.
+
+``` {=html}
+<p>Here is some HTML content that will be ignored.</p>
+```
+\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:
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!
\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:
@@ -4590,8 +4767,8 @@ contain the following text:
In this paper, we have discovered that most grandmas would rather eat
dinner with their grandchildren than get eaten. Begone, wolf!
-
2.2.1.34 Option
+
2.2.1.37 Option
shiftHeadings
shiftHeadings (default value: 0)
@@ -4607,32 +4784,32 @@ when ⟨shift amount⟩ is positive, and to level 1, when
class="tex">TeX
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:
A PDF document named document.pdf should be produced and
contain the following text:
@@ -4692,8 +4869,8 @@ contain the following text:
A section
A section
-
2.2.1.35 Option
+
2.2.1.38 Option
slice
slice (default value: ^ $)
@@ -4727,43 +4904,43 @@ i.e. the entire section with the HTML attribute
class="tex">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.
+
# 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:
A PDF document named document.pdf should be produced and
contain the following text:
@@ -4776,34 +4953,34 @@ contain the following text:
Act V
Hamlet dies.
-
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}
+
\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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -4820,33 +4997,33 @@ contain the following text:
class="tex">TeXt 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.
+
# 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:
A PDF document named document.pdf should be produced and
contain the following text:
@@ -4859,8 +5036,8 @@ contain the following text:
Act V
Hamlet dies.
-
2.2.1.36 Option
+
2.2.1.39 Option
smartEllipses
smartEllipses (default value: false)
@@ -4887,25 +5064,25 @@ class="tex">TeX macro.
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:
@@ -4915,23 +5092,23 @@ contain the following text:
Lua CLI Example
Using a text editor, create a text document named
document.tex with the following content:
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
@@ -4952,55 +5129,55 @@ contain the following text:
class="tex">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
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}
+
\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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -5011,32 +5188,32 @@ contain the following text:
class="tex">TeXt 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
-
-\setupmarkdown[smartEllipses = yes]
-\startmarkdown
-... and this is a victorian ellipsis.
-\stopmarkdown
-
-\stoptext
+
\usemodule[t][markdown]
+\def\markdownRendererEllipsis{. . .}
+\starttext
+
+\startmarkdown
+These are just three regular dots ...
+\stopmarkdown
+
+\setupmarkdown[smartEllipses = yes]
+\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.37 Option
+
2.2.1.40 Option
startNumber
startNumber (default value: true)
@@ -5062,36 +5239,36 @@ class="tex">TeX macro.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-The following list respects the numbers specified in the markup:
-
-3. third item
-4. fourth item
-5. fifth item
-\end{markdown}
-
-\begin{markdown*}{startNumber=false}
-The following list does not respect the numbers specified in the
-markup:
-
-3. third item
-4. fourth item
-5. fifth item
-\end{markdown*}
-
-\end{document}
+
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+The following list respects the numbers specified in the markup:
+
+3. third item
+4. fourth item
+5. fifth item
+\end{markdown}
+
+\begin{markdown*}{startNumber=false}
+The following list does not respect the numbers specified in the
+markup:
+
+3. third item
+4. fourth item
+5. fifth item
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-
lualatex document.tex
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -5113,30 +5290,30 @@ markup:
class="tex">TeXt 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
-
-\setupmarkdown[startNumber = no]
-\startmarkdown
-The following list respects the numbers specified in the markup:
-
-3. third item
-4. fourth item
-5. fifth item
-\stopmarkdown
-\stoptext
+
\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
+
+\setupmarkdown[startNumber = no]
+\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
+
context document.tex
A PDF document named document.pdf should be produced and
contain the following text:
\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.
@@ -5730,57 +5907,57 @@ comments.
class="tex">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
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]
-\setupmarkdown[texComments = yes]
-\starttext
-\startmarkdown
-Hel% this is a comment
- lo *world*!
-\stopmarkdown
-\stoptext
+
\usemodule[t][markdown]
+\setupmarkdown[texComments = yes]
+\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.45 Option
+
2.2.1.48 Option
tightLists
tightLists (default value: true)
@@ -5792,16 +5969,16 @@ class="header-section-number">2.2.1.45 Option
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.
+
- This is
+- a tight
+- unordered list.
+
+- This is
+
+ not a tight
+
+- unordered list.
@@ -5816,43 +5993,43 @@ multiple paragraphs.
-
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}
+
\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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -5911,23 +6088,23 @@ constantly escape subscripts.
class="tex">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:
@@ -5936,27 +6113,27 @@ contain the following text:
This is emphasized text and this is a math subscript:
mₙ.
-
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:
@@ -5969,24 +6146,24 @@ contain the following text:
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[hybrid = yes]
-\starttext
-
-\startmarkdown
-This is _emphasized text_ and this is a math subscript: $m\_n$.
-\stopmarkdown
-
-\setupmarkdown[underscores = yes]
-\startmarkdown
-This is *emphasized text* and this is a math subscript: $m_n$.
-\stopmarkdown
-
-\stoptext
+
\usemodule[t][markdown]
+\setupmarkdown[hybrid = yes]
+\starttext
+
+\startmarkdown
+This is _emphasized text_ and this is a math subscript: $m\_n$.
+\stopmarkdown
+
+\setupmarkdown[underscores = yes]
+\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:
@@ -6013,8 +6190,8 @@ plain TeX
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
@@ -6034,7 +6211,7 @@ with stale auxiliary cache files.
Enable the finalizeCache option.
Typeset the plain TeX document
to populate and finalize the cache.
-
Enable the \markdownOptionFrozenCache option.
+
Enable the frozenCache option.
Publish the source code of the plain TeX document and the
cacheDir directory.
@@ -6064,24 +6241,24 @@ options.
Using a text editor, create a folder named
output-directory and a text document named
document.tex with the following content:
A text document named temporary-input.md should be
produced in the folder named output-directory and contain
the following text:
@@ -6094,8 +6271,8 @@ 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:
-
Text documents named helper-script.lua, and
temporary-output.md should be produced in the folder named
output-directory. The document named
@@ -6124,21 +6301,21 @@ Mittelbach. The recognized values of the macro are truefalse.
Using a text editor, create a text document named
document.dtx with the following content:
A PDF document named document.pdf should be produced and
contain the text “Hello world!”
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
@@ -6169,10 +6346,10 @@ the \markdownOptionHelperScriptFileName plain TeX option to
helper-script.lua, we would inclde the following code in
our LaTeX document:
@@ -6187,8 +6364,8 @@ class="tex">TeX implementation and prevent the soft
from being loaded: The plain option must be set before or when loading
the package. Setting the option after loading the package will have no
effect.
-
\usepackage[plain]{markdown}
+
\usepackage[plain]{markdown}
2.2.3.3LaTeX themes
@@ -6201,11 +6378,11 @@ 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:
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:
@@ -6286,26 +6463,26 @@ http or https protocol. The theme requires the
class="latex">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
-\markdownOptionFrozenCache plain frozenCache plain TeX option is enabled.
-
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:
@@ -6324,21 +6501,21 @@ non-breaking space even when the hybrid
Lua option is disabled.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
A PDF document named document.pdf should be produced and
contain the following text, where the middot (·) denotes a
non-breaking space:
@@ -6355,30 +6532,30 @@ class="latex">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
@@ -6392,700 +6569,627 @@ class="header-section-number">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.
-
2.3.1.1 Attribute Renderers
+
The following macros are only produced, when the
+headerAttributes option is enabled.
+
\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
Using a text editor, create a text document named
document.tex with the following content:
A PDF document named document.pdf should be produced and
contain the following text:
-
-
No you can’t.
-
Yes I can!
-
+
First top-level heading
+
(Key: Jane, Value: Doe)
+
A subheading
+
(Identifier: identifier)
+
Second top-level heading
+
(Class name: class_name)
-
ConTeXt Example
+
2.3.1.2 Block Quote Renderers
+
The \markdownRendererBlockQuoteBegin macro represents
+the beginning of a block quote. The macro receives no arguments.
+
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:
-
\usemodule[t][markdown]
-\setupmarkdown[taskLists = yes]
-\def\markdownRendererUntickedBox{No}
-\def\markdownRendererTickedBox{Yes}
-\starttext
-\startmarkdown
-- [ ] you can't.
-- [x] I can!
-\stopmarkdown
-\stoptext
+
\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:
-
context document.tex
+
luatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
-
No you can’t.
-
Yes I can!
-
+
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 […]
-
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
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{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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
(The beginning of a document)
-
Hello world!
-
(The beginning of a nested document)
-
This is a nested markdown document.
-
(The end of a nested document)
-
Foo bar!
-
(The end of a document)
-
(The beginning of a document)
-
Bar baz!
-
(The end of a document)
+
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 […]
-
2.3.1.3 Interblock Separator
-Renderer
-
The \markdownRendererInterblockSeparator macro
-represents a separator between two markdown block elements. The macro
-receives no arguments.
-
Plain TeX Example
+
+
ConTeXt 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
+
\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:
-
luatex document.tex
+
context document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
Hello world!
-
(The end of a block)
-
Foo bar!
+
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 […]
-
+
2.3.1.3 Bracketed Spans Context
+Renderers
+
The following macros are only produced, when the
+bracketedSpans option is enabled.
+
The \markdownRendererBracketedSpanAttributeContextBegin
+and \markdownRendererBracketedSpanAttributeContextEnd
+macros represent the beginning and the end of an inline bracketed span
+in which the attributes of the span apply. The macros receive no
+arguments.
+
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
A PDF document named document.pdf should be produced and
contain the following text:
-
Hello world!
-
(The end of a block)
-
Foo bar!
+
(foo (bar)) (baz)
-
ConTeXt Example
+
2.3.1.4 Bullet List Renderers
+
The \markdownRendererUlBegin macro represents the
+beginning of a bulleted list that contains an item with several
+paragraphs of text (the list is not tight). The macro receives no
+arguments.
+
The \markdownRendererUlBeginTight macro represents the
+beginning of a bulleted list that contains no item with several
+paragraphs of text (the list is tight). This macro will only be
+produced, when the tightLists option is
+disabled. The macro receives no arguments.
+
The \markdownRendererUlItem macro represents an item in
+a bulleted list. The macro receives no arguments.
+
The \markdownRendererUlItemEnd macro represents the end
+of an item in a bulleted list. The macro receives no arguments.
+
The \markdownRendererUlEnd macro represents the end of a
+bulleted list that contains an item with several paragraphs of text (the
+list is not tight). The macro receives no arguments.
+
The \markdownRendererUlEndTight macro represents the end
+of a bulleted list that contains no item with several paragraphs of text
+(the list is tight). This macro will only be produced, when the
+tightLists option is disabled. The macro
+receives no arguments.
+
Plain TeX 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
+
\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:
-
context 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!
+
This is a tight list (the first item, the second item, and the third
+item).
+
This is a loose list:
+
+
This is the first item.
+
This is the second item.
+
This is the third item.
+
-
2.3.1.4 Line Break Renderer
-
The \markdownRendererLineBreak macro represents a forced
-line break. The macro receives no arguments.
-
Plain TeX Example
+
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
Using a text editor, create a text document named
-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!
+
\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:
-
luatex document.tex
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
Hello world!
-
(A forced linebreak)
-
Foo bar!
+
This is a tight list (the first item, the second item, and the third
+item).
+
This is a loose list:
+
+
This is the first item.
+
This is the second item.
+
This is the third item.
+
-
LaTeX Example
+
ConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
Using a text editor, create a text document named
-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!
+
\usemodule[t][markdown]
+\setupmarkdown[tightLists = yes]
+\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:
-
lualatex document.tex
+
context document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
Hello world!
-
(A forced linebreak)
-
Foo bar!
+
This is a tight list (the first item, the second item, and the third
+item).
+
This is a loose list:
+
+
This is the first item.
+
This is the second item.
+
This is the third item.
+
-
ConTeXt Example
+
2.3.1.5 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
Using a text editor, create a text document named
document.tex with the following content:
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.
A PDF document named document.pdf should be produced and
-contain the following text:
+contain the following text except for the filename, which may
+differ:
-
Hello world!
-
(A forced linebreak)
-
Foo bar!
+
The following code is contained in file
+./_markdown_document/882453149edcf288976647f6fe147ada.verbatim:
+
def foo(bar):
+iflen(bar) <=1:
+return bar[:1]
+eliflen(bar) ==2:
+returnsorted(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]
-
2.3.1.5 Ellipsis Renderer
-
The \markdownRendererEllipsis macro replaces any
-occurance of ASCII ellipses in the input text. This macro will only be
-produced, when the smartEllipses option is
-enabled. The macro receives no arguments.
+
2.3.1.6 Code Span Renderer
+
The \markdownRendererCodeSpan macro represents inline
+code span in the input text. It receives a single argument that
+corresponds to the inline code span.
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
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]
-\setupmarkdown[smartEllipses = yes]
-\def\markdownRendererEllipsis{\emph{SHAZAM}!}
-\starttext
-\startmarkdown
-The secret word is ...
-\stopmarkdown
-\stoptext
-
Next, invoke LuaTeX from the terminal:
-
context document.tex
-
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
Hello world!
-
(The end of a block)
-
Foo bar!
-
-
2.3.1.6 Non-Breaking Space
-Renderer
-
The \markdownRendererNbsp macro represents a
-non-breaking space.
-
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:
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
The TeXbook [1, p.·123·and·130] is good.
-
References
-
1
-Donald Ervin Knuth. The TeXbook, volume A of Computers and
-typesetting. Addison-Wesley, 1984.
-
-
2.3.1.7 Special Character
-Renderers
-
The following macros replace any special plain TeX characters, including the active pipe
-character (|) of ConTeXt, in the input text:
-
-
\markdownRendererAmpersand replaces the ampersand
-(&).
-
\markdownRendererBackslash replaces the backslash
-(\).
-
\markdownRendererCircumflex replaces the circumflex
-(^).
-
\markdownRendererDollarSign replaces the dollar sign
-($).
-
\markdownRendererHash replaces the hash sign
-(#).
-
\markdownRendererLeftBrace replaces the left brace
-({).
-
\markdownRendererPercentSign replaces the percent sign
-(%).
-
\markdownRendererPipe replaces the pipe character
-(|).
-
\markdownRendererRightBrace replaces the right brace
-(}).
-
\markdownRendererTilde replaces the tilde
-(~).
-
\markdownRendererUnderscore replaces the underscore
-(_).
-
-
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.
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
-
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.
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.
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
-
-
2.3.1.8 Code Span Renderer
-
The \markdownRendererCodeSpan macro represents inline
-code span in the input text. It receives a single argument that
-corresponds to the inline code span.
-
Plain TeX Example
-
Using a text editor, create a text document named
-document.tex with the following content:
A PDF document named document.pdf should be produced and
contain the following text:
@@ -7093,161 +7197,8 @@ contain the following text:
$\sqrt{-1}$ equals $i$.
√-̅1̅ equalsi.
-
2.3.1.9 Link Renderer
-
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:
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
-
Using a text editor, create a text document named
-document.tex with the following content:
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.
-
-
-
-
2.3.1.11 Content Block
+
2.3.1.7 Content Block
Renderers
The \markdownRendererContentBlock macro represents an iA
Writer content block. It receives four arguments: the local file or
@@ -7287,38 +7238,38 @@ highlighting. The
Languages.json file provided by Anton Sotkov is a good
starting point.
-
Plain 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:
@@ -7330,38 +7281,38 @@ extensions and programming language names.
This is the image https://tug.org/tugboat/noword.jpg,
the logotype of TUGboat.
-
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}
+
\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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -7373,39 +7324,39 @@ extensions and programming language names.
This is the image https://tug.org/tugboat/noword.jpg,
the logotype of TUGboat.
-
ConConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[contentBlocks = yes]
-\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]
+\setupmarkdown[contentBlocks = yes]
+\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:
@@ -7417,555 +7368,8 @@ extensions and programming language names.
This is the image https://tug.org/tugboat/noword.jpg,
the logotype of TUGboat.
-
2.3.1.12 Bullet List Renderers
-
The \markdownRendererUlBegin macro represents the
-beginning of a bulleted list that contains an item with several
-paragraphs of text (the list is not tight). The macro receives no
-arguments.
-
The \markdownRendererUlBeginTight macro represents the
-beginning of a bulleted list that contains no item with several
-paragraphs of text (the list is tight). This macro will only be
-produced, when the tightLists option is
-disabled. The macro receives no arguments.
-
The \markdownRendererUlItem macro represents an item in
-a bulleted list. The macro receives no arguments.
-
The \markdownRendererUlItemEnd macro represents the end
-of an item in a bulleted list. The macro receives no arguments.
-
The \markdownRendererUlEnd macro represents the end of a
-bulleted list that contains an item with several paragraphs of text (the
-list is not tight). The macro receives no arguments.
-
The \markdownRendererUlEndTight macro represents the end
-of a bulleted list that contains no item with several paragraphs of text
-(the list is tight). This macro will only be produced, when the
-tightLists option is disabled. 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
-
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
This is a tight list (the first item, the second item, and the third
-item).
-
This is a loose list:
-
-
This is the first item.
-
This is the second item.
-
This is the third item.
-
-
-
LaTeX Example
-
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
-
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
This is a tight list (the first item, the second item, and the third
-item).
-
This is a loose list:
-
-
This is the first item.
-
This is the second item.
-
This is the third item.
-
-
-
ConTeXt Example
-
Using a text editor, create a text document named
-document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[tightLists = yes]
-\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
-
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
This is a tight list (the first item, the second item, and the third
-item).
-
This is a loose list:
-
-
This is the first item.
-
This is the second item.
-
This is the third item.
-
-
-
2.3.1.13 Ordered List
-Renderers
-
The \markdownRendererOlBegin macro represents the
-beginning of an ordered list that contains an item with several
-paragraphs of text (the list is not tight). This macro will only be
-produced, when the fancyLists option is
-disabled. The macro receives no arguments.
-
The \markdownRendererOlBeginTight macro represents the
-beginning of an ordered list that contains no item with several
-paragraphs of text (the list is tight). This macro will only be
-produced, when the tightLists option is
-enabled and the fancyLists option is
-disabled. The macro receives no arguments.
-
The \markdownRendererFancyOlBegin macro represents the
-beginning of a fancy ordered list that contains an item with several
-paragraphs of text (the list is not tight). This macro will only be
-produced, when the fancyLists option is
-enabled. The macro receives two arguments: the style of the list item
-labels (Decimal, LowerRoman,
-UpperRoman, LowerAlpha, and
-UpperAlpha), and the style of delimiters between list item
-labels and texts (Default, OneParen, and
-Period).
-
The \markdownRendererFancyOlBeginTight macro represents
-the beginning of a fancy ordered list that contains no item with several
-paragraphs of text (the list is tight). This macro will only be
-produced, when the fancyLists and
-tightLists options are enabled. The macro
-receives two arguments: the style of the list item labels, and the style
-of delimiters between list item labels and texts. See the
-\markdownRendererFancyOlBegin macro for the valid style
-values.
-
The \markdownRendererOlItem macro represents an item in
-an ordered list. This macro will only be produced, when the
-startNumber option is disabled and the
-fancyLists option is disabled. The macro
-receives no arguments.
-
The \markdownRendererOlItemEnd macro represents the end
-of an item in an ordered list. This macro will only be produced, when
-the fancyLists option is disabled. The
-macro receives no arguments.
-
The \markdownRendererOlItemWithNumber macro represents
-an item in an ordered list. This macro will only be produced, when the
-startNumber option is enabled and the
-fancyLists option is disabled. The macro
-receives a single numeric argument that corresponds to the item
-number.
-
The \markdownRendererFancyOlItem macro represents an
-item in a fancy ordered list. This macro will only be produced, when the
-startNumber option is disabled and the
-fancyLists option is enabled. The macro
-receives no arguments.
-
The \markdownRendererFancyOlItemEnd macro represents the
-end of an item in a fancy ordered list. This macro will only be
-produced, when the fancyLists option is
-enabled. The macro receives no arguments.
-
The \markdownRendererFancyOlItemWithNumber macro
-represents an item in a fancy ordered list. This macro will only be
-produced, when the startNumber and
-fancyLists options are enabled. The macro
-receives a single numeric argument that corresponds to the item
-number.
-
The \markdownRendererOlEnd macro represents the end of
-an ordered list that contains an item with several paragraphs of text
-(the list is not tight). This macro will only be produced, when the
-fancyLists option is disabled. The macro
-receives no arguments.
-
The \markdownRendererOlEndTight macro represents the end
-of an ordered list that contains no item with several paragraphs of text
-(the list is tight). This macro will only be produced, when the
-tightLists option is enabled and the
-fancyLists option is disabled. The macro
-receives no arguments.
-
The \markdownRendererFancyOlEnd macro represents the end
-of a fancy ordered list that contains an item with several paragraphs of
-text (the list is not tight). This macro will only be produced, when the
-fancyLists option is enabled. The macro
-receives no arguments.
-
The \markdownRendererFancyOlEndTight macro represents
-the end of a fancy ordered list that contains no item with several
-paragraphs of text (the list is tight). This macro will only be
-produced, when the fancyLists and
-tightLists options are 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\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
-
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
This is a tight list (the first item, the second item, and the third
-item).
-
This is a loose list:
-
-
This is the first item.
-
This is the second item.
-
This is the third item.
-
-
-
LaTeX Example
-
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}
-
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).
-
This is a loose list:
-
-
This is the first item.
-
This is the second item.
-
This is the third item.
-
-
-
ConTeXt Example
-
Using a text editor, create a text document named
-document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown
- [
- tightLists = yes,
- startNumber = yes,
- ]
-\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
-
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
This is a tight list (the first item, the second item, and the third
-item).
-
This is a loose list:
-
-
This is the first item.
-
This is the second item.
-
This is the third item.
-
-
-
2.3.1.14 Definition List
+
2.3.1.8 Definition List
Renderers
The following macros are only produced, when the
definitionLists option is enabled.
@@ -7997,92 +7401,92 @@ 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 disabled. The macro
receives no arguments.
-
Plain 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:
@@ -8104,94 +7508,94 @@ 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
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:
@@ -8213,94 +7617,94 @@ 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.
-
ConConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown
- [
- definitionLists = yes,
- tightLists = yes,
- ]
-\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
+
\usemodule[t][markdown]
+\setupmarkdown
+ [
+ definitionLists = yes,
+ tightLists = yes,
+ ]
+\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
A PDF document named document.pdf should be produced and
contain the following text:
@@ -8322,81 +7726,155 @@ 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.
-
2.3.1.15 Emphasis Renderers
-
The \markdownRendererEmphasis macro represents an
-emphasized span of text. The macro receives a single argument that
-corresponds to the emphasized span of text.
-
Plain 2.3.1.9 Ellipsis Renderer
+
The \markdownRendererEllipsis macro replaces any
+occurance of ASCII ellipses in the input text. This macro will only be
+produced, when the smartEllipses option is
+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\markdownRendererEmphasis#1{{\it#1}}
-\def\markdownRendererStrongEmphasis#1{{\bf#1}}
-\markdownBegin
-This is *emphasis*.
-
-This is **strong emphasis**.
-\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:
-
This is emphasis.
-
This is strong emphasis.
+
The secret word is SHAZAM!
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
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]
+\setupmarkdown[smartEllipses = yes]
+\def\markdownRendererEllipsis{\emph{SHAZAM}!}
+\starttext
+\startmarkdown
+The secret word is ...
+\stopmarkdown
+\stoptext
+
Next, invoke LuaTeX from the terminal:
+
context document.tex
+
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
Hello world!
+
(The end of a block)
+
Foo bar!
+
+
2.3.1.10 Emphasis Renderers
+
The \markdownRendererEmphasis macro represents an
+emphasized span of text. The macro receives a single argument that
+corresponds to the emphasized span of text.
+
Plain TeX Example
+
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
+
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 emphasis.
This is strong emphasis.
-
ConLaTeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
This is emphasis.
+
This is strong emphasis.
+
+
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:
@@ -8406,515 +7884,906 @@ contain the following text:
The \markdownRendererStrongEmphasis macro represents a
strongly emphasized span of text. The macro receives a single argument
that corresponds to the emphasized span of text.
-
2.3.1.16 Block Quote Renderers
-
The \markdownRendererBlockQuoteBegin macro represents
-the beginning of a block quote. The macro receives no arguments.
-
The \markdownRendererBlockQuoteEnd macro represents the
-end of a block quote. The macro receives no arguments.
-
Plain TeX Example
+
2.3.1.11 Fenced Div Context
+Renderers
+
The following macros are only produced, when the
+fencedDiv option is enabled.
+
The \markdownRendererFencedDivAttributeContextBegin and
+\markdownRendererFencedDivAttributeContextEnd macros
+represent the beginning and the end of a div in which the attributes of
+the div apply. The macros receive no arguments.
+
LaTeX 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
+
\documentclass{article}
+\usepackage[fencedDiv]{markdown}
+\markdownSetup{
+ renderers = {
+ fencedDivAttributeContextBegin = {%
+\par
+\emph{(The beginning of a fenced div attribute context)}
+\par
+ },
+ fencedDivAttributeContextEnd = {%
+\par
+\emph{(The end of a fenced div attribute context)}
+\par
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+
+::: {key=value}
+
+foo
+
+:::: {#identifier}
+
+bar
+
+::::
+
+:::
+
+::: {.class_name}
+
+baz
+
+:::
+
+\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-
luatex document.tex
+
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:
+
(The beginning of a fenced div attribute context)
+
foo
+
(The beginning of a fenced div attribute context)
+
bar
+
(The end of a fenced div attribute context)
+
(The end of a fenced div attribute context)
+
(The beginning of a fenced div attribute context)
+
baz
+
(The end of a fenced div attribute context)
+
+
2.3.1.12 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
+
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
+ },
+ headerAttributeContextEnd = {%
+\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:
-
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 […]
+
First top-level heading
+
(The beginning of a header attribute context)
+
A subheading
+
(The end of a header attribute context)
+
(The beginning of a header attribute context)
+
Second top-level heading
+
(The end of a header attribute context)
+
2.3.1.13 Heading Renderers
+
The \markdownRendererHeadingOne macro represents a first
+level heading. The macro receives a single argument that corresponds to
+the heading text.
+
The \markdownRendererHeadingTwo macro represents a
+second level heading. The macro receives a single argument that
+corresponds to the heading text.
+
The \markdownRendererHeadingThree macro represents a
+third level heading. The macro receives a single argument that
+corresponds to the heading text.
+
The \markdownRendererHeadingFour macro represents a
+fourth level heading. The macro receives a single argument that
+corresponds to the heading text.
+
The \markdownRendererHeadingFive macro represents a
+fifth level heading. The macro receives a single argument that
+corresponds to the heading text.
+
The \markdownRendererHeadingSix macro represents a sixth
+level heading. The macro receives a single argument that corresponds to
+the heading text.
+
Plain TeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
65536
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}
A PDF document named document.pdf should be produced and
contain the following text:
-
A quote from William Shakespeare’s King Lear:
-
-
This is the excellent foppery of the world that when we are sick in
-fortune—often the surfeit of our own behavior—we make guilty of our
-disasters the sun, the moon, and the stars […]
-
+
65536
-
ConConTeXt 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
A PDF document named document.pdf should be produced and
contain the following text:
-
A quote from William Shakespeare’s King Lear:
-
-
This is the excellent foppery of the world that when we are sick in
-fortune—often the surfeit of our own behavior—we make guilty of our
-disasters the sun, the moon, and the stars […]
-
+
65536
-
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.
+
2.3.1.14 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
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 notes. -->
+
+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
+lualatex document.tex
A PDF document named document.pdf should be produced and
-contain the following text except for the filename, which may
-differ:
+contain the following body text:
-
The following code is contained in file
-./_markdown_document/882453149edcf288976647f6fe147ada.verbatim:
-
def foo(bar):
-iflen(bar) <=1:
-return bar[:1]
-eliflen(bar) ==2:
-returnsorted(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]
+
A useful use of HTML comments are side notes.
+
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
+
+
+
The horizontal margins should contain the following text:
+
+
Side notes are displayed in the horizontal margins next to the
+relevant passages, which makes them easier for the reader to
+find than notes.
-
2.3.1.18 YAML Metadata
+
2.3.1.15 HTML Tag and Element
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.
-
The \markdownRendererJekyllDataMappingEnd macro
-represents the end of a mapping in a yaml document. This
-macro will only be produced when the
-jekyllData option is enabled. The macro
-receives no arguments.
-
The \markdownRendererJekyllDataSequenceBegin macro
-represents the beginning of a sequence 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 sequence.
-
The \markdownRendererJekyllDataSequenceEnd macro
-represents the end of a sequence in a yaml document. This
-macro will only be produced when the
-jekyllData option is enabled. The macro
+
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
+
Using a text editor, create a text document named
+document.tex with the following content:
A PDF document named document.pdf should be produced and
+contain the following body text:
+
+
_Hello,_ world!
+
<div>_Hello,_ world!</div>
+
+
2.3.1.16 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
+
Using a text editor, create a text document named
+document.tex with the following content:
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.
+
+
+
+
2.3.1.17 Interblock Separator
+Renderer
+
The \markdownRendererInterblockSeparator macro
+represents a separator between two markdown block elements. The macro
receives no arguments.
-
The \markdownRendererJekyllDataBoolean macro represents
-a boolean scalar value 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, and the scalar value, both cast to a string
-following yaml serialization rules.
-
The \markdownRendererJekyllDataNumber macro represents a
-numeric scalar value 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, and the scalar value, both cast to a string
-following yaml serialization rules.
-
The \markdownRendererJekyllDataString macro represents a
-string scalar value 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 scalar value.
-
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 Plain TeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\input markdown
+\def\markdownRendererInterblockSeparator{%
+\par
+ {\it(The end of a block)}%
+\par
+}
+\markdownBegin
+Hello *world*!
+
+_Foo_ bar!
+\markdownEnd
+\bye
+
Next, invoke LuaTeX from the terminal:
+
luatex document.tex
+
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
+
Using a text editor, create a text document named
+document.tex with the following content:
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
+
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
Hello world!
+
(A forced linebreak)
+
Foo bar!
+
+
LaTeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
Using a text editor, create a text document named
+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
+
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
Hello world!
+
(A forced linebreak)
+
Foo bar!
+
+
ConTeXt Example
+
Using a text editor, create a text document named
+document.tex with the following content:
Using a text editor, create a text document named
+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
+
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
Hello world!
+
(A forced linebreak)
+
Foo bar!
+
+
2.3.1.19 Link Renderer
+
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\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
A PDF document named document.pdf should be produced and
contain the following text:
-
Jane Doe is 99 years old.
+
Please visit the link https://ctan.org/ titled the Comprehensive TeX
+Archive Network.
-
2.3.1.19 Heading Renderers
-
The \markdownRendererHeadingOne macro represents a first
-level heading. The macro receives a single argument that corresponds to
-the heading text.
-
The \markdownRendererHeadingTwo macro represents a
-second level heading. The macro receives a single argument that
-corresponds to the heading text.
-
The \markdownRendererHeadingThree macro represents a
-third level heading. The macro receives a single argument that
-corresponds to the heading text.
-
The \markdownRendererHeadingFour macro represents a
-fourth level heading. The macro receives a single argument that
-corresponds to the heading text.
-
The \markdownRendererHeadingFive macro represents a
-fifth level heading. The macro receives a single argument that
-corresponds to the heading text.
-
The \markdownRendererHeadingSix macro represents a sixth
-level heading. The macro receives a single argument that corresponds to
-the heading text.
-
Plain TeX Example
+
2.3.1.20 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
Using a text editor, create a text document named
-document.tex with the following content:
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
65536
-
-
ConTeXt Example
+class="sourceCode bib">@book{knuth:tex,
+author = "Knuth, Donald Ervin",
+title = "The \TeX book, volume A of Computers and typesetting",
+publisher = "Addison-Wesley",
+year = "1984"
+}
Using a text editor, create a text document named
document.tex with the following content:
A PDF document named document.pdf should be produced and
contain the following text:
-
65536
+
The TeXbook [1, p.·123·and·130] is good.
+
References
+
1
+Donald Ervin Knuth. The TeXbook, volume A of Computers and
+typesetting. Addison-Wesley, 1984.
-
2.3.1.20 Thematic Break
-Renderer
-
The \markdownRendererThematicBreak macro represents a
-thematic break. The macro receives no arguments.
-
Plain 2.3.1.22 Note Renderer
+
The \markdownRendererNote macro represents a note. This
+macro will only be produced, when the
+notes option is enabled. The macro
+receives a single argument that corresponds to the note text.
+
Plain TeX Example
Using a text editor, create a text document named
document.tex with the following content:
\input markdown
-\def\markdownRendererThematicBreak{\vfil\break}
-\markdownBegin
-This is the first page.
-
-***
-
-This is the second page.
-\markdownEnd
-\bye
+\def\markdownOptionNotes{true}
+\def\markdownRendererNote#1{ (and \lowercase{#1})}
+\markdownBegin
+This is some text[^1] and this is some other text[^2].
+
+ [^1]: this is a note
+
+ [^2]: this is some other note
+\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 the first page.
-
-
This is the second page.
+
This is some text (and this is a note) and this is some other text
+(and this is some other note).
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
\documentclass{article}
-\usepackage{markdown}
+\usepackage[notes]{markdown}\markdownSetup{ renderers = {
- thematicBreak = \newpage,
+ note = { (and \MakeLowercase{#1})}, },}\begin{document}\begin{markdown}
-This is the first page.
+This is some text[^1] and this is some other text[^2].
-***
+ [^1]: this is a note
-This is the second page.
+ [^2]: this is some other note\end{markdown}\end{document}
Using a text editor, create a text document named
document.tex with the following content:
\usemodule[t][markdown]
-\def\markdownRendererThematicBreak{\page[yes]}
-\starttext
-\startmarkdown
-This is the first page.
-
-***
-
-This is the second page.
-\stopmarkdown
-\stoptext
+\setupmarkdown[notes = yes]
+\def\markdownRendererNote#1{ (and \lowercase{#1})}
+\starttext
+\startmarkdown
+This is some text[^1] and this is some other text[^2].
+
+ [^1]: this is a note
+
+ [^2]: this is some other note
+\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
context document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
This is the first page.
-
-
This is the second page.
+
This is some text (and this is a note) and this is some other text
+(and this is some other note).
-
2.3.1.21 Note Renderer
-
The \markdownRendererNote macro represents a note. This
-macro will only be produced, when the
-notes option is enabled. The macro
-receives a single argument that corresponds to the note text.
-
Plain 2.3.1.23 Ordered List
+Renderers
+
The \markdownRendererOlBegin macro represents the
+beginning of an ordered list that contains an item with several
+paragraphs of text (the list is not tight). This macro will only be
+produced, when the fancyLists option is
+disabled. The macro receives no arguments.
+
The \markdownRendererOlBeginTight macro represents the
+beginning of an ordered list that contains no item with several
+paragraphs of text (the list is tight). This macro will only be
+produced, when the tightLists option is
+enabled and the fancyLists option is
+disabled. The macro receives no arguments.
+
The \markdownRendererFancyOlBegin macro represents the
+beginning of a fancy ordered list that contains an item with several
+paragraphs of text (the list is not tight). This macro will only be
+produced, when the fancyLists option is
+enabled. The macro receives two arguments: the style of the list item
+labels (Decimal, LowerRoman,
+UpperRoman, LowerAlpha, and
+UpperAlpha), and the style of delimiters between list item
+labels and texts (Default, OneParen, and
+Period).
+
The \markdownRendererFancyOlBeginTight macro represents
+the beginning of a fancy ordered list that contains no item with several
+paragraphs of text (the list is tight). This macro will only be
+produced, when the fancyLists and
+tightLists options are enabled. The macro
+receives two arguments: the style of the list item labels, and the style
+of delimiters between list item labels and texts. See the
+\markdownRendererFancyOlBegin macro for the valid style
+values.
+
The \markdownRendererOlItem macro represents an item in
+an ordered list. This macro will only be produced, when the
+startNumber option is disabled and the
+fancyLists option is disabled. The macro
+receives no arguments.
+
The \markdownRendererOlItemEnd macro represents the end
+of an item in an ordered list. This macro will only be produced, when
+the fancyLists option is disabled. The
+macro receives no arguments.
+
The \markdownRendererOlItemWithNumber macro represents
+an item in an ordered list. This macro will only be produced, when the
+startNumber option is enabled and the
+fancyLists option is disabled. The macro
+receives a single numeric argument that corresponds to the item
+number.
+
The \markdownRendererFancyOlItem macro represents an
+item in a fancy ordered list. This macro will only be produced, when the
+startNumber option is disabled and the
+fancyLists option is enabled. The macro
+receives no arguments.
+
The \markdownRendererFancyOlItemEnd macro represents the
+end of an item in a fancy ordered list. This macro will only be
+produced, when the fancyLists option is
+enabled. The macro receives no arguments.
+
The \markdownRendererFancyOlItemWithNumber macro
+represents an item in a fancy ordered list. This macro will only be
+produced, when the startNumber and
+fancyLists options are enabled. The macro
+receives a single numeric argument that corresponds to the item
+number.
+
The \markdownRendererOlEnd macro represents the end of
+an ordered list that contains an item with several paragraphs of text
+(the list is not tight). This macro will only be produced, when the
+fancyLists option is disabled. The macro
+receives no arguments.
+
The \markdownRendererOlEndTight macro represents the end
+of an ordered list that contains no item with several paragraphs of text
+(the list is tight). This macro will only be produced, when the
+tightLists option is enabled and the
+fancyLists option is disabled. The macro
+receives no arguments.
+
The \markdownRendererFancyOlEnd macro represents the end
+of a fancy ordered list that contains an item with several paragraphs of
+text (the list is not tight). This macro will only be produced, when the
+fancyLists option is enabled. The macro
+receives no arguments.
+
The \markdownRendererFancyOlEndTight macro represents
+the end of a fancy ordered list that contains no item with several
+paragraphs of text (the list is tight). This macro will only be
+produced, when the fancyLists and
+tightLists options are 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\markdownOptionNotes{true}
-\def\markdownRendererNote#1{ (and \lowercase{#1})}
-\markdownBegin
-This is some text[^1] and this is some other text[^2].
-
- [^1]: this is a note
-
- [^2]: this is some other note
-\markdownEnd
-\bye
+\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
A PDF document named document.pdf should be produced and
contain the following text:
-
This is some text (and this is a note) and this is some other text
-(and this is some other note).
+
This is a tight list (the first item, the second item, and the third
+item).
+
This is a loose list:
+
+
This is the first item.
+
This is the second item.
+
This is the third item.
+
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
\documentclass{article}
-\usepackage[notes]{markdown}
-\markdownSetup{
- renderers = {
- note = { (and \MakeLowercase{#1})},
- },
-}
-\begin{document}
-\begin{markdown}
-This is some text[^1] and this is some other text[^2].
-
- [^1]: this is a note
-
- [^2]: this is some other note
-\end{markdown}
-\end{document}
+\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
A PDF document named document.pdf should be produced and
contain the following text:
-
This is some text (and this is a note) and this is some other text
-(and this is some other note).
+
This is a tight list (the first item, the second item, and the third
+item).
+
This is a loose list:
+
+
This is the first item.
+
This is the second item.
+
This is the third item.
+
-
ConConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
\usemodule[t][markdown]
-\setupmarkdown[notes = yes]
-\def\markdownRendererNote#1{ (and \lowercase{#1})}
-\starttext
-\startmarkdown
-This is some text[^1] and this is some other text[^2].
-
- [^1]: this is a note
-
- [^2]: this is some other note
-\stopmarkdown
-\stoptext
+\setupmarkdown
+ [
+ tightLists = yes,
+ startNumber = yes,
+ ]
+\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
A PDF document named document.pdf should be produced and
contain the following text:
-
This is some text (and this is a note) and this is some other text
-(and this is some other note).
+
This is a tight list (the first item, the second item, and the third
+item).
+
This is a loose list:
+
+
This is the first item.
+
This is the second item.
+
This is the third item.
+
-
2.3.1.22 Parenthesized Citations
+
2.3.1.24 Parenthesized Citations
Renderer
The \markdownRendererCite macro represents a string of
one or more parenthetical citations. This macro will only be produced,
@@ -9052,7 +9165,7 @@ citations⟩} followed by ⟨suppress author⟩
repeated ⟨number of citations⟩ times. The ⟨suppress
author⟩ parameter is either the token -, when the
author’s name is to be suppressed, or + otherwise.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
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.25 Raw Content Renderers
+
The \markdownRendererInputRawInline macro represents an
+inline raw span. The macro receives two arguments: the filename of a
+file contaning the inline raw span contents and the raw attribute that
+designates the format of the inline raw span. This macro will only be
+produced, when the rawAttribute option is
+enabled.
+
The \markdownRendererInputRawBlock macro represents a
+raw block. The macro receives two arguments: the filename of a file
+contaning the raw block and the raw attribute that designates the format
+of the raw block. This macro will only be produced, when the
+rawAttribute and
+fencedCode options are enabled.
+
LaTeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\documentclass{article}
+\usepackage[rawAttribute, fencedCode]{markdown}
+\usepackage{expl3}
+\ExplSyntaxOn
+\cs_new:Nn
+\display_raw_content:nn
+ {
+% If the raw attribute is TeX, execute the content as a TeX document.
+\str_if_eq:nnTF
+ { #2 }
+ { tex }
+ { \markdownEscape { #1 } }
+% Otherwise, ignore the content.
+ { }
+ }
+\markdownSetup{
+ renderers = {
+ rawInline = { \display_raw_content:nn { #1 } { #2 } },
+ rawBlock = { \display_raw_content:nn { #1 } { #2 } }
+ },
+}
+\ExplSyntaxOff
+\begin{document}
+\begin{markdown}
+`$H_2 O$`{=tex} is a liquid.
+
+``` {=html}
+<p>Here is some HTML content that will be ignored.</p>
+```
+\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:
+
+
H2O is a liquid.
+
+
2.3.1.26 Special Character
+Renderers
+
The following macros replace any special plain TeX characters, including the active pipe
+character (|) of ConTeXt, in the input text:
+
+
\markdownRendererAmpersand replaces the ampersand
+(&).
+
\markdownRendererBackslash replaces the backslash
+(\).
+
\markdownRendererCircumflex replaces the circumflex
+(^).
+
\markdownRendererDollarSign replaces the dollar sign
+($).
+
\markdownRendererHash replaces the hash sign
+(#).
+
\markdownRendererLeftBrace replaces the left brace
+({).
+
\markdownRendererPercentSign replaces the percent sign
+(%).
+
\markdownRendererPipe replaces the pipe character
+(|).
+
\markdownRendererRightBrace replaces the right brace
+(}).
+
\markdownRendererTilde replaces the tilde
+(~).
+
\markdownRendererUnderscore replaces the underscore
+(_).
+
+
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.
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
+
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.
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.
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
+
+
2.3.1.27 Strike-Through
+Renderer
+
The \markdownRendererStrikeThrough macro represents a
+strike-through span of text. The macro receives a single argument that
+corresponds to the striked-out span of text. This macro will only be
+produced, when the strikeThrough option is
+enabled.
+
Plain TeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
This is a lunar roving vehicle strike-through text.
+
+
2.3.1.28 Subscript Renderer
+
The \markdownRendererSubscript macro represents a
+subscript span of text. The macro receives a single argument that
+corresponds to the subscript span of text. This macro will only be
+produced, when the subscripts option is
+enabled.
+
Plain TeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\input markdown
+\def\markdownOptionSubscripts{true}
+\def\markdownRendererSubscript#1{ (#1 moles) and }
+\markdownBegin
+H~2~O is a liquid.
+\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:
+
+
H (2 moles) and O is a liquid.
+
+
LaTeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\documentclass{article}
+\usepackage[subscripts]{markdown}
+\markdownSetup{
+ renderers = {
+ subscript = { (#1 moles) and },
+ },
+}
+\begin{document}
+\begin{markdown}
+H~2~O is a liquid.
+\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:
+
+
H (2 moles) and O is a liquid.
+
+
ConTeXt Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\usemodule[t][markdown]
+\setupmarkdown[subscripts = yes]
+\def\markdownRendererSubscript#1{ (#1 moles) and }
+\starttext
+\startmarkdown
+H~2~O is a liquid.
+\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:
+
+
H (2 moles) and O is a liquid.
+
+
2.3.1.29 Superscript Renderer
+
The \markdownRendererSuperscript macro represents a
+superscript span of text. The macro receives a single argument that
+corresponds to the superscript span of text. This macro will only be
+produced, when the superscripts option is
+enabled.
+
Plain TeX Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\input markdown
+\def\markdownOptionSuperscripts{true}
+\def\markdownRendererSuperscript#1{ taken to the power of #1}
+\markdownBegin
+2^10^ is 1024.
+\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 parenthesized citation abrahams90 with a prefix
-see and a postfix pp. 12, and a citation eijkhout91
-with a postfix pp. 34.
+
2 taken to the power of 10 is 1024.
-
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
-\markdownRendererCite macro.
-
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}
+
\documentclass{article}
+\usepackage[superscripts]{markdown}
+\markdownSetup{
+ renderers = {
+ superscript = { taken to the power of #1},
+ },
+}
+\begin{document}
+\begin{markdown}
+2^10^ is 1024.
+\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 text citation abrahams90 with a postfix
-pp. 12, and a citation eijkhout91 with a prefix
-also.
+
2 taken to the power of 10 is 1024.
+
+
ConTeXt Example
+
Using a text editor, create a text document named
+document.tex with the following content:
+
\usemodule[t][markdown]
+\setupmarkdown[superscripts = yes]
+\def\markdownRendererSuperscript#1{ taken to the power of #1}
+\starttext
+\startmarkdown
+2^10^ is 1024.
+\stopmarkdown
+\stoptext
+
Next, invoke LuaTeX from the terminal:
+
context document.tex
+
A PDF document named document.pdf should be produced and
+contain the following text:
+
+
2 taken to the power of 10 is 1024.
-
2.3.1.24 Table Renderer
+
2.3.1.30 Table Renderer
The \markdownRendererTable macro represents a table.
This macro will only be produced, when the
pipeTables option is enabled. The macro
@@ -9192,71 +9629,71 @@ one of the following:
c – The corresponding column is centered.
r – The corresponding column is right-aligned.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
-
\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}
+
\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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
@@ -9274,520 +9711,367 @@ column number 4 says 12. In row 3, column number 1 says
number 1 says 1, column number 2 says 1, column number
3 says 1, and column number 4 says 1.
-
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
-
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 notes. -->
-
-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.
-
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
-
-
-
The horizontal margins should contain the following text:
-
-
Side notes are displayed in the horizontal margins next to the
-relevant passages, which makes them easier for the reader to
-find than notes.
-
-
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
-
Using a text editor, create a text document named
-document.tex with the following content:
A PDF document named document.pdf should be produced and
-contain the following body text:
-
-
_Hello,_ world!
-
<div>_Hello,_ world!</div>
-
-
2.3.1.27 Attribute Renderers
-
The following macros are only produced, when the
-headerAttributes option is enabled.
-
\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
-
Using a text editor, create a text document named
-document.tex with the following content:
A PDF document named document.pdf should be produced and
-contain the following text:
-
-
First top-level heading
-
(Key: Jane, Value: Doe)
-
A subheading
-
(Identifier: identifier)
-
Second top-level heading
-
(Class name: class_name)
-
-
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.
-
2.3.1.31 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
+\markdownRendererCite macro.
+
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}
+
\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
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
First top-level heading
-
(The beginning of a header attribute context)
-
A subheading
-
(The end of a header attribute context)
-
(The beginning of a header attribute context)
-
Second top-level heading
-
(The end of a header attribute context)
+
This is a text citation abrahams90 with a postfix
+pp. 12, and a citation eijkhout91 with a prefix
+also.
-
2.3.1.29 Strike-Through
+
2.3.1.32 Thematic Break
Renderer
-
The \markdownRendererStrikeThrough macro represents a
-strike-through span of text. The macro receives a single argument that
-corresponds to the striked-out span of text. This macro will only be
-produced, when the strikeThrough option is
-enabled.
-
Plain The \markdownRendererThematicBreak macro represents a
+thematic 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\markdownRendererThematicBreak{\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 a lunar roving vehicle strike-through text.
+
This is the first page.
+
+
This is the second page.
-
LaTeX Example
Using a text editor, create a text document named
document.tex with the following content:
\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+ renderers = {
+ thematicBreak = \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:
-
context document.tex
+
lualatex document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
This is a lunar roving vehicle strike-through text.
+
This is the first page.
+
+
This is the second page.
-
2.3.1.30 Superscript Renderer
-
The \markdownRendererSuperscript macro represents a
-superscript span of text. The macro receives a single argument that
-corresponds to the superscript span of text. This macro will only be
-produced, when the superscripts option is
-enabled.
-
Plain TeX Example
+
ConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\input markdown
-\def\markdownOptionSuperscripts{true}
-\def\markdownRendererSuperscript#1{ taken to the power of #1}
-\markdownBegin
-2^10^ is 1024.
-\markdownEnd
-\bye
+
\usemodule[t][markdown]
+\def\markdownRendererThematicBreak{\page[yes]}
+\starttext
+\startmarkdown
+This is the first page.
+
+***
+
+This is the second page.
+\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-
luatex document.tex
+
context document.tex
A PDF document named document.pdf should be produced and
contain the following text:
-
2 taken to the power of 10 is 1024.
+
This is the first page.
+
+
This is the second page.
-
2.3.1.33 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
Using a text editor, create a text document named
document.tex with the following content:
-
\documentclass{article}
-\usepackage[superscripts]{markdown}
-\markdownSetup{
- renderers = {
- superscript = { taken to the power of #1},
- },
-}
-\begin{document}
-\begin{markdown}
-2^10^ is 1024.
-\end{markdown}
-\end{document}
A PDF document named document.pdf should be produced and
contain the following text:
-
2 taken to the power of 10 is 1024.
+
+
No you can’t.
+
Yes I can!
+
ConTeXt Example
Using a text editor, create a text document named
document.tex with the following content:
-
\usemodule[t][markdown]
-\setupmarkdown[superscripts = yes]
-\def\markdownRendererSuperscript#1{ taken to the power of #1}
-\starttext
-\startmarkdown
-2^10^ is 1024.
-\stopmarkdown
-\stoptext
+
\usemodule[t][markdown]
+\setupmarkdown[taskLists = yes]
+\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:
-
2 taken to the power of 10 is 1024.
+
+
No you can’t.
+
Yes I can!
+
-
2.3.1.31 Subscript Renderer
-
The \markdownRendererSubscript macro represents a
-subscript span of text. The macro receives a single argument that
-corresponds to the subscript span of text. This macro will only be
-produced, when the subscripts option is
-enabled.
+
2.3.1.34 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.
+
The \markdownRendererJekyllDataMappingEnd macro
+represents the end of a mapping in a yaml document. This
+macro will only be produced when the
+jekyllData option is enabled. The macro
+receives no arguments.
+
The \markdownRendererJekyllDataSequenceBegin macro
+represents the beginning of a sequence 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 sequence.
+
The \markdownRendererJekyllDataSequenceEnd macro
+represents the end of a sequence in a yaml document. This
+macro will only be produced when the
+jekyllData option is enabled. The macro
+receives no arguments.
+
The \markdownRendererJekyllDataBoolean macro represents
+a boolean scalar value 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, and the scalar value, both cast to a string
+following yaml serialization rules.
+
The \markdownRendererJekyllDataNumber macro represents a
+numeric scalar value 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, and the scalar value, both cast to a string
+following yaml serialization rules.
+
The \markdownRendererJekyllDataString macro represents a
+string scalar value 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 scalar value.
+
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\markdownOptionSubscripts{true}
-\def\markdownRendererSubscript#1{ (#1 moles) and }
-\markdownBegin
-H~2~O is a liquid.
-\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:
-
H (2 moles) and O is a liquid.
+
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[subscripts]{markdown}
-\markdownSetup{
- renderers = {
- subscript = { (#1 moles) and },
- },
-}
-\begin{document}
-\begin{markdown}
-H~2~O is a liquid.
-\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:
-
H (2 moles) and O is a liquid.
+
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]
-\setupmarkdown[subscripts = yes]
-\def\markdownRendererSubscript#1{ (#1 moles) and }
-\starttext
-\startmarkdown
-H~2~O is a liquid.
-\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:
-
-
H (2 moles) and O is a liquid.
-
-
2.3.1.32 Raw Content Renderers
-
The \markdownRendererInputRawInline macro represents an
-inline raw span. The macro receives two arguments: the filename of a
-file contaning the inline raw span contents and the raw attribute that
-designates the format of the inline raw span. This macro will only be
-produced, when the rawAttribute option is
-enabled.
-
The \markdownRendererInputRawBlock macro represents a
-raw block. The macro receives two arguments: the filename of a file
-contaning the raw block and the raw attribute that designates the format
-of the raw block. This macro will only be produced, when the
-rawAttribute and
-fencedCode options are enabled.
-
LaTeX Example
-
Using a text editor, create a text document named
-document.tex with the following content:
-
\documentclass{article}
-\usepackage[rawAttribute, fencedCode]{markdown}
-\usepackage{expl3}
-\ExplSyntaxOn
-\cs_new:Nn
-\display_raw_content:nn
- {
-% If the raw attribute is TeX, execute the content as a TeX document.
-\str_if_eq:nnTF
- { #2 }
- { tex }
- { \markdownEscape { #1 } }
-% Otherwise, ignore the content.
- { }
- }
-\markdownSetup{
- renderers = {
- rawInline = { \display_raw_content:nn { #1 } { #2 } },
- rawBlock = { \display_raw_content:nn { #1 } { #2 } }
- },
-}
-\ExplSyntaxOff
-\begin{document}
-\begin{markdown}
-`$H_2 O$`{=tex} is a liquid.
-
-``` {=html}
-<p>Here is some HTML content that will be ignored.</p>
-```
-\end{markdown}
-\end{document}
+
\usemodule[t][markdown]
+\setupmarkdown[jekyllData = yes]
+\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:
-
lualatex document.tex
+
context document.tex
A PDF document named document.pdf should be produced and
contain the following text: