From dcd4b33437ee2d76762844fd5b757285a0495900 Mon Sep 17 00:00:00 2001
From: Karl Berry 2.19.0-0-g80fcf20 2022-12-23 2.20.0-0-gf64ade1 2023-02-01Markdown Package User Manual
-
A paragraph.
A fenced div.
-A paragraph. ::: {.identifier} Not a fenced div. :::
+A paragraph.
+::: {.identifier} Not a fenced div. :::
renderers = {
attributeKeyValue = {
\str_if_eq:nnT
- { #1 }
+ { ##1 }
{ color }
{
- \color_select:n { #2 }
+ \color_select:n { ##2 }
}
},
},
@@ -1918,11 +1921,11 @@ class="sourceCode tex">\end{document}
Next, invoke LuaTeX from the terminal:
lualatex --shell-escape document.tex
+class="sourceCode sh">lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
-Here is some colored text.
+Here is some colored text.
2.2.1.10 Option
@@ -3325,22 +3328,23 @@ class="sourceCode html"> </code>
</pre>
-2.2.1.22 Option
-fencedDivs
+fencedCodeAttributes
-fencedDivs
(default value: false
)
+fencedCodeAttributes
(default value:
+false
)
-
- true
-
-
Enable the Pandoc fenced divs extension:
+Enable the Pandoc fenced code attribute extension:
- ::::: {#special .sidebar}
- Here is a paragraph.
-
- And another. :::::
+class="sourceCode md">~~~~ {#mycode .haskell .numberLines startFrom="100"}
+qsort [] = []
+qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++
+ qsort (filter (>= x) xs)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3348,7 +3352,7 @@ class="sourceCode md">
- false
-
-
Disable the Pandoc fenced divs extension:
+Disable the Pandoc fenced code attribute extension.
@@ -3359,75 +3363,112 @@ class="latex">LaTeX Example
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}
+\usepackage[fencedCode,
+ fencedCodeAttributes]{markdown}
+\usepackage{minted}
+\markdownSetup{
+ renderers = {
+ fencedCodeAttributeContextBegin = {%
+ \begingroup
+ \markdownSetup{
+ renderers = {
+ attributeKeyValue = {%
+ \setminted{{#1} = {#2}}%
+ },
+ },
+ }%
+ },
+ fencedCodeAttributeContextEnd = {%
+ \endgroup
+ },
+ },
+}
+\begin{document}
+\begin{markdown}
+``` js {linenos=true}
+if (a > 3) {
+ moveShip(5 * gravity, DOWN);
+}
+\end{markdown} \end{document}
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ``` js {.linenos}
+> 1. if (a > 3) {
+> 2. moveShip(5 * gravity, DOWN);
+> 3. }
+> ``````
+
+
+#### Option `fencedDivs`
+
+`fencedDivs` (default value: `false`)
+
+: true
+
+ : Enable the Pandoc fenced divs extension:
+
+ ``` md
+ ::::: {#special .sidebar}
+ Here is a paragraph.
+
+ And another.
+ :::::
+ ``````
+
+: false
+
+ : Disable the Pandoc fenced divs extension:
+
+
+#### Option `finalizeCache`
+
+`finalizeCache` (default value: `false`)
+
+: Whether an output file specified with the **`frozenCacheFileName`** option
+ (frozen cache) that contains a mapping between an enumeration of markdown
+ documents and their auxiliary cache files will be created.
+
+ The frozen cache makes it possible to later typeset a plain <span class="tex">T<sub>e</sub>X</span>
+ document that contains markdown documents without invoking Lua using
+ the **`frozenCache`** plain <span class="tex">T<sub>e</sub>X</span> option. As a result, the
+ plain <span class="tex">T<sub>e</sub>X</span> document becomes more portable, but further changes in the
+ order and the content of markdown documents will not be reflected.
+
+
+##### Plain <span class="tex">T<sub>e</sub>X</span> Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionFinalizeCache{true}
+\markdownBegin
+Hello *world*!
+\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-lualatex --shell-escape document.tex
A PDF document named document.pdf
should be produced and
-contain the following text:
--Here is a special paragraph.
-
finalizeCache
finalizeCache
(default value: false
)Whether an output file specified with the
-frozenCacheFileName
option (frozen cache)
-that contains a mapping between an enumeration of markdown documents and
-their auxiliary cache files will be created.
The frozen cache makes it possible to later typeset a plain TeX document that contains markdown
-documents without invoking Lua using the
-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.
Using a text editor, create a text document named
-document.tex
with the following content:
\input markdown
-\def\markdownOptionFinalizeCache{true}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced as we requested using the finalizeCache
option.
Next, change the content of document.tex
as follows:
\input markdown
-\def\markdownOptionFrozenCache{true}
-\markdownBegin
-
- Hi *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFrozenCache{true}
+\markdownBegin
+
+ Hi *world*!\markdownEnd
+\bye
Last, invoke pdfTeX without shell access from the terminal:
-pdftex -no-shell-escape document.tex
pdftex -no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3439,33 +3480,33 @@ in the content of the markdown document from “Hello world!” to
class="latex">LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass[finalizecache]{article}
-\usepackage{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
\documentclass[finalizecache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hello *world*!\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced as we requested using the finalizecache
option.
Next, change the content of document.tex
as follows:
\documentclass[frozencache]{article}
-\usepackage{markdown}
-\begin{document}
-\begin{markdown}
-
- Hi *world*!\end{markdown}
-\end{document}
\documentclass[frozencache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hi *world*!\end{markdown}
+\end{document}
Last, invoke pdfTeX without shell access from the terminal:
-pdflatex -no-shell-escape document.tex
pdflatex -no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3477,33 +3518,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:
\usemodule[t][markdown]
-\setupmarkdown[finalizeCache = yes]
-\starttext
-\startmarkdown
-
- Hello *world*!\stopmarkdown
-\stoptext
\usemodule[t][markdown]
+\setupmarkdown[finalizeCache = yes]
+\starttext
+\startmarkdown
+
+ Hello *world*!\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
context document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced in the cache.tex
output file as we requested using
the finalizeCache
option.
Next, change the content of document.tex
as follows:
\usemodule[t][markdown]
-\setupmarkdown[frozenCache = yes]
-\starttext
-\startmarkdown
-
- Hi *world*!\stopmarkdown
-\stoptext
\usemodule[t][markdown]
+\setupmarkdown[frozenCache = yes]
+\starttext
+\startmarkdown
+
+ Hi *world*!\stopmarkdown
+\stoptext
Last, invoke pdfTeX without shell access from the terminal:
-texexec --passon=--no-shell-escape document.tex
texexec --passon=--no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3511,8 +3552,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.
frozenCacheCounter
frozenCacheCounter
(default value: 0
)Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
- local firstInput = "Hello"
- local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
- local secondInput = "*world*!"
- tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
+ local firstInput = "Hello"
+ local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
+ local secondInput = "*world*!"
+ tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache with two entries
will also be produced as we requested using the
frozenCacheCounter
option.
hardLineBreaks
hardLineBreaks
(default value: false
)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}
\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
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3606,8 +3647,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.
hashEnumerators
hashEnumerators
(default value:
@@ -3618,10 +3659,10 @@ class="header-section-number">2.2.1.26 Option
Enable the use of hash symbols (#
) as ordered item list
markers:
- #. Bird
- #. McHale #. Parish
+ #. Bird
+ #. McHale #. Parish
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-
- #. Bird
- #. McHale
- #. Parish\end{markdown}
-
-\begin{markdown*}{hashEnumerators}
-
- #. Bird
- #. McHale
- #. Parish\end{markdown*}
-
-\end{document}
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+
+ #. Bird
+ #. McHale
+ #. Parish\end{markdown}
+
+\begin{markdown*}{hashEnumerators}
+
+ #. Bird
+ #. McHale
+ #. Parish\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3676,27 +3717,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown - - #. Bird - #. McHale - #. Parish\stopmarkdown - -\setupmarkdown[hashEnumerators = yes] -\startmarkdown - - #. Bird - #. McHale - #. Parish\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + #. Bird + #. McHale + #. Parish\stopmarkdown + +\setupmarkdown[hashEnumerators = yes] +\startmarkdown + + #. Bird + #. McHale + #. Parish\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:@@ -3709,8 +3750,8 @@ contain the following text:-- Parish
2.2.1.27 Option +
2.2.1.26 Option
headerAttributes
@@ -3739,8 +3780,8 @@ class="sourceCode md">
headerAttributes
(default value: @@ -3720,13 +3761,13 @@ class="header-section-number">2.2.1.27 Option- true
Enable the assignment of HTML attributes to headings:
-+# My first heading {#foo} - -## My second heading ## {#bar .baz} - - - Yet another heading {key=value}===================
# My first heading {#foo} + +## My second heading ## {#bar .baz} + + + Yet another heading {key=value}===================
html
html
(default value: false
)Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input lmfonts
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new()
- local newline = [[^^J^^J]]
- local input =
- "<div>*There is no block tag support.*</div>" .. newline ..
- "*There is no <inline tag="tag"></inline> support.*" .. newline ..
- "_There is no <!-- comment --> support._" .. newline ..
- "_There is no <? HTML instruction ?> support._"
- tex.sprint(convert(input)) }\par
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new({html = true})
- local input =
- "<div>*There is block tag support.*</div>" .. newline ..
- "*There is <inline tag="tag"></inline> support.*" .. newline ..
- "_There is <!-- comment --> support._" .. newline ..
- "_There is <? HTML instruction ?> support._"
- tex.sprint(convert(input)) }\bye
\input markdown
+\input lmfonts
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new()
+ local newline = [[^^J^^J]]
+ local input =
+ "<div>*There is no block tag support.*</div>" .. newline ..
+ "*There is no <inline tag="tag"></inline> support.*" .. newline ..
+ "_There is no <!-- comment --> support._" .. newline ..
+ "_There is no <? HTML instruction ?> support._"
+ tex.sprint(convert(input)) }\par
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new({html = true})
+ local input =
+ "<div>*There is block tag support.*</div>" .. newline ..
+ "*There is <inline tag="tag"></inline> support.*" .. newline ..
+ "_There is <!-- comment --> support._" .. newline ..
+ "_There is <? HTML instruction ?> support._"
+ tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3808,27 +3849,27 @@ support.-Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+<div> - - *Is there block tag support?*</div> -<inline tag="tag"></inline> support?* - *Is there <!-- comment --> support?_ - _Is there <? HTML instruction ?> support?_ _Is there
<div> + + *Is there block tag support?*</div> +<inline tag="tag"></inline> support?* + *Is there <!-- comment --> support?_ + _Is there <? HTML instruction ?> support?_ _Is there
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
–> support? Is there <? HTML instruction ?> support?~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -3846,37 +3887,37 @@ contain the following text:Is there support? Is there support? Is there support?
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
\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
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3890,33 +3931,33 @@ support. class="latex">LaTeX ExampleUsing 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}
\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
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3930,33 +3971,33 @@ support. class="tex">TeXt ExampleUsing 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
\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
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3966,8 +4007,8 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
2.2.1.29 Option +
2.2.1.28 Option
hybrid
- @@ -4003,27 +4044,27 @@ prepared with this package in mind. Example
hybrid
(default value:false
)Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local input, convert_safe, convert_unsafe, paragraph -$\string\sqrt{-1}$ *equals* $i$.]] - input = [[ - convert_safe = markdown.new() - convert_unsafe = markdown.new({hybrid = true})\par]] - paragraph = [[ - - tex.sprint( - convert_safe(input) .. paragraph .. - convert_unsafe(input) - ) - }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local input, convert_safe, convert_unsafe, paragraph +$\string\sqrt{-1}$ *equals* $i$.]] + input = [[ + convert_safe = markdown.new() + convert_unsafe = markdown.new({hybrid = true})\par]] + paragraph = [[ + + tex.sprint( + convert_safe(input) .. paragraph .. + convert_unsafe(input) + ) + }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4033,25 +4074,25 @@ contain the following text:-Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse - -\begingroup -\catcode`\%=12 -\input optiontrue -\endgroup -\bye
\input markdown +\input lmfonts +\input optionfalse + +\begingroup +\catcode`\%=12 +\input optiontrue +\endgroup +\bye
Using a text editor, create a text document named
-content.md
with the following content:+$\sqrt{-1}$ *equals* $i$.
$\sqrt{-1}$ *equals* $i$.
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -4067,27 +4108,27 @@ contain the following text:$\sqrt {-1}$ equals $i$.
√-̅1̅ equals i.
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts - -\markdownBegin -$\sqrt{-1}$ *equals* $i$. -\markdownEnd - -\def\markdownOptionHybrid{true} -\markdownBegin -$\sqrt{-1}$ *equals* $i$. -\markdownEnd - -\bye
\input markdown +\input lmfonts + +\markdownBegin +$\sqrt{-1}$ *equals* $i$. +\markdownEnd + +\def\markdownOptionHybrid{true} +\markdownBegin +$\sqrt{-1}$ *equals* $i$. +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4098,23 +4139,23 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} -$\sqrt{-1}$ *equals* $i$. -\end{markdown} - -\begin{markdown*}{hybrid} -$\sqrt{-1}$ *equals* $i$. -\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} +$\sqrt{-1}$ *equals* $i$. +\end{markdown} + +\begin{markdown*}{hybrid} +$\sqrt{-1}$ *equals* $i$. +\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4125,31 +4166,31 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown -$\sqrt{-1}$ *equals* $i$. -\stopmarkdown - -\setupmarkdown[hybrid = yes] -\startmarkdown -$\sqrt{-1}$ *equals* $i$. -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown +$\sqrt{-1}$ *equals* $i$. +\stopmarkdown + +\setupmarkdown[hybrid = yes] +\startmarkdown +$\sqrt{-1}$ *equals* $i$. +\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-$\sqrt {-1}$ equals $i$.
√-̅1̅ equals i.
2.2.1.30 Option +
2.2.1.29 Option
inlineNotes
@@ -4178,19 +4219,19 @@ class="sourceCode md">
- @@ -4158,10 +4199,10 @@ class="header-section-number">2.2.1.30 Option
inlineNotes
(default value:false
)- true
Enable the Pandoc inline note syntax extension:
-+- Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and move down to type the note.]
+ Here is an inline note.^[Inlines notes are easier to + write, since you don't have to pick an identifier and move down to type the note.]
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}
\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
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4201,27 +4242,27 @@ id="fnref1" role="doc-noteref">1 class="tex">TeXt ExampleUsing 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
\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
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Here is an inline note.2
2.2.1.31 Option +
2.2.1.30 Option
jekyllData
@@ -4256,33 +4297,33 @@ for entering metadata in yaml.
- @@ -4231,18 +4272,18 @@ class="header-section-number">2.2.1.31 Option
jekyllData
(default value:false
)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.---
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 }
- {\gdef\name{#1} },
- name .code:n = { \gdef\age{#1} },
- age .code:n = {
- }\ExplSyntaxOff
-\def\markdownRendererJekyllDataEnd{%
-\name{} is \age{} years old.}
- \markdownBegin
-
- ---
- name: Jane Doe
- age: 99
- ---\markdownEnd
-\bye
\input markdown
+\def\markdownOptionJekyllData{true}
+\ExplSyntaxOn
+\keys_define:nn
+
+ { markdown/jekyllData }
+ {\gdef\name{#1} },
+ name .code:n = { \gdef\age{#1} },
+ age .code:n = {
+ }\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
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4292,31 +4333,31 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\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:@@ -4326,37 +4367,142 @@ contain the following text: class="tex">TeXt ExampleUsing 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 } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\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
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.31 Option +
+lineBlocks
+
+- +
lineBlocks
(default value:false
)- +
++
+- true
+- +
+Enable the Pandoc line block syntax extension.
+++ | this is a line block that + | spans multiple + | even + discontinuous | lines
- +
++
+- false
+- +
+Disable the Pandoc line block syntax extension.
+Plain TeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown +\def\markdownOptionLineBlocks{true} +\markdownBegin + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\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:++I would spread the cloths under your feet:+
+But I, being poor, have only my dreams;
+I have spread my dreams under your feet;
+Tread softly because you tread on my dreams.LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\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:++I would spread the cloths under your feet:+
+But I, being poor, have only my dreams;
+I have spread my dreams under your feet;
+Tread softly because you tread on my dreams.ConTeXt Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\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:+I would spread the cloths under your feet:+
+But I, being poor, have only my dreams;
+I have spread my dreams under your feet;
+Tread softly because you tread on my dreams.2.2.1.32 Option
@@ -4367,24 +4513,24 @@ class="header-section-number">2.2.1.32 Optionnotes
- true
Enable the Pandoc note syntax extension:
-+[^1] and another.[^longnote] - Here is a note reference, -[^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.
[^1] and another.[^longnote] + Here is a note reference, +[^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.
-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}
+\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
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4438,37 +4584,37 @@ role="doc-noteref">4
This paragraph won’t be part of the note, because it isn’t
indented.
-ConConTeXt 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
+\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
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4489,12 +4635,12 @@ class="header-section-number">2.2.1.33
Option
true
Enable the PHP Markdown pipe table syntax extension:
-
- | Right | Left | Default | Center |
- |------:|:-----|---------|:------:|
- | 12 | 12 | 12 | 12 |
- | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
+
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
@@ -4508,25 +4654,25 @@ extension.
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[pipeTables]{markdown}
-\begin{document}
-\begin{markdown}
-
- | Right | Left | Default | Center |
- |------:|:-----|---------|:------:|
- | 12 | 12 | 12 | 12 |
- | 123 | 123 | 123 | 123 |
- | 1 | 1 | 1 | 1 |\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[pipeTables]{markdown}
+\begin{document}
+\begin{markdown}
+
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4561,25 +4707,25 @@ contain the following text:
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[pipeTables = yes]
-\starttext
-\startmarkdown
-
- | Right | Left | Default | Center |
- |------:|:-----|---------|:------:|
- | 12 | 12 | 12 | 12 |
- | 123 | 123 | 123 | 123 |
- | 1 | 1 | 1 | 1 |\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[pipeTables = yes]
+\starttext
+\startmarkdown
+
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4646,20 +4792,20 @@ class="header-section-number">2.2.1.35 Option
true
Enable the Pandoc raw attribute syntax extension:
-`$H_2 O$`{=tex} is a liquid.
+`$H_2 O$`{=tex} is a liquid.
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
@@ -4677,26 +4823,26 @@ 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:
@@ -4715,14 +4861,14 @@ class="header-section-number">2.2.1.36 Option
Enable relative
references in autolinks:
-
- I conclude in Section <#conclusion>.
-
- Conclusion {#conclusion}==========
-
- In this paper, we have discovered that most
- grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
+
+ I conclude in Section <#conclusion>.
+
+ Conclusion {#conclusion}==========
+
+ In this paper, we have discovered that most
+ grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
@@ -4735,30 +4881,30 @@ class="sourceCode md">
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[headerAttributes, relativeReferences]{markdown}
-\begin{document}
-\begin{markdown}
-
-
- I conclude in Section <#conclusion>.
-
- Conclusion {#conclusion}
- ==========
- In this paper, we have discovered that most
- grandmas would rather eat dinner with their
- grandchildren than get eaten. Begone, wolf!
-\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[headerAttributes, relativeReferences]{markdown}
+\begin{document}
+\begin{markdown}
+
+
+ I conclude in Section <#conclusion>.
+
+ Conclusion {#conclusion}
+ ==========
+ In this paper, we have discovered that most
+ grandmas would rather eat dinner with their
+ grandchildren than get eaten. Begone, wolf!
+\end{markdown}
+\end{document}
Next, invoke LuaTeX twice from the terminal:
-lualatex document.tex
-lualatex document.tex
+lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4784,32 +4930,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:
-\input markdown
-
-\font\normal=cmr10\normal
-\font\big=cmr10 at 12pt
-\def\markdownRendererHeadingTwo#1{{\big #1\par}}
-\font\bigger=cmr10 scaled 1440
-\def\markdownRendererHeadingOne#1{{\bigger #1\par}}
-
-\def\markdownOptionShiftHeadings{-1}
-\markdownInput{example.md}
-
-\def\markdownOptionShiftHeadings{0}
-\markdownInput{example.md}
-
-\def\markdownOptionShiftHeadings{+1}
-\markdownInput{example.md}
-
-\bye
+\input markdown
+
+\font\normal=cmr10\normal
+\font\big=cmr10 at 12pt
+\def\markdownRendererHeadingTwo#1{{\big #1\par}}
+\font\bigger=cmr10 scaled 1440
+\def\markdownRendererHeadingOne#1{{\bigger #1\par}}
+
+\def\markdownOptionShiftHeadings{-1}
+\markdownInput{example.md}
+
+\def\markdownOptionShiftHeadings{0}
+\markdownInput{example.md}
+
+\def\markdownOptionShiftHeadings{+1}
+\markdownInput{example.md}
+
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4817,24 +4963,24 @@ contain the following text:
A section
A section
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\begin{filecontents}[overwrite,nosearch,noheader]{example.md}
-
- ## A section\end{filecontents}
-\begin{document}
-\markdownInput[shiftHeadings=-1]{example.md}
-\markdownInput{example.md}
-\markdownInput[shiftHeadings=+1]{example.md}
-\end{document}
+\documentclass{article}
+\usepackage{markdown}
+\begin{filecontents}[overwrite,nosearch,noheader]{example.md}
+
+ ## A section\end{filecontents}
+\begin{document}
+\markdownInput[shiftHeadings=-1]{example.md}
+\markdownInput{example.md}
+\markdownInput[shiftHeadings=+1]{example.md}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4842,26 +4988,26 @@ contain the following text:
A section
A section
-ConConTeXt Example
Using a text editor, create a text document named
example.md
with the following content:
-## A section
+## A section
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\starttext
-
-\inputmarkdown[shiftHeadings = -1]{example.md}
-\inputmarkdown[shiftHeadings = 0]{example.md}
-\inputmarkdown[shiftHeadings = +1]{example.md}
-
-\stoptext
+\usemodule[t][markdown]
+\starttext
+
+\inputmarkdown[shiftHeadings = -1]{example.md}
+\inputmarkdown[shiftHeadings = 0]{example.md}
+\inputmarkdown[shiftHeadings = +1]{example.md}
+
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4904,43 +5050,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:
-\input markdown
-\def\markdownOptionHeaderAttributes{true}
-
-\font\normal=cmr10\normal
-\font\big=cmr10 at 12pt
-\def\markdownRendererHeadingTwo#1{{\big #1\par}}
-\font\bigger=cmr10 scaled 1440
-\def\markdownRendererHeadingOne#1{{\bigger #1\par}}
-
-\def\markdownOptionSlice{^ ^act-3}
-\markdownInput{hamlet.md}
-
-\def\markdownOptionSlice{act-1}
-\markdownInput{hamlet.md}
-
-\def\markdownOptionSlice{act-3 act-5}
-\markdownInput{hamlet.md}
-
-\bye
+\input markdown
+\def\markdownOptionHeaderAttributes{true}
+
+\font\normal=cmr10\normal
+\font\big=cmr10 at 12pt
+\def\markdownRendererHeadingTwo#1{{\big #1\par}}
+\font\bigger=cmr10 scaled 1440
+\def\markdownRendererHeadingOne#1{{\bigger #1\par}}
+
+\def\markdownOptionSlice{^ ^act-3}
+\markdownInput{hamlet.md}
+
+\def\markdownOptionSlice{act-1}
+\markdownInput{hamlet.md}
+
+\def\markdownOptionSlice{act-3 act-5}
+\markdownInput{hamlet.md}
+
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4953,34 +5099,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:
@@ -4993,37 +5139,37 @@ contain the following text:
Act V
Hamlet dies.
-ConConTeXt 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:
-\usemodule[t][markdown]
-\setupmarkdown[headerAttributes = yes]
-\starttext
-
-\inputmarkdown[slice = ^ ^act-3]{example.md}
-\inputmarkdown[slice = act-1]{example.md}
-\inputmarkdown[slice = act-3 act-5]{example.md}
-
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[headerAttributes = yes]
+\starttext
+
+\inputmarkdown[slice = ^ ^act-3]{example.md}
+\inputmarkdown[slice = act-1]{example.md}
+\inputmarkdown[slice = act-3 act-5]{example.md}
+
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -5064,25 +5210,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:
@@ -5092,23 +5238,23 @@ contain the following text:
Lua CLI Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownRendererEllipsis{. . .}
-\input lmfonts
-\input optionfalse
-\par
-\input optiontrue
-\bye
+\input markdown
+\def\markdownRendererEllipsis{. . .}
+\input lmfonts
+\input optionfalse
+\par
+\input optiontrue
+\bye
Using a text editor, create a text document named
content.md
with the following content:
- Are these just three regular dots, a victorian ellipsis, or ... ?
+ Are these just three regular dots, a victorian ellipsis, or ... ?
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex
-luatex document.tex
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -5129,83 +5275,83 @@ 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:
These are just three regular dots …
. . . and this is a victorian ellipsis.
-ConConTeXt 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:
@@ -5239,36 +5385,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:
@@ -5286,34 +5432,34 @@ markup:
fifth item
-ConConTeXt 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:
@@ -5341,8 +5487,8 @@ class="header-section-number">2.2.1.41 Option
true
Enable the Pandoc strike-through syntax extension:
- This ~~is deleted text.~~
+ This ~~is deleted text.~~
@@ -5359,65 +5505,65 @@ class="sourceCode md">TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\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
+\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:
-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.
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[strikeThrough]{markdown}
-\usepackage{soulutf8}
-\markdownSetup{
-
- renderers = {\st{#1}},
- strikeThrough = {
- },
- }\begin{document}
-\begin{markdown}
-
- This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[strikeThrough]{markdown}
+\usepackage{soulutf8}
+\markdownSetup{
+
+ renderers = {\st{#1}},
+ strikeThrough = {
+ },
+ }\begin{document}
+\begin{markdown}
+
+ This is ~~a lunar roving vehicle~~ strike-through text.\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 lunar roving vehicle strike-through text.
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[strikeThrough = yes]
-\def\markdownRendererStrikeThrough#1{\overstrikes{#1}}
-\starttext
-\startmarkdown
-
- This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown
-\stoptext
+\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:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -5435,14 +5581,14 @@ class="header-section-number">2.2.1.42 Option
Strip the minimal indentation of non-blank lines from all lines in a
markdown document. Requires that the
preserveTabs
Lua option is disabled:
-\documentclass{article}
-\usepackage[stripIndent]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
- \end{document}
+\documentclass{article}
+\usepackage[stripIndent]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hello *world*!\end{markdown}
+ \end{document}
@@ -5460,50 +5606,50 @@ document.
class="tex">TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownOptionStripIndent{true}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
+\input markdown
+\def\markdownOptionStripIndent{true}
+\markdownBegin
+
+ Hello *world*!\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!”
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[stripIndent]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
- \end{document}
+\documentclass{article}
+\usepackage[stripIndent]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hello *world*!\end{markdown}
+ \end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!”
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[stripIndent = yes]
-\starttext
-\startmarkdown
-
- Hello *world*!\stopmarkdown
- \stoptext
+\usemodule[t][markdown]
+\setupmarkdown[stripIndent = yes]
+\starttext
+\startmarkdown
+
+ Hello *world*!\stopmarkdown
+ \stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!”
2.2.1.43 Option
true
Enable the Pandoc subscript syntax extension:
- H~2~O is a liquid.
+ H~2~O is a liquid.
@@ -5530,41 +5676,41 @@ class="sourceCode md">
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[subscripts]{markdown}
-\begin{document}
-\begin{markdown}
-
- H~2~O is a liquid.\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[subscripts]{markdown}
+\begin{document}
+\begin{markdown}
+
+ H~2~O is a liquid.\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:
H2O is a liquid.
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[subscripts = yes]
-\starttext
-\startmarkdown
-
- H~2~O is a liquid.\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[subscripts = yes]
+\starttext
+\startmarkdown
+
+ H~2~O is a liquid.\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:
@@ -5580,8 +5726,8 @@ class="header-section-number">2.2.1.44
Option
true
Enable the Pandoc superscript syntax extension:
- 2^10^ is 1024.
+ 2^10^ is 1024.
@@ -5594,41 +5740,41 @@ class="sourceCode md">
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[superscripts]{markdown}
-\begin{document}
-\begin{markdown}
-
- 2^10^ is 1024.\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[superscripts]{markdown}
+\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:
210 is 1024.
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[superscripts = yes]
-\starttext
-\startmarkdown
-
- 2^10^ is 1024.\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[superscripts = yes]
+\starttext
+\startmarkdown
+
+ 2^10^ is 1024.\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:
@@ -5645,14 +5791,14 @@ class="header-section-number">2.2.1.45
Option
Enable the Pandoc table_captions
syntax extension for pipe tables.
-
- | Right | Left | Default | Center |
- |------:|:-----|---------|:------:|
- | 12 | 12 | 12 | 12 |
- | 123 | 123 | 123 | 123 |
- | 1 | 1 | 1 | 1 |
- : Demonstration of pipe table syntax.
+
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |
+ : Demonstration of pipe table syntax.
@@ -5665,27 +5811,27 @@ class="sourceCode md">
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[pipeTables, tableCaptions]{markdown}
-\begin{document}
-\begin{markdown}
-
- | Right | Left | Default | Center |
- |------:|:-----|---------|:------:|
- | 12 | 12 | 12 | 12 |
- | 123 | 123 | 123 | 123 |
- | 1 | 1 | 1 | 1 |
-
- : Demonstration of pipe table syntax.\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[pipeTables, tableCaptions]{markdown}
+\begin{document}
+\begin{markdown}
+
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -5721,31 +5867,31 @@ contain the following text:
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown
-
- [
- pipeTables = yes,
- tableCaptions = yes,
- ]\starttext
-\startmarkdown
-
- | Right | Left | Default | Center |
- |------:|:-----|---------|:------:|
- | 12 | 12 | 12 | 12 |
- | 123 | 123 | 123 | 123 |
- | 1 | 1 | 1 | 1 |
-
- : Demonstration of pipe table syntax.\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown
+
+ [
+ pipeTables = yes,
+ tableCaptions = yes,
+ ]\starttext
+\startmarkdown
+
+ | Right | Left | Default | Center |
+ |------:|:-----|---------|:------:|
+ | 12 | 12 | 12 | 12 |
+ | 123 | 123 | 123 | 123 |
+ | 1 | 1 | 1 | 1 |
+
+ : Demonstration of pipe table syntax.\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -5791,10 +5937,10 @@ class="header-section-number">2.2.1.46
Option
true
Enable the Pandoc task_lists
syntax extension.
-- [ ] an unticked task list item
-- [/] a half-checked task list item
-- [X] a ticked task list item
+- [ ] an unticked task list item
+- [/] a half-checked task list item
+- [X] a ticked task list item
@@ -5807,30 +5953,30 @@ class="sourceCode md">
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[taskLists]{markdown}
-\markdownSetup{
-
- renderers = {
- untickedBox = No,
- halfTickedBox = Maybe,
- tickedBox = Yes,
- },
- }\begin{document}
-\begin{markdown}
-
- - [ ] you can't.
- - [/] I can?
- - [X] I can!\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[taskLists]{markdown}
+\markdownSetup{
+
+ renderers = {
+ untickedBox = No,
+ halfTickedBox = Maybe,
+ tickedBox = Yes,
+ },
+ }\begin{document}
+\begin{markdown}
+
+ - [ ] you can't.
+ - [/] I can?
+ - [X] I can!\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -5840,26 +5986,26 @@ contain the following text:
Yes I can!
-ConConTeXt 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\markdownRendererHalftickedBox{Maybe}
-\def\markdownRendererTickedBox{Yes}
-\starttext
-\startmarkdown
-
- - [ ] you can't.
- - [/] I can?
- - [X] I can!\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[taskLists = yes]
+\def\markdownRendererUntickedBox{No}
+\def\markdownRendererHalftickedBox{Maybe}
+\def\markdownRendererTickedBox{Yes}
+\starttext
+\startmarkdown
+
+ - [ ] you can't.
+ - [/] I can?
+ - [X] I can!\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -5879,15 +6025,15 @@ class="header-section-number">2.2.1.47
Option
true
Strip TeX-style comments.
-\documentclass{article}
-\usepackage[texComments]{markdown}
-\begin{document}
-\begin{markdown}
-% this is a comment
- Hel
- lo *world*!\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[texComments]{markdown}
+\begin{document}
+\begin{markdown}
+% this is a comment
+ Hel
+ lo *world*!\end{markdown}
+\end{document}
Always enabled when hybrid
is
enabled.
@@ -5907,53 +6053,53 @@ 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
-% this is a comment
- Hel
- lo *world*!\markdownEnd
-\bye
+\input markdown
+\def\markdownOptionTexComments{true}
+\markdownBegin
+% this is a comment
+ Hel
+ 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}
-% this is a comment
- Hel
- lo *world*!\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[texComments]{markdown}
+\begin{document}
+\begin{markdown}
+% this is a comment
+ Hel
+ 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!”
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[texComments = yes]
-\starttext
-\startmarkdown
-% this is a comment
- Hel
- lo *world*!\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[texComments = yes]
+\starttext
+\startmarkdown
+% this is a comment
+ Hel
+ 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.48 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.
@@ -5993,43 +6139,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:
@@ -6064,11 +6210,11 @@ class="header-section-number">2.2.1.49 Option
Both underscores and asterisks can be used to denote emphasis and
strong emphasis:
-
- *single asterisks*
- _single underscores_
- **double asterisks** __double underscores__
+
+ *single asterisks*
+ _single underscores_
+ **double asterisks** __double underscores__
@@ -6088,23 +6234,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
-$m\_n$.
- This is _emphasized text_ and this is a math subscript: \markdownEnd
-
-\def\markdownOptionUnderscores{false}
-\markdownBegin
-$m_n$.
- This is *emphasized text* and this is a math subscript: \markdownEnd
-
-\bye
+\input markdown
+\def\markdownOptionHybrid{true}
+
+\markdownBegin
+$m\_n$.
+ This is _emphasized text_ and this is a math subscript: \markdownEnd
+
+\def\markdownOptionUnderscores{false}
+\markdownBegin
+$m_n$.
+ This is *emphasized text* and this is a math subscript: \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:
@@ -6113,27 +6259,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}
-$m\_n$.
- This is _emphasized text_ and this is a math subscript: \end{markdown}
-
-\begin{markdown*}{underscores=false}
-$m_n$.
- This is *emphasized text* and this is a math subscript: \end{markdown*}
-
-\end{document}
+\documentclass{article}
+\usepackage[hybrid]{markdown}
+\begin{document}
+
+\begin{markdown}
+$m\_n$.
+ This is _emphasized text_ and this is a math subscript: \end{markdown}
+
+\begin{markdown*}{underscores=false}
+$m_n$.
+ This is *emphasized text* and this is a math subscript: \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:
@@ -6142,28 +6288,28 @@ contain the following text:
This is emphasized text and this is a math subscript:
mₙ.
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[hybrid = yes]
-\starttext
-
-\startmarkdown
-$m\_n$.
- This is _emphasized text_ and this is a math subscript: \stopmarkdown
-
-\setupmarkdown[underscores = yes]
-\startmarkdown
-$m_n$.
- This is *emphasized text* and this is a math subscript: \stopmarkdown
-
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[hybrid = yes]
+\starttext
+
+\startmarkdown
+$m\_n$.
+ This is _emphasized text_ and this is a math subscript: \stopmarkdown
+
+\setupmarkdown[underscores = yes]
+\startmarkdown
+$m_n$.
+ This is *emphasized text* and this is a math subscript: \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:
@@ -6190,8 +6336,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
@@ -6241,24 +6387,24 @@ options.
Using a text editor, create a folder named
output-directory
and a text document named
document.tex
with the following content:
-\input lmfonts
-\input markdown
-\def\markdownOptionHelperScriptFileName{helper-script.lua}
-\def\markdownOptionInputTempFileName{temporary-input.md}
-\def\markdownOptionOutputTempFileName{temporary-output.tex}
-\def\markdownOptionErrorTempFileName{error-output.txt}
-\def\markdownOptionOutputDir{output-directory}
-\def\markdownOptionCacheDir{output-directory/cache-directory}
-\markdownOptionFinalizeCachetrue
-\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
+\input lmfonts
+\input markdown
+\def\markdownOptionHelperScriptFileName{helper-script.lua}
+\def\markdownOptionInputTempFileName{temporary-input.md}
+\def\markdownOptionOutputTempFileName{temporary-output.tex}
+\def\markdownOptionErrorTempFileName{error-output.txt}
+\def\markdownOptionOutputDir{output-directory}
+\def\markdownOptionCacheDir{output-directory/cache-directory}
+\markdownOptionFinalizeCachetrue
+\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex}
+\markdownBegin
+
+ Hello *world*!\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex --output-directory output-directory document.tex
+luatex --output-directory output-directory document.tex
A text document named temporary-input.md
should be
produced in the folder named output-directory
and contain
the following text:
@@ -6271,8 +6417,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:
-pdftex --output-directory output-directory --shell-escape document.tex
+pdftex --output-directory output-directory --shell-escape document.tex
Text documents named helper-script.lua
, and
temporary-output.md
should be produced in the folder named
output-directory
. The document named
@@ -6301,21 +6447,21 @@ Mittelbach. The recognized values of the macro are true
false
.
Using a text editor, create a text document named
document.dtx
with the following content:
-% \iffalse
-\documentclass{ltxdoc}
-\usepackage[stripPercentSigns]{markdown}
-\begin{document}
-\DocInput{document.dtx}
-\end{document}
-% \fi
-%
-% \begin{markdown}
-% Hello *world*!
-% \end{markdown}
+% \iffalse
+\documentclass{ltxdoc}
+\usepackage[stripPercentSigns]{markdown}
+\begin{document}
+\DocInput{document.dtx}
+\end{document}
+% \fi
+%
+% \begin{markdown}
+% Hello *world*!
+% \end{markdown}
Next, invoke LuaTeX from the terminal:
-lualatex document.dtx
+lualatex document.dtx
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
@@ -6346,10 +6492,10 @@ the \markdownOptionHelperScriptFileName
plain TeX option to
helper-script.lua
, we would inclde the following code in
our LaTeX document:
-\markdownSetup{
-
- helperScriptFileName = helper-script.lua, }
+\markdownSetup{
+
+ helperScriptFileName = helper-script.lua, }
2.2.3.2 No default token renderer
prototypes
@@ -6364,8 +6510,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.3 LaTeX themes
@@ -6378,11 +6524,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:
-\usepackage[
-
- theme = witiko/beamer/MU,
- theme = witiko/dot,markdown} ]{
+\usepackage[
+
+ theme = witiko/beamer/MU,
+ theme = witiko/dot,markdown} ]{
Due to limitations of LaTeX, themes may not be
loaded after the beginning of a 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/dot]{markdown}
-\setkeys{Gin}{
-\columnwidth,
- width=\paperheight,
- height=0.65
- keepaspectratio}\begin{document}
-\begin{markdown}
-
- ``` dot Various formats of mathemathical formulae
- digraph tree {
- margin = 0;
- rankdir = "LR";
-
- latex -> pmml;
- latex -> cmml;
- pmml -> slt;
- cmml -> opt;
- cmml -> prefix;
- cmml -> infix;
- pmml -> mterms [style=dashed];
- cmml -> mterms;
-
- latex [label = "LaTeX"];
- pmml [label = "Presentation MathML"];
- cmml [label = "Content MathML"];
- slt [label = "Symbol Layout Tree"];
- opt [label = "Operator Tree"];
- prefix [label = "Prefix"];
- infix [label = "Infix"];
- mterms [label = "M-Terms"];
- }
- ```\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[theme=witiko/dot]{markdown}
+\setkeys{Gin}{
+\columnwidth,
+ width=\paperheight,
+ height=0.65
+ keepaspectratio}\begin{document}
+\begin{markdown}
+
+ ``` dot Various formats of mathemathical formulae
+ digraph tree {
+ margin = 0;
+ rankdir = "LR";
+
+ latex -> pmml;
+ latex -> cmml;
+ pmml -> slt;
+ cmml -> opt;
+ cmml -> prefix;
+ cmml -> infix;
+ pmml -> mterms [style=dashed];
+ cmml -> mterms;
+
+ latex [label = "LaTeX"];
+ pmml [label = "Presentation MathML"];
+ cmml [label = "Content MathML"];
+ slt [label = "Symbol Layout Tree"];
+ opt [label = "Operator Tree"];
+ prefix [label = "Prefix"];
+ infix [label = "Infix"];
+ mterms [label = "M-Terms"];
+ }
+ ```\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain a drawing of a directed graph similar to Figure 1 from the
following conference article:
@@ -6467,22 +6613,22 @@ Wget or cURL installed. The theme also requires shell access unless the
class="tex">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:
@@ -6501,21 +6647,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:
-\documentclass{article}
-\usepackage[theme=witiko/tilde]{markdown}
-\begin{document}
-\begin{markdown}
-
- Bartel~Leendert van~der~Waerden\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[theme=witiko/tilde]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Bartel~Leendert van~der~Waerden\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text, where the middot (·
) denotes a
non-breaking space:
@@ -6532,30 +6678,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
@@ -6591,46 +6737,46 @@ 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:
-\documentclass{article}
-\usepackage[headerAttributes, underscores=false]{markdown}
-\markdownSetup{
-
- renderers = {%
- attributeIdentifier = {\par
- \emph{(Identifier: #1)}
- \par
-
- },%
- attributeClassName = {\par
- \emph{(Class name: #1)}
- \par
-
- },%
- attributeKeyValue = {\par
- \emph{(Key: #1, Value: #2)}
- \par
-
- },
- },
- }\begin{document}
-\begin{markdown}
-
-
- # First top-level heading {jane=doe}
-
- ## A subheading {#identifier}
-
- # Second top-level heading {.class_name}
-\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[headerAttributes, underscores=false]{markdown}
+\markdownSetup{
+
+ renderers = {%
+ attributeIdentifier = {\par
+ \emph{(Identifier: #1)}
+ \par
+
+ },%
+ attributeClassName = {\par
+ \emph{(Class name: #1)}
+ \par
+
+ },%
+ attributeKeyValue = {\par
+ \emph{(Key: #1, Value: #2)}
+ \par
+
+ },
+ },
+ }\begin{document}
+\begin{markdown}
+
+
+ # First top-level heading {jane=doe}
+
+ ## A subheading {#identifier}
+
+ # Second top-level heading {.class_name}
+\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -6651,31 +6797,31 @@ end of a block quote. The macro receives no arguments.
class="tex">TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownRendererBlockQuoteBegin{%
-\begingroup
- \vskip\parindent
- \leftskip=2\parindent
- \parindent=0pt
-
- }\def\markdownRendererBlockQuoteEnd{%
-\par
- \vskip\parindent
- \endgroup
-
- }\markdownBegin
-
- A quote from William Shakespeare's King Lear:
-
- > This is the excellent foppery of the world that when we are
- > sick in fortune---often the surfeit of our own behavior---we
- > make guilty of our disasters the sun, the moon, and the
- > stars [...]\markdownEnd
-\bye
+\input markdown
+\def\markdownRendererBlockQuoteBegin{%
+\begingroup
+ \vskip\parindent
+ \leftskip=2\parindent
+ \parindent=0pt
+
+ }\def\markdownRendererBlockQuoteEnd{%
+\par
+ \vskip\parindent
+ \endgroup
+
+ }\markdownBegin
+
+ A quote from William Shakespeare's King Lear:
+
+ > This is the excellent foppery of the world that when we are
+ > sick in fortune---often the surfeit of our own behavior---we
+ > make guilty of our disasters the sun, the moon, and the
+ > stars [...]\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -6686,32 +6832,32 @@ fortune—often the surfeit of our own behavior—we make guilty of our
disasters the sun, the moon, and the stars […]
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\markdownSetup{
-
- renderers = {\begin{quote}},
- blockQuoteBegin = {\end{quote}},
- blockQuoteEnd = {
- },
- }\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}
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+
+ renderers = {\begin{quote}},
+ blockQuoteBegin = {\end{quote}},
+ blockQuoteEnd = {
+ },
+ }\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:
@@ -6722,27 +6868,27 @@ fortune—often the surfeit of our own behavior—we make guilty of our
disasters the sun, the moon, and the stars […]
-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
+\usemodule[t][markdown]
+\def\markdownRendererBlockQuoteBegin{\startquotation}
+\def\markdownRendererBlockQuoteEnd{\stopquotation}
+\starttext
+\startmarkdown
+
+ A quote from William Shakespeare's King Lear:
+
+ > This is the excellent foppery of the world that when we are
+ > sick in fortune---often the surfeit of our own behavior---we
+ > make guilty of our disasters the sun, the moon, and the
+ > stars [...]\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -6753,9 +6899,10 @@ 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
+2.3.1.3 Bracketed Spans Attribute
+Context Renderers
The following macros are only produced, when the
bracketedSpans
option is enabled.
The \markdownRendererBracketedSpanAttributeContextBegin
@@ -6763,29 +6910,29 @@ 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:
-\documentclass{article}
-\usepackage[bracketedSpans]{markdown}
-\markdownSetup{
-
- renderers = {
- fencedDivAttributeContextBegin = {(},
- fencedDivAttributeContextEnd = {)},
- },
- }\begin{document}
-\begin{markdown}
-
-
- [foo [bar]{#identifier}]{key=value} [baz]{.class_name}
-\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[bracketedSpans]{markdown}
+\markdownSetup{
+
+ renderers = {
+ bracketedSpanAttributeContextBegin = {(},
+ bracketedSpanAttributeContextEnd = {)},
+ },
+ }\begin{document}
+\begin{markdown}
+
+
+ [foo [bar]{#identifier}]{key=value} [baz]{.class_name}
+\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:
@@ -6818,52 +6965,52 @@ receives no arguments.
class="tex">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
+\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
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -6876,61 +7023,61 @@ 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}%
-
- },\begin{itemize}},
- ulBeginTight = {\item},
- ulItem = {
- ulItemEnd = {.},\end{itemize}},
- ulEnd = {
- },
- }
- This is a loose list
-
- - This is the first item
-
- - This is the second item
-
- - This is the third item\end{markdown*}
-
-\end{document}
+\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}%
+
+ },\begin{itemize}},
+ ulBeginTight = {\item},
+ ulItem = {
+ ulItemEnd = {.},\end{itemize}},
+ ulEnd = {
+ },
+ }
+ 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
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -6943,57 +7090,57 @@ 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[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
+\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
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7016,83 +7163,83 @@ 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:
-\documentclass{article}
-\usepackage{verbatim}
-\usepackage[hyphens]{url}
-\usepackage[fencedCode]{markdown}
-\markdownSetup{
-
- renderers = {
- interblockSeparator = {\def\markdownRendererInterblockSeparator{%
- \par
- \def\markdownRendererInterblockSeparator{%
- \def\markdownRendererInterblockSeparator{%
- \par
- %
- }%
- }%
- }
- },
- inputVerbatim = {\url{#1}:%
- is contained in file \verbatiminput{#1}%
-
- },
- inputFencedCode = {\markdownRendererInputVerbatim{#1}%
- in #2
- },
- },
- }\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}
+\documentclass{article}
+\usepackage{verbatim}
+\usepackage[hyphens]{url}
+\usepackage[fencedCode]{markdown}
+\markdownSetup{
+
+ renderers = {
+ interblockSeparator = {\def\markdownRendererInterblockSeparator{%
+ \par
+ \def\markdownRendererInterblockSeparator{%
+ \def\markdownRendererInterblockSeparator{%
+ \par
+ %
+ }%
+ }%
+ }
+ },
+ inputVerbatim = {\url{#1}:%
+ is contained in file \verbatiminput{#1}%
+
+ },
+ inputFencedCode = {\markdownRendererInputVerbatim{#1}%
+ in #2
+ },
+ },
+ }\begin{document}
+\begin{markdown}
+
+ The following code
+
+ def foo(bar):
+ if len(bar) <= 1:
+ return bar[0]
+ elif len(bar) == 2:
+ return sorted(bar)
+ else:
+ baz = len(bar) // 2
+ return foo(bar[baz:], bar[:baz])
+
+ The following code
+
+ ~~~ Python
+ >>> foo([4, 2, 1, 3])
+ [1, 2, 3, 4]
+ ~~~~~~~~~~\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text except for the filename, which may
differ:
The following code is contained in file
./_markdown_document/882453149edcf288976647f6fe147ada.verbatim
:
-def foo(bar):
-if len(bar) <= 1:
- return bar[:1]
- elif len(bar) == 2:
- return sorted(bar)
- else:
- = bar[len(bar) // 2]
- baz return (
- for qux in bar if qux < baz]) + [baz] +
- foo([qux for qux in bar if qux > baz])
- foo([qux )
+def foo(bar):
+if len(bar) <= 1:
+ return bar[:1]
+ elif len(bar) == 2:
+ return sorted(bar)
+ else:
+ = bar[len(bar) // 2]
+ baz return (
+ for qux in bar if qux < baz]) + [baz] +
+ foo([qux for qux in bar if qux > baz])
+ foo([qux )
The following code in Python contained in file
./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim
:
->>> foo([4, 2, 1, 3])
-1, 2, 3, 4] [
+>>> foo([4, 2, 1, 3])
+1, 2, 3, 4] [
2.3.1.6 Code Span Renderer
@@ -7103,27 +7250,27 @@ corresponds to the inline code span.
class="tex">TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-
-\def\markdownRendererCodeSpan#1{#1}
-
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$`
- `
-$\sqrt{-1}$ *equals* $i$
-\markdownEnd
-
-\def\markdownOptionHybrid{true}
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$
-\markdownEnd
-
-\bye
+\input markdown
+\input lmfonts
+
+\def\markdownRendererCodeSpan#1{#1}
+
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$`
+ `
+$\sqrt{-1}$ *equals* $i$
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$
+\markdownEnd
+
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7131,34 +7278,34 @@ contain the following text:
$\sqrt{-1}$ equals $i$.
√-̅1̅ equals i.
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[smartEllipses]{markdown}
-\markdownSetup{
-
- renderers = {
- codeSpan = {#1},
- },
- }\begin{document}
-
-\begin{markdown}
-$\sqrt{-1}$ *equals* $i$`
- `
-$\sqrt{-1}$ *equals* $i$
-\end{markdown}
-
-\begin{markdown*}{hybrid}
-$\sqrt{-1}$ *equals* $i$
-\end{markdown*}
-
-\end{document}
+\documentclass{article}
+\usepackage[smartEllipses]{markdown}
+\markdownSetup{
+
+ renderers = {
+ codeSpan = {#1},
+ },
+ }\begin{document}
+
+\begin{markdown}
+$\sqrt{-1}$ *equals* $i$`
+ `
+$\sqrt{-1}$ *equals* $i$
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7166,30 +7313,30 @@ contain the following text:
$\sqrt{-1}$ equals $i$.
√-̅1̅ equals i.
-ConConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\def\markdownRendererCodeSpan#1{#1}
-\starttext
-
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$`
- `
-$\sqrt{-1}$ *equals* $i$
-\stopmarkdown
-
-\setupmarkdown[hybrid = yes]
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$
-\stopmarkdown
-
-\bye
+\usemodule[t][markdown]
+\def\markdownRendererCodeSpan#1{#1}
+\starttext
+
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$`
+ `
+$\sqrt{-1}$ *equals* $i$
+\stopmarkdown
+
+\setupmarkdown[hybrid = yes]
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$
+\stopmarkdown
+
+\bye
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7242,34 +7389,34 @@ starting point.
class="tex">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{%
-\tt #2}, #4.
- This is {
- }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
-\tt #2}, #4.
- This is the image {
- }\def\markdownRendererContentBlockCode#1#2#3#4#5{%
-\uppercase{#1}) document {\tt #3}, #5.
- This is the #2 (
- }\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{%
+\tt #2}, #4.
+ This is {
+ }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
+\tt #2}, #4.
+ This is the image {
+ }\def\markdownRendererContentBlockCode#1#2#3#4#5{%
+\uppercase{#1}) document {\tt #3}, #5.
+ This is the #2 (
+ }\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:
@@ -7281,38 +7428,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 = {\texttt{#2}, #4.},
- contentBlock = {This is \texttt{#2}, #4.},
- contentBlockOnlineImage = {This is the image %
- contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5.
- This is the #2 (
- },
- },
- }\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 = {\texttt{#2}, #4.},
+ contentBlock = {This is \texttt{#2}, #4.},
+ contentBlockOnlineImage = {This is the image %
+ contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5.
+ This is the #2 (
+ },
+ },
+ }\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:
@@ -7324,39 +7471,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{%
-\tt #2}, #4.
- This is {
- }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
-\tt #2}, #4.
- This is the image {
- }\def\markdownRendererContentBlockCode#1#2#3#4#5{%
-\uppercase{#1}) document {\tt #3}, #5.
- This is the #2 (
- }\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{%
+\tt #2}, #4.
+ This is {
+ }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{%
+\tt #2}, #4.
+ This is the image {
+ }\def\markdownRendererContentBlockCode#1#2#3#4#5{%
+\uppercase{#1}) document {\tt #3}, #5.
+ This is the #2 (
+ }\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:
@@ -7405,88 +7552,88 @@ receives no arguments.
class="tex">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:
@@ -7508,94 +7655,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}%
-
- },\begin{description}},
- dlBeginTight = {%
- dlItem = {\item[#1]
- \begin{itemize}
- \def\markdownRendererDlDefinitionEnd{%
-
- ,\def\markdownRendererDlDefinitionEnd{%
-
- , and\def\markdownRendererDlDefinitionEnd{.}%
- %
- }%
- }
- },\end{itemize}},
- dlItemEnd = {\item,
- dlDefinitionBegin = \end{description}},
- dlEndTight = {
- },
- }
- 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}%
+
+ },\begin{description}},
+ dlBeginTight = {%
+ dlItem = {\item[#1]
+ \begin{itemize}
+ \def\markdownRendererDlDefinitionEnd{%
+
+ ,\def\markdownRendererDlDefinitionEnd{%
+
+ , and\def\markdownRendererDlDefinitionEnd{.}%
+ %
+ }%
+ }
+ },\end{itemize}},
+ dlItemEnd = {\item,
+ dlDefinitionBegin = \end{description}},
+ dlEndTight = {
+ },
+ }
+ 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:
@@ -7617,94 +7764,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
+\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
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7736,63 +7883,63 @@ enabled. The macro receives no arguments.
class="tex">TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownOptionSmartEllipses{true}
-\def\markdownRendererEllipsis{{\it SHAZAM}!}
-\markdownBegin
-
- The secret word is ...\markdownEnd
-\bye
+\input markdown
+\def\markdownOptionSmartEllipses{true}
+\def\markdownRendererEllipsis{{\it SHAZAM}!}
+\markdownBegin
+
+ The secret word is ...\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
The secret word is SHAZAM!
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[smartEllipses]{markdown}
-\markdownSetup{
-
- renderers = {\emph{SHAZAM}!,
- ellipsis =
- },
- }\begin{document}
-\begin{markdown}
-
- The secret word is ...\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[smartEllipses]{markdown}
+\markdownSetup{
+
+ renderers = {\emph{SHAZAM}!,
+ ellipsis =
+ },
+ }\begin{document}
+\begin{markdown}
+
+ The secret word is ...\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
The secret word is SHAZAM!
-ConConTeXt 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
+\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
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7809,72 +7956,72 @@ corresponds to the emphasized span of text.
class="tex">TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownRendererEmphasis#1{{\it#1}}
-\def\markdownRendererStrongEmphasis#1{{\bf#1}}
-\markdownBegin
-
- This is *emphasis*.
-
- This is **strong emphasis**.\markdownEnd
-\bye
+\input markdown
+\def\markdownRendererEmphasis#1{{\it#1}}
+\def\markdownRendererStrongEmphasis#1{{\bf#1}}
+\markdownBegin
+
+ This is *emphasis*.
+
+ This is **strong emphasis**.\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
This is emphasis.
This is strong emphasis.
-LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\markdownSetup{
-
- renderers = {\emph{#1}},
- emphasis = {\textbf{#1}},
- strongEmphasis = {
- },
- }\begin{document}
-\begin{markdown}
-
- This is *emphasis*.
-
- This is **strong emphasis**.\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage{markdown}
+\markdownSetup{
+
+ renderers = {\emph{#1}},
+ emphasis = {\textbf{#1}},
+ strongEmphasis = {
+ },
+ }\begin{document}
+\begin{markdown}
+
+ This is *emphasis*.
+
+ This is **strong emphasis**.\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
This is emphasis.
This is strong emphasis.
-ConConTeXt 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:
@@ -7884,62 +8031,120 @@ 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.11 Fenced Div Context
-Renderers
+2.3.1.11 Fenced Code Attribute
+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.
-fencedCode
option is enabled.
+The \markdownRendererFencedCodeAttributeContextBegin
and
+\markdownRendererFencedCodeAttributeContextEnd
macros
+represent the beginning and the end of a context in which the attributes
+of a fenced code 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[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}
+\documentclass{article}
+\usepackage[fencedCode,
+markdown}
+ fencedCodeAttributes]{\usepackage{minted}
+\markdownSetup{
+
+ renderers = {%
+ fencedCodeAttributeContextBegin = {\begingroup
+ \markdownSetup{
+
+ renderers = {%
+ attributeKeyValue = {\setminted{{#1} = {#2}}%
+
+ },
+ },%
+ }
+ },%
+ fencedCodeAttributeContextEnd = {\endgroup
+
+ },
+ },
+ }\begin{document}
+\begin{markdown}
+
+ ``` js {linenos=true}
+ if (a > 3) {
+ moveShip(5 * gravity, DOWN); }
+\end{markdown} \end{document}
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex --shell-escape document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> ``` js {.linenos}
+> 1. if (a > 3) {
+> 2. moveShip(5 * gravity, DOWN);
+> 3. }
+> ``````
+
+
+#### Fenced Div Attribute 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.
+
+
+##### <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[fencedDivs]{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:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -7962,41 +8167,41 @@ Renderers
\markdownRendererHeaderAttributeContextEnd
macros represent
the beginning and the end of a section in which the attributes of a
heading apply. The macros receive no arguments.
-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}
\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
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -8032,91 +8237,91 @@ the heading text. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\input markdown -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\markdownBegin - - ###### - ##### - ##### - ### - ######\markdownEnd -\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.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:
+luatex document.tex
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 = { - interblockSeparator = {}, - headingOne = 1, - headingTwo = 2, - headingThree = 3, - headingFour = 4, - headingFive = 5, - headingSix = 6, - }, - }\begin{document} -\begin{markdown} - - ###### - ##### - ##### - ### - ######\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {}, + headingOne = 1, + headingTwo = 2, + headingThree = 3, + headingFour = 4, + headingFive = 5, + headingSix = 6, + }, + }\begin{document} +\begin{markdown} + + ###### + ##### + ##### + ### + ######\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-65536
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\starttext -\startmarkdown - - ###### - ##### - ##### - ### - ######\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\starttext +\startmarkdown + + ###### + ##### + ##### + ### + ######\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8134,40 +8339,40 @@ contents of the HTML comment.\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 = {\marginnote{#1}}, - inlineHtmlComment = {\begin{quote}}, - blockHtmlCommentBegin = {\end{quote}}, - blockHtmlCommentEnd = { - }, - }\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}
\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\markdownSetup{ + + renderers = {\marginnote{#1}}, + inlineHtmlComment = {\begin{quote}}, + blockHtmlCommentBegin = {\end{quote}}, + blockHtmlCommentEnd = { + }, + }\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 +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -8198,32 +8403,32 @@ represents a block HTML element. This macro will only be produced, when thehtml
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:+\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\usepackage{verbatim} -\markdownSetup{ - - renderers = {\textbf{#1}}, - inlineHtmlTag = {\verbatiminput{#1}}, - inputBlockHtmlElement = { - }, - }\begin{document} -\begin{markdown} - - <b>_Hello,_ world!</b><br/> - - <div>_Hello,_ world!</div>\end{markdown} -\end{document}
\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\usepackage{verbatim} +\markdownSetup{ + + renderers = {\textbf{#1}}, + inlineHtmlTag = {\verbatiminput{#1}}, + inputBlockHtmlElement = { + }, + }\begin{document} +\begin{markdown} + + <b>_Hello,_ world!</b><br/> + + <div>_Hello,_ world!</div>\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -8236,48 +8441,48 @@ class="header-section-number">2.3.1.16 Image Renderer 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:-\documentclass{article} -\usepackage{markdown} -\begingroup -\catcode`\@=11 -\catcode`\%=12 -\catcode`\^^A=14 -\global\def\markdownRendererImage#1#2#3#4{^^A -\immediate\write18{^^A
-if printf '%s' "#3" | grep -q ^http; then - OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A - $(printf '%s' "#3" | sed 's/.*[.]//')"; -if ! [ -e "$OUTPUT" ]; then - wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; - convert "$OUTPUT" png:"$OUTPUT"; - fi; - printf '%s%%' "$OUTPUT" > \jobname.fetched; - else - printf '%s%%' "#3" > \jobname.fetched; - fi^^A
-- }^^A - {^^A\everyeof={\noexpand}^^A - \edef\filename{\__markdowninput"\jobname.fetched" }^^A - \includegraphics[width=\textwidth]{\filename}^^A - - }^^A - }\endgroup -\begin{document} -\begin{markdown} - - ![TUGboat](https://tug.org/tugboat/noword.jpg)\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
+\documentclass{article} +\usepackage{markdown} +\begingroup +\catcode`\@=11 +\catcode`\%=12 +\catcode`\^^A=14 +\global\def\markdownRendererImage#1#2#3#4{^^A +\immediate\write18{^^A
+if printf '%s' "#3" | grep -q ^http; then + OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A + $(printf '%s' "#3" | sed 's/.*[.]//')"; +if ! [ -e "$OUTPUT" ]; then + wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; + convert "$OUTPUT" png:"$OUTPUT"; + fi; + printf '%s%%' "$OUTPUT" > \jobname.fetched; + else + printf '%s%%' "#3" > \jobname.fetched; + fi^^A
++ }^^A + {^^A\everyeof={\noexpand}^^A + \edef\filename{\__markdowninput"\jobname.fetched" }^^A + \includegraphics[width=\textwidth]{\filename}^^A + + }^^A + }\endgroup +\begin{document} +\begin{markdown} + + ![TUGboat](https://tug.org/tugboat/noword.jpg)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex --shell-escape document.tex
A PDF document named
class="tex">TeX Exampledocument.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 @@ -8302,22 +8507,22 @@ receives no arguments.Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererInterblockSeparator{% -\par - \it(The end of a block)}% - {\par - - }\markdownBegin - - Hello *world*! - - _Foo_ bar!\markdownEnd -\bye
\input markdown +\def\markdownRendererInterblockSeparator{% +\par + \it(The end of a block)}% + {\par + + }\markdownBegin + + Hello *world*! + + _Foo_ bar!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8325,32 +8530,32 @@ contain the following text:-(The end of a block)
Foo bar!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - interblockSeparator = {\par - \emph{(The end of a block)}% - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - _Foo_ bar!\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + interblockSeparator = {\par + \emph{(The end of a block)}% + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + _Foo_ bar!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8358,27 +8563,27 @@ contain the following text:-(The end of a block)
Foo bar!
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{% -\par - \emph{(The end of a block)}% - \par - - }\starttext -\startmarkdown - - Hello *world*! - - _Foo_ bar!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{% +\par + \emph{(The end of a block)}% + \par + + }\starttext +\startmarkdown + + Hello *world*! + + _Foo_ bar!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8386,23 +8591,108 @@ contain the following text:-(The end of a block)
Foo bar!
2.3.1.18 Line Break Renderer
+2.3.1.18 Line Block Renderer
+The following macros are only produced, when the +
+lineBlocks
option is enabled.The
+\markdownRendererLineBlockBegin
and +\markdownRendererLineBlockEnd
macros represent the +beginning and the end of a line block. The macros receive no +arguments.Plain TeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown +\def\markdownOptionLineBlocks{true} +\markdownBegin + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\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:++I would spread the cloths under your feet:+
+But I, being poor, have only my dreams;
+I have spread my dreams under your feet;
+Tread softly because you tread on my dreams.LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\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:++I would spread the cloths under your feet:+
+But I, being poor, have only my dreams;
+I have spread my dreams under your feet;
+Tread softly because you tread on my dreams.ConTeXt Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\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:++I would spread the cloths under your feet:+
+But I, being poor, have only my dreams;
+I have spread my dreams under your feet;
+Tread softly because you tread on my dreams.2.3.1.19 Line Break Renderer
The
-\markdownRendererLineBreak
macro represents a forced line break. 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\markdownRendererLineBreak{% -\par - \it(A forced linebreak)}% - {\par - - }\markdownInput{example.md} -\bye
\input markdown +\def\markdownRendererLineBreak{% +\par + \it(A forced linebreak)}% + {\par + + }\markdownInput{example.md} +\bye
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the @@ -8411,8 +8701,8 @@ processor, hard linebreaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8420,25 +8710,25 @@ contain the following text:-(A forced linebreak)
Foo bar!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - lineBreak = {\par - \emph{(A forced linebreak)}% - \par - - }, - }, - }\begin{document} -\markdownInput{example.md} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + lineBreak = {\par + \emph{(A forced linebreak)}% + \par + + }, + }, + }\begin{document} +\markdownInput{example.md} +\end{document}
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the @@ -8447,8 +8737,8 @@ processor, hard linebreaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8456,20 +8746,20 @@ contain the following text:-(A forced linebreak)
Foo bar!
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererLineBreak{% -\par - \emph{(A forced linebreak)}% - \par - - }\starttext -\markdownInput{example.md} -\stoptext
\usemodule[t][markdown] +\def\markdownRendererLineBreak{% +\par + \emph{(A forced linebreak)}% + \par + + }\starttext +\markdownInput{example.md} +\stoptext
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the @@ -8478,8 +8768,8 @@ processor, hard linebreaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8487,31 +8777,31 @@ contain the following text:-(A forced linebreak)
Foo bar!
2.3.1.19 Link Renderer
+2.3.1.20 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 Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled {\it#4}% - #1 { - }\markdownBegin - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\markdownEnd -\bye
\input markdown +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled {\it#4}% + #1 { + }\markdownBegin + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8519,31 +8809,31 @@ contain the following text: class="uri">https://ctan.org/ titled the Comprehensive TeX Archive Network.-LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - link = {\texttt{#2} titled \emph{#4}% - #1 - }, - }, - }\begin{document} -\begin{markdown} - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + link = {\texttt{#2} titled \emph{#4}% + #1 + }, + }, + }\begin{document} +\begin{markdown} + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8551,26 +8841,26 @@ contain the following text: class="uri">https://ctan.org/ titled the Comprehensive TeX Archive Network.-ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled \emph{#4}% - #1 { - }\starttext -\startmarkdown - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled \emph{#4}% + #1 { + }\starttext +\startmarkdown + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8578,8 +8868,8 @@ contain the following text: class="uri">https://ctan.org/ titled the Comprehensive TeX Archive Network.-2.3.1.20 Markdown Document +
2.3.1.21 Markdown Document Renderers
The
-\markdownRendererDocumentBegin
and\markdownRendererDocumentEnd
macros represent the beginning @@ -8590,81 +8880,81 @@ 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.
This is a *nested* markdown document.
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {% - contentBlock = {\markdownInput{#3}% - - },% - documentBegin = {\par - \emph{(The beginning of a document)} - \par - \begingroup - \markdownSetup{snippet=first-nesting-level}% - - },% - documentEnd = {\endgroup - \par - \emph{(The end of a document)} - \par - - }, - }, - }\markdownSetupSnippet{first-nesting-level}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - \markdownSetup{snippet=second-nesting-level-and-below} - - }, - }, - }\markdownSetupSnippet{second-nesting-level-and-below}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - - }, - documentEnd = {\endgroup - \par - \emph{(The end of a nested document)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - /nested.md - - _Foo_ bar!\end{markdown} -\begin{markdown} - - - Bar baz! -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {% + contentBlock = {\markdownInput{#3}% + + },% + documentBegin = {\par + \emph{(The beginning of a document)} + \par + \begingroup + \markdownSetup{snippet=first-nesting-level}% + + },% + documentEnd = {\endgroup + \par + \emph{(The end of a document)} + \par + + }, + }, + }\markdownSetupSnippet{first-nesting-level}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + \markdownSetup{snippet=second-nesting-level-and-below} + + }, + }, + }\markdownSetupSnippet{second-nesting-level-and-below}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + + }, + documentEnd = {\endgroup + \par + \emph{(The end of a nested document)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + /nested.md + + _Foo_ bar!\end{markdown} +\begin{markdown} + + + Bar baz! +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8679,51 +8969,51 @@ contain the following text:-Bar baz!
(The end of a document)
2.3.1.21 Non-Breaking Space +
2.3.1.22 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" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[ - - citations, - citationNbsps,markdown} - ]{\markdownSetup{ - - renderers = {$\cdot$}, - nbsp = { - }, - }\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} - -\bibliographystyle{plain} -\bibliography{document.bib} - -\end{document}
\documentclass{article} +\usepackage[ + + citations, + citationNbsps,markdown} + ]{\markdownSetup{ + + renderers = {$\cdot$}, + nbsp = { + }, + }\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} + +\bibliographystyle{plain} +\bibliography{document.bib} + +\end{document}
Next, invoke LuaTeX and BibTeX from the terminal:
-+lualatex document.tex -bibtex document.aux -lualatex document.tex -lualatex document.tex
lualatex document.tex +bibtex document.aux +lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8734,95 +9024,95 @@ 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.-2.3.1.22 Note Renderer
+2.3.1.23 Note Renderer
The
-\markdownRendererNote
macro represents a note. This macro will only be produced, when thenotes
option is enabled. The macro receives a single argument that corresponds to the note text.Plain 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
\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
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a 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[notes]{markdown} -\markdownSetup{ - - renderers = {\MakeLowercase{#1})}, - note = { (and - }, - }\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}
\documentclass{article} +\usepackage[notes]{markdown} +\markdownSetup{ + + renderers = {\MakeLowercase{#1})}, + note = { (and + }, + }\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}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a note) and this is some other text (and this is some other note).
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
\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
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a note) and this is some other text (and this is some other note).
2.3.1.23 Ordered List +
2.3.1.24 Ordered List Renderers
The
-\markdownRendererOlBegin
macro represents the beginning of an ordered list that contains an item with several @@ -8906,74 +9196,74 @@ paragraphs of text (the list is tight). This macro will only be produced, when thefancyLists
andtightLists
options are enabled. 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\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{% -\kern 0.5em% - #1. - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{} - -\markdownBegin - - This is a loose list - - 1. item - - 2. item - - 3. item\markdownEnd - -\bye
\input markdown +\def\markdownOptionTightLists{true} +\def\markdownOptionStartNumber{true} + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\markdownBegin + + This is a tight list + + 1. item + 2. item + 3. item\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{} +\def\markdownRendererOlItemWithNumber#1{% +\kern 0.5em% + #1. + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{} + +\markdownBegin + + This is a loose list + + 1. item + + 2. item + + 3. item\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8986,77 +9276,77 @@ 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}% - - },\begin{enumerate}}, - olBeginTight = {% - olItemWithNumber = {\item This is the - \ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }, - olItemEnd = {.},\end{enumerate}}, - olEnd = { - }, - } - This is a loose list - - 1. item - - 2. item - - 3. item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists, startNumber]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + olBeginTight = { (},% + olItemWithNumber = {\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }, + olItemEnd = {}, + olEndTight = {).}, + }, + } + This is a tight list + + 1. item + 2. item + 3. item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{enumerate}}, + olBeginTight = {% + olItemWithNumber = {\item This is the + \ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }, + olItemEnd = {.},\end{enumerate}}, + olEnd = { + }, + } + This is a loose list + + 1. item + + 2. item + + 3. item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9069,78 +9359,78 @@ 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 - - [ - 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
\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
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9153,8 +9443,8 @@ item).-This is the third item.
2.3.1.24 Parenthesized Citations +
2.3.1.25 Parenthesized Citations Renderer
The
-\markdownRendererCite
macro represents a string of one or more parenthetical citations. This macro will only be produced, @@ -9165,54 +9455,54 @@ 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:+\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a parenthesized citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \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}
\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a parenthesized citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \ifx\relax#3\relax\else + \ and a postfix \emph{#3}% + \fi + \fi + \ifnum\citationsCounter>\citationsTotal\relax + % + .\expandafter\@gobble + \else + + , and\fi\citations} + \makeatother +\markdownSetup{ + + renderers = {% + cite = {\citationsCounter=1% + \citationsTotal=#1% + + This is\expandafter\citations + + }, + }, + }\begin{document} +\begin{markdown} + + [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9220,8 +9510,8 @@ contain the following text: see and a postfix pp. 12, and a citation eijkhout91 with a postfix pp. 34.-2.3.1.25 Raw Content Renderers
+2.3.1.26 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 @@ -9234,52 +9524,58 @@ contaning the raw block and the raw attribute that designates the format of the raw block. This macro will only be produced, when therawAttribute
andfencedCode
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 = {\display_raw_content:nn { #1 } { #2 } }, - rawInline = { \display_raw_content:nn { #1 } { #2 } } - rawBlock = { - }, - }\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}
\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 = {\display_raw_content:nn { #1 } { #2 } }, + rawInline = { \display_raw_content:nn { #1 } { #2 } } + rawBlock = { + }, + }\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
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 +
2.3.1.27 Replacement Character +Renderers
+The
+\markdownRendererReplacementCharacter
macro +represents the U+0000 and U+FFFD Unicode characters. The macro receives +no arguments.2.3.1.28 Special Character Renderers
The following macros replace any special plain TeX characters, including the active pipe @@ -9309,306 +9605,306 @@ class="tex">TeXt, in the input text:
- \markdownRendererUnderscore
replaces the underscore (_
).Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\input markdown -\def\markdownRendererTilde{~} -\markdownBegin - - Bartel~Leendert van~der~Waerden\markdownEnd -\bye
\input markdown +\def\markdownRendererTilde{~} +\markdownBegin + + Bartel~Leendert van~der~Waerden\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, 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.+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - tilde = ~, - }, - }\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + tilde = ~, + }, + }\begin{document} +\begin{markdown} + + Bartel~Leendert van~der~Waerden\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
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
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\usemodule[t][markdown] -\def\markdownRendererTilde{~} -\starttext -\startmarkdown - - Bartel~Leendert van~der~Waerden\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTilde{~} +\starttext +\startmarkdown + + Bartel~Leendert van~der~Waerden\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, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
2.3.1.27 Strike-Through +
2.3.1.29 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 thestrikeThrough
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\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
\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:
-+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 vehiclestrike-through text.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\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 lunar roving vehiclestrike-through text.ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\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:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.2.3.1.28 Subscript Renderer
+2.3.1.30 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 thesubscripts
option is enabled.Plain 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\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
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}
\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
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.
ConConTeXt 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
\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
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
+2.3.1.31 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 thesuperscripts
option is enabled.Plain 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
\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
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
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}
\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:-2 taken to the power of 10 is 1024.
ConConTeXt 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[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
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.30 Table Renderer
+2.3.1.32 Table Renderer
The
\markdownRendererTable
macro represents a table. This macro will only be produced, when thepipeTables
option is enabled. The macro @@ -9629,71 +9925,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 - \the\rowCounter, - In row \fi - \processColumn#1 - \advance\rowCounter by 1\relax - \ifnum\rowCounter>\rowTotal\relax - \expandafter\@gobble - \fi\processRow}% - \def\processColumn#1{% -\the\columnCounter{} - column number \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 - \emph{#1}% - says \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 = {\emph{#1} that is #3 colums wide - This is a table with caption - 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 + \the\rowCounter, + In row \fi + \processColumn#1 + \advance\rowCounter by 1\relax + \ifnum\rowCounter>\rowTotal\relax + \expandafter\@gobble + \fi\processRow}% + \def\processColumn#1{% +\the\columnCounter{} + column number \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 + \emph{#1}% + says \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 = {\emph{#1} that is #3 colums wide + This is a table with caption + 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:@@ -9711,62 +10007,62 @@ 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.31 Text Citations +
2.3.1.33 Text Citations Renderer
The
-\markdownRendererTextCite
macro represents a string of one or more text citations. This macro will only be produced, when thecitations
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{% -\emph{#4} - a text citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \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[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a text citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \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:@@ -9774,29 +10070,29 @@ contain the following text: pp. 12, and a citation eijkhout91 with a prefix also.-2.3.1.32 Thematic Break +
2.3.1.34 Thematic Break Renderer
The
-\markdownRendererThematicBreak
macro represents a thematic break. 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\markdownRendererThematicBreak{\vfil\break} -\markdownBegin - - This is the first page. - - *** - - This is the second page.\markdownEnd -\bye
\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:@@ -9804,30 +10100,30 @@ contain the following text:-
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 = {\newpage, - thematicBreak = - }, - }\begin{document} -\begin{markdown} - - This is the first page. - - *** - - This is the second page.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\newpage, + thematicBreak = + }, + }\begin{document} +\begin{markdown} + + This is the first page. + + *** + + This is the second page.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9835,25 +10131,25 @@ contain the following text:-
This is the second page.
ConConTeXt Example
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
\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:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9861,8 +10157,8 @@ contain the following text:-
This is the second page.
2.3.1.33 Tickbox Renderers
+2.3.1.35 Tickbox Renderers
The macros named
-\markdownRendererTickedBox
,\markdownRendererHalfTickedBox
, and\markdownRendererUntickedBox
represent ticked and unticked @@ -9871,28 +10167,28 @@ boxes, respectively. These macros will either be produced, 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[taskLists]{markdown} -\markdownSetup{ - - renderers = { - untickedBox = No, - tickedBox = Yes, - }, - }\begin{document} -\begin{markdown} - - - [ ] you can't. - - [x] I can!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[taskLists]{markdown} +\markdownSetup{ + + renderers = { + untickedBox = No, + tickedBox = Yes, + }, + }\begin{document} +\begin{markdown} + + - [ ] you can't. + - [x] I can!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9901,24 +10197,24 @@ contain the following text:-Yes I can! ConConTeXt 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
\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:@@ -9927,8 +10223,8 @@ contain the following text:-Yes I can! 2.3.1.34 YAML Metadata +
2.3.1.36 YAML Metadata Renderers
The
-\markdownRendererJekyllDataBegin
macro represents the beginning of a yaml document. This macro will only be @@ -9986,88 +10282,88 @@ be produced when thejekyllData
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\markdownOptionJekyllData{true} -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\input markdown +\def\markdownOptionJekyllData{true} +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - renderers = {\gdef\name{#2}}, - jekyllDataString = {\gdef\age{#2}}, - jekyllDataNumber = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + renderers = {\gdef\name{#2}}, + jekyllDataString = {\gdef\age{#2}}, + jekyllDataNumber = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:-\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:
-+context document.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:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10079,93 +10375,93 @@ PrototypesBy default, token renderers point to package-defined TeX macros, further referred to as prototypes, which provide useful default definitions.
-Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\markdownBegin - - ~\markdownEnd - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\markdownBegin - - ~\markdownEnd -\bye
\input markdown +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\markdownBegin + + ~\markdownEnd + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\markdownBegin + + ~\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Packages can specify token renderer prototypes.
User-defined token renderers take precedence.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - rendererPrototypes = { - tilde = {Packages can specify token renderer prototypes.}, - }, - }\begin{document} -\begin{markdown} - - ~\end{markdown} - -\begin{markdown*}{ - - renderers = { - tilde = {User-defined token renderers take precedence.}, - }, - } - ~\end{markdown*} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + rendererPrototypes = { + tilde = {Packages can specify token renderer prototypes.}, + }, + }\begin{document} +\begin{markdown} + + ~\end{markdown} + +\begin{markdown*}{ + + renderers = { + tilde = {User-defined token renderers take precedence.}, + }, + } + ~\end{markdown*} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Packages can specify token renderer prototypes.
User-defined token renderers take precedence.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\starttext -\startmarkdown - - ~\stopmarkdown - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\startmarkdown - - ~\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\starttext +\startmarkdown + + ~\stopmarkdown + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\startmarkdown + + ~\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10179,102 +10475,102 @@ Prototypes high-level interface that can be programmed using themarkdown/jekyllData
key–values from the l3keys module of the LaTeX3 kernel. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\input markdown -\def\markdownOptionJekyllData{true} -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\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
+\input markdown +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\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 = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\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 } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\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
+\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\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:diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf index e213c16aa06..f2bf87e5288 100644 Binary files a/Master/texmf-dist/doc/generic/markdown/markdown.pdf and b/Master/texmf-dist/doc/generic/markdown/markdown.pdf differ diff --git a/Master/texmf-dist/doc/latex/markdown/examples/example.md b/Master/texmf-dist/doc/latex/markdown/examples/example.md index f697bcff579..16d32368d92 100644 --- a/Master/texmf-dist/doc/latex/markdown/examples/example.md +++ b/Master/texmf-dist/doc/latex/markdown/examples/example.md @@ -171,3 +171,9 @@ This is raw `\TeX`{=tex} code: ``` {=tex} $$ x^n + y^n = z^n $$ ``` + +| this is a line block that +| spans multiple +| even + discontinuous +| lines diff --git a/Master/texmf-dist/doc/latex/markdown/examples/latex.tex b/Master/texmf-dist/doc/latex/markdown/examples/latex.tex index c14bc4bd474..a37b9049e2c 100644 --- a/Master/texmf-dist/doc/latex/markdown/examples/latex.tex +++ b/Master/texmf-dist/doc/latex/markdown/examples/latex.tex @@ -24,6 +24,7 @@ hashEnumerators, inlineNotes, jekyllData, + lineBlocks, notes, pipeTables, rawAttribute, diff --git a/Master/texmf-dist/scripts/markdown/markdown-cli.lua b/Master/texmf-dist/scripts/markdown/markdown-cli.lua index e406d0665d5..bfbad77b2ad 100644 --- a/Master/texmf-dist/scripts/markdown/markdown-cli.lua +++ b/Master/texmf-dist/scripts/markdown/markdown-cli.lua @@ -58,7 +58,7 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.19.0-0-g80fcf20", + version = "2.20.0-0-gf64ade1", comment = "A module for the conversion from markdown to plain TeX", author = "John MacFarlane, Hans Hagen, Vít Novotný", copyright = {"2009-2016 John MacFarlane, Hans Hagen", @@ -88,6 +88,7 @@ defaultOptions.expectJekyllData = false defaultOptions.extensions = {} defaultOptions.fancyLists = false defaultOptions.fencedCode = false +defaultOptions.fencedCodeAttributes = false defaultOptions.fencedDivs = false defaultOptions.finalizeCache = false defaultOptions.frozenCacheCounter = 0 @@ -99,6 +100,7 @@ defaultOptions.hybrid = false defaultOptions.inlineFootnotes = false defaultOptions.inlineNotes = false defaultOptions.jekyllData = false +defaultOptions.lineBlocks = false defaultOptions.footnotes = false defaultOptions.notes = false defaultOptions.pipeTables = false @@ -247,7 +249,7 @@ if metadata.version ~= md.metadata.version then "markdown.lua " .. md.metadata.version .. ".") end local convert = md.new(options) -local output = convert(input:gsub("\r\n?", "\n") .. "\n") +local output = convert(input) if output_filename then local output_file = assert(io.open(output_filename, "w"), diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx index 5b3f73cb8e2..1a391e223fe 100644 --- a/Master/texmf-dist/source/generic/markdown/markdown.dtx +++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx @@ -275,6 +275,15 @@ pre { white-space: pre; white-space: pre-wrap; word-wrap: break-word; + counter-reset: line; +} + +.sourceCode.linenos > span { + counter-increment: line; +} + +.sourceCode.linenos > span:before{ + content: counter(line) " "; } b, strong { @@ -1213,7 +1222,8 @@ local md5 = require("md5") % %: A package that provides the `compactitem`, `compactenum`, and % `compactdesc` macros for the typesetting of tight bulleted lists, -% ordered lists, and definition lists. +% ordered lists, and definition lists as well as the rendering of +% fancy lists. % % \pkg{ifthen} % @@ -1263,13 +1273,24 @@ local md5 = require("md5") %: A package that is used to polyfill the general hook management system in % the default renderer prototypes for \acro{yaml} metadata, see Section % <#sec:latexyamlmetadata>, and also in the default renderer prototype -% for attribute identifiers. +% for identifier attributes. % % \pkg{soulutf8} % %: A package that is used in the default renderer prototype for % strike-throughs. % +% \pkg{ltxcmds} +% +%: A package that is used to detect whether the \pkg{minted} and +% \pkg{listings} packages are loaded in the default renderer prototype +% for fenced code blocks. +% +% \pkg{verse} +% +%: A package that is used in the default renderer prototypes for +% line blocks. +% % \end{markdown} % \begin{macrocode} \RequirePackage{expl3} @@ -1312,7 +1333,7 @@ local md5 = require("md5") % Extensive user documentation for the Markdown package was kindly written by % Lian Tze Lim and published by Overleaf. % -% Funding by the the Faculty of Informatics at the Masaryk~University +% Funding by the Faculty of Informatics at the Masaryk~University % in~Brno~[@novotny15] is gratefully acknowledged. % % Support for content slicing (Lua options \Opt{shiftHeadings} and \Opt{slice}) @@ -3290,6 +3311,7 @@ following content: \begin{markdown} A paragraph. + ::: {.identifier} A fenced div. ::: @@ -3297,9 +3319,10 @@ A fenced div. \begin{markdown*}{blankBeforeDivFence} A paragraph. -``` + +::: {.identifier} Not a fenced div. -``` +::: \end{markdown*} \end{document} @@ -3315,7 +3338,9 @@ following text: > > A fenced div. > -> A paragraph. ::: {.identifier} Not a fenced div. ::: +> A paragraph. +> +> ::: {.identifier} Not a fenced div. ::: % %<*tex> @@ -3612,10 +3637,10 @@ following content: renderers = { attributeKeyValue = { \str_if_eq:nnT - { #1 } + { ##1 } { color } { - \color_select:n { #2 } + \color_select:n { ##2 } } }, }, @@ -3636,12 +3661,12 @@ Here is some [colored text]{color=red}. ``````` Next, invoke LuaTeX from the terminal: ``` sh -lualatex --shell-escape document.tex +lualatex document.tex `````` A PDF document named `document.pdf` should be produced and contain the following text: -> Here is some [colored text]{color=red}. +> Here is some colored text. % %<*tex> @@ -5409,30 +5434,30 @@ defaultOptions.fencedCode = false % %<*manual-options> -#### Option `fencedDivs` +#### Option `fencedCodeAttributes` -`fencedDivs` (default value: `false`) +`fencedCodeAttributes` (default value: `false`) % \fi % \begin{markdown} % -% \Optitem[false]{fencedDivs}{\opt{true}, \opt{false}} +% \Optitem[false]{fencedCodeAttributes}{\opt{true}, \opt{false}} % : true - : Enable the Pandoc fenced divs extension: - - ``` md - ::::: {#special .sidebar} - Here is a paragraph. + : Enable the Pandoc fenced code attribute extension: - And another. - ::::: - `````` + ```````` md + ~~~~ {#mycode .haskell .numberLines startFrom="100"} + qsort [] = [] + qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ``````````` : false - : Disable the Pandoc fenced divs extension: + : Disable the Pandoc fenced code attribute extension. % \end{markdown} % \iffalse @@ -5443,16 +5468,33 @@ Using a text editor, create a text document named `document.tex` with the following content: ```` tex \documentclass{article} -\usepackage[fencedDivs]{markdown} +\usepackage[fencedCode, + fencedCodeAttributes]{markdown} +\usepackage{minted} +\markdownSetup{ + renderers = { + fencedCodeAttributeContextBegin = {% + \begingroup + \markdownSetup{ + renderers = { + attributeKeyValue = {% + \setminted{{#1} = {#2}}% + }, + }, + }% + }, + fencedCodeAttributeContextEnd = {% + \endgroup + }, + }, +} \begin{document} -\begin{markdown}{slice=special} -Here is a regular paragraph. - -::::: {#special} -Here is a special paragraph. -::::: - -And here is another regular paragraph. +\begin{markdown} +``` js {linenos=true} +if (a > 3) { + moveShip(5 * gravity, DOWN); +} +`````` \end{markdown} \end{document} ``````` @@ -5463,8 +5505,60 @@ lualatex --shell-escape document.tex A PDF document named `document.pdf` should be produced and contain the following text: -> Here is a special paragraph. +> ``` js {.linenos} +> 1. if (a > 3) { +> 2. moveShip(5 * gravity, DOWN); +> 3. } +> `````` + +% +%<*tex> +% \fi +% \begin{macrocode} +\@@_add_lua_option:nnn + { fencedCodeAttributes } + { boolean } + { false } +% \end{macrocode} +% \iffalse +% +%<*lua,lua-cli> +% \fi +% \begin{macrocode} +defaultOptions.fencedCodeAttributes = false +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> + +#### Option `fencedDivs` + +`fencedDivs` (default value: `false`) + +% \fi +% \begin{markdown} +% +% \Optitem[false]{fencedDivs}{\opt{true}, \opt{false}} +% +: true + + : 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 % %<*tex> % \fi @@ -6726,6 +6820,138 @@ defaultOptions.jekyllData = false % %<*manual-options> +#### Option `lineBlocks` + +`lineBlocks` (default value: `false`) + +% \fi +% \begin{markdown} +% +% \Optitem[false]{lineBlocks}{\opt{true}, \opt{false}} +% +: true + + : Enable the Pandoc line block syntax extension. + + ``` md + | this is a line block that + | spans multiple + | even + discontinuous + | lines + `````` + +: false + + : Disable the Pandoc line block syntax extension. + +% \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\markdownOptionLineBlocks{true} +\markdownBegin +| I would spread the cloths under your feet: +| But I, being poor, have only my dreams; +| I have spread my dreams under your feet; +| Tread softly because you tread on my dreams. +\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: + +> | I would spread the cloths under your feet: +> | But I, being poor, have only my dreams; +> | I have spread my dreams under your feet; +> | Tread softly because you tread on my dreams. + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} +| I would spread the cloths under your feet: +| But I, being poor, have only my dreams; +| I have spread my dreams under your feet; +| Tread softly because you tread on my dreams. +\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: + +> | I would spread the cloths under your feet: +> | But I, being poor, have only my dreams; +> | I have spread my dreams under your feet; +> | Tread softly because you tread on my dreams. + +##### \Hologo{ConTeXt} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown +| I would spread the cloths under your feet: +| But I, being poor, have only my dreams; +| I have spread my dreams under your feet; +| Tread softly because you tread on my dreams. +\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: + +> | I would spread the cloths under your feet: +> | But I, being poor, have only my dreams; +> | I have spread my dreams under your feet; +> | Tread softly because you tread on my dreams. + +% +%<*tex> +% \fi +% \begin{macrocode} +\@@_add_lua_option:nnn + { lineBlocks } + { boolean } + { false } +% \end{macrocode} +% \iffalse +% +%<*lua,lua-cli> +% \fi +% \begin{macrocode} +defaultOptions.lineBlocks = false +% \end{macrocode} +% \par +% \iffalse +% +%<*manual-options> + #### Option `notes` `notes` (default value: `false`) @@ -8480,7 +8706,7 @@ defaultOptions.tableCaptions = false : true : Enable the Pandoc `task_lists` syntax extension. - + ``` md - [ ] an unticked task list item @@ -9256,7 +9482,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > > √-̅1̅ *equals* $i$. - + Invoking pdfTeX should have the same effect: ``` sh pdftex --shell-escape document.tex @@ -10249,7 +10475,7 @@ following text: % % \begin{markdown} -#### Bracketed Spans Context Renderers +#### Bracketed Spans Attribute Context Renderers The following macros are only produced, when the \Opt{bracketedSpans} option is enabled. @@ -10271,8 +10497,8 @@ following content: \usepackage[bracketedSpans]{markdown} \markdownSetup{ renderers = { - fencedDivAttributeContextBegin = {(}, - fencedDivAttributeContextEnd = {)}, + bracketedSpanAttributeContextBegin = {(}, + bracketedSpanAttributeContextEnd = {)}, }, } \begin{document} @@ -12157,14 +12383,14 @@ corresponds to the emphasized span of text. % % \begin{markdown} -#### Fenced Div Context Renderers -The following macros are only produced, when the \Opt{fencedDiv} option is +#### Fenced Code Attribute Context Renderers +The following macros are only produced, when the \Opt{fencedCode} 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. +The \mdef{markdownRendererFencedCodeAttributeContextBegin} and +\mdef{markdownRendererFencedCodeAttributeContextEnd} macros represent the +beginning and the end of a context in which the attributes of a fenced code +apply. The macros receive no arguments. % \end{markdown} % @@ -12174,67 +12400,166 @@ receive no arguments. Using a text editor, create a text document named `document.tex` with the following content: -``` tex +```` tex \documentclass{article} -\usepackage[fencedDiv]{markdown} +\usepackage[fencedCode, + fencedCodeAttributes]{markdown} +\usepackage{minted} \markdownSetup{ renderers = { - fencedDivAttributeContextBegin = {% - \par - \emph{(The beginning of a fenced div attribute context)} - \par + fencedCodeAttributeContextBegin = {% + \begingroup + \markdownSetup{ + renderers = { + attributeKeyValue = {% + \setminted{{#1} = {#2}}% + }, + }, + }% }, - fencedDivAttributeContextEnd = {% - \par - \emph{(The end of a fenced div attribute context)} - \par + fencedCodeAttributeContextEnd = {% + \endgroup }, }, } \begin{document} \begin{markdown} - -::: {key=value} - -foo - -:::: {#identifier} - -bar - -:::: - -::: - -::: {.class_name} - -baz - -::: - +``` js {linenos=true} +if (a > 3) { + moveShip(5 * gravity, DOWN); +} +`````` \end{markdown} \end{document} ``````` Next, invoke LuaTeX from the terminal: ``` sh -lualatex document.tex +lualatex --shell-escape 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)* +> ``` js {.linenos} +> 1. if (a > 3) { +> 2. moveShip(5 * gravity, DOWN); +> 3. } +> `````` + +% +%<*tex> +% \fi +% +% \begin{macrocode} +\def\markdownRendererFencedCodeAttributeContextBegin{% + \markdownRendererFencedCodeAttributeContextBeginPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g_@@_renderers_seq + { fencedCodeAttributeContextBegin } +\prop_gput:Nnn + \g_@@_renderer_arities_prop + { fencedCodeAttributeContextBegin } + { 0 } +\ExplSyntaxOff +\def\markdownRendererFencedCodeAttributeContextEnd{% + \markdownRendererFencedCodeAttributeContextEndPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g_@@_renderers_seq + { fencedCodeAttributeContextEnd } +\prop_gput:Nnn + \g_@@_renderer_arities_prop + { fencedCodeAttributeContextEnd } + { 0 } +\ExplSyntaxOff +% \end{macrocode} +% \par +% +% \iffalse +% +%<*manual-tokens> +% \fi +% +% \begin{markdown} + +#### Fenced Div Attribute 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[fencedDivs]{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 > @@ -13108,6 +13433,137 @@ following text: % % \begin{markdown} +#### Line Block Renderer +The following macros are only produced, when the \Opt{lineBlocks} option +is enabled. + +The \mdef{markdownRendererLineBlockBegin} and \mdef{markdownRendererLineBlockEnd} macros +represent the beginning and the end of a line block. 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\markdownOptionLineBlocks{true} +\markdownBegin +| I would spread the cloths under your feet: +| But I, being poor, have only my dreams; +| I have spread my dreams under your feet; +| Tread softly because you tread on my dreams. +\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: + +> | I would spread the cloths under your feet: +> | But I, being poor, have only my dreams; +> | I have spread my dreams under your feet; +> | Tread softly because you tread on my dreams. + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} +| I would spread the cloths under your feet: +| But I, being poor, have only my dreams; +| I have spread my dreams under your feet; +| Tread softly because you tread on my dreams. +\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: + +> | I would spread the cloths under your feet: +> | But I, being poor, have only my dreams; +> | I have spread my dreams under your feet; +> | Tread softly because you tread on my dreams. + +##### \Hologo{ConTeXt} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown +| I would spread the cloths under your feet: +| But I, being poor, have only my dreams; +| I have spread my dreams under your feet; +| Tread softly because you tread on my dreams. +\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: + +> | I would spread the cloths under your feet: +> | But I, being poor, have only my dreams; +> | I have spread my dreams under your feet; +> | Tread softly because you tread on my dreams. + +% +%<*tex> +% \fi +% +% \begin{macrocode} +\def\markdownRendererLineBlockBegin{% + \markdownRendererLineBlockBeginPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g_@@_renderers_seq + { lineBlockBegin } +\prop_gput:Nnn + \g_@@_renderer_arities_prop + { lineBlockBegin } + { 0 } +\ExplSyntaxOff +\def\markdownRendererLineBlockEnd{% + \markdownRendererLineBlockEndPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g_@@_renderers_seq + { lineBlockEnd } +\prop_gput:Nnn + \g_@@_renderer_arities_prop + { lineBlockEnd } + { 0 } +\ExplSyntaxOff +% \end{macrocode} +% \par +% +% \iffalse +% +%<*manual-tokens> +% \fi +% +% \begin{markdown} + #### Line Break Renderer The \mdef{markdownRendererLineBreak} macro represents a forced line break. The macro receives no arguments. @@ -14733,6 +15189,39 @@ following text: % % \begin{markdown} +#### Replacement Character Renderers +The \mdef{markdownRendererReplacementCharacter} macro represents the U+0000 +and U+FFFD Unicode characters. The macro receives no arguments. + +% \end{markdown} +% +% \iffalse +% +%<*tex> +% \fi +% +% \begin{macrocode} +\def\markdownRendererReplacementCharacter{% + \markdownRendererReplacementCharacterPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g_@@_renderers_seq + { replacementCharacter } +\prop_gput:Nnn + \g_@@_renderer_arities_prop + { replacementCharacter } + { 0 } +\ExplSyntaxOff +% \end{macrocode} +% \par +% +% \iffalse +% +%<*manual-tokens> +% \fi +% +% \begin{markdown} + #### Special Character Renderers The following macros replace any special plain \TeX{} characters, including % \iffalse @@ -17918,7 +18407,7 @@ following text: > \$\\sqrt{-1}\$ *equals* \$i\$. > > √-̅1̅ *equals* $i$. - + Invoking pdfTeX should have the same effect: ``` sh texexec --passon=--shell-escape document.tex @@ -18262,7 +18751,6 @@ end % \end{markdown} % \begin{macrocode} function util.cache_verbatim(dir, string) - string = string:gsub('[\r\n%s]*$', '') local name = util.cache(dir, string, nil, nil, ".verbatim") return name end @@ -20789,7 +21277,7 @@ function M.writer.new(options) % \end{markdown} % \begin{macrocode} function self.pack(name) - return [[\input ]] .. name .. [[\relax]] + return [[\input{]] .. name .. [[}\relax]] end % \end{macrocode} % \par @@ -20846,40 +21334,53 @@ function M.writer.new(options) % % \end{markdown} % \begin{macrocode} - self.escaped_uri_chars = { - ["{"] = "\\markdownRendererLeftBrace{}", - ["}"] = "\\markdownRendererRightBrace{}", - ["\\"] = "\\markdownRendererBackslash{}", - } - self.escaped_minimal_strings = { - ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ", - ["☒"] = "\\markdownRendererTickedBox{}", - ["⌛"] = "\\markdownRendererHalfTickedBox{}", - ["☐"] = "\\markdownRendererUntickedBox{}", - } + self.escaped_uri_chars = { + ["{"] = "\\markdownRendererLeftBrace{}", + ["}"] = "\\markdownRendererRightBrace{}", + ["\\"] = "\\markdownRendererBackslash{}", + } + self.escaped_minimal_strings = { + ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ", + ["☒"] = "\\markdownRendererTickedBox{}", + ["⌛"] = "\\markdownRendererHalfTickedBox{}", + ["☐"] = "\\markdownRendererUntickedBox{}", + [entities.hex_entity('FFFD')] = "\\markdownRendererReplacementCharacter{}", + } +% \end{macrocode} +% \par +% \begin{markdown} +% +% Define table \luamdef{writer->escaped_strings} containing the mapping from +% character strings that need to be escaped in typeset content. +% +% \end{markdown} +% \begin{macrocode} + self.escaped_strings = util.table_copy(self.escaped_minimal_strings) + self.escaped_strings[entities.hex_entity('00A0')] = self.nbsp % \end{macrocode} % \par % \begin{markdown} % % Define a table \luamdef{writer->escaped_chars} containing the mapping from % special plain \TeX{} characters (including the active pipe character (`|`) -% of \Hologo{ConTeXt}) that need to be escaped for typeset content. +% of \Hologo{ConTeXt}) that need to be escaped in typeset content. % % \end{markdown} % \begin{macrocode} self.escaped_chars = { - ["{"] = "\\markdownRendererLeftBrace{}", - ["}"] = "\\markdownRendererRightBrace{}", - ["%"] = "\\markdownRendererPercentSign{}", - ["\\"] = "\\markdownRendererBackslash{}", - ["#"] = "\\markdownRendererHash{}", - ["$"] = "\\markdownRendererDollarSign{}", - ["&"] = "\\markdownRendererAmpersand{}", - ["_"] = "\\markdownRendererUnderscore{}", - ["^"] = "\\markdownRendererCircumflex{}", - ["~"] = "\\markdownRendererTilde{}", - ["|"] = "\\markdownRendererPipe{}", - } + ["{"] = "\\markdownRendererLeftBrace{}", + ["}"] = "\\markdownRendererRightBrace{}", + ["%"] = "\\markdownRendererPercentSign{}", + ["\\"] = "\\markdownRendererBackslash{}", + ["#"] = "\\markdownRendererHash{}", + ["$"] = "\\markdownRendererDollarSign{}", + ["&"] = "\\markdownRendererAmpersand{}", + ["_"] = "\\markdownRendererUnderscore{}", + ["^"] = "\\markdownRendererCircumflex{}", + ["~"] = "\\markdownRendererTilde{}", + ["|"] = "\\markdownRendererPipe{}", + [entities.hex_entity('0000')] = "\\markdownRendererReplacementCharacter{}", + } % \end{macrocode} % \par % \begin{markdown} @@ -20891,7 +21392,7 @@ function M.writer.new(options) % % \end{markdown} % \begin{macrocode} - self.escape = util.escaper(self.escaped_chars, self.escaped_minimal_strings) + self.escape = util.escaper(self.escaped_chars, self.escaped_strings) self.escape_uri = util.escaper(self.escaped_uri_chars, self.escaped_minimal_strings) self.escape_minimal = util.escaper({}, self.escaped_minimal_strings) % \end{macrocode} @@ -21170,6 +21671,7 @@ function M.writer.new(options) % \begin{macrocode} function self.verbatim(s) if not self.is_writing then return "" end + s = s:gsub("\n$", "") local name = util.cache_verbatim(options.cacheDir, s) return {"\\markdownRendererInputVerbatim{",name,"}"} end @@ -21621,6 +22123,14 @@ parsers.attributes = parsers.lbrace * parsers.optionalspace * parsers.rbrace + +parsers.raw_attribute = parsers.lbrace + * parsers.optionalspace + * parsers.equal + * C(parsers.attribute_key) + * parsers.optionalspace + * parsers.rbrace + -- block followed by 0 or more optionally -- indented blocks with first line indented. parsers.indented_blocks = function(bl) @@ -21687,78 +22197,11 @@ parsers.inticks = parsers.openticks * parsers.space^-1 % \par % \begin{markdown} % -%#### Parsers Used for Fenced Code Blocks +%#### Parsers Used for Markdown Tags and Links % % \end{markdown} % \begin{macrocode} -local function captures_geq_length(_,i,a,b) - return #a >= #b and i -end - -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, 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 * Ct(parsers.attributes) - * parsers.optionalspace * (parsers.newline + parsers.eof) -end - -parsers.fencetail = function(char) - return parsers.nonindentspace - * Cmt(C(char^3) * Cb("fencelength"), captures_geq_length) - * parsers.optionalspace * (parsers.newline + parsers.eof) - + parsers.eof -end - -parsers.fencedline = function(char) - return C(parsers.line - parsers.fencetail(char)) - / function(s) - local i = 1 - local remaining = fenceindent - while true do - local c = s:sub(i, i) - if c == " " and remaining > 0 then - remaining = remaining - 1 - i = i + 1 - elseif c == "\t" and remaining > 3 then - remaining = remaining - 4 - i = i + 1 - else - break - end - end - return s:sub(i) - end -end -% \end{macrocode} -% \par -% \begin{markdown} -% -%#### Parsers Used for Markdown Tags and Links -% -% \end{markdown} -% \begin{macrocode} -parsers.leader = parsers.space^-3 +parsers.leader = parsers.space^-3 -- content in balanced brackets, parentheses, or quotes: parsers.bracketed = P{ parsers.lbracket @@ -21982,18 +22425,6 @@ parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more % % \end{markdown} % \begin{macrocode} -parsers.TildeFencedCode - = parsers.fencehead(parsers.tilde, - parsers.tilde_infostring) - * Cs(parsers.fencedline(parsers.tilde)^0) - * parsers.fencetail(parsers.tilde) - -parsers.BacktickFencedCode - = parsers.fencehead(parsers.backtick, - parsers.backtick_infostring) - * Cs(parsers.fencedline(parsers.backtick)^0) - * parsers.fencetail(parsers.backtick) - parsers.lineof = function(c) return (parsers.leader * (P(c) * parsers.optionalspace)^3 * (parsers.newline * parsers.blankline^1 @@ -22274,8 +22705,7 @@ function M.reader.new(writer, options) -- strip off leading > and indents, and run through blocks parsers.blockquote_body = ((parsers.leader * parsers.more * parsers.space^-1)/"" * parsers.linechar^0 * parsers.newline)^1 - * (-(parsers.leader * parsers.more - + parsers.blankline) * parsers.linechar^1 + * (-V("BlockquoteExceptions") * parsers.linechar^1 * parsers.newline)^0 if not options.breakableBlockquotes then @@ -22511,14 +22941,14 @@ function M.reader.new(writer, options) / writer.string parsers.EscapedChar = parsers.backslash * C(parsers.escapable) / writer.string - + parsers.InlineHtml = parsers.emptyelt_any / writer.inline_html_tag + (parsers.htmlcomment / self.parser_functions.parse_inlines_no_html) / writer.inline_html_comment + parsers.htmlinstruction + parsers.openelt_any / writer.inline_html_tag + parsers.closeelt_any / writer.inline_html_tag - + parsers.HtmlEntity = parsers.hexentity / entities.hex_entity / writer.string + parsers.decentity / entities.dec_entity / writer.string + parsers.tagentity / entities.char_entity / writer.string @@ -22541,6 +22971,9 @@ function M.reader.new(writer, options) * ((parsers.indentedline - parsers.blankline))^1)^1 ) / self.expandtabs / writer.verbatim + parsers.BlockquoteExceptions = parsers.leader * parsers.more + + parsers.blankline + parsers.Blockquote = Cs(parsers.blockquote_body^1) / self.parser_functions.parse_blocks_nested / writer.blockquote @@ -22796,7 +23229,9 @@ function M.reader.new(writer, options) DisplayHtml = parsers.DisplayHtml, Paragraph = parsers.Paragraph, Plain = parsers.Plain, + EndlineExceptions = parsers.EndlineExceptions, + BlockquoteExceptions = parsers.BlockquoteExceptions, Str = parsers.Str, Space = parsers.Space, @@ -22868,7 +23303,6 @@ function M.reader.new(writer, options) end self.add_special_character("*") - self.add_special_character("`") self.add_special_character("[") self.add_special_character("]") self.add_special_character("<") @@ -23025,6 +23459,8 @@ function M.reader.new(writer, options) if not options.codeSpans then syntax.Code = parsers.fail + else + self.add_special_character("`") end if not options.html then @@ -23086,13 +23522,22 @@ function M.reader.new(writer, options) % \begin{markdown} % % Return a function that converts markdown string `input` into a plain \TeX{} -% output and returns it. Note that the converter assumes that the input has -% \acro{unix} line endings. +% output and returns it.. % % \end{markdown} % \begin{macrocode} return function(input) - references = {} +% \end{macrocode} +% \begin{markdown} +% Since the Lua converter expects \acro{unix} line endings, normalize the +% input. Also add a line ending at the end of the file in case the input file +% has none. +% \end{markdown} +% \begin{macrocode} + input = input:gsub("\r\n?", "\n") + if input:sub(-1) ~= "\n" then + input = input .. "\n" + end % \end{macrocode} % \begin{markdown} % When determining the name of the cache file, create salt for the hashing @@ -23101,6 +23546,7 @@ function M.reader.new(writer, options) % is disregarded. % \end{markdown} % \begin{macrocode} + references = {} local opt_string = {} for k, _ in pairs(defaultOptions) do local v = options[k] @@ -23906,9 +24352,16 @@ end % parameter is `true`, the syntax extension requires a blank line between a % paragraph and the following fenced code block. % +% When the `allow_attributes` option is `true`, the syntax extension permits +% attributes following the infostring. When the `allow_raw_blocks` option is +% `true`, the syntax extension permits the specification of raw blocks using +% Pandoc's raw attribute syntax extension. +% % \end{markdown} % \begin{macrocode} -M.extensions.fenced_code = function(blank_before_code_fence) +M.extensions.fenced_code = function(blank_before_code_fence, + allow_attributes, + allow_raw_blocks) return { name = "built-in fenced_code syntax extension", extend_writer = function(self) @@ -23918,29 +24371,141 @@ M.extensions.fenced_code = function(blank_before_code_fence) % \par % \begin{markdown} % -% Define \luamdef{writer->codeFence} as a function that will transform an -% input fenced code block `s` with the infostring `i` to the output -% format. +% Define \luamdef{writer->fencedCode} as a function that will transform an +% input fenced code block `s` with the infostring `i` and optional attributes +% `attr` to the output format. % % \end{markdown} % \begin{macrocode} - function self.fencedCode(s, i) + function self.fencedCode(s, i, attr) if not self.is_writing then return "" end + s = s:gsub("\n$", "") + local buf = {} + if attr ~= nil then + table.insert(buf, {"\\markdownRendererFencedCodeAttributeContextBegin", + self.attributes(attr)}) + end local name = util.cache_verbatim(options.cacheDir, s) - return {"\\markdownRendererInputFencedCode{", - name,"}{",self.string(i),"}"} + table.insert(buf, {"\\markdownRendererInputFencedCode{", + name,"}{",self.string(i),"}"}) + if attr ~= nil then + table.insert(buf, "\\markdownRendererFencedCodeAttributeContextEnd") + end + return buf + end + +% \end{macrocode} +% \par +% \begin{markdown} +% +% Define \luamdef{writer->rawBlock} as a function that will transform an +% input raw block `s` with the raw attribute `attr` to the output format. +% +% \end{markdown} +% \begin{macrocode} + if allow_raw_blocks then + function self.rawBlock(s, attr) + if not self.is_writing then return "" end + s = s:gsub("\n$", "") + local name = util.cache_verbatim(options.cacheDir, s) + return {"\\markdownRendererInputRawBlock{", + name,"}{", self.string(attr),"}"} + end end end, extend_reader = function(self) local parsers = self.parsers 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 + local function captures_geq_length(_,i,a,b) + return #a >= #b and i + end + + local tilde_infostring + = C((parsers.linechar + - (parsers.spacechar^1 * parsers.newline))^0) + + local backtick_infostring + = C((parsers.linechar + - (parsers.backtick + + parsers.spacechar^1 * parsers.newline))^0) + + local fenceindent + local fencehead = function(char, infostring) + return C(parsers.nonindentspace) / function(s) fenceindent = #s end + * Cg(char^3, "fencelength") + * parsers.optionalspace + * infostring + * (parsers.newline + parsers.eof) + end + + local fencetail = function(char) + return parsers.nonindentspace + * Cmt(C(char^3) * Cb("fencelength"), captures_geq_length) + * parsers.optionalspace * (parsers.newline + parsers.eof) + + parsers.eof + end + + local fencedline = function(char) + return C(parsers.line - fencetail(char)) + / function(s) + local i = 1 + local remaining = fenceindent + while true do + local c = s:sub(i, i) + if c == " " and remaining > 0 then + remaining = remaining - 1 + i = i + 1 + elseif c == "\t" and remaining > 3 then + remaining = remaining - 4 + i = i + 1 + else + break + end + end + return s:sub(i) + end + end + + local TildeFencedCode + = fencehead(parsers.tilde, tilde_infostring) + * Cs(fencedline(parsers.tilde)^0) + * fencetail(parsers.tilde) + + local BacktickFencedCode + = fencehead(parsers.backtick, backtick_infostring) + * Cs(fencedline(parsers.backtick)^0) + * fencetail(parsers.backtick) + + local infostring_with_attributes + = Ct(C((parsers.linechar + - ( parsers.optionalspace + * parsers.attributes))^0) + * parsers.optionalspace + * Ct(parsers.attributes)) + + local FencedCode + = (TildeFencedCode + BacktickFencedCode) + / function(infostring, code) + local expanded_code = self.expandtabs(code) + + if allow_raw_blocks then + local raw_attr = lpeg.match(parsers.raw_attribute, + infostring) + if raw_attr then + return writer.rawBlock(expanded_code, raw_attr) + end + end + + local attr = nil + if allow_attributes then + local match = lpeg.match(infostring_with_attributes, + infostring) + if match then + infostring, attr = table.unpack(match) + end + end + return writer.fencedCode(expanded_code, infostring, attr) + end self.insert_pattern("Block after Verbatim", FencedCode, "FencedCode") @@ -23949,10 +24514,8 @@ 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.backtick_infostring) - + parsers.fencehead(parsers.tilde, - parsers.tilde_infostring) + fencestart = fencehead(parsers.backtick, backtick_infostring) + + fencehead(parsers.tilde, tilde_infostring) end self.update_rule("EndlineExceptions", function(previous_pattern) @@ -23962,6 +24525,7 @@ M.extensions.fenced_code = function(blank_before_code_fence) return previous_pattern + fencestart end) + self.add_special_character("`") self.add_special_character("~") end } @@ -24071,6 +24635,31 @@ M.extensions.fenced_divs = function(blank_before_div_fence) FencedDiv, "FencedDiv") self.add_special_character(":") + +% \end{macrocode} +% \par +% \begin{markdown} +% +% Patch blockquotes, so that they allow the end of a fenced div immediately +% afterwards. +% +% \end{markdown} +% \begin{macrocode} + local function check_div_level(s, i, current_level) -- luacheck: ignore s i + current_level = tonumber(current_level) + return current_level > 0 + end + + local is_inside_div = Cmt(Cb("div_level"), check_div_level) + local fencestart = is_inside_div * fenced_div_end + + self.update_rule("BlockquoteExceptions", function(previous_pattern) + if previous_pattern == nil then + previous_pattern = parsers.BlockquoteExceptions + end + return previous_pattern + fencestart + end) + % \end{macrocode} % \par % \begin{markdown} @@ -24082,13 +24671,6 @@ M.extensions.fenced_divs = function(blank_before_div_fence) % \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 - - 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 @@ -24167,6 +24749,64 @@ end % \end{macrocode} % \begin{markdown} % +%#### Line Blocks +% +% The \luamdef{extensions.line_blocks} function implements the Pandoc line blocks +% syntax extension. +% +% \end{markdown} +% \begin{macrocode} +M.extensions.line_blocks = function() + return { + name = "built-in line_blocks syntax extension", + extend_writer = function(self) +% \end{macrocode} +% \par +% \begin{markdown} +% +% Define \luamdef{writer->lineblock} as a function that will transform +% a line block consisted of `lines` to the output format, with +% all but the last newline rendered as a line break. +% +% \end{markdown} +% \begin{macrocode} + function self.lineblock(lines) + if not self.is_writing then return "" end + local buffer = {} + for i = 1, #lines - 1 do + buffer[#buffer + 1] = { lines[i], self.linebreak } + end + buffer[#buffer + 1] = lines[#lines] + + return {"\\markdownRendererLineBlockBegin\n" + ,buffer, + "\n\\markdownRendererLineBlockEnd "} + end + end, extend_reader = function(self) + local parsers = self.parsers + local writer = self.writer + + local LineBlock = Ct( + (Cs( + ( (parsers.pipe * parsers.space)/"" + * ((parsers.space)/entities.char_entity("nbsp"))^0 + * parsers.linechar^0 * (parsers.newline/"")) + * (-parsers.pipe + * (parsers.space^1/" ") + * parsers.linechar^1 + * (parsers.newline/"") + )^0 + * (parsers.blankline/"")^0 + ) / self.parser_functions.parse_inlines)^1) / writer.lineblock + + self.insert_pattern("Block after Blockquote", + LineBlock, "LineBlock") + end + } +end +% \end{macrocode} +% \begin{markdown} +% %#### Notes % % The \luamdef{extensions.notes} function implements the Pandoc note @@ -24423,14 +25063,14 @@ end % %#### Raw Attributes % -% The \luamdef{extensions.raw_attribute} function implements the Pandoc -% raw attribute syntax extension. +% The \luamdef{extensions.raw_inline} function implements the Pandoc +% raw attribute syntax extension for inline code spans. % % \end{markdown} % \begin{macrocode} -M.extensions.raw_attribute = function() +M.extensions.raw_inline = function() return { - name = "built-in raw_attribute syntax extension", + name = "built-in raw_inline syntax extension", extend_writer = function(self) local options = self.options @@ -24449,59 +25089,15 @@ M.extensions.raw_attribute = function() return {"\\markdownRendererInputRawInline{", name,"}{", self.string(attr),"}"} end - - if options.fencedCode then -% \end{macrocode} -% \par -% \begin{markdown} -% -% Define \luamdef{writer->rawBlock} as a function that will transform an -% input raw block `s` with the raw attribute `attr` to the output format. -% -% \end{markdown} -% \begin{macrocode} - function self.rawBlock(s, attr) - if not self.is_writing then return "" end - local name = util.cache_verbatim(options.cacheDir, s) - return {"\\markdownRendererInputRawBlock{", - name,"}{", self.string(attr),"}"} - end - end end, extend_reader = function(self) - local options = self.options local writer = self.writer - local raw_attribute = parsers.lbrace - * parsers.optionalspace - * parsers.equal - * C(parsers.attribute_key) - * parsers.optionalspace - * parsers.rbrace - local RawInline = parsers.inticks - * raw_attribute + * parsers.raw_attribute / writer.rawInline self.insert_pattern("Inline before Code", RawInline, "RawInline") - - 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 - end - - self.insert_pattern("Block after Verbatim", - RawBlock, "RawBlock") - end end } end @@ -24837,7 +25433,9 @@ function M.new(options) if options.fencedCode then local fenced_code_extension = M.extensions.fenced_code( - options.blankBeforeCodeFence) + options.blankBeforeCodeFence, + options.fencedCodeAttributes, + options.rawAttribute) table.insert(extensions, fenced_code_extension) end @@ -24865,8 +25463,8 @@ function M.new(options) end if options.rawAttribute then - local raw_attribute_extension = M.extensions.raw_attribute() - table.insert(extensions, raw_attribute_extension) + local raw_inline_extension = M.extensions.raw_inline() + table.insert(extensions, raw_inline_extension) end if options.strikeThrough then @@ -24884,6 +25482,11 @@ function M.new(options) table.insert(extensions, superscript_extension) end + if options.lineBlocks then + local line_block_extension = M.extensions.line_blocks() + table.insert(extensions, line_block_extension) + end + % \end{macrocode} % \begin{markdown} % @@ -25072,14 +25675,7 @@ if metadata.version ~= md.metadata.version then "markdown.lua " .. md.metadata.version .. ".") end local convert = md.new(options) -% \end{macrocode} -% \begin{markdown} -% Since the Lua converter expects \acro{unix} line endings, normalize the -% input. Also add a line ending at the end of the file in case the input file -% has none. -% \end{markdown} -% \begin{macrocode} -local output = convert(input:gsub("\r\n?", "\n") .. "\n") +local output = convert(input) if output_filename then local output_file = assert(io.open(output_filename, "w"), @@ -25186,12 +25782,14 @@ end \def\markdownRendererDlEndTightPrototype{}% \def\markdownRendererEmphasisPrototype#1{{\it#1}}% \def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}% -\def\markdownRendererBlockQuoteBeginPrototype{\par\begingroup\it}% +\def\markdownRendererBlockQuoteBeginPrototype{\begingroup\it}% \def\markdownRendererBlockQuoteEndPrototype{\endgroup\par}% +\def\markdownRendererLineBlockBeginPrototype{\begingroup\parindent=0pt}% +\def\markdownRendererLineBlockEndPrototype{\endgroup}% \def\markdownRendererInputVerbatimPrototype#1{% \par{\tt\input#1\relax{}}\par}% \def\markdownRendererInputFencedCodePrototype#1#2{% - \markdownRendererInputVerbatimPrototype{#1}}% + \markdownRendererInputVerbatim{#1}}% \def\markdownRendererHeadingOnePrototype#1{#1}% \def\markdownRendererHeadingTwoPrototype#1{#1}% \def\markdownRendererHeadingThreePrototype#1{#1}% @@ -25208,6 +25806,46 @@ end \def\markdownRendererStrikeThroughPrototype#1{#1}% \def\markdownRendererSuperscriptPrototype#1{#1}% \def\markdownRendererSubscriptPrototype#1{#1}% +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererHeaderAttributeContextBeginPrototype + { + \group_begin: + \color_group_begin: + } +\cs_gset:Npn + \markdownRendererHeaderAttributeContextEndPrototype + { + \color_group_end: + \group_end: + } +\cs_gset_eq:NN + \markdownRendererBracketedSpanAttributeContextBeginPrototype + \markdownRendererHeaderAttributeContextBeginPrototype +\cs_gset_eq:NN + \markdownRendererBracketedSpanAttributeContextEndPrototype + \markdownRendererHeaderAttributeContextEndPrototype +\cs_gset_eq:NN + \markdownRendererFencedDivAttributeContextBeginPrototype + \markdownRendererHeaderAttributeContextBeginPrototype +\cs_gset_eq:NN + \markdownRendererFencedDivAttributeContextEndPrototype + \markdownRendererHeaderAttributeContextEndPrototype +\cs_gset_eq:NN + \markdownRendererFencedCodeAttributeContextBeginPrototype + \markdownRendererHeaderAttributeContextBeginPrototype +\cs_gset_eq:NN + \markdownRendererFencedCodeAttributeContextEndPrototype + \markdownRendererHeaderAttributeContextEndPrototype +\cs_gset:Npn + \markdownRendererReplacementCharacterPrototype + { + % TODO: Replace with `\codepoint_generate:nn` in TeX Live 2023 + \sys_if_engine_pdftex:TF + { ^^ef^^bf^^bd } + { ^^^^fffd } + } +\ExplSyntaxOff % \end{macrocode} % \par % \begin{markdown} @@ -25221,19 +25859,40 @@ end % \end{markdown} % \begin{macrocode} \ExplSyntaxOn -\cs_gset:Npn - \markdownRendererInputRawInlinePrototype#1#2 +\cs_new:Nn + \@@_plain_tex_default_input_raw_inline_renderer_prototype:nn { \str_case:nn { #2 } { - { tex } { \markdownEscape{#1} } { md } { \markdownInput{#1} } + { tex } { \markdownEscape{#1} \unskip } } } -\cs_gset_eq:NN - \markdownRendererInputRawBlockPrototype - \markdownRendererInputRawInlinePrototype +\cs_new:Nn + \@@_plain_tex_default_input_raw_block_renderer_prototype:nn + { + \str_case:nn + { #2 } + { + { md } { \markdownInput{#1} } + { tex } { \markdownEscape{#1} } + } + } +\cs_gset:Npn + \markdownRendererInputRawInlinePrototype#1#2 + { + \@@_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \@@_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } + } \ExplSyntaxOff % \end{macrocode} % \par @@ -25878,7 +26537,7 @@ end % whether the shell access is enabled (`1`), disabled (`0`), or restricted % (`2`). % -% Inherit the value of the the `\pdfshellescape` (Lua\TeX{}, \Hologo{pdfTeX}) +% Inherit the value of 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 % `status.shell_escape` configuration item. @@ -26150,7 +26809,7 @@ end % has none. % \end{markdown} % \begin{macrocode} - print(convert(input:gsub("\r\n?", "\n") .. "\n"))}% + print(convert(input))}% % \end{macrocode} % \begin{markdown} % In case we were finalizing the frozen cache, increment \Opt{frozenCacheCounter}. @@ -26362,7 +27021,7 @@ end % % \end{markdown} % \begin{macrocode} -\renewcommand\markdownRendererInputFencedCode[2]{% +\renewcommand\markdownRendererInputFencedCodePrototype[2]{% \def\next##1 ##2\relax{% \ifthenelse{\equal{##1}{dot}}{% \markdownIfOption{frozenCache}{}{% @@ -26690,14 +27349,16 @@ end % \end{macrocode} % \par % \begin{markdown}% -% If the \Opt{tightLists} Lua option is disabled or the current document class -% is \pkg{beamer}, do not load the \pkg{paralist} package. +% If either the \Opt{tightLists} or the \Opt{fancyLists} Lua option is enabled +% and the current document class is not \pkg{beamer}, then load the +% \pkg{paralist} package. % % \end{markdown} % \begin{macrocode} -\markdownIfOption{tightLists}{ - \@ifclassloaded{beamer}{}{\RequirePackage{paralist}}% -}{} +\@ifclassloaded{beamer}{}{% + \markdownIfOption{tightLists}{\RequirePackage{paralist}}{}% + \markdownIfOption{fancyLists}{\RequirePackage{paralist}}{}% +} % \end{macrocode} % \par % \begin{markdown} @@ -26956,7 +27617,7 @@ end % % \end{markdown} % \begin{macrocode} - headerAttributeContextBegin = { + headerAttributeContextBegin = {% \markdownSetup{ rendererPrototypes = { attributeIdentifier = {% @@ -26978,46 +27639,92 @@ end }, }% }, + headerAttributeContextEnd = {}, superscript = {\textsuperscript{#1}}, subscript = {\textsubscript{#1}}, blockQuoteBegin = {\begin{quotation}}, blockQuoteEnd = {\end{quotation}}, inputVerbatim = {\VerbatimInput{#1}}, - inputFencedCode = {% - \ifx\relax#2\relax - \VerbatimInput{#1}% - \else - \@ifundefined{minted@code}{% - \@ifundefined{lst@version}{% - \markdownRendererInputFencedCode{#1}{}% + thematicBreak = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, + note = {\footnote{#1}}}} % \end{macrocode} % \par % \begin{markdown} % -% When the \pkg{listings} package is loaded, use it for syntax highlighting. +%#### Fenced Code +% When no infostring has been specified, default to the indented code block +% renderer. % % \end{markdown} % \begin{macrocode} - }{% - \lstinputlisting[language=#2]{#1}% - }% +\RequirePackage{ltxcmds} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputFencedCodePrototype#1#2 + { + \tl_if_empty:nTF + { #2 } + { \markdownRendererInputVerbatim{#1} } +% \end{macrocode} +% \begin{markdown} +% +% Otherwise, extract the first word of the infostring and treat it as the name +% of the programming language in which the code block is written. +% +% \end{markdown} +% \begin{macrocode} + { + \regex_extract_once:nnN + { \w* } + { #2 } + \l_tmpa_seq + \seq_pop_left:NN + \l_tmpa_seq + \l_tmpa_tl % \end{macrocode} % \par % \begin{markdown} % % When the \pkg{minted} package is loaded, use it for syntax highlighting. -% The \pkg{minted} package is preferred over \pkg{listings}. % % \end{markdown} % \begin{macrocode} - }{% - \catcode`\#=6\relax - \inputminted{#2}{#1}% - \catcode`\#=12\relax - }% - \fi}, - thematicBreak = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, - note = {\footnote{#1}}}} + \ltx@ifpackageloaded + { minted } + { + \catcode`\#=6\relax + \exp_args:NV + \inputminted + \l_tmpa_tl + { #1 } + \catcode`\#=12\relax + } + { +% \end{macrocode} +% \par +% \begin{markdown} +% +% When the \pkg{listings} package is loaded, use it for syntax highlighting. +% +% \end{markdown} +% \begin{macrocode} + \ltx@ifpackageloaded + { listings } + { \lstinputlisting[language=\l_tmpa_tl]{#1} } +% \end{macrocode} +% \par +% \begin{markdown} +% +% When neither the \pkg{listings} package nor the \pkg{minted} package is +% loaded, act as though no infostring were given. +% +% \end{markdown} +% \begin{macrocode} + { \markdownRendererInputFencedCode{#1}{} } + } + } + } +\ExplSyntaxOff % \end{macrocode} % \par % \begin{markdown} @@ -27540,6 +28247,32 @@ end \addto@hook\markdownLaTeXTable{#1\\}% \expandafter\@gobble \fi\markdownLaTeXRenderTableCell} +% \end{macrocode} +% \par +% \begin{markdown} +% +%#### Line Blocks +% Here is a basic implementation of line blocks. If the \pkg{verse} package is +% loaded, then it is used to produce the verses. +% +% \end{markdown} +% \begin{macrocode} + +\markdownIfOption{lineBlocks}{% + \RequirePackage{verse} + \markdownSetup{rendererPrototypes={ + lineBlockBegin = {% + \begingroup + \def\markdownRendererLineBreak{\\}% + \begin{verse}% + }, + lineBlockEnd = {% + \end{verse}% + \endgroup + }, + }} +}{} + % \end{macrocode} % \par % \begin{markdown} @@ -27621,9 +28354,8 @@ end % %#### Raw Attribute Renderer Prototypes % -% In the raw block and inline raw span renderer prototypes, execute the content -% with TeX when the raw attribute is `tex` or `latex`, display the content as -% markdown when the raw attribute is `md`, and ignore the content otherwise. +% In the raw block and inline raw span renderer prototypes, default to the +% plain TeX renderer prototypes, translating raw attribute `latex` to `tex`. % % \end{markdown} % \begin{macrocode} @@ -27631,17 +28363,41 @@ end \cs_gset:Npn \markdownRendererInputRawInlinePrototype#1#2 { - \str_case:nn + \str_case:nnF { #2 } { - { tex } { \markdownEscape{#1} } - { latex } { \markdownEscape{#1} } - { md } { \markdownInput{#1} } + { latex } + { + \@@_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \@@_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \str_case:nnF + { #2 } + { + { latex } + { + \@@_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \@@_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } } } -\cs_gset_eq:NN - \markdownRendererInputRawBlockPrototype - \markdownRendererInputRawInlinePrototype \ExplSyntaxOff \fi % Closes `\markdownIfOption{Plain}{\iffalse}{iftrue}` % \end{macrocode} @@ -27856,18 +28612,42 @@ end \def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}% \def\markdownRendererBlockQuoteBeginPrototype{\startquotation}% \def\markdownRendererBlockQuoteEndPrototype{\stopquotation}% +\def\markdownRendererLineBlockBeginPrototype{% + \begingroup + \def\markdownRendererLineBreak{ + }% + \startlines +}% +\def\markdownRendererLineBlockEndPrototype{% + \stoplines + \endgroup +}% \def\markdownRendererInputVerbatimPrototype#1{\typefile{#1}}% -\def\markdownRendererInputFencedCodePrototype#1#2{% - \ifx\relax#2\relax - \typefile{#1}% - \else % \end{macrocode} % \par % \begin{markdown} % -% The code fence infostring is used as a name from the \Hologo{ConTeXt} -% `\definetyping` macro. This allows the user to set up code highlighting -% mapping as follows: +%#### Fenced Code +% When no infostring has been specified, default to the indented code block +% renderer. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputFencedCodePrototype#1#2 + { + \tl_if_empty:nTF + { #2 } + { \markdownRendererInputVerbatim{#1} } +% \end{macrocode} +% \par +% \begin{markdown} +% +% Otherwise, extract the first word of the infostring and treat it as the name +% of the programming language in which the code block is written. +% This name is then used in the \Hologo{ConTeXt} `\definetyping` macro, which +% allows the user to set up code highlighting mapping as follows: % ````` tex % % Map the `TEX` syntax highlighter to the `latex` infostring. % \definetyping [latex] @@ -27887,8 +28667,18 @@ end % % \end{markdown} % \begin{macrocode} - \typefile[#2][]{#1}% - \fi}% + { + \regex_extract_once:nnN + { \w* } + { #2 } + \l_tmpa_seq + \seq_pop_left:NN + \l_tmpa_seq + \l_tmpa_tl + \typefile[\l_tmpa_tl][]{#1} + } + } +\ExplSyntaxOff \def\markdownRendererHeadingOnePrototype#1{\chapter{#1}}% \def\markdownRendererHeadingTwoPrototype#1{\section{#1}}% \def\markdownRendererHeadingThreePrototype#1{\subsection{#1}}% @@ -27984,9 +28774,8 @@ end % %#### Raw Attribute Renderer Prototypes % -% In the raw block and inline raw span renderer prototypes, execute the content -% with TeX when the raw attribute is `tex` or `context`, display the content as -% markdown when the raw attribute is `md`, and ignore the content otherwise. +% In the raw block and inline raw span renderer prototypes, default to the +% plain TeX renderer prototypes, translating raw attribute `context` to `tex`. % % \end{markdown} % \begin{macrocode} @@ -27994,12 +28783,39 @@ end \cs_gset:Npn \markdownRendererInputRawInlinePrototype#1#2 { - \str_case:nn + \str_case:nnF { #2 } { - { tex } { \markdownEscape{#1} } - { context } { \markdownEscape{#1} } - { md } { \markdownInput{#1} } + { latex } + { + \@@_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { context } + } + } + { + \@@_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \str_case:nnF + { #2 } + { + { context } + { + \@@_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \@@_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } } } \cs_gset_eq:NN diff --git a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex index 79ba3273a63..9c9e035629d 100644 --- a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex +++ b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex @@ -261,13 +261,36 @@ \def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}% \def\markdownRendererBlockQuoteBeginPrototype{\startquotation}% \def\markdownRendererBlockQuoteEndPrototype{\stopquotation}% +\def\markdownRendererLineBlockBeginPrototype{% + \begingroup + \def\markdownRendererLineBreak{ + }% + \startlines +}% +\def\markdownRendererLineBlockEndPrototype{% + \stoplines + \endgroup +}% \def\markdownRendererInputVerbatimPrototype#1{\typefile{#1}}% -\def\markdownRendererInputFencedCodePrototype#1#2{% - \ifx\relax#2\relax - \typefile{#1}% - \else - \typefile[#2][]{#1}% - \fi}% +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputFencedCodePrototype#1#2 + { + \tl_if_empty:nTF + { #2 } + { \markdownRendererInputVerbatim{#1} } + { + \regex_extract_once:nnN + { \w* } + { #2 } + \l_tmpa_seq + \seq_pop_left:NN + \l_tmpa_seq + \l_tmpa_tl + \typefile[\l_tmpa_tl][]{#1} + } + } +\ExplSyntaxOff \def\markdownRendererHeadingOnePrototype#1{\chapter{#1}}% \def\markdownRendererHeadingTwoPrototype#1{\section{#1}}% \def\markdownRendererHeadingThreePrototype#1{\subsection{#1}}% @@ -352,12 +375,39 @@ \cs_gset:Npn \markdownRendererInputRawInlinePrototype#1#2 { - \str_case:nn + \str_case:nnF { #2 } { - { tex } { \markdownEscape{#1} } - { context } { \markdownEscape{#1} } - { md } { \markdownInput{#1} } + { latex } + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { context } + } + } + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \str_case:nnF + { #2 } + { + { context } + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } } } \cs_gset_eq:NN diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index bc769262a08..1158fcd4e17 100644 --- a/Master/texmf-dist/tex/generic/markdown/markdown.tex +++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex @@ -403,6 +403,10 @@ { fencedCode } { boolean } { false } +\__markdown_add_lua_option:nnn + { fencedCodeAttributes } + { boolean } + { false } \__markdown_add_lua_option:nnn { fencedDivs } { boolean } @@ -447,6 +451,10 @@ { jekyllData } { boolean } { false } +\__markdown_add_lua_option:nnn + { lineBlocks } + { boolean } + { false } \__markdown_add_lua_option:nnn { footnotes } { boolean } @@ -524,8 +532,8 @@ { boolean } { true } \ExplSyntaxOff -\def\markdownLastModified{2022-12-23}% -\def\markdownVersion{2.19.0-0-g80fcf20}% +\def\markdownLastModified{2023-02-01}% +\def\markdownVersion{2.20.0-0-gf64ade1}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax @@ -1008,6 +1016,28 @@ { strongEmphasis } { 1 } \ExplSyntaxOff +\def\markdownRendererFencedCodeAttributeContextBegin{% + \markdownRendererFencedCodeAttributeContextBeginPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { fencedCodeAttributeContextBegin } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { fencedCodeAttributeContextBegin } + { 0 } +\ExplSyntaxOff +\def\markdownRendererFencedCodeAttributeContextEnd{% + \markdownRendererFencedCodeAttributeContextEndPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { fencedCodeAttributeContextEnd } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { fencedCodeAttributeContextEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererFencedDivAttributeContextBegin{% \markdownRendererFencedDivAttributeContextBeginPrototype}% \ExplSyntaxOn @@ -1195,6 +1225,28 @@ { interblockSeparator } { 0 } \ExplSyntaxOff +\def\markdownRendererLineBlockBegin{% + \markdownRendererLineBlockBeginPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { lineBlockBegin } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { lineBlockBegin } + { 0 } +\ExplSyntaxOff +\def\markdownRendererLineBlockEnd{% + \markdownRendererLineBlockEndPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { lineBlockEnd } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { lineBlockEnd } + { 0 } +\ExplSyntaxOff \def\markdownRendererLineBreak{% \markdownRendererLineBreakPrototype}% \ExplSyntaxOn @@ -1482,6 +1534,17 @@ { inputRawBlock } { 2 } \ExplSyntaxOff +\def\markdownRendererReplacementCharacter{% + \markdownRendererReplacementCharacterPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { replacementCharacter } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { replacementCharacter } + { 0 } +\ExplSyntaxOff \def\markdownRendererLeftBrace{% \markdownRendererLeftBracePrototype}% \ExplSyntaxOn @@ -2009,12 +2072,14 @@ \def\markdownRendererDlEndTightPrototype{}% \def\markdownRendererEmphasisPrototype#1{{\it#1}}% \def\markdownRendererStrongEmphasisPrototype#1{{\bf#1}}% -\def\markdownRendererBlockQuoteBeginPrototype{\par\begingroup\it}% +\def\markdownRendererBlockQuoteBeginPrototype{\begingroup\it}% \def\markdownRendererBlockQuoteEndPrototype{\endgroup\par}% +\def\markdownRendererLineBlockBeginPrototype{\begingroup\parindent=0pt}% +\def\markdownRendererLineBlockEndPrototype{\endgroup}% \def\markdownRendererInputVerbatimPrototype#1{% \par{\tt\input#1\relax{}}\par}% \def\markdownRendererInputFencedCodePrototype#1#2{% - \markdownRendererInputVerbatimPrototype{#1}}% + \markdownRendererInputVerbatim{#1}}% \def\markdownRendererHeadingOnePrototype#1{#1}% \def\markdownRendererHeadingTwoPrototype#1{#1}% \def\markdownRendererHeadingThreePrototype#1{#1}% @@ -2033,18 +2098,79 @@ \def\markdownRendererSubscriptPrototype#1{#1}% \ExplSyntaxOn \cs_gset:Npn - \markdownRendererInputRawInlinePrototype#1#2 + \markdownRendererHeaderAttributeContextBeginPrototype + { + \group_begin: + \color_group_begin: + } +\cs_gset:Npn + \markdownRendererHeaderAttributeContextEndPrototype + { + \color_group_end: + \group_end: + } +\cs_gset_eq:NN + \markdownRendererBracketedSpanAttributeContextBeginPrototype + \markdownRendererHeaderAttributeContextBeginPrototype +\cs_gset_eq:NN + \markdownRendererBracketedSpanAttributeContextEndPrototype + \markdownRendererHeaderAttributeContextEndPrototype +\cs_gset_eq:NN + \markdownRendererFencedDivAttributeContextBeginPrototype + \markdownRendererHeaderAttributeContextBeginPrototype +\cs_gset_eq:NN + \markdownRendererFencedDivAttributeContextEndPrototype + \markdownRendererHeaderAttributeContextEndPrototype +\cs_gset_eq:NN + \markdownRendererFencedCodeAttributeContextBeginPrototype + \markdownRendererHeaderAttributeContextBeginPrototype +\cs_gset_eq:NN + \markdownRendererFencedCodeAttributeContextEndPrototype + \markdownRendererHeaderAttributeContextEndPrototype +\cs_gset:Npn + \markdownRendererReplacementCharacterPrototype + { + % TODO: Replace with `\codepoint_generate:nn` in TeX Live 2023 + \sys_if_engine_pdftex:TF + { ^^ef^^bf^^bd } + { ^^^^fffd } + } +\ExplSyntaxOff +\ExplSyntaxOn +\cs_new:Nn + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn { \str_case:nn { #2 } { - { tex } { \markdownEscape{#1} } { md } { \markdownInput{#1} } + { tex } { \markdownEscape{#1} \unskip } } } -\cs_gset_eq:NN - \markdownRendererInputRawBlockPrototype - \markdownRendererInputRawInlinePrototype +\cs_new:Nn + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { + \str_case:nn + { #2 } + { + { md } { \markdownInput{#1} } + { tex } { \markdownEscape{#1} } + } + } +\cs_gset:Npn + \markdownRendererInputRawInlinePrototype#1#2 + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } + } \ExplSyntaxOff \ExplSyntaxOn \seq_new:N \g__markdown_jekyll_data_datatypes_seq @@ -2490,7 +2616,7 @@ [[Could not open file "&1" for reading]]) local input = assert(file:read("*a")) assert(file:close()) - print(convert(input:gsub("\r\n?", "\n") .. "\n"))}% + print(convert(input))}% |global|advance|markdownOptionFrozenCacheCounter by 1|relax }% |endgroup diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 47bdd40a0df..0dede25d9cc 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -521,9 +521,10 @@ { NnV } \ExplSyntaxOff \markdownIfOption{plain}{\iffalse}{\iftrue} -\markdownIfOption{tightLists}{ - \@ifclassloaded{beamer}{}{\RequirePackage{paralist}}% -}{} +\@ifclassloaded{beamer}{}{% + \markdownIfOption{tightLists}{\RequirePackage{paralist}}{}% + \markdownIfOption{fancyLists}{\RequirePackage{paralist}}{}% +} \ExplSyntaxOn \@ifpackageloaded{paralist}{ \tl_new:N @@ -735,7 +736,7 @@ emphasis = {\emph{#1}}, tickedBox = {$\boxtimes$}, halfTickedBox = {$\boxdot$}, - headerAttributeContextBegin = { + headerAttributeContextBegin = {% \markdownSetup{ rendererPrototypes = { attributeIdentifier = {% @@ -757,29 +758,49 @@ }, }% }, + headerAttributeContextEnd = {}, superscript = {\textsuperscript{#1}}, subscript = {\textsubscript{#1}}, blockQuoteBegin = {\begin{quotation}}, blockQuoteEnd = {\end{quotation}}, inputVerbatim = {\VerbatimInput{#1}}, - inputFencedCode = {% - \ifx\relax#2\relax - \VerbatimInput{#1}% - \else - \@ifundefined{minted@code}{% - \@ifundefined{lst@version}{% - \markdownRendererInputFencedCode{#1}{}% - }{% - \lstinputlisting[language=#2]{#1}% - }% - }{% - \catcode`\#=6\relax - \inputminted{#2}{#1}% - \catcode`\#=12\relax - }% - \fi}, thematicBreak = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, note = {\footnote{#1}}}} +\RequirePackage{ltxcmds} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputFencedCodePrototype#1#2 + { + \tl_if_empty:nTF + { #2 } + { \markdownRendererInputVerbatim{#1} } + { + \regex_extract_once:nnN + { \w* } + { #2 } + \l_tmpa_seq + \seq_pop_left:NN + \l_tmpa_seq + \l_tmpa_tl + \ltx@ifpackageloaded + { minted } + { + \catcode`\#=6\relax + \exp_args:NV + \inputminted + \l_tmpa_tl + { #1 } + \catcode`\#=12\relax + } + { + \ltx@ifpackageloaded + { listings } + { \lstinputlisting[language=\l_tmpa_tl]{#1} } + { \markdownRendererInputFencedCode{#1}{} } + } + } + } +\ExplSyntaxOff \ExplSyntaxOn \def\markdownLATEXStrongEmphasis#1{% \str_if_in:NnTF @@ -1215,6 +1236,22 @@ \addto@hook\markdownLaTeXTable{#1\\}% \expandafter\@gobble \fi\markdownLaTeXRenderTableCell} + +\markdownIfOption{lineBlocks}{% + \RequirePackage{verse} + \markdownSetup{rendererPrototypes={ + lineBlockBegin = {% + \begingroup + \def\markdownRendererLineBreak{\\}% + \begin{verse}% + }, + lineBlockEnd = {% + \end{verse}% + \endgroup + }, + }} +}{} + \ExplSyntaxOn \keys_define:nn { markdown/jekyllData } @@ -1258,17 +1295,41 @@ \cs_gset:Npn \markdownRendererInputRawInlinePrototype#1#2 { - \str_case:nn + \str_case:nnF + { #2 } + { + { latex } + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \str_case:nnF { #2 } { - { tex } { \markdownEscape{#1} } - { latex } { \markdownEscape{#1} } - { md } { \markdownInput{#1} } + { latex } + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } } } -\cs_gset_eq:NN - \markdownRendererInputRawBlockPrototype - \markdownRendererInputRawInlinePrototype \ExplSyntaxOff \fi % Closes `\markdownIfOption{Plain}{\iffalse}{iftrue}` \newcommand\markdownMakeOther{% diff --git a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty index c0e11e67e34..c788c950a86 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdownthemewitiko_dot.sty @@ -47,7 +47,7 @@ \RequirePackage{ifthen,grffile} \let\markdown@witiko@dot@oldRendererInputFencedCodePrototype \markdownRendererInputFencedCodePrototype -\renewcommand\markdownRendererInputFencedCode[2]{% +\renewcommand\markdownRendererInputFencedCodePrototype[2]{% \def\next##1 ##2\relax{% \ifthenelse{\equal{##1}{dot}}{% \markdownIfOption{frozenCache}{}{% diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index 8a5a6ce9f56..4d5a96e56cb 100644 --- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua +++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua @@ -58,7 +58,7 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.19.0-0-g80fcf20", + version = "2.20.0-0-gf64ade1", comment = "A module for the conversion from markdown to plain TeX", author = "John MacFarlane, Hans Hagen, Vít Novotný", copyright = {"2009-2016 John MacFarlane, Hans Hagen", @@ -135,6 +135,7 @@ metadata.grammar_version = 2 defaultOptions.extensions = {} defaultOptions.fancyLists = false defaultOptions.fencedCode = false +defaultOptions.fencedCodeAttributes = false defaultOptions.fencedDivs = false defaultOptions.finalizeCache = false defaultOptions.frozenCacheCounter = 0 @@ -146,6 +147,7 @@ defaultOptions.hybrid = false defaultOptions.inlineFootnotes = false defaultOptions.inlineNotes = false defaultOptions.jekyllData = false +defaultOptions.lineBlocks = false defaultOptions.footnotes = false defaultOptions.notes = false defaultOptions.pipeTables = false @@ -192,7 +194,6 @@ function util.cache(dir, string, salt, transform, suffix) return name end function util.cache_verbatim(dir, string) - string = string:gsub('[\r\n%s]*$', '') local name = util.cache(dir, string, nil, nil, ".verbatim") return name end @@ -2411,7 +2412,7 @@ function M.writer.new(options) return s end function self.pack(name) - return [[\input ]] .. name .. [[\relax]] + return [[\input{]] .. name .. [[}\relax]] end function self.interblocksep() if not self.is_writing then return "" end @@ -2423,31 +2424,35 @@ function M.writer.new(options) if not self.is_writing then return "" end return "\\markdownRendererThematicBreak{}" end - self.escaped_uri_chars = { - ["{"] = "\\markdownRendererLeftBrace{}", - ["}"] = "\\markdownRendererRightBrace{}", - ["\\"] = "\\markdownRendererBackslash{}", - } - self.escaped_minimal_strings = { - ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ", - ["☒"] = "\\markdownRendererTickedBox{}", - ["⌛"] = "\\markdownRendererHalfTickedBox{}", - ["☐"] = "\\markdownRendererUntickedBox{}", - } + self.escaped_uri_chars = { + ["{"] = "\\markdownRendererLeftBrace{}", + ["}"] = "\\markdownRendererRightBrace{}", + ["\\"] = "\\markdownRendererBackslash{}", + } + self.escaped_minimal_strings = { + ["^^"] = "\\markdownRendererCircumflex\\markdownRendererCircumflex ", + ["☒"] = "\\markdownRendererTickedBox{}", + ["⌛"] = "\\markdownRendererHalfTickedBox{}", + ["☐"] = "\\markdownRendererUntickedBox{}", + [entities.hex_entity('FFFD')] = "\\markdownRendererReplacementCharacter{}", + } + self.escaped_strings = util.table_copy(self.escaped_minimal_strings) + self.escaped_strings[entities.hex_entity('00A0')] = self.nbsp self.escaped_chars = { - ["{"] = "\\markdownRendererLeftBrace{}", - ["}"] = "\\markdownRendererRightBrace{}", - ["%"] = "\\markdownRendererPercentSign{}", - ["\\"] = "\\markdownRendererBackslash{}", - ["#"] = "\\markdownRendererHash{}", - ["$"] = "\\markdownRendererDollarSign{}", - ["&"] = "\\markdownRendererAmpersand{}", - ["_"] = "\\markdownRendererUnderscore{}", - ["^"] = "\\markdownRendererCircumflex{}", - ["~"] = "\\markdownRendererTilde{}", - ["|"] = "\\markdownRendererPipe{}", - } - self.escape = util.escaper(self.escaped_chars, self.escaped_minimal_strings) + ["{"] = "\\markdownRendererLeftBrace{}", + ["}"] = "\\markdownRendererRightBrace{}", + ["%"] = "\\markdownRendererPercentSign{}", + ["\\"] = "\\markdownRendererBackslash{}", + ["#"] = "\\markdownRendererHash{}", + ["$"] = "\\markdownRendererDollarSign{}", + ["&"] = "\\markdownRendererAmpersand{}", + ["_"] = "\\markdownRendererUnderscore{}", + ["^"] = "\\markdownRendererCircumflex{}", + ["~"] = "\\markdownRendererTilde{}", + ["|"] = "\\markdownRendererPipe{}", + [entities.hex_entity('0000')] = "\\markdownRendererReplacementCharacter{}", + } + self.escape = util.escaper(self.escaped_chars, self.escaped_strings) self.escape_uri = util.escaper(self.escaped_uri_chars, self.escaped_minimal_strings) self.escape_minimal = util.escaper({}, self.escaped_minimal_strings) if options.hybrid then @@ -2557,6 +2562,7 @@ function M.writer.new(options) end function self.verbatim(s) if not self.is_writing then return "" end + s = s:gsub("\n$", "") local name = util.cache_verbatim(options.cacheDir, s) return {"\\markdownRendererInputVerbatim{",name,"}"} end @@ -2882,6 +2888,13 @@ parsers.attributes = parsers.lbrace * parsers.optionalspace * parsers.rbrace +parsers.raw_attribute = parsers.lbrace + * parsers.optionalspace + * parsers.equal + * C(parsers.attribute_key) + * parsers.optionalspace + * parsers.rbrace + -- block followed by 0 or more optionally -- indented blocks with first line indented. parsers.indented_blocks = function(bl) @@ -2928,65 +2941,6 @@ parsers.intickschar = (parsers.any - S(" \n\r`")) parsers.inticks = parsers.openticks * parsers.space^-1 * C(parsers.intickschar^0) * parsers.closeticks -local function captures_geq_length(_,i,a,b) - return #a >= #b and i -end - -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, 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 * Ct(parsers.attributes) - * parsers.optionalspace * (parsers.newline + parsers.eof) -end - -parsers.fencetail = function(char) - return parsers.nonindentspace - * Cmt(C(char^3) * Cb("fencelength"), captures_geq_length) - * parsers.optionalspace * (parsers.newline + parsers.eof) - + parsers.eof -end - -parsers.fencedline = function(char) - return C(parsers.line - parsers.fencetail(char)) - / function(s) - local i = 1 - local remaining = fenceindent - while true do - local c = s:sub(i, i) - if c == " " and remaining > 0 then - remaining = remaining - 1 - i = i + 1 - elseif c == "\t" and remaining > 3 then - remaining = remaining - 4 - i = i + 1 - else - break - end - end - return s:sub(i) - end -end parsers.leader = parsers.space^-3 -- content in balanced brackets, parentheses, or quotes: @@ -3171,18 +3125,6 @@ parsers.between = function(p, starter, ender) end parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more -parsers.TildeFencedCode - = parsers.fencehead(parsers.tilde, - parsers.tilde_infostring) - * Cs(parsers.fencedline(parsers.tilde)^0) - * parsers.fencetail(parsers.tilde) - -parsers.BacktickFencedCode - = parsers.fencehead(parsers.backtick, - parsers.backtick_infostring) - * Cs(parsers.fencedline(parsers.backtick)^0) - * parsers.fencetail(parsers.backtick) - parsers.lineof = function(c) return (parsers.leader * (P(c) * parsers.optionalspace)^3 * (parsers.newline * parsers.blankline^1 @@ -3320,8 +3262,7 @@ function M.reader.new(writer, options) -- strip off leading > and indents, and run through blocks parsers.blockquote_body = ((parsers.leader * parsers.more * parsers.space^-1)/"" * parsers.linechar^0 * parsers.newline)^1 - * (-(parsers.leader * parsers.more - + parsers.blankline) * parsers.linechar^1 + * (-V("BlockquoteExceptions") * parsers.linechar^1 * parsers.newline)^0 if not options.breakableBlockquotes then @@ -3563,6 +3504,9 @@ function M.reader.new(writer, options) * ((parsers.indentedline - parsers.blankline))^1)^1 ) / self.expandtabs / writer.verbatim + parsers.BlockquoteExceptions = parsers.leader * parsers.more + + parsers.blankline + parsers.Blockquote = Cs(parsers.blockquote_body^1) / self.parser_functions.parse_blocks_nested / writer.blockquote @@ -3749,7 +3693,9 @@ function M.reader.new(writer, options) DisplayHtml = parsers.DisplayHtml, Paragraph = parsers.Paragraph, Plain = parsers.Plain, + EndlineExceptions = parsers.EndlineExceptions, + BlockquoteExceptions = parsers.BlockquoteExceptions, Str = parsers.Str, Space = parsers.Space, @@ -3798,7 +3744,6 @@ function M.reader.new(writer, options) end self.add_special_character("*") - self.add_special_character("`") self.add_special_character("[") self.add_special_character("]") self.add_special_character("<") @@ -3888,6 +3833,8 @@ function M.reader.new(writer, options) if not options.codeSpans then syntax.Code = parsers.fail + else + self.add_special_character("`") end if not options.html then @@ -3945,6 +3892,10 @@ function M.reader.new(writer, options) inlines_nbsp_t.Space = parsers.NonbreakingSpace parsers.inlines_nbsp = Ct(inlines_nbsp_t) return function(input) + input = input:gsub("\r\n?", "\n") + if input:sub(-1) ~= "\n" then + input = input .. "\n" + end references = {} local opt_string = {} for k, _ in pairs(defaultOptions) do @@ -4526,29 +4477,134 @@ M.extensions.fancy_lists = function() end } end -M.extensions.fenced_code = function(blank_before_code_fence) +M.extensions.fenced_code = function(blank_before_code_fence, + allow_attributes, + allow_raw_blocks) return { name = "built-in fenced_code syntax extension", extend_writer = function(self) local options = self.options - function self.fencedCode(s, i) + function self.fencedCode(s, i, attr) if not self.is_writing then return "" end + s = s:gsub("\n$", "") + local buf = {} + if attr ~= nil then + table.insert(buf, {"\\markdownRendererFencedCodeAttributeContextBegin", + self.attributes(attr)}) + end local name = util.cache_verbatim(options.cacheDir, s) - return {"\\markdownRendererInputFencedCode{", - name,"}{",self.string(i),"}"} + table.insert(buf, {"\\markdownRendererInputFencedCode{", + name,"}{",self.string(i),"}"}) + if attr ~= nil then + table.insert(buf, "\\markdownRendererFencedCodeAttributeContextEnd") + end + return buf + end + + if allow_raw_blocks then + function self.rawBlock(s, attr) + if not self.is_writing then return "" end + s = s:gsub("\n$", "") + local name = util.cache_verbatim(options.cacheDir, s) + return {"\\markdownRendererInputRawBlock{", + name,"}{", self.string(attr),"}"} + end end end, extend_reader = function(self) local parsers = self.parsers 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 + local function captures_geq_length(_,i,a,b) + return #a >= #b and i + end + + local tilde_infostring + = C((parsers.linechar + - (parsers.spacechar^1 * parsers.newline))^0) + + local backtick_infostring + = C((parsers.linechar + - (parsers.backtick + + parsers.spacechar^1 * parsers.newline))^0) + + local fenceindent + local fencehead = function(char, infostring) + return C(parsers.nonindentspace) / function(s) fenceindent = #s end + * Cg(char^3, "fencelength") + * parsers.optionalspace + * infostring + * (parsers.newline + parsers.eof) + end + + local fencetail = function(char) + return parsers.nonindentspace + * Cmt(C(char^3) * Cb("fencelength"), captures_geq_length) + * parsers.optionalspace * (parsers.newline + parsers.eof) + + parsers.eof + end + + local fencedline = function(char) + return C(parsers.line - fencetail(char)) + / function(s) + local i = 1 + local remaining = fenceindent + while true do + local c = s:sub(i, i) + if c == " " and remaining > 0 then + remaining = remaining - 1 + i = i + 1 + elseif c == "\t" and remaining > 3 then + remaining = remaining - 4 + i = i + 1 + else + break + end + end + return s:sub(i) + end + end + + local TildeFencedCode + = fencehead(parsers.tilde, tilde_infostring) + * Cs(fencedline(parsers.tilde)^0) + * fencetail(parsers.tilde) + + local BacktickFencedCode + = fencehead(parsers.backtick, backtick_infostring) + * Cs(fencedline(parsers.backtick)^0) + * fencetail(parsers.backtick) + + local infostring_with_attributes + = Ct(C((parsers.linechar + - ( parsers.optionalspace + * parsers.attributes))^0) + * parsers.optionalspace + * Ct(parsers.attributes)) + + local FencedCode + = (TildeFencedCode + BacktickFencedCode) + / function(infostring, code) + local expanded_code = self.expandtabs(code) + + if allow_raw_blocks then + local raw_attr = lpeg.match(parsers.raw_attribute, + infostring) + if raw_attr then + return writer.rawBlock(expanded_code, raw_attr) + end + end + + local attr = nil + if allow_attributes then + local match = lpeg.match(infostring_with_attributes, + infostring) + if match then + infostring, attr = table.unpack(match) + end + end + return writer.fencedCode(expanded_code, infostring, attr) + end self.insert_pattern("Block after Verbatim", FencedCode, "FencedCode") @@ -4557,10 +4613,8 @@ 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.backtick_infostring) - + parsers.fencehead(parsers.tilde, - parsers.tilde_infostring) + fencestart = fencehead(parsers.backtick, backtick_infostring) + + fencehead(parsers.tilde, tilde_infostring) end self.update_rule("EndlineExceptions", function(previous_pattern) @@ -4570,6 +4624,7 @@ M.extensions.fenced_code = function(blank_before_code_fence) return previous_pattern + fencestart end) + self.add_special_character("`") self.add_special_character("~") end } @@ -4641,14 +4696,23 @@ M.extensions.fenced_divs = function(blank_before_div_fence) FencedDiv, "FencedDiv") self.add_special_character(":") - 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 + + local function check_div_level(s, i, current_level) -- luacheck: ignore s i + current_level = tonumber(current_level) + return current_level > 0 + end + + local is_inside_div = Cmt(Cb("div_level"), check_div_level) + local fencestart = is_inside_div * fenced_div_end + + self.update_rule("BlockquoteExceptions", function(previous_pattern) + if previous_pattern == nil then + previous_pattern = parsers.BlockquoteExceptions end + return previous_pattern + fencestart + end) - local is_inside_div = Cmt(Cb("div_level"), check_div_level) - local fencestart = is_inside_div * fenced_div_end + if not blank_before_div_fence then self.update_rule("EndlineExceptions", function(previous_pattern) if previous_pattern == nil then previous_pattern = parsers.EndlineExceptions @@ -4714,6 +4778,44 @@ M.extensions.header_attributes = function() end } end +M.extensions.line_blocks = function() + return { + name = "built-in line_blocks syntax extension", + extend_writer = function(self) + function self.lineblock(lines) + if not self.is_writing then return "" end + local buffer = {} + for i = 1, #lines - 1 do + buffer[#buffer + 1] = { lines[i], self.linebreak } + end + buffer[#buffer + 1] = lines[#lines] + + return {"\\markdownRendererLineBlockBegin\n" + ,buffer, + "\n\\markdownRendererLineBlockEnd "} + end + end, extend_reader = function(self) + local parsers = self.parsers + local writer = self.writer + + local LineBlock = Ct( + (Cs( + ( (parsers.pipe * parsers.space)/"" + * ((parsers.space)/entities.char_entity("nbsp"))^0 + * parsers.linechar^0 * (parsers.newline/"")) + * (-parsers.pipe + * (parsers.space^1/" ") + * parsers.linechar^1 + * (parsers.newline/"") + )^0 + * (parsers.blankline/"")^0 + ) / self.parser_functions.parse_inlines)^1) / writer.lineblock + + self.insert_pattern("Block after Blockquote", + LineBlock, "LineBlock") + end + } +end M.extensions.notes = function(notes, inline_notes) assert(notes or inline_notes) return { @@ -4924,9 +5026,9 @@ M.extensions.pipe_tables = function(table_captions) end } end -M.extensions.raw_attribute = function() +M.extensions.raw_inline = function() return { - name = "built-in raw_attribute syntax extension", + name = "built-in raw_inline syntax extension", extend_writer = function(self) local options = self.options @@ -4936,50 +5038,15 @@ M.extensions.raw_attribute = function() return {"\\markdownRendererInputRawInline{", name,"}{", self.string(attr),"}"} end - - if options.fencedCode then - function self.rawBlock(s, attr) - if not self.is_writing then return "" end - local name = util.cache_verbatim(options.cacheDir, s) - return {"\\markdownRendererInputRawBlock{", - name,"}{", self.string(attr),"}"} - end - end end, extend_reader = function(self) - local options = self.options local writer = self.writer - local raw_attribute = parsers.lbrace - * parsers.optionalspace - * parsers.equal - * C(parsers.attribute_key) - * parsers.optionalspace - * parsers.rbrace - local RawInline = parsers.inticks - * raw_attribute + * parsers.raw_attribute / writer.rawInline self.insert_pattern("Inline before Code", RawInline, "RawInline") - - 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 - end - - self.insert_pattern("Block after Verbatim", - RawBlock, "RawBlock") - end end } end @@ -5206,7 +5273,9 @@ function M.new(options) if options.fencedCode then local fenced_code_extension = M.extensions.fenced_code( - options.blankBeforeCodeFence) + options.blankBeforeCodeFence, + options.fencedCodeAttributes, + options.rawAttribute) table.insert(extensions, fenced_code_extension) end @@ -5234,8 +5303,8 @@ function M.new(options) end if options.rawAttribute then - local raw_attribute_extension = M.extensions.raw_attribute() - table.insert(extensions, raw_attribute_extension) + local raw_inline_extension = M.extensions.raw_inline() + table.insert(extensions, raw_inline_extension) end if options.strikeThrough then @@ -5253,6 +5322,11 @@ function M.new(options) table.insert(extensions, superscript_extension) end + if options.lineBlocks then + local line_block_extension = M.extensions.line_blocks() + table.insert(extensions, line_block_extension) + end + if options.footnotes or options.inlineFootnotes or options.notes or options.inlineNotes then local notes_extension = M.extensions.notes( -- cgit v1.2.3