From fd9564b21054e27d1e4f4bfcca7683ae3b84e2fb Mon Sep 17 00:00:00 2001
From: Karl Berry 2.22.0-0-g5a3d0fe 2023-04-02 2.23.0-0-g0b22f91 2023-04-27Markdown Package User Manual
-
git clone https://github.com/witiko/markdown
cd markdown/examples
-lualatex latex.tex
A PDF document named latex.pdf
should be produced. Open
-the text documents latex.tex
and example.md
in
-a text editor to see how the example documents are structured. Try
-changing the documents and typesetting them as follows:
A PDF document named latex-luatex.pdf
should be
+produced. Open the text documents latex-luatex.tex
and
+example.md
in a text editor to see how the example
+documents are structured. Try changing the documents and typesetting
+them as follows:
lualatex latex.tex
lualatex latex-luatex.tex
to see the effect of your changes.
context document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” Invoking pdfTeX should have the
-same effect:
-texexec --passon=--shell-escape document.tex
+contain the text “Hello world!”
As the next step, try typesetting the example documents distributed
along with the Markdown package:
-git clone https://github.com/witiko/markdown
-cd markdown/examples
-context context.tex
+git clone https://github.com/witiko/markdown
+cd markdown/examples
+context context.tex
A PDF document named context.pdf
should be produced.
Open the text documents context.tex
and
example.md
in a text editor to see how the example
documents are structured. Try changing the documents and typesetting
them as follows:
-context context.tex
+context context.tex
to see the effect of your changes.
2 Examples
@@ -459,33 +457,33 @@ parameter is optional; when unspecified, the behaviour will be the same
as if ⟨options⟩ were an empty table.
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\input example
-\bye
+\input markdown
+\input lmfonts
+\input example
+\bye
Using a text editor, create a text document named
example.lua
with the following content:
-#!/usr/bin/env texlua
-local ran_ok, kpse = pcall(require, "kpse")
-if ran_ok then kpse.set_program_name("luatex") end
-local markdown = require("markdown")
-local input, convert_safe, convert_unsafe, paragraph
-
-= [[$\sqrt{-1}$ *equals* $i$.]]
- input = markdown.new()
- convert_safe = markdown.new({hybrid = true})
- convert_unsafe = [[\par]]
- paragraph
-print(
-(input) .. paragraph ..
- convert_safe(input)
- convert_unsafe)
+#!/usr/bin/env texlua
+local ran_ok, kpse = pcall(require, "kpse")
+if ran_ok then kpse.set_program_name("luatex") end
+local markdown = require("markdown")
+local input, convert_safe, convert_unsafe, paragraph
+
+= [[$\sqrt{-1}$ *equals* $i$.]]
+ input = markdown.new()
+ convert_safe = markdown.new({hybrid = true})
+ convert_unsafe = [[\par]]
+ paragraph
+print(
+(input) .. paragraph ..
+ convert_safe(input)
+ convert_unsafe)
Next, invoke LuaTeX from the terminal:
-texlua example.lua > example.tex
-luatex document.tex
+texlua example.lua > example.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -494,35 +492,35 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-texlua example.lua > example.tex
-pdftex document.tex
+texlua example.lua > example.tex
+pdftex document.tex
Rather than use the texlua
interpreter, we can also
access the markdown
Lua module directly from our document.
Using a text editor, create a text document named
document.tex
with the following content:
-\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
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:
@@ -546,25 +544,25 @@ Lua programming language.
command-line parameters.
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\input safe
-
-\begingroup
-\catcode`\%=12
-\input unsafe
-\endgroup
-\bye
+\input markdown
+\input lmfonts
+\input safe
+
+\begingroup
+\catcode`\%=12
+\input unsafe
+\endgroup
+\bye
Using a text editor, create a text document named
example.md
with the following content:
- $\sqrt{-1}$ *equals* $i$.
+ $\sqrt{-1}$ *equals* $i$.
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ -- example.md safe.tex
-texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
-luatex document.tex
+texlua ⟨CLI pathname⟩ -- example.md safe.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -582,10 +580,10 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-texlua ⟨CLI pathname⟩ -- example.md safe.tex
-texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
-pdftex document.tex
+texlua ⟨CLI pathname⟩ -- example.md safe.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex
+pdftex document.tex
2.1.2 Plain TeX
@@ -601,23 +599,23 @@ its own options, but now the options are specified as TeX commands.
Using a text editor, create a text document named
document.tex
with the following content:
-\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:
@@ -626,8 +624,8 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-pdftex --shell-escape document.tex
+pdftex --shell-escape document.tex
2.1.3 LaTeX
@@ -649,23 +647,23 @@ or as parameters for the markdown*
LaTeX environment.
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-$\sqrt{-1}$ *equals* $i$
-\end{markdown}
-
-\begin{markdown*}{hybrid}
-$\sqrt{-1}$ *equals* $i$
-\end{markdown*}
-
-\end{document}
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -674,8 +672,8 @@ contain the following text:
equals .
Invoking pdfTeX should have the same effect:
-pdflatex --shell-escape document.tex
+pdflatex --shell-escape document.tex
2.1.4 ConTeXt
@@ -692,23 +690,23 @@ same options as the plain TeX
interface.
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$.
-\stopmarkdown
-
-\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:
@@ -716,9 +714,6 @@ contain the following text:
equals .
-Invoking pdfTeX should have the same effect:
-texexec --passon=--shell-escape document.tex
2.2 Options
In this section, I will describe all the options recognized by the
@@ -752,18 +747,18 @@ periodically emptied.
Lua Module Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new({cacheDir = "cache"})
- local input = "Hello *world*!"
- tex.sprint(convert(input)) }\bye
+\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new({cacheDir = "cache"})
+ local input = "Hello *world*!"
+ tex.sprint(convert(input)) }\bye
Create an empty directory named cache
next to our text
document. Then, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” Several cache files of the
Markdown package will also be produced in the cache
@@ -771,18 +766,18 @@ directory as we requested using the cacheDir
option.
Lua CLI Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input hello
-\bye
+\input markdown
+\input hello
+\bye
Using a text editor, create a text document named
hello.md
with the following content:
- Hello *world*!
+ Hello *world*!
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex
-luatex document.tex
+texlua ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -801,16 +796,16 @@ package will also be produced as we requested using the
class="tex">TeX
Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\def\markdownOptionCacheDir{cache}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
+\input markdown
+\def\markdownOptionCacheDir{cache}
+\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 directory named
cache
containing several cache files of the Markdown
@@ -820,17 +815,17 @@ package will also be produced as we requested using the
class="latex">LaTeX
Example
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass{article}
-\usepackage[cacheDir=cache]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
\documentclass{article}
+\usepackage[cacheDir=cache]{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 directory named
cache
containing several cache files of the Markdown
@@ -840,17 +835,17 @@ package will also be produced as we requested using the
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
-\setupmarkdown[cacheDir = cache]
-\starttext
-\startmarkdown
-
- Hello *world*!\stopmarkdown
-\stoptext
\usemodule[t][markdown]
+\setupmarkdown[cacheDir = cache]
+\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 directory named
cache
containing several cache files of the Markdown
@@ -879,37 +874,37 @@ Marie,Curie,1867
Thomas,Edison,1847
Create also a text document named language-map.json
with
the following content:
- {"tex": "LaTeX"
- }
+ {"tex": "LaTeX"
+ }
Create also a text document named code.tex
with the
following content:
\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
Create also a text document named part.md
with the
following content:
This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named document.tex
with the
following content:
\documentclass{article}
-\usepackage{minted}
-\usepackage[contentBlocks]{markdown}
-\markdownSetup{
-
- contentBlocksLanguageMap = {language-map.json},
- }\begin{document}
-\begin{markdown}
-
- /table.csv (An example table)
- /code.tex (An example code listing)
- /part.md (A file transclusion example)\end{markdown}
-\end{document}
\documentclass{article}
+\usepackage{minted}
+\usepackage[contentBlocks]{markdown}
+\markdownSetup{
+
+ contentBlocksLanguageMap = {language-map.json},
+ }\begin{document}
+\begin{markdown}
+
+ /table.csv (An example table)
+ /code.tex (An example code listing)
+ /part.md (A file transclusion example)\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -940,8 +935,8 @@ contain the following text:Table 1: An example table
-+\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
This is a transcluded markdown document.
Create also a text document named language-map.json
with
the following content:
- {"tex": "ConTeXt"
- }
+ {"tex": "ConTeXt"
+ }
Create also a text document named code.tex
with the
following content:
\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
Create also a text document named part.md
with the
following content:
This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named document.tex
with the
following content:
\usemodule[t][markdown]
-\setupmarkdown
-
- [
- contentBlocks = yes,
- contentBlocksLanguageMap = language-map.json,
- ]\definetyping [ConTeXt]
-\setuptyping [ConTeXt] [option=TEX]
-\starttext
-\startmarkdown
-
- /table.csv (An example table)
- /code.tex (An example code listing)
- /part.md (A file transclusion example)\stopmarkdown
-\stoptext
\usemodule[t][markdown]
+\setupmarkdown
+
+ [
+ contentBlocks = yes,
+ contentBlocksLanguageMap = language-map.json,
+ ]\definetyping [ConTeXt]
+\setuptyping [ConTeXt] [option=TEX]
+\starttext
+\startmarkdown
+
+ /table.csv (An example table)
+ /code.tex (An example code listing)
+ /part.md (A file transclusion example)\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -1017,8 +1012,8 @@ contain the following text:Table 1: An example table
-+\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
This is a transcluded markdown document.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new({finalizeCache = true, frozenCacheFileName = "cache.tex"})
- local input = "Hello *world*!"
- tex.sprint(convert(input)) }\bye
\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new({finalizeCache = true, frozenCacheFileName = "cache.tex"})
+ local input = "Hello *world*!"
+ tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-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 in the cache.tex
output file as we requested using
@@ -1082,18 +1077,18 @@ options.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input hello
-\bye
\input markdown
+\input hello
+\bye
Using a text editor, create a text document named
hello.md
with the following content:
Hello *world*!
Hello *world*!
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ finalizeCache=true frozenCacheFileName=cache.tex -- hello.md hello.tex
-luatex document.tex
texlua ⟨CLI pathname⟩ finalizeCache=true frozenCacheFileName=cache.tex -- hello.md hello.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -1112,17 +1107,17 @@ options.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\def\markdownOptionFinalizeCache{true}
-\def\markdownOptionFrozenCacheFileName{cache.tex}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFinalizeCache{true}
+\def\markdownOptionFrozenCacheFileName{cache.tex}
+\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 in the cache.tex
output file as we requested using
@@ -1130,17 +1125,17 @@ the finalizeCache
and frozenCacheFileName
options.
Next, create a new text document frozen-document.tex
with the following content:
\input markdown
-\def\markdownOptionFrozenCache{true}
-\def\markdownOptionFrozenCacheFileName{cache.tex}
-\markdownBegin
-
- Hi *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFrozenCache{true}
+\def\markdownOptionFrozenCacheFileName{cache.tex}
+\markdownBegin
+
+ Hi *world*!\markdownEnd
+\bye
Last, invoke pdfTeX without shell access from the terminal:
-pdftex -no-shell-escape frozen-document.tex
pdftex -no-shell-escape frozen-document.tex
A PDF document named frozen-document.pdf
should be
produced and contain the text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -1152,17 +1147,17 @@ 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[frozenCacheFileName=cache.tex]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
\documentclass[finalizecache]{article}
+\usepackage[frozenCacheFileName=cache.tex]{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 in the cache.tex
output file as we requested using
@@ -1170,17 +1165,17 @@ the finalizecache
and frozenCacheFileName
options.
Next, create a new text document frozen-document.tex
with the following content:
\documentclass[frozencache]{article}
-\usepackage[frozenCacheFileName=cache.tex]{markdown}
-\begin{document}
-\begin{markdown}
-
- Hi *world*!\end{markdown}
-\end{document}
\documentclass[frozencache]{article}
+\usepackage[frozenCacheFileName=cache.tex]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hi *world*!\end{markdown}
+\end{document}
Last, invoke pdfTeX without shell access from the terminal:
-pdflatex -no-shell-escape frozen-document.tex
pdflatex -no-shell-escape frozen-document.tex
A PDF document named frozen-document.pdf
should be
produced and contain the text “Hello world!” Since we used the
contents of the frozen cache using the frozencache
option,
@@ -1192,43 +1187,43 @@ reflected.
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
+\setupmarkdown
+
+ [
+ finalizeCache = yes,
+ frozenCacheFileName = cache.tex,
+ ]\starttext
+\startmarkdown
+
+ Hello *world*!\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced in the cache.tex
output file as we requested using
+the finalizeCache
and frozenCacheFileName
+options.
Next, create a new text document frozen-document.tex
+with the following content:
\usemodule[t][markdown]
\setupmarkdown
- [
+ finalizeCache = yes,
frozenCache = yes,
frozenCacheFileName = cache.tex,
]\starttext
\startmarkdown
-
+ Hello *world*!
Hi *world*!\stopmarkdown
\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced in the cache.tex
output file as we requested using
-the finalizeCache
and frozenCacheFileName
-options.
Next, create a new text document frozen-document.tex
-with the following content:
\usemodule[t][markdown]
-\setupmarkdown
-
- [
- frozenCache = yes,
- frozenCacheFileName = cache.tex,
- ]\starttext
-\startmarkdown
-
- Hi *world*!\stopmarkdown
-\stoptext
Last, invoke pdfTeX without shell access from the terminal:
-texexec --passon=--no-shell-escape frozen-document.tex
context frozen-document.tex
A PDF document named frozen-document.pdf
should be
produced and contain the text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -1260,27 +1255,27 @@ blockquote.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input lmfonts
-\directlua{
-
- local markdown = require("markdown")
- local newline = [[^^J^^J]]
- local convert, input
-
- convert = markdown.new()
- input = "A paragraph." .. newline ..
- "> A quote." .. newline
- tex.sprint(convert(input))
-
- convert = markdown.new({blankBeforeBlockquote = true})
- input = "A paragraph." .. newline ..
- "> Not a quote." .. newline
- tex.sprint(convert(input)) }\bye
\input markdown
+\input lmfonts
+\directlua{
+
+ local markdown = require("markdown")
+ local newline = [[^^J^^J]]
+ local convert, input
+
+ convert = markdown.new()
+ input = "A paragraph." .. newline ..
+ "> A quote." .. newline
+ tex.sprint(convert(input))
+
+ convert = markdown.new({blankBeforeBlockquote = true})
+ input = "A paragraph." .. newline ..
+ "> Not a quote." .. newline
+ tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -1293,22 +1288,22 @@ 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 -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- A paragraph.> A quote?
+ A paragraph.> A quote?
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -1331,24 +1326,24 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - A paragraph. - > A quote.\markdownEnd - -\def\markdownOptionBlankBeforeBlockquote{true} -\markdownBegin - - A paragraph. - > Not a quote.\markdownEnd - -\bye
\input markdown + +\markdownBegin + + A paragraph. + > A quote.\markdownEnd + +\def\markdownOptionBlankBeforeBlockquote{true} +\markdownBegin + + A paragraph. + > Not a quote.\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1362,25 +1357,25 @@ 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} - - A paragraph. - > A quote.\end{markdown} - -\begin{markdown*}{blankBeforeBlockquote} - - A paragraph. - > Not a quote.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + > A quote.\end{markdown} + +\begin{markdown*}{blankBeforeBlockquote} + + A paragraph. + > Not a quote.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1394,25 +1389,25 @@ 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 - - A paragraph. - > A quote.\stopmarkdown - -\setupmarkdown[blankBeforeBlockquote = yes] -\startmarkdown - - A paragraph. - > Not a quote.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + A paragraph. + > A quote.\stopmarkdown + +\setupmarkdown[blankBeforeBlockquote = yes] +\startmarkdown + + A paragraph. + > Not a quote.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1446,32 +1441,32 @@ fenced code block.Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new({fencedCode = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "A fenced code." .. newline .. - "```" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({ - fencedCode = true, blankBeforeCodeFence = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "Not a fenced code." .. newline .. - "```" .. newline - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert, input + + convert = markdown.new({fencedCode = true}) + input = "A paragraph." .. newline .. + "```" .. newline .. + "A fenced code." .. newline .. + "```" .. newline + tex.sprint(convert(input)) + + convert = markdown.new({ + fencedCode = true, blankBeforeCodeFence = true}) + input = "A paragraph." .. newline .. + "```" .. newline .. + "Not a fenced code." .. newline .. + "```" .. newline + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1482,24 +1477,24 @@ 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 -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- A paragraph.``` -A code fence? -```
+ A paragraph.``` +A code fence? +```
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -1520,29 +1515,29 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:-\input markdown -\def\markdownOptionFencedCode{true} - -\markdownBegin - - A paragraph. - ``` - A fenced code. - ```\markdownEnd - -\def\markdownOptionBlankBeforeCodeFence{true} -\markdownBegin - - A paragraph. - ``` - Not a fenced code. - ```\markdownEnd - -\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
+\input markdown +\def\markdownOptionFencedCode{true} + +\markdownBegin + + A paragraph. + ``` + A fenced code. + ```\markdownEnd + +\def\markdownOptionBlankBeforeCodeFence{true} +\markdownBegin + + A paragraph. + ``` + Not a fenced code. + ```\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:@@ -1554,29 +1549,29 @@ 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[fencedCode]{markdown} -\begin{document} - -\begin{markdown} - - A paragraph. - ``` - A fenced code. - ```\end{markdown} - -\begin{markdown*}{blankBeforeCodeFence} - - A paragraph. - ``` - Not a fenced code. - ```\end{markdown*} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[fencedCode]{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + ``` + A fenced code. + ```\end{markdown} + +\begin{markdown*}{blankBeforeCodeFence} + + A paragraph. + ``` + Not a fenced code. + ```\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:@@ -1588,30 +1583,30 @@ 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[fencedCode = yes] -\starttext - -\startmarkdown - - A paragraph. - ``` - A fenced code. - ```\stopmarkdown - -\setupmarkdown[blankBeforeCodeFence = yes] -\startmarkdown - - A paragraph. - ``` - Not a fenced code. - ```\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[fencedCode = yes] +\starttext + +\startmarkdown + + A paragraph. + ``` + A fenced code. + ```\stopmarkdown + +\setupmarkdown[blankBeforeCodeFence = yes] +\startmarkdown + + A paragraph. + ``` + Not a fenced code. + ```\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:@@ -1643,31 +1638,31 @@ div. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[fencedDivs]{markdown} -\begin{document} - -\begin{markdown} - - A paragraph. - - ::: {.identifier} - A fenced div. - :::\end{markdown} - -\begin{markdown*}{blankBeforeDivFence} - - A paragraph. - - ::: {.identifier} - Not a fenced div. - :::\end{markdown*} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[fencedDivs]{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + + ::: {.identifier} + A fenced div. + :::\end{markdown} + +\begin{markdown*}{blankBeforeDivFence} + + A paragraph. + + ::: {.identifier} + Not a fenced div. + :::\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:@@ -1700,30 +1695,30 @@ header.Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\def\markdownRendererHeadingOne#1{{\bf #1}\par} -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "A paragraph." .. newline .. - "A heading." .. newline .. - "==========" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({blankBeforeHeading = true}) - input = "A paragraph." .. newline .. - "Not a heading." .. newline .. - "==============" .. newline - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\def\markdownRendererHeadingOne#1{{\bf #1}\par} +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert, input + + convert = markdown.new() + input = "A paragraph." .. newline .. + "A heading." .. newline .. + "==========" .. newline + tex.sprint(convert(input)) + + convert = markdown.new({blankBeforeHeading = true}) + input = "A paragraph." .. newline .. + "Not a heading." .. newline .. + "==============" .. newline + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1734,23 +1729,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 -\input lmfonts -\input optionfalse -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- A paragraph. - A heading?==========
+ A paragraph. + A heading?==========
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -1771,26 +1766,26 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - A paragraph. - A heading. - ==========\markdownEnd - -\def\markdownOptionBlankBeforeHeading{true} -\markdownBegin - - A paragraph. - Not a heading. - ==============\markdownEnd - -\bye
\input markdown + +\markdownBegin + + A paragraph. + A heading. + ==========\markdownEnd + +\def\markdownOptionBlankBeforeHeading{true} +\markdownBegin + + A paragraph. + Not a heading. + ==============\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1802,27 +1797,27 @@ 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} - - A paragraph. - A heading. - ==========\end{markdown} - -\begin{markdown*}{blankBeforeHeading} - - A paragraph. - Not a heading. - ==============\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + A paragraph. + A heading. + ==========\end{markdown} + +\begin{markdown*}{blankBeforeHeading} + + A paragraph. + Not a heading. + ==============\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1834,29 +1829,29 @@ 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 - - A paragraph. - A heading. - ==========\stopmarkdown - -\setupmarkdown[blankBeforeHeading = yes] -\startmarkdown - - A paragraph. - Not a heading. - ==============\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
--context document.tex
A PDF document named
+document.pdf
should be produced and -contain the following text:+\usemodule[t][markdown] +\starttext + +\startmarkdown + + A paragraph. + A heading. + ==========\stopmarkdown + +\setupmarkdown[blankBeforeHeading = yes] +\startmarkdown + + A paragraph. + Not a heading. + ==============\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
document.pdf
should be produced and +contain the following text:A paragraph.
A heading.
@@ -1874,8 +1869,8 @@ class="header-section-number">2.2.1.9 OptionEnable the Pandoc bracketed span syntax extension:
-+[This is *some text*]{.class key=val}
@@ -1892,44 +1887,44 @@ class="sourceCode md">[This is *some text*]{.class key=val}
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[bracketedSpans]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\markdownSetup{ - - renderers = { - bracketedSpanAttributeContextBegin = {\group_begin: - \color_group_begin: - \markdownSetup{ - - renderers = { - attributeKeyValue = {\str_if_eq:nnT - - { ##1 } - { color } - {\color_select:n { ##2 } - - } - }, - }, - } - }, - bracketedSpanAttributeContextEnd = {\color_group_end: - \group_end: - - }, - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} - - Here is some [colored text]{color=red}.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[bracketedSpans]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\markdownSetup{ + + renderers = { + bracketedSpanAttributeContextBegin = {\group_begin: + \color_group_begin: + \markdownSetup{ + + renderers = { + attributeKeyValue = {\str_if_eq:nnT + + { ##1 } + { color } + {\color_select:n { ##2 } + + } + }, + }, + } + }, + bracketedSpanAttributeContextEnd = {\color_group_end: + \group_end: + + }, + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} + + Here is some [colored text]{color=red}.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1957,28 +1952,28 @@ class="header-section-number">2.2.1.10 OptionLua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\def\markdownRendererHeadingOne#1{{\bf #1}\par} -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "> A single" .. newline .. newline .. - "> block quote." .. newline - tex.sprint(convert(input)) - - convert = markdown.new({breakableBlockquotes = true}) - input = "> A block quote." .. newline .. newline .. - "> Another block quote." .. newline - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\def\markdownRendererHeadingOne#1{{\bf #1}\par} +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert, input + + convert = markdown.new() + input = "> A single" .. newline .. newline .. + "> block quote." .. newline + tex.sprint(convert(input)) + + convert = markdown.new({breakableBlockquotes = true}) + input = "> A block quote." .. newline .. newline .. + "> Another block quote." .. newline + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -1995,23 +1990,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 -\input lmfonts -\input optionfalse -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+> A single block quote - -> or two block quotes?
> A single block quote + +> or two block quotes?
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -2038,26 +2033,26 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - > A single - - > block quote.\markdownEnd - -\def\markdownOptionBreakableBlockquotes{true} -\markdownBegin - - > A block quote. - - > Another block quote.\markdownEnd - -\bye
\input markdown + +\markdownBegin + + > A single + + > block quote.\markdownEnd + +\def\markdownOptionBreakableBlockquotes{true} +\markdownBegin + + > A block quote. + + > Another block quote.\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2075,27 +2070,27 @@ 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} - - > A single - - > block quote.\end{markdown} - -\begin{markdown*}{breakableBlockquotes} - - > A block quote. - - > Another block quote.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + > A single + + > block quote.\end{markdown} + +\begin{markdown*}{breakableBlockquotes} + + > A block quote. + + > Another block quote.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2113,27 +2108,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 - - > A single - - > block quote.\stopmarkdown - -\setupmarkdown[breakableBlockquotes = yes] -\startmarkdown - - > A block quote. - - > Another block quote.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + > A single + + > block quote.\stopmarkdown + +\setupmarkdown[breakableBlockquotes = yes] +\startmarkdown + + > A block quote. + + > Another block quote.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2173,37 +2168,37 @@ syntax extension. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.bib
with the following content:+@book{knuth:tex, -author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} - -\begin{markdown*}{citationNbsps = false} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown*} - -\bibliographystyle{plain} -\bibliography{document.bib} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} + +\begin{markdown*}{citationNbsps = false} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown*} + +\bibliographystyle{plain} +\bibliography{document.bib} +\end{document}
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
@@ -2228,20 +2223,20 @@ class="header-section-number">2.2.1.12 Optiondocument.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:Enable the Pandoc citation syntax extension:
-+[@doe99] and here - Here is a simple parenthetical citation - is a string of several [see @doe99, pp. 33-35; also - @smith04, chap. 1]. -[prenote @doe99] and - A parenthetical citation can have a [@smith04 postnote]. The name of the author can be - a - suppressed by inserting a dash before the name of an[-@smith04]. - author as follows - - Here is a simple text citation @doe99 and here is - a string of several @doe99 [pp. 33-35; also @smith04, - chap. 1]. Here is one with the name of the author suppressed -@doe99.
@@ -2258,34 +2253,34 @@ class="sourceCode md">[@doe99] and here + Here is a simple parenthetical citation + is a string of several [see @doe99, pp. 33-35; also + @smith04, chap. 1]. +[prenote @doe99] and + A parenthetical citation can have a [@smith04 postnote]. The name of the author can be + a + suppressed by inserting a dash before the name of an[-@smith04]. + author as follows + + Here is a simple text citation @doe99 and here is + a string of several @doe99 [pp. 33-35; also @smith04, + chap. 1]. Here is one with the name of the author suppressed -@doe99.
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[backend=biber]{biblatex} -\addbibresource{document.bib} -\usepackage[citations]{markdown} -\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.\end{markdown} - -\printbibliography -\end{document}
\documentclass{article} +\usepackage[backend=biber]{biblatex} +\addbibresource{document.bib} +\usepackage[citations]{markdown} +\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.\end{markdown} + +\printbibliography +\end{document}
Next, invoke LuaTeX and Biber from the terminal:
-+lualatex document.tex -biber document.bcf -lualatex document.tex -lualatex document.tex
lualatex document.tex +biber document.bcf +lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2307,9 +2302,9 @@ class="header-section-number">2.2.1.13 Optiontrue @@ -2327,28 +2322,28 @@ quotation mark ligatures in texts that do not contain code spans: Enable the code span syntax:
-+`printf()` function. - Use the `There is a literal backtick (`) here.`` `
`printf()` function. + Use the `There is a literal backtick (`) here.`` `
Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local input = - "``This is a code span.'' " .. - "``This is no longer a code span.''" - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({codeSpans = false}) - local input = - "``This is a quote.'' " .. - "``This is another quote.''" - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local input = + "``This is a code span.'' " .. + "``This is no longer a code span.''" + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({codeSpans = false}) + local input = + "``This is a quote.'' " .. + "``This is another quote.''" + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2359,22 +2354,22 @@ span.’’Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+``Is this a code span?'' ``Or a quote?''
``Is this a code span?'' ``Or a quote?''
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -2394,24 +2389,24 @@ contain the following text:Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\markdownBegin - - ``This is a code span.'' - ``This is no longer a code span.''\markdownEnd - -\def\markdownOptionCodeSpans{false} -\markdownBegin - - ``This is a quote.'' - ``This is another quote.''\markdownEnd - -\bye
\input markdown + +\markdownBegin + + ``This is a code span.'' + ``This is no longer a code span.''\markdownEnd + +\def\markdownOptionCodeSpans{false} +\markdownBegin + + ``This is a quote.'' + ``This is another quote.''\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2423,25 +2418,25 @@ span.’’ 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} - - ``This is a code span.'' - ``This is no longer a code span.''\end{markdown} - -\begin{markdown*}{codeSpans=false} - - ``This is a quote.'' - ``This is another quote.''\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + ``This is a code span.'' + ``This is no longer a code span.''\end{markdown} + +\begin{markdown*}{codeSpans=false} + + ``This is a quote.'' + ``This is another quote.''\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2453,25 +2448,25 @@ span.’’ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\starttext - -\startmarkdown - - ``This is a code span.'' - ``This is no longer a code span.''\stopmarkdown - -\setupmarkdown[codeSpans = no] -\startmarkdown - - ``This is a quote.'' - ``This is another quote.''\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\starttext + +\startmarkdown + + ``This is a code span.'' + ``This is no longer a code span.''\stopmarkdown + +\setupmarkdown[codeSpans = no] +\startmarkdown + + ``This is a quote.'' + ``This is another quote.''\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2489,13 +2484,13 @@ class="header-section-number">2.2.1.14 Optiontrue @@ -2518,34 +2513,34 @@ Marie,Curie,1867 Thomas,Edison,1847 Enable the iA Writer content blocks syntax extension:
-+- http://example.com/minard.jpg (Napoleon's - disastrous Russian campaign of 1812) - /Flowchart.png "Engineering Flowchart" - /Savings Account.csv 'Recent Transactions' - /Example.swift /Lorem Ipsum.txt
+ http://example.com/minard.jpg (Napoleon's + disastrous Russian campaign of 1812) + /Flowchart.png "Engineering Flowchart" + /Savings Account.csv 'Recent Transactions' + /Example.swift /Lorem Ipsum.txt
Create also a text document named
-markdown-languages.json
with the following content:+- {"tex": "LaTeX" - }
+ {"tex": "LaTeX" + }
Create also a text document named
-code.tex
with the following content:+\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
Create also a text document named
-part.md
with the following content:+This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{minted} -\usepackage[contentBlocks]{markdown} -\begin{document} -\begin{markdown} - - /table.csv (An example table) - /code.tex (An example code listing) - /part.md (A file transclusion example)\end{markdown} -\end{document}
\documentclass{article} +\usepackage{minted} +\usepackage[contentBlocks]{markdown} +\begin{document} +\begin{markdown} + + /table.csv (An example table) + /code.tex (An example code listing) + /part.md (A file transclusion example)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2576,8 +2571,8 @@ contain the following text:Table 1: An example table
-+\LaTeX. This is an example code listing in
\LaTeX. This is an example code listing in
This is a transcluded markdown document.
Con
Create also a text document named
-markdown-languages.json
with the following content:+- {"tex": "ConTeXt" - }
+ {"tex": "ConTeXt" + }
Create also a text document named
-code.tex
with the following content:+\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
Create also a text document named
-part.md
with the following content:+This is a *transcluded markdown document*.
This is a *transcluded markdown document*.
Create also a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[contentBlocks = yes] -\definetyping [ConTeXt] -\setuptyping [ConTeXt] [option=TEX] -\starttext -\startmarkdown - - /table.csv (An example table) - /code.tex (An example code listing) - /part.md (A file transclusion example)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[contentBlocks = yes] +\definetyping [ConTeXt] +\setuptyping [ConTeXt] [option=TEX] +\starttext +\startmarkdown + + /table.csv (An example table) + /code.tex (An example code listing) + /part.md (A file transclusion example)\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2649,8 +2644,8 @@ contain the following text:Table 1: An example table
-+\ConTeXt. This is an example code listing in
\ConTeXt. This is an example code listing in
This is a transcluded markdown document.
class="latex">LaTeX Example
Using a text editor, create a text document named
-strike-through.lua
with the following content:+local strike_through = { -= 2, - api_version = 2, - grammar_version = function(reader) - finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") - local doubleslashes = lpeg.P("//") - local function between(p, starter, ender) - = lpeg.B(nonspacechar) * ender - ender return (starter * #nonspacechar - * lpeg.Ct(p * (p - ender)^0) * ender) - end - -local read_strike_through = between( - .V("Inline"), doubleslashes, doubleslashes - lpeg) / function(s) return {"\\st{", s, "}"} end - -.insert_pattern("Inline after Emph", read_strike_through, - reader"StrikeThrough") - .add_special_character("/") - readerend - } - -return strike_through
local strike_through = { += 2, + api_version = 2, + grammar_version = function(reader) + finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") + local doubleslashes = lpeg.P("//") + local function between(p, starter, ender) + = lpeg.B(nonspacechar) * ender + ender return (starter * #nonspacechar + * lpeg.Ct(p * (p - ender)^0) * ender) + end + +local read_strike_through = between( + .V("Inline"), doubleslashes, doubleslashes + lpeg) / function(s) return {"\\st{", s, "}"} end + +.insert_pattern("Inline after Emph", read_strike_through, + reader"StrikeThrough") + .add_special_character("/") + readerend + } + +return strike_through
Using a text editor, create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{soul} -\usepackage[extension = strike-through.lua, -markdown} - debugExtensions]{\begin{document} -\begin{markdown} - - This is //a lunar roving vehicle// strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{soul} +\usepackage[extension = strike-through.lua, +markdown} + debugExtensions]{\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:@@ -2736,40 +2731,40 @@ contain the following text:Furthermore, a JSON document named
-document.debug-extensions.json
should also be produced and contain the following text:+{ -"Block": [ - "Blockquote", - "Verbatim", - "ThematicBreak", - "BulletList", - "OrderedList", - "Heading", - "DisplayHtml", - "Paragraph", - "Plain" - ], - "Inline": [ - "Str", - "Space", - "Endline", - "UlOrStarLine", - "Strong", - "Emph", - "StrikeThrough (user-defined \"./strike-through.lua\" syntax extension)", - "Link", - "Image", - "Code", - "AutoLinkUrl", - "AutoLinkEmail", - "AutoLinkRelativeReference", - "InlineHtml", - "HtmlEntity", - "EscapedChar", - "Smart", - "Symbol" - ] - }
{ +"Block": [ + "Blockquote", + "Verbatim", + "ThematicBreak", + "BulletList", + "OrderedList", + "Heading", + "DisplayHtml", + "Paragraph", + "Plain" + ], + "Inline": [ + "Str", + "Space", + "Endline", + "UlOrStarLine", + "Strong", + "Emph", + "StrikeThrough (user-defined \"./strike-through.lua\" syntax extension)", + "Link", + "Image", + "Code", + "AutoLinkUrl", + "AutoLinkEmail", + "AutoLinkRelativeReference", + "InlineHtml", + "HtmlEntity", + "EscapedChar", + "Smart", + "Symbol" + ] + }
This output shows us that our user-defined syntax extension has been correctly inserted to the grammar of markdown.
2.2.1.16 Option
true @@ -2811,27 +2806,27 @@ class="sourceCode md"> Enable the pandoc definition list syntax extension:
-+- Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - { some code, part of Definition 2 } - - Third paragraph of definition 2.
+ Term 1 + + : Definition 1 + + Term 2 with *inline markup* + + : Definition 2 + { some code, part of Definition 2 } + + Third paragraph of definition 2.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[definitionLists]{markdown} -\begin{document} -\begin{markdown} - - Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[definitionLists]{markdown} +\begin{document} +\begin{markdown} + + Term 1 + + : Definition 1 + + Term 2 with *inline markup* + + : Definition 2 + + { some code, part of Definition 2 } + + Third paragraph of definition 2.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2852,27 +2847,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] -\setupmarkdown[definitionLists = yes] -\starttext -\startmarkdown - - Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2.\stopmarkdown -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[definitionLists = yes] +\starttext +\startmarkdown + + Term 1 + + : Definition 1 + + Term 2 with *inline markup* + + : Definition 2 + + { some code, part of Definition 2 } + + Third paragraph of definition 2.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -2927,12 +2922,12 @@ wheneagerCache
is disabled.Lua Module Example
Using a text editor, create a text document named
-hello.md
with the following content:+Hello *world*!
Hello *world*!
Next, invoke LuaTeX from the terminal with the
-eagerCache
option disabled:+texlua ⟨CLI pathname⟩ eagerCache=false -- hello.md hello.tex
texlua ⟨CLI pathname⟩ eagerCache=false -- hello.md hello.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 @@ -2945,23 +2940,23 @@ title="Kpathsea - TeX Users Group">Kpathsea.A TeX document named
-hello.tex
should be produced and contain the following code:+\markdownRendererEmphasis{world}!\relax Hello
\markdownRendererEmphasis{world}!\relax Hello
Invoke LuaTeX from the terminal again, this time with the
-eagerCache
option enabled:+texlua ⟨CLI pathname⟩ eagerCache=true -- hello.md hello.tex
texlua ⟨CLI pathname⟩ eagerCache=true -- hello.md hello.tex
A TeX document named
-hello.tex
should be produced and contain the following code:+\input ./⟨hash⟩.md.tex\relax
\input ./⟨hash⟩.md.tex\relax
Additionally, a TeX document named
-⟨hash⟩.md.tex
should be produced and contain the following code:+\markdownRendererEmphasis{world}!\relax Hello
\markdownRendererEmphasis{world}!\relax Hello
2.2.1.18 Option
@@ -2977,26 +2972,26 @@ then a markdown document may begin with yaml metadata if and only if the metadata begin with the end-of-directives marker (expectJekyllData
---
) and they end with either the end-of-directives or the end-of-document marker (...
): -+\documentclass{article} -\usepackage[jekyllData]{markdown} -\begin{document} -\begin{markdown} - - --- - - this - - is - - YAML - ... - - followed - - by - - Markdown\end{markdown} -\begin{markdown} - - - this - - is - - Markdown\end{markdown} -\end{document}
@@ -3007,25 +3002,25 @@ class="sourceCode latex">\documentclass{article} +\usepackage[jekyllData]{markdown} +\begin{document} +\begin{markdown} + + --- + - this + - is + - YAML + ... + - followed + - by + - Markdown\end{markdown} +\begin{markdown} + + - this + - is + - Markdown\end{markdown} +\end{document}
When the
jekyllData
option is enabled, then a markdown document may begin directly with yaml metadata and may contain nothing but yaml metadata. -+\documentclass{article} -\usepackage[jekyllData, expectJekyllData]{markdown} -\begin{document} -\begin{markdown} - - - this - - is - - YAML - ... - - followed - - by - - Markdown\end{markdown} -\begin{markdown} - - - this - - is - - YAML\end{markdown} -\end{document}
@@ -3034,29 +3029,29 @@ class="sourceCode latex">\documentclass{article} +\usepackage[jekyllData, expectJekyllData]{markdown} +\begin{document} +\begin{markdown} + + - this + - is + - YAML + ... + - followed + - by + - Markdown\end{markdown} +\begin{markdown} + + - this + - is + - YAML\end{markdown} +\end{document}
LaTeX Example
directory structure. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-jane-doe.yml
with the following content:+name: Jane Doe -age: 99
name: Jane Doe +age: 99
Using a text editor, create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} -\markdownInput[expectJekyllData]{jane-doe.yml} -\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} +\markdownInput[expectJekyllData]{jane-doe.yml} +\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:@@ -3079,44 +3074,44 @@ class="tex">TeXUsing a text editor, create a text document named
-strike-through.lua
with the following content:+local strike_through = { -= 2, - api_version = 2, - grammar_version = function(reader) - finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") - local doubleslashes = lpeg.P("//") - local function between(p, starter, ender) - = lpeg.B(nonspacechar) * ender - ender return (starter * #nonspacechar - * lpeg.Ct(p * (p - ender)^0) * ender) - end - -local read_strike_through = between( - .V("Inline"), doubleslashes, doubleslashes - lpeg) / function(s) return {"\\st{", s, "}"} end - -.insert_pattern("Inline after Emph", read_strike_through, - reader"StrikeThrough") - .add_special_character("/") - readerend - } - -return strike_through
local strike_through = { += 2, + api_version = 2, + grammar_version = function(reader) + finalize_grammar local nonspacechar = lpeg.P(1) - lpeg.S("\t ") + local doubleslashes = lpeg.P("//") + local function between(p, starter, ender) + = lpeg.B(nonspacechar) * ender + ender return (starter * #nonspacechar + * lpeg.Ct(p * (p - ender)^0) * ender) + end + +local read_strike_through = between( + .V("Inline"), doubleslashes, doubleslashes + lpeg) / function(s) return {"\\st{", s, "}"} end + +.insert_pattern("Inline after Emph", read_strike_through, + reader"StrikeThrough") + .add_special_character("/") + readerend + } + +return strike_through
Using a text editor, create also a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{soul} -\usepackage[extension = strike-through.lua]{markdown} -\begin{document} -\begin{markdown} - - This is //a lunar roving vehicle// strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{soul} +\usepackage[extension = strike-through.lua]{markdown} +\begin{document} +\begin{markdown} + + This is //a lunar roving vehicle// strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3134,10 +3129,10 @@ class="header-section-number">2.2.1.20 OptionEnable the Pandoc fancy list syntax extension:
-+- a) first item - b) second item c) third item
@@ -3154,20 +3149,20 @@ class="sourceCode md">+ a) first item + b) second item c) third item
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{minted} -\usepackage[fancyLists]{markdown} -\begin{document} -\begin{markdown} - - a) first item - b) second item - c) third item\end{markdown} -\end{document}
\documentclass{article} +\usepackage{minted} +\usepackage[fancyLists]{markdown} +\begin{document} +\begin{markdown} + + a) first item + b) second item + c) third item\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3181,19 +3176,19 @@ 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[fancyLists = yes] -\starttext -\startmarkdown - - a) first item - b) second item - c) third item\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[fancyLists = yes] +\starttext +\startmarkdown + + a) first item + b) second item + c) 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:@@ -3213,23 +3208,23 @@ class="header-section-number">2.2.1.21 Optiontrue @@ -3246,99 +3241,99 @@ class="sourceCode md"> Enable the commonmark fenced code block extension:
-+~~~ js -if (a > 3) { -moveShip(5 * gravity, DOWN); - - }~~~~~~ - -``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ```
~~~ js +if (a > 3) { +moveShip(5 * gravity, DOWN); + + }~~~~~~ + +``` html + <pre> + <code> + // Some comments + line 1 of code + line 2 of code + line 3 of code + </code> + </pre> + ```
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{minted} -\usepackage[fencedCode]{markdown} -\begin{document} -\begin{markdown} - - ~~~ js - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage{minted} +\usepackage[fencedCode]{markdown} +\begin{document} +\begin{markdown} + + ~~~ js + if (a > 3) { + moveShip(5 * gravity, DOWN); + } + ~~~~~~ + + ``` html + <pre> + <code> + // Some comments + line 1 of code + line 2 of code + line 3 of code + </code> + </pre> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--if (a > 3) { -moveShip(5 * gravity, DOWN); - }
+<pre> -<code> - - // Some comments - line 1 of code - line 2 of code - line 3 of code</code> - </pre>
+if (a > 3) { +moveShip(5 * gravity, DOWN); + }
<pre> +<code> + + // Some comments + line 1 of code + line 2 of code + line 3 of code</code> + </pre>
ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[fencedCode = yes] -\definetyping [js] -\definetyping [html] -\setuptyping [html] [option=XML] -\starttext -\startmarkdown - - ~~~ js - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ```\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[fencedCode = yes] +\definetyping [js] +\definetyping [html] +\setuptyping [html] [option=XML] +\starttext +\startmarkdown + + ~~~ js + if (a > 3) { + moveShip(5 * gravity, DOWN); + } + ~~~~~~ + + ``` html + <pre> + <code> + // Some comments + line 1 of code + line 2 of code + line 3 of code + </code> + </pre> + ```\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--if (a > 3) { -moveShip(5 * gravity, DOWN); - }
+<pre> -<code> - - // Some comments - line 1 of code - line 2 of code - line 3 of code</code> - </pre>
+if (a > 3) { +moveShip(5 * gravity, DOWN); + }
<pre> +<code> + + // Some comments + line 1 of code + line 2 of code + line 3 of code</code> + </pre>
2.2.1.22 Option @@ -3353,12 +3348,12 @@ class="header-section-number">2.2.1.22 Option
Enable the Pandoc fenced code attribute syntax extension:
-+~~~~ {#mycode .haskell .numberLines startFrom=100} -qsort [] = [] -qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ - qsort (filter (>= x) xs) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -3375,40 +3370,40 @@ class="sourceCode md">~~~~ {#mycode .haskell .numberLines startFrom=100} +qsort [] = [] +qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ + qsort (filter (>= x) xs) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\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}
\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:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3427,12 +3422,12 @@ class="header-section-number">2.2.1.23 OptionEnable the Pandoc fenced div syntax extension:
-+- ::::: {#special .sidebar} - Here is a paragraph. - - And another. :::::
@@ -3449,23 +3444,23 @@ class="sourceCode md">+ ::::: {#special .sidebar} + Here is a paragraph. + + And another. :::::
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[fencedDivs]{markdown} -\begin{document} -\begin{markdown}{slice=special} - - Here is a regular paragraph. - - ::::: {#special} - Here is a special paragraph. - ::::: - - And here is another regular paragraph.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[fencedDivs]{markdown} +\begin{document} +\begin{markdown}{slice=special} + + Here is a regular paragraph. + + ::::: {#special} + Here is a special paragraph. + ::::: + + And here is another regular paragraph.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3495,31 +3490,31 @@ not be reflected. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionFinalizeCache{true} -\markdownBegin - - Hello *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionFinalizeCache{true} +\markdownBegin + + Hello *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!” A frozen cache will also be produced as we requested using thefinalizeCache
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 @@ -3531,33 +3526,33 @@ in the content of the markdown document from “Hello world!” to class="latex">LaTeX ExampleUsing 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 thefinalizecache
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 @@ -3569,33 +3564,33 @@ in the content of the markdown document from “Hello world!” to class="tex">TeXt ExampleUsing 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
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the text “Hello world!” A frozen cache will also be +produced in thecache.tex
output file as we requested using +thefinalizeCache
option.Next, change the content of
document.tex
as follows:-\usemodule[t][markdown] -\setupmarkdown[finalizeCache = yes] +\setupmarkdown[frozenCache = yes] \starttext \startmarkdown - + Hello *world*! Hi *world*!\stopmarkdown \stoptext
Next, invoke LuaTeX from the terminal:
+Last, invoke pdfTeX without shell access from the terminal:
-context document.tex
A PDF document named
-document.pdf
should be produced and -contain the text “Hello world!” A frozen cache will also be -produced in thecache.tex
output file as we requested using -thefinalizeCache
option.Next, change the content of
-document.tex
as follows:-\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
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 @@ -3623,19 +3618,19 @@ markdown document number ⟨number⟩.Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\directlua{ - - local markdown = require("markdown") - local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0}) - local firstInput = "Hello" - local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1}) - local secondInput = "*world*!" - tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
\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
class="latex">LaTeX Exampledocument.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 @@ -3667,29 +3662,29 @@ of spaces.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:@@ -3710,10 +3705,10 @@ class="header-section-number">2.2.1.27 Option@@ -3731,27 +3726,27 @@ markers. class="latex">LaTeX Example 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:@@ -3768,27 +3763,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:@@ -3812,13 +3807,13 @@ class="header-section-number">2.2.1.28 Optiontrue @@ -3861,33 +3856,33 @@ will be rendered as plain text. 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}===================
Lua Module Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local newline = [[^^J^^J]] - local input = - "<div>*There is no block tag support.*</div>" .. newline .. - "*There is no <inline tag="tag"></inline> support.*" .. newline .. - "_There is no <!-- comment --> support._" .. newline .. - "_There is no <? HTML instruction ?> support._" - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({html = true}) - local input = - "<div>*There is block tag support.*</div>" .. newline .. - "*There is <inline tag="tag"></inline> support.*" .. newline .. - "_There is <!-- comment --> support._" .. newline .. - "_There is <? HTML instruction ?> support._" - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local newline = [[^^J^^J]] + local input = + "<div>*There is no block tag support.*</div>" .. newline .. + "*There is no <inline tag="tag"></inline> support.*" .. newline .. + "_There is no <!-- comment --> support._" .. newline .. + "_There is no <? HTML instruction ?> support._" + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({html = true}) + local input = + "<div>*There is block tag support.*</div>" .. newline .. + "*There is <inline tag="tag"></inline> support.*" .. newline .. + "_There is <!-- comment --> support._" .. newline .. + "_There is <? HTML instruction ?> support._" + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3900,27 +3895,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
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -3942,33 +3937,73 @@ contain the following text:Using a text editor, create a text document named
+document.tex
with the following content:+\input markdown +\input lmfonts + +\markdownBegin + + <div> + *There is no block tag support.* + </div> + *There is no <inline tag="tag"></inline> support.* + _There is no <!-- comment --> support._ + _There is no <? HTML instruction ?> support._\markdownEnd + +\def\markdownOptionHtml{true} +\markdownBegin + + <div> + *There is block tag support.* + </div> + *There is <inline tag="tag"></inline> support.* + _There is <!-- comment --> support._ + _There is <? HTML instruction ?> support._\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++<div>There is no block tag support.</div> There is no +<inline tag=”tag”></inline> support. There is no <!– +comment –> support. There is no <? HTML instruction ?> +support.
+There is support. There is support. There is support.
+LaTeX Example
+Using a text editor, create a text document named +
document.tex
with the following content:+\end{document}\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 +class="sourceCode tex">
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + <div> + *There is no block tag support.* + </div> + *There is no <inline tag="tag"></inline> support.* + _There is no <!-- comment --> support._ + _There is no <? HTML instruction ?> support._\end{markdown} + +\begin{markdown*}{html} <div> *There is block tag support.* </div> *There is <inline tag="tag"></inline> support.* _There is <!-- comment --> support._ - _There is <? HTML instruction ?> support._\markdownEnd +\end{markdown*} -\bye
Next, invoke LuaTeX from the terminal:
+class="sourceCode sh">luatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -3978,77 +4013,37 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
LaTeX Example
+ConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:+\stoptext\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} +class="sourceCode tex">
\usemodule[t][markdown] +\starttext + +\startmarkdown + + <div> + *There is no block tag support.* + </div> + *There is no <inline tag="tag"></inline> support.* + _There is no <!-- comment --> support._ + _There is no <? HTML instruction ?> support._\stopmarkdown + +\setupmarkdown[html = yes] +\startmarkdown <div> *There is block tag support.* </div> *There is <inline tag="tag"></inline> support.* _There is <!-- comment --> support._ - _There is <? HTML instruction ?> support._\end{markdown*} +\stopmarkdown -\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
A PDF document named
-document.pdf
should be produced and -contain the following text:--<div>There is no block tag support.</div> There is no -<inline tag=”tag”></inline> support. There is no <!– -comment –> support. There is no <? HTML instruction ?> -support.
-There is support. There is support. There is support.
-ConTeXt Example
-Using a text editor, create a text document named -
-document.tex
with the following content:-\usemodule[t][markdown] -\starttext - -\startmarkdown - - <div> - *There is no block tag support.* - </div> - *There is no <inline tag="tag"></inline> support.* - _There is no <!-- comment --> support._ - _There is no <? HTML instruction ?> support._\stopmarkdown - -\setupmarkdown[html = yes] -\startmarkdown - - <div> - *There is block tag support.* - </div> - *There is <inline tag="tag"></inline> support.* - _There is <!-- comment --> support._ - _There is <? HTML instruction ?> support._\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+class="sourceCode sh">context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4095,27 +4090,27 @@ prepared with this package in mind. ExampleUsing 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:@@ -4126,25 +4121,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
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -4165,23 +4160,23 @@ contain the following text: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:@@ -4193,23 +4188,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:@@ -4221,23 +4216,23 @@ 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:@@ -4258,8 +4253,8 @@ class="header-section-number">2.2.1.31 OptionEnable the Pandoc inline code span attribute extension:
-+`<$>`{.haskell}
@@ -4276,44 +4271,44 @@ class="sourceCode md">`<$>`{.haskell}
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[inlineCodeAttributes]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\markdownSetup{ - - renderers = { - codeSpanAttributeContextBegin = {\group_begin: - \color_group_begin: - \markdownSetup{ - - renderers = { - attributeKeyValue = {\str_if_eq:nnT - - { ##1 } - { color } - {\color_select:n { ##2 } - - } - }, - }, - } - }, - codeSpanAttributeContextEnd = {\color_group_end: - \group_end: - - }, - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} - - Here is some `colored text`{color=red}.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[inlineCodeAttributes]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\markdownSetup{ + + renderers = { + codeSpanAttributeContextBegin = {\group_begin: + \color_group_begin: + \markdownSetup{ + + renderers = { + attributeKeyValue = {\str_if_eq:nnT + + { ##1 } + { color } + {\color_select:n { ##2 } + + } + }, + }, + } + }, + codeSpanAttributeContextEnd = {\color_group_end: + \group_end: + + }, + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} + + Here is some `colored text`{color=red}.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4332,10 +4327,10 @@ class="header-section-number">2.2.1.32 OptionEnable 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.]
@@ -4352,19 +4347,19 @@ class="sourceCode md">+ Here is an inline note.^[Inlines notes are easier to + write, since you don't have to pick an identifier and move down to type the note.]
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:@@ -4375,19 +4370,19 @@ 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:@@ -4407,18 +4402,18 @@ class="header-section-number">2.2.1.33 Option href="https://pandoc.org/MANUAL.html#extension-yaml_metadata_block">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.---
@@ -4436,29 +4431,29 @@ for entering metadata in yaml. class="tex">TeX Example--- +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:@@ -4468,31 +4463,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:@@ -4502,32 +4497,32 @@ 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:@@ -4545,11 +4540,11 @@ class="header-section-number">2.2.1.34 OptionEnable the Pandoc link and image attribute syntax extension:
-+![image](foo.jpg){#id .class width=30 height=20px} - An inline ![image][ref] with attributes. - and a reference -[ref]: foo.jpg "optional title" {#id .class key=val key2=val2}
@@ -4566,41 +4561,41 @@ class="sourceCode md">![image](foo.jpg){#id .class width=30 height=20px} + An inline ![image][ref] with attributes. + and a reference +[ref]: foo.jpg "optional title" {#id .class key=val key2=val2}
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[linkAttributes]{markdown} -\usepackage{expl3, graphicx} -\ExplSyntaxOn -\markdownSetup{ - - renderers = { - imageAttributeContextBegin = {\group_begin: - \markdownSetup{ - - renderers = { - attributeKeyValue = {\setkeys - - { Gin } - { { ##1 } = { ##2 } } - }, - }, - } - }, - imageAttributeContextEnd = {\group_end: - - }, - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} - - Here is an example image: - - ![example image](example-image){width=5cm height=4cm}\end{markdown} -\end{document}
\documentclass{article} +\usepackage[linkAttributes]{markdown} +\usepackage{expl3, graphicx} +\ExplSyntaxOn +\markdownSetup{ + + renderers = { + imageAttributeContextBegin = {\group_begin: + \markdownSetup{ + + renderers = { + attributeKeyValue = {\setkeys + + { Gin } + { { ##1 } = { ##2 } } + }, + }, + } + }, + imageAttributeContextEnd = {\group_end: + + }, + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} + + Here is an example image: + + ![example image](example-image){width=5cm height=4cm}\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
class="tex">TeXt Exampledocument.pdf
should be produced and contain an example image (from Martin Scharrer’s mwe @@ -4617,12 +4612,12 @@ class="header-section-number">2.2.1.35 OptionEnable the Pandoc line block syntax extension:
-+- | this is a line block that - | spans multiple - | even - discontinuous | lines
@@ -4639,19 +4634,19 @@ class="sourceCode md">+ | this is a line block that + | spans multiple + | even + discontinuous | lines
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
\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
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4664,20 +4659,20 @@ Tread softly because you tread on my dreams. class="latex">LaTeX ExampleUsing 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}
\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
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4690,20 +4685,20 @@ Tread softly because you tread on my dreams. class="tex">TeXt ExampleUsing 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
\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
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4724,24 +4719,24 @@ class="header-section-number">2.2.1.36 OptionEnable 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.
@@ -4758,33 +4753,33 @@ class="sourceCode md">[^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:@@ -4799,33 +4794,33 @@ indented.Using a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\starttext -\startmarkdown - - Here is a note reference,[^1] and another.[^longnote] - - [^1]: Here is the note. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous note. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented.\stopmarkdown -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\starttext +\startmarkdown + + Here is a note reference,[^1] and another.[^longnote] + + [^1]: Here is the note. + + [^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + belong to the previous note. + + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + This paragraph won't be part of the note, because it + isn't indented.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4846,12 +4841,12 @@ class="header-section-number">2.2.1.37 Optiontrue @@ -4869,21 +4864,21 @@ extension. class="latex">LaTeX Example 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 |
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:@@ -4922,21 +4917,21 @@ 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[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:@@ -5005,20 +5000,20 @@ class="header-section-number">2.2.1.39 OptionEnable 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
class="latex">LaTeX ExamplerawAttribute
option is a good alternative to thehybrid
option. Unlike thehybrid
option, which affects the @@ -5040,22 +5035,22 @@ allows you to isolate the parts of your documents that use TeX: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:@@ -5074,14 +5069,14 @@ class="header-section-number">2.2.1.40 OptionEnable 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!
@@ -5098,26 +5093,26 @@ class="sourceCode md">+ 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!
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:@@ -5143,32 +5138,32 @@ when ⟨shift amount⟩ is positive, and to level 1, when class="tex">TeX ExampleUsing 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:@@ -5180,20 +5175,20 @@ 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{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:@@ -5205,22 +5200,22 @@ contain the following text: class="tex">TeXt ExampleUsing 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:@@ -5264,43 +5259,43 @@ i.e. the entire section with the HTML attribute class="tex">TeX ExampleUsing 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:@@ -5317,30 +5312,30 @@ 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[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:@@ -5357,33 +5352,33 @@ contain the following text: class="tex">TeXt ExampleUsing 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:@@ -5424,25 +5419,25 @@ class="tex">TeX macro. ExampleUsing 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:@@ -5452,23 +5447,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
class="tex">TeX Example~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -5489,23 +5484,23 @@ contain the following text: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:@@ -5516,28 +5511,28 @@ 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} -\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:@@ -5548,24 +5543,24 @@ 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] -\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:@@ -5603,32 +5598,32 @@ class="tex">TeX macro. 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} - - 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:@@ -5650,30 +5645,30 @@ markup: class="tex">TeXt ExampleUsing 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:@@ -5703,8 +5698,8 @@ class="header-section-number">2.2.1.45 OptionEnable the Pandoc strike-through syntax extension:
-+This ~~is deleted text.~~
@@ -5721,18 +5716,18 @@ class="sourceCode md">This ~~is deleted text.~~
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:@@ -5742,23 +5737,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[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:@@ -5768,18 +5763,18 @@ 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[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:@@ -5797,14 +5792,14 @@ class="header-section-number">2.2.1.46 OptionStrip 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}
@@ -5822,50 +5817,50 @@ document. class="tex">TeX Example\documentclass{article} +\usepackage[stripIndent]{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} + \end{document}
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!”ConTeXt 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.47 Option
Enable the Pandoc subscript syntax extension:
-+H~2~O is a liquid.
@@ -5898,17 +5893,17 @@ class="sourceCode md">H~2~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} -\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:@@ -5918,17 +5913,17 @@ 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[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:@@ -5946,8 +5941,8 @@ class="header-section-number">2.2.1.48 OptionEnable the Pandoc superscript syntax extension:
-+2^10^ is 1024.
@@ -5964,17 +5959,17 @@ class="sourceCode md">2^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} -\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:@@ -5984,17 +5979,17 @@ 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[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:@@ -6013,14 +6008,14 @@ class="header-section-number">2.2.1.49 Option href="https://pandoc.org/MANUAL.html#extension-table_captions">table caption 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.
@@ -6037,23 +6032,23 @@ class="sourceCode md">+ | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + : Demonstration of pipe table syntax.
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:@@ -6093,27 +6088,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] -\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:@@ -6161,10 +6156,10 @@ class="header-section-number">2.2.1.50 OptionEnable the Pandoc task list syntax extension:
-+- [ ] an unticked task list item -- [/] a half-checked task list item -- [X] a ticked task list item
@@ -6181,26 +6176,26 @@ class="sourceCode md">- [ ] an unticked task list item +- [/] a half-checked task list item +- [X] a ticked task list item
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:@@ -6214,22 +6209,22 @@ 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[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:@@ -6249,15 +6244,15 @@ class="header-section-number">2.2.1.51 Optiontrue @@ -6277,53 +6272,53 @@ comments. class="tex">TeX Example 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.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!”ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texComments = yes] -\starttext -\startmarkdown -% 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.52 Option
Enable the Pandoc dollar math syntax extension:
-+inline math: $E=mc^2$ - - display math: $$E=mc^2$$
@@ -6358,21 +6353,21 @@ class="sourceCode md">inline math: $E=mc^2$ + + display math: $$E=mc^2$$
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert = markdown.new({texMathDollars = true}) - local input =$E=mc^2$]] .. newline .. newline .. - [[$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$]] - [[ - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathDollars = true}) + local input =$E=mc^2$]] .. newline .. newline .. + [[$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$]] + [[ + 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:@@ -6384,24 +6379,24 @@ class="math display">f̂(ξ) = ∫−∞ExampleLua 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:+- $E=mc^2$ - $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
+ $E=mc^2$ + $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ texMathDollars=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathDollars=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 @@ -6426,20 +6421,20 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\def\markdownOptionTexMathDollars{true} -\markdownBegin -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\markdownEnd - -\bye
\input markdown + +\def\markdownOptionTexMathDollars{true} +\markdownBegin +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\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:@@ -6452,21 +6447,21 @@ class="math display">f̂(ξ) = ∫−∞ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathDollars]{markdown} -\begin{document} - -\begin{markdown} -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[texMathDollars]{markdown} +\begin{document} + +\begin{markdown} +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\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:@@ -6479,21 +6474,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathDollars = yes] -\starttext - -\startmarkdown -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathDollars = yes] +\starttext + +\startmarkdown +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\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:@@ -6515,10 +6510,10 @@ class="header-section-number">2.2.1.53 OptionEnable the Pandoc double backslash math syntax extension:
-+inline math: \\(E=mc^2\\) - -\\[E=mc^2\\] display math:
@@ -6535,21 +6530,21 @@ class="sourceCode md">inline math: \\(E=mc^2\\) + +\\[E=mc^2\\] display math:
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert = markdown.new({texMathDoubleBackslash = true}) - local input =\\(E=mc^2\\)]] .. newline .. newline .. - [[\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]]] - [[ - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathDoubleBackslash = true}) + local input =\\(E=mc^2\\)]] .. newline .. newline .. + [[\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]]] + [[ + 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:@@ -6561,24 +6556,24 @@ class="math display">f̂(ξ) = ∫−∞ExampleLua 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:+\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]
\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\]
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ texMathDoubleBackslash=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathDoubleBackslash=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 @@ -6604,20 +6599,20 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\def\markdownOptionTexMathDoubleBackslash{true} -\markdownBegin -\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] -\markdownEnd - -\bye
\input markdown + +\def\markdownOptionTexMathDoubleBackslash{true} +\markdownBegin +\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] +\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:@@ -6630,21 +6625,21 @@ class="math display">f̂(ξ) = ∫−∞ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathDoubleBackslash]{markdown} -\begin{document} - -\begin{markdown} -\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] -\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[texMathDoubleBackslash]{markdown} +\begin{document} + +\begin{markdown} +\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] +\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:@@ -6657,21 +6652,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathDoubleBackslash = yes] -\starttext - -\startmarkdown -\\(E=mc^2\\) - -\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathDoubleBackslash = yes] +\starttext + +\startmarkdown +\\(E=mc^2\\) + +\\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\\] +\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:@@ -6693,10 +6688,10 @@ class="header-section-number">2.2.1.54 OptionEnable the Pandoc single backslash math syntax extension:
-+inline math: \(E=mc^2\) - -\[E=mc^2\] display math:
@@ -6713,21 +6708,21 @@ class="sourceCode md">inline math: \(E=mc^2\) + +\[E=mc^2\] display math:
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert = markdown.new({texMathSingleBackslash = true}) - local input =\(E=mc^2\)]] .. newline .. newline .. - [[\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]]] - [[ - tex.sprint(convert(input)) }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathSingleBackslash = true}) + local input =\(E=mc^2\)]] .. newline .. newline .. + [[\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]]] + [[ + 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:@@ -6739,24 +6734,24 @@ class="math display">f̂(ξ) = ∫−∞ExampleLua 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:+\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]
\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\]
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ texMathSingleBackslash=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathSingleBackslash=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 @@ -6781,20 +6776,20 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\def\markdownOptionTexMathSingleBackslash{true} -\markdownBegin -\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] -\markdownEnd - -\bye
\input markdown + +\def\markdownOptionTexMathSingleBackslash{true} +\markdownBegin +\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] +\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:@@ -6807,21 +6802,21 @@ class="math display">f̂(ξ) = ∫−∞ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathSingleBackslash]{markdown} -\begin{document} - -\begin{markdown} -\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] -\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[texMathSingleBackslash]{markdown} +\begin{document} + +\begin{markdown} +\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] +\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:@@ -6834,21 +6829,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathSingleBackslash = yes] -\starttext - -\startmarkdown -\(E=mc^2\) - -\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] -\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathSingleBackslash = yes] +\starttext + +\startmarkdown +\(E=mc^2\) + +\[\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\] +\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:@@ -6870,16 +6865,16 @@ class="header-section-number">2.2.1.55 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.
@@ -6898,39 +6893,39 @@ multiple paragraphs. class="latex">LaTeX Example- This is +- a tight +- unordered list. + +- This is + + + not a tight +- unordered list.
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:@@ -6965,11 +6960,11 @@ class="header-section-number">2.2.1.56 Option@@ -6989,23 +6984,23 @@ constantly escape subscripts. class="tex">TeX Example 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__
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:@@ -7018,23 +7013,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[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:@@ -7047,24 +7042,24 @@ 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[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:@@ -7091,8 +7086,8 @@ plain TeXtaskLists
Lua option totrue
, 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
@@ -7142,24 +7137,24 @@ options.Using a text editor, create a folder named
-output-directory
and a text document nameddocument.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
@@ -7172,8 +7167,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: -temporary-input.md
should be produced in the folder namedoutput-directory
and contain the following text:+pdftex --output-directory output-directory --shell-escape document.tex
pdftex --output-directory output-directory --shell-escape document.tex
Text documents named
helper-script.lua
, andtemporary-output.md
should be produced in the folder namedoutput-directory
. The document named @@ -7202,21 +7197,21 @@ Mittelbach. The recognized values of the macro aretrue
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 totrue
, 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 @@ -7247,10 +7242,10 @@ the
-\markdownOptionHelperScriptFileName
plain TeX option tohelper-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
@@ -7265,8 +7260,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
@@ -7279,11 +7274,11 @@ without low-level programming.For example, to load themes named
-witiko/beamer/MU
andwitiko/dot
, you would use the following code in the preamble of your document:+\usepackage[ - - import=witiko/beamer/MU, - import=witiko/dot,markdown} ]{
\usepackage[ + + import=witiko/beamer/MU, + import=witiko/dot,markdown} ]{
Due to limitations of LaTeX, themes may not be loaded after the beginning of a TeX option is enabled.
class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[import=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[import=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
@@ -7372,18 +7367,18 @@ class="tex">TeX option is enabled. class="latex">LaTeX Exampledocument.pdf
should be produced and contain a drawing of a directed graph similar to Figure 1 from the following conference article:Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[import=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[import=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:@@ -7406,17 +7401,17 @@ Lua option is disabled. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[import=witiko/tilde]{markdown} -\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage[import=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
@@ -7433,82 +7428,99 @@ class="latex">LaTeX snippets provide syntactic sugar for defining and invoking various options locally.document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:Here is how we can use 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*}
If the
-romanNumerals
snippet were defined in the -jdoe/lists
theme, we can import the theme and use the -qualified name of the snippet:+\markdownSetup{import=jdoe/lists} -\begin{markdown*}{snippet=jdoe/lists/romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
jdoe/lists
theme, we could import the +jdoe/lists
theme and use the qualified name +jdoe/lists/romanNumerals
to invoke the snippet: +\markdownSetup{import=jdoe/lists} +\begin{markdown*}{snippet=jdoe/lists/romanNumerals} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
Alternatively, we can use the extended variant of the
-import
LaTeX option that allows us to import theromanNumerals
snippet to the current -namespace, so that we can invoke the snippet with less typing:+namespace for easier access: +\markdownSetup{ - - import = { - jdoe/lists = romanNumerals, - }, - }\begin{markdown*}{snippet=romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
\markdownSetup{ + + import = { + jdoe/lists = romanNumerals, + }, + }\begin{markdown*}{snippet=romanNumerals} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
Furthermore, we can also specify the name of the snippet in the -current namespace, which is different from the name of the snippet in -the
-jdoe/lists
theme:+current namespace, which can be different from the name of the snippet +in the\markdownSetup{ - - import = { - jdoe/lists = romanNumerals as roman, - }, - }\begin{markdown*}{snippet=roman} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
jdoe/lists
theme. For example, we can make the +snippetjdoe/lists/romanNumerals
available under the name +roman
. +\markdownSetup{ + + import = { + jdoe/lists = romanNumerals as roman, + }, + }\begin{markdown*}{snippet=roman} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
Several themes and/or snippets can be loaded at once using the extended variant of the
+class="latex">LaTeX option: +import
LaTeX option.\markdownSetup{ + + import = { + jdoe/longpackagename/lists = { + arabic as arabic1, + roman, + alphabetic, + }, + jdoe/anotherlongpackagename/lists = { + arabic as arabic2, + }, + jdoe/yetanotherlongpackagename, + }, }
2.3 Markdown Tokens
A key feature of the Markdown package is the support for manipulating @@ -7549,42 +7561,42 @@ attributes that correspond to the ⟨key⟩ and the class="latex">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:@@ -7605,31 +7617,31 @@ end of a block quote. The macro receives no arguments. class="tex">TeX ExampleUsing 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:@@ -7644,28 +7656,28 @@ disasters the sun, the moon, and the stars […] class="latex">LaTeX ExampleUsing 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:@@ -7680,23 +7692,23 @@ disasters the sun, the moon, and the stars […] class="tex">TeXt ExampleUsing 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:@@ -7722,25 +7734,25 @@ arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\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}
\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:@@ -7773,52 +7785,52 @@ receives no arguments. class="tex">TeX ExampleUsing 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:@@ -7835,57 +7847,57 @@ item). class="latex">LaTeX ExampleUsing 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:@@ -7902,53 +7914,53 @@ item). class="tex">TeXt ExampleUsing 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:@@ -7975,79 +7987,79 @@ contaning the code block contents and to the code fence infostring. class="latex">LaTeX ExampleUsing 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
@@ -8058,27 +8070,27 @@ corresponds to the inline code span. class="tex">TeX ExampleUsing 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:@@ -8091,30 +8103,30 @@ 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[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:@@ -8127,26 +8139,26 @@ 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] -\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:@@ -8171,26 +8183,26 @@ arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[inlineCodeAttributes]{markdown} -\markdownSetup{ - - renderers = { - codeSpanAttributeContextBegin = {(}, - codeSpan = {#1}, - codeSpanAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - foo `bar`{key=value} baz -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[inlineCodeAttributes]{markdown} +\markdownSetup{ + + renderers = { + codeSpanAttributeContextBegin = {(}, + codeSpan = {#1}, + codeSpanAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + foo `bar`{key=value} 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:@@ -8241,34 +8253,34 @@ starting point. class="tex">TeX ExampleUsing 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:@@ -8284,34 +8296,34 @@ the logotype of TUGboat. class="latex">LaTeX ExampleUsing 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:@@ -8327,35 +8339,35 @@ the logotype of TUGboat. class="tex">TeXt ExampleUsing 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:@@ -8377,8 +8389,8 @@ beginning of a definition list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.The
\markdownRendererDlBeginTight
macro represents the -beginning of a definition list that contains an item with several -paragraphs of text (the list is not tight). This macro will only be +beginning of a definition list that contains no item with several +paragraphs of text (the list is tight). This macro will only be produced, when thetightLists
option is disabled. The macro receives no arguments.The
class="tex">TeX Example\markdownRendererDlItem
macro represents a term in a @@ -8404,88 +8416,88 @@ receives no arguments.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:@@ -8511,90 +8523,90 @@ nutrient-rich, and produced on an industrial scale. class="latex">LaTeX ExampleUsing 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:@@ -8620,90 +8632,90 @@ nutrient-rich, and produced on an industrial scale. class="tex">TeXt ExampleUsing 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:@@ -8735,17 +8747,17 @@ enabled. The macro receives no arguments. class="tex">TeX ExampleUsing 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:@@ -8755,22 +8767,22 @@ 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[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:@@ -8780,18 +8792,18 @@ 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[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:@@ -8808,19 +8820,19 @@ corresponds to the emphasized span of text. class="tex">TeX ExampleUsing 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:@@ -8831,25 +8843,25 @@ 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} -\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:@@ -8860,20 +8872,20 @@ 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] -\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:@@ -8897,40 +8909,40 @@ of a fenced code apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\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}
\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:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8951,49 +8963,49 @@ the div apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\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}
\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:@@ -9020,37 +9032,37 @@ heading apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing 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:@@ -9086,26 +9098,26 @@ 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
\input markdown +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\markdownBegin + + ###### + ##### + ##### + ### + ######\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9115,32 +9127,32 @@ 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} -\markdownSetup{ - - renderers = { - interblockSeparator = {}, - headingOne = 1, - headingTwo = 2, - headingThree = 3, - headingFour = 4, - headingFive = 5, - headingSix = 6, - }, - }\begin{document} -\begin{markdown} - - ###### - ##### - ##### - ### - ######\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {}, + headingOne = 1, + headingTwo = 2, + headingThree = 3, + headingFour = 4, + headingFive = 5, + headingSix = 6, + }, + }\begin{document} +\begin{markdown} + + ###### + ##### + ##### + ### + ######\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9150,27 +9162,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] -\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:@@ -9192,36 +9204,36 @@ receive no arguments. class="latex">LaTeX ExampleUsing 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}
Next, invoke LuaTeX from the terminal:
-\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:
-+class="sourceCode sh">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:@@ -9256,28 +9268,28 @@ the contents of the HTML element. class="latex">LaTeX ExampleUsing 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}
Next, invoke LuaTeX from the terminal:
-\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:
-+class="sourceCode sh">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:@@ -9294,44 +9306,44 @@ outside typesetting, and the title of the link. class="latex">LaTeX ExampleUsing 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
+class="sourceCode sh">\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
-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
+class="sourceCode tex">- }^^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}
}^^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
lualatex --shell-escape document.tex
A PDF document named
class="latex">LaTeX 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 @@ -9359,26 +9371,26 @@ image apply. The macros receive no arguments.Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[linkAttributes]{markdown} -\markdownSetup{ - - renderers = { - imageAttributeContextBegin = {(}, - image = {#1}, - imageAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - foo ![bar](#bar){key=value} baz -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[linkAttributes]{markdown} +\markdownSetup{ + + renderers = { + imageAttributeContextBegin = {(}, + image = {#1}, + imageAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + foo ![bar](#bar){key=value} 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:@@ -9394,22 +9406,22 @@ receives no arguments. class="tex">TeX ExampleUsing 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:@@ -9421,28 +9433,28 @@ 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} -\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:@@ -9454,23 +9466,23 @@ 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] -\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:@@ -9490,19 +9502,19 @@ arguments. class="tex">TeX ExampleUsing 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
\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
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9515,20 +9527,20 @@ Tread softly because you tread on my dreams. class="latex">LaTeX ExampleUsing 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}
\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
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9541,20 +9553,20 @@ Tread softly because you tread on my dreams. class="tex">TeXt ExampleUsing 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
\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
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9571,15 +9583,15 @@ hard line break. The macro receives no arguments. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererHardLineBreak{% -\par - \it(A hard line break)}% - {\par - - }\markdownInput{example.md} -\bye
\input markdown +\def\markdownRendererHardLineBreak{% +\par + \it(A hard line break)}% + {\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 line break. Due to @@ -9588,8 +9600,8 @@ processor, hard line breaks 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:@@ -9601,21 +9613,21 @@ 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} -\markdownSetup{ - - renderers = {% - hardLineBreak = {\par - \emph{(A hard line break)}% - \par - - }, - }, - }\begin{document} -\markdownInput{example.md} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + hardLineBreak = {\par + \emph{(A hard line break)}% + \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 line break. Due to @@ -9624,8 +9636,8 @@ processor, hard line breaks 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:@@ -9643,21 +9655,21 @@ that can be used outside typesetting, and the title of the link. class="tex">TeX ExampleUsing 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:@@ -9669,27 +9681,27 @@ Archive Network. class="latex">LaTeX ExampleUsing 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:@@ -9701,22 +9713,22 @@ Archive Network. class="tex">TeXt ExampleUsing 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:@@ -9737,26 +9749,26 @@ hyperlink apply. The macros receive no arguments. class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[linkAttributes]{markdown} -\markdownSetup{ - - renderers = { - linkAttributeContextBegin = {(}, - link = {#1}, - linkAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - foo [bar](#bar){key=value} baz -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[linkAttributes]{markdown} +\markdownSetup{ + + renderers = { + linkAttributeContextBegin = {(}, + link = {#1}, + linkAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + foo [bar](#bar){key=value} 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:@@ -9778,77 +9790,77 @@ account. class="latex">LaTeX ExampleUsing 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:@@ -9872,42 +9884,42 @@ non-breaking space. class="latex">LaTeX ExampleUsing 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:@@ -9928,21 +9940,21 @@ receives a single argument that corresponds to the note text. class="tex">TeX ExampleUsing 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:@@ -9953,26 +9965,26 @@ 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[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:@@ -9983,22 +9995,22 @@ 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[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:@@ -10094,70 +10106,70 @@ receives no arguments. class="tex">TeX ExampleUsing 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:@@ -10174,73 +10186,73 @@ item). class="latex">LaTeX ExampleUsing 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:@@ -10257,74 +10269,74 @@ item). class="tex">TeXt ExampleUsing 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:@@ -10353,50 +10365,50 @@ author’s name is to be suppressed, or+
otherwise. class="latex">LaTeX ExampleUsing 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:@@ -10422,41 +10434,41 @@ of the raw block. This macro will only be produced, when the class="latex">LaTeX ExampleUsing 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:@@ -10511,16 +10523,16 @@ class="tex">TeX Example 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
@@ -10534,22 +10546,22 @@ class="latex">LaTeX Example tilde behave as if it were written in TeX, where it represents a non-breaking space. -document.pdf
should be produced and contain the following text, where the middot (·
) denotes 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
@@ -10563,17 +10575,17 @@ class="tex">TeXt Example tilde behave as if it were written in TeX, where it represents a non-breaking space. -document.pdf
should be produced and contain the following text, where the middot (·
) denotes 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
@@ -10592,18 +10604,18 @@ enabled. class="tex">TeX Exampledocument.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space: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:@@ -10613,23 +10625,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[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:@@ -10639,18 +10651,18 @@ 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[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:@@ -10667,17 +10679,17 @@ enabled. class="tex">TeX ExampleUsing 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:@@ -10687,22 +10699,22 @@ 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[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:@@ -10712,18 +10724,18 @@ 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[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:@@ -10740,17 +10752,17 @@ enabled. class="tex">TeX ExampleUsing 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:@@ -10760,22 +10772,22 @@ 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[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:@@ -10785,18 +10797,18 @@ 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[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:@@ -10828,67 +10840,67 @@ one of the following: class="latex">LaTeX ExampleUsing 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:@@ -10921,20 +10933,20 @@ enabled. class="tex">TeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTexMathDollars{true} -\def\markdownRendererInlineMath#1{$#1\dots$} -\def\markdownRendererDisplayMath#1{$$#1\eqno(1)$$} -\markdownBegin -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\markdownEnd -\bye
\input markdown +\def\markdownOptionTexMathDollars{true} +\def\markdownRendererInlineMath#1{$#1\dots$} +\def\markdownRendererDisplayMath#1{$$#1\eqno(1)$$} +\markdownBegin +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\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:@@ -10948,22 +10960,22 @@ dx\eqno(1)$$ class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texMathDollars]{markdown} -\usepackage{amsmath} -\def\markdownRendererInlineMath#1{\begin{math}#1\dots\end{math}} -\def\markdownRendererDisplayMath#1{\begin{equation}#1\end{equation}} -\begin{document} -\begin{markdown} -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[texMathDollars]{markdown} +\usepackage{amsmath} +\def\markdownRendererInlineMath#1{\begin{math}#1\dots\end{math}} +\def\markdownRendererDisplayMath#1{\begin{equation}#1\end{equation}} +\begin{document} +\begin{markdown} +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\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:@@ -10976,21 +10988,21 @@ class="math display">f̂(ξ) = ∫−∞ class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texMathDollars = yes] -\def\markdownRendererInlineMath#1{$#1\dots$}% -\def\markdownRendererDisplayMath#1{\placeformula\startformula#1\stopformula}% -\starttext -\startmarkdown -$E=mc^2$ - -$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ -\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texMathDollars = yes] +\def\markdownRendererInlineMath#1{$#1\dots$}% +\def\markdownRendererDisplayMath#1{\placeformula\startformula#1\stopformula}% +\starttext +\startmarkdown +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\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:@@ -11011,50 +11023,50 @@ receives parameters in the same format as the class="latex">LaTeX ExampleUsing 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:@@ -11071,20 +11083,20 @@ thematic break. The macro receives no arguments. class="tex">TeX ExampleUsing 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:@@ -11096,26 +11108,26 @@ 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} -\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:@@ -11127,21 +11139,21 @@ 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] -\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:@@ -11163,24 +11175,24 @@ respectively. class="latex">LaTeX ExampleUsing 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:@@ -11193,20 +11205,20 @@ 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[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:@@ -11278,23 +11290,23 @@ rules. class="tex">TeX ExampleUsing 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:@@ -11304,29 +11316,29 @@ 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{ - - 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:@@ -11336,26 +11348,26 @@ 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] -\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
\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
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11371,25 +11383,25 @@ class="tex">TeX macros, further referred to as class="tex">TeX ExampleUsing 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:@@ -11400,30 +11412,30 @@ 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} -\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}
\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
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -11434,26 +11446,26 @@ 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] -\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:@@ -11471,29 +11483,29 @@ the LaTeX3 kernel. class="tex">TeX ExampleUsing 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:@@ -11503,31 +11515,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:@@ -11537,32 +11549,32 @@ 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
Next, invoke LuaTeX from the terminal:
-\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:
-+class="sourceCode sh">context document.tex
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 68b87a09605..4b99308976f 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/latex-luatex.tex b/Master/texmf-dist/doc/latex/markdown/examples/latex-luatex.tex new file mode 100644 index 00000000000..18b16bf7769 --- /dev/null +++ b/Master/texmf-dist/doc/latex/markdown/examples/latex-luatex.tex @@ -0,0 +1,56 @@ +\documentclass{book} +\usepackage{polyglossia} +\setmainlanguage{english} +\usepackage{fontspec} +\usepackage{booktabs} +% Load the Markdown package and set its options. +\usepackage[ + contentBlocks, + debugExtensions, + definitionLists, + fancy_lists, + fencedCode, + hashEnumerators, + inlineNotes, + jekyllData, + lineBlocks, + notes, + pipeTables, + rawAttribute, + smartEllipses, + strikeThrough, + subscripts, + superscripts, + tableCaptions, + taskLists, + texMathDollars, + texMathDoubleBackslash, + texMathSingleBackslash, +]{markdown} +% Set the document metadata using a YAML metadata block. +\begin{markdown*}{hybrid} +--- +title: An Example *Markdown* Document +author: Vít Novotný +date: \today +--- +\end{markdown*} +\begin{document} +% Typeset the document `example.md` by letting the Markdown package handle +% the conversion internally. +\markdownInput{./example.md} + +% Typeset the document `example.tex` that we prepared separately using the +% Lua command-line interface of the Markdown package and that contains a +% plain TeX representation of the document `example.md`. +\catcode`\%=12\relax +\catcode`\#=12\relax +\InputIfFileExists{./example.tex}{}{} +\catcode`\%=14\relax +\catcode`\#=6\relax + +% Typeset some further examples with inline markdown text. +\begin{markdown} +Here are some non-ASCII characters: *ěščřžýáíé*. +\end{markdown} +\end{document} diff --git a/Master/texmf-dist/doc/latex/markdown/examples/latex-pdftex.tex b/Master/texmf-dist/doc/latex/markdown/examples/latex-pdftex.tex new file mode 100644 index 00000000000..db6cbea8c80 --- /dev/null +++ b/Master/texmf-dist/doc/latex/markdown/examples/latex-pdftex.tex @@ -0,0 +1,76 @@ +\documentclass{book} +\usepackage[english]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{booktabs} +% Load the Markdown package and set its options. +\usepackage[ + contentBlocks, + debugExtensions, + definitionLists, + fancy_lists, + fencedCode, + hashEnumerators, + inlineNotes, + jekyllData, + lineBlocks, + notes, + pipeTables, + rawAttribute, + smartEllipses, + strikeThrough, + subscripts, + superscripts, + tableCaptions, + taskLists, + texMathDollars, + texMathDoubleBackslash, + texMathSingleBackslash, +]{markdown} +% Set the document metadata using a YAML metadata block. +\begin{markdown*}{hybrid} +--- +title: An Example *Markdown* Document +author: Vít Novotný +date: \today +--- +\end{markdown*} +\begin{document} +% Typeset the document `example.md` by letting the Markdown package handle +% the conversion internally. +\markdownInput{./example.md} + +% Typeset the document `example.tex` that we prepared separately using the +% Lua command-line interface of the Markdown package and that contains a +% plain TeX representation of the document `example.md`. +\catcode`\%=12\relax +\catcode`\#=12\relax +\InputIfFileExists{./example.tex}{}{} +\catcode`\%=14\relax +\catcode`\#=6\relax + +% Typeset some further examples with inline markdown text. +\begin{markdown} +Here are some non-ASCII characters: *ěščřžýáíé*. +\end{markdown} + +\begin{markdown*}{html, hybrid} +Here is some HTML code mixed *with Markdown*. In \TeX, the HTML code +will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed +through to the output: + ++
+\end{markdown*} +\end{document} diff --git a/Master/texmf-dist/doc/latex/markdown/examples/latex-tex4ht.tex b/Master/texmf-dist/doc/latex/markdown/examples/latex-tex4ht.tex new file mode 100644 index 00000000000..db6cbea8c80 --- /dev/null +++ b/Master/texmf-dist/doc/latex/markdown/examples/latex-tex4ht.tex @@ -0,0 +1,76 @@ +\documentclass{book} +\usepackage[english]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{booktabs} +% Load the Markdown package and set its options. +\usepackage[ + contentBlocks, + debugExtensions, + definitionLists, + fancy_lists, + fencedCode, + hashEnumerators, + inlineNotes, + jekyllData, + lineBlocks, + notes, + pipeTables, + rawAttribute, + smartEllipses, + strikeThrough, + subscripts, + superscripts, + tableCaptions, + taskLists, + texMathDollars, + texMathDoubleBackslash, + texMathSingleBackslash, +]{markdown} +% Set the document metadata using a YAML metadata block. +\begin{markdown*}{hybrid} +--- +title: An Example *Markdown* Document +author: Vít Novotný +date: \today +--- +\end{markdown*} +\begin{document} +% Typeset the document `example.md` by letting the Markdown package handle +% the conversion internally. +\markdownInput{./example.md} + +% Typeset the document `example.tex` that we prepared separately using the +% Lua command-line interface of the Markdown package and that contains a +% plain TeX representation of the document `example.md`. +\catcode`\%=12\relax +\catcode`\#=12\relax +\InputIfFileExists{./example.tex}{}{} +\catcode`\%=14\relax +\catcode`\#=6\relax + +% Typeset some further examples with inline markdown text. +\begin{markdown} +Here are some non-ASCII characters: *ěščřžýáíé*. +\end{markdown} + +\begin{markdown*}{html, hybrid} +Here is some HTML code mixed *with Markdown*. In \TeX, the HTML code +will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed +through to the output: + ++ +Emil +Tobias +Linus ++ +16 +14 +10 ++
+\end{markdown*} +\end{document} diff --git a/Master/texmf-dist/doc/latex/markdown/examples/latex-xetex.tex b/Master/texmf-dist/doc/latex/markdown/examples/latex-xetex.tex new file mode 100644 index 00000000000..18b16bf7769 --- /dev/null +++ b/Master/texmf-dist/doc/latex/markdown/examples/latex-xetex.tex @@ -0,0 +1,56 @@ +\documentclass{book} +\usepackage{polyglossia} +\setmainlanguage{english} +\usepackage{fontspec} +\usepackage{booktabs} +% Load the Markdown package and set its options. +\usepackage[ + contentBlocks, + debugExtensions, + definitionLists, + fancy_lists, + fencedCode, + hashEnumerators, + inlineNotes, + jekyllData, + lineBlocks, + notes, + pipeTables, + rawAttribute, + smartEllipses, + strikeThrough, + subscripts, + superscripts, + tableCaptions, + taskLists, + texMathDollars, + texMathDoubleBackslash, + texMathSingleBackslash, +]{markdown} +% Set the document metadata using a YAML metadata block. +\begin{markdown*}{hybrid} +--- +title: An Example *Markdown* Document +author: Vít Novotný +date: \today +--- +\end{markdown*} +\begin{document} +% Typeset the document `example.md` by letting the Markdown package handle +% the conversion internally. +\markdownInput{./example.md} + +% Typeset the document `example.tex` that we prepared separately using the +% Lua command-line interface of the Markdown package and that contains a +% plain TeX representation of the document `example.md`. +\catcode`\%=12\relax +\catcode`\#=12\relax +\InputIfFileExists{./example.tex}{}{} +\catcode`\%=14\relax +\catcode`\#=6\relax + +% Typeset some further examples with inline markdown text. +\begin{markdown} +Here are some non-ASCII characters: *ěščřžýáíé*. +\end{markdown} +\end{document} diff --git a/Master/texmf-dist/doc/latex/markdown/examples/latex.tex b/Master/texmf-dist/doc/latex/markdown/examples/latex.tex deleted file mode 100644 index 44736c61dc2..00000000000 --- a/Master/texmf-dist/doc/latex/markdown/examples/latex.tex +++ /dev/null @@ -1,84 +0,0 @@ -\documentclass{book} -\usepackage{ifxetex,ifluatex} -\ifxetex - \usepackage{polyglossia} - \setmainlanguage{english} - \usepackage{fontspec} -\else\ifluatex - \usepackage{polyglossia} - \setmainlanguage{english} - \usepackage{fontspec} -\else - \usepackage[english]{babel} - \usepackage[utf8]{inputenc} - \usepackage[T1]{fontenc} - \usepackage{lmodern} -\fi\fi -\usepackage{booktabs} -\usepackage[ - contentBlocks, - debugExtensions, - definitionLists, - fancy_lists, - fencedCode, - hashEnumerators, - inlineNotes, - jekyllData, - lineBlocks, - notes, - pipeTables, - rawAttribute, - smartEllipses, - strikeThrough, - subscripts, - superscripts, - tableCaptions, - taskLists, - texMathDollars, - texMathDoubleBackslash, - texMathSingleBackslash, -]{markdown} -\begin{markdown*}{hybrid} ---- -title: An Example *Markdown* Document -author: Vít Novotný -date: \today ---- -\end{markdown*} -\begin{document} -% Typeset the document `example.md` by letting the Markdown package handle -% the conversion internally. -\markdownInput{./example.md} - -% Typeset the document `example.tex` that we prepared separately using the -% Lua command-line interface of the Markdown package and that contains a -% plain TeX representation of the document `example.md`. -\catcode`\%=12\relax -\catcode`\#=12\relax -\InputIfFileExists{./example.tex}{}{} -\catcode`\%=14\relax -\catcode`\#=6\relax - -\begin{markdown} -Here are some non-ASCII characters: *ěščřžýáíé*. -\end{markdown} - -\begin{markdown*}{html, hybrid} -Here is some HTML code mixed *with Markdown*. In \TeX, the HTML code -will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed -through to the output: - -+ +Emil +Tobias +Linus ++ +16 +14 +10 +-
-\end{markdown*} -\end{document} diff --git a/Master/texmf-dist/scripts/markdown/markdown-cli.lua b/Master/texmf-dist/scripts/markdown/markdown-cli.lua index c61fc777369..2d23c9a7bd8 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.22.0-0-g5a3d0fe", + version = "2.23.0-0-g0b22f91", 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", diff --git a/Master/texmf-dist/source/generic/markdown/markdown.dtx b/Master/texmf-dist/source/generic/markdown/markdown.dtx index ee878acc728..3edb022e15a 100644 --- a/Master/texmf-dist/source/generic/markdown/markdown.dtx +++ b/Master/texmf-dist/source/generic/markdown/markdown.dtx @@ -796,16 +796,18 @@ abbr { \ProvidesPackage{markdownthemewitiko_markdown_techdoc}[2022/02/23] \RequirePackage{etoolbox} \markdownSetup{ - rendererPrototypes = { - codeSpan = {\inline{#1}}, - headingFour = {% + renderers = { + head*Four = {% \paragraph{#1}\leavevmode \def\markdownRendererInterblockSeparator{% \let\markdownRendererInterblockSeparator\par }% \noindent }, - jekyllDataEnd = {% + }, + rendererPrototypes = { + codeSpan = {\inline{#1}}, + jek*llDataEnd = {% \AfterEndPreamble{% \printtitlepage \tableofcontents @@ -1045,7 +1047,7 @@ a directory named `markdown` due to [issue #74][issue-74]. % % This section gives an overview of all resources required by the package. % -%### Lua Requirements {#luaprerequisites} +%### Lua Requirements {#lua-prerequisites} % % The Lua part of the package requires that the following Lua modules are % available from within the Lua\TeX{} engine (though not necessarily in the @@ -1201,7 +1203,8 @@ end)() % (subset) parser that is used to read \acro{yaml} metadata when the % \Opt{jekyllData} option is enabled. We carry a copy of the library % in file `markdown-tinyyaml.lua` distributed together with the Markdown -% package. +% package. % % \end{markdown} % \iffalse @@ -1211,11 +1214,11 @@ end)() % \par % \begin{markdown} % -%### Plain \TeX{} Requirements {#texprerequisites} +%### Plain \TeX{} Requirements {#tex-prerequisites} % % The plain \TeX{} part of the package requires that the plain \TeX{} % format (or its superset) is loaded, all the Lua prerequisites (see -% Section <#sec:luaprerequisites>), and the following packages: +% Section <#sec:lua-prerequisites>), and the following packages: % % \pkg{expl3} % @@ -1275,7 +1278,7 @@ end)() % \par % \begin{markdown} % -%### \LaTeX{} Requirements {#latexprerequisites} +%### \LaTeX{} Requirements {#latex-prerequisites} % % The \LaTeX{} part of the package requires that the \Hologo{LaTeX2e} format is % loaded, @@ -1291,12 +1294,12 @@ end)() % \fi % \begin{markdown} % a \TeX{} engine that extends \Hologo{eTeX}, and all the plain \TeX{} -% prerequisites (see Section <#sec:texprerequisites>): +% prerequisites (see Section <#sec:tex-prerequisites>): % % The following packages are soft prerequisites. They are only used to provide % default token renderer prototypes (see sections % <#sec:texrendererprototypes> and -% <#sec:latexdefaultrendererprototypes>) or \LaTeX{} themes (see Section +% <#sec:latex-default-renderer-prototypes>) or \LaTeX{} themes (see Section % <#sec:latexthemes>) and will not be loaded if the `plain` package option % has been enabled (see Section <#sec:latexplain>): % @@ -1369,7 +1372,7 @@ end)() % %: 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 +% <#sec:latex-yaml-metadata>, and also in the default renderer prototype % for identifier attributes. % % \pkg{soulutf8} @@ -1402,7 +1405,7 @@ end)() %### \Hologo{ConTeXt} Prerequisites % The \Hologo{ConTeXt} part of the package requires that either the Mark II or % the Mark IV format is loaded, all the plain \TeX{} prerequisites (see -% Section <#sec:texprerequisites>), and the following \Hologo{ConTeXt} +% Section <#sec:tex-prerequisites>), and the following \Hologo{ConTeXt} % modules: % % \pkg{m-database} @@ -1601,13 +1604,14 @@ the Markdown package: ``` sh git clone https://github.com/witiko/markdown cd markdown/examples -lualatex latex.tex +lualatex latex-luatex.tex `````` -A PDF document named `latex.pdf` should be produced. Open the text documents -`latex.tex` and `example.md` in a text editor to see how the example documents -are structured. Try changing the documents and typesetting them as follows: +A PDF document named `latex-luatex.pdf` should be produced. Open the text +documents `latex-luatex.tex` and `example.md` in a text editor to see how the +example documents are structured. Try changing the documents and typesetting +them as follows: ``` sh -lualatex latex.tex +lualatex latex-luatex.tex `````` to see the effect of your changes. @@ -1628,10 +1632,7 @@ Next, invoke LuaTeX from the terminal: context document.tex `````` A PDF document named `document.pdf` should be produced and contain the text “Hello -*world*!” Invoking pdfTeX should have the same effect: -``` sh -texexec --passon=--shell-escape document.tex -`````` +*world*!” *** @@ -1714,12 +1715,12 @@ local M = {metadata = metadata} % \par % \begin{markdown} % -%### Conversion from Markdown to Plain \TeX{} {#luaconversion} +%### Conversion from Markdown to Plain \TeX{} {#lua-conversion} % % The Lua interface exposes the \luamdef{new}`(options)` function. This % function returns a conversion function from markdown to plain \TeX{} according % to the table `options` that contains options recognized by the Lua interface -% (see Section <#sec:luaoptions>). The `options` parameter is optional; when +% (see Section <#sec:lua-options>). The `options` parameter is optional; when % unspecified, the behaviour will be the same as if `options` were an empty % table. % @@ -1732,7 +1733,7 @@ local M = {metadata = metadata} % print(convert("Hello *world*!")) % ``````` % -%### User-Defined Syntax Extensions {#luauserextensions} +%### User-Defined Syntax Extensions {#lua-user-extensions} % % For the purpose of user-defined syntax extensions, the Lua interface also % exposes the \luamdef{reader} object, which performs the lexical and @@ -1966,7 +1967,7 @@ pdftex document.tex % \fi % \begin{markdown} % -%### Options {#luaoptions} +%### Options {#lua-options} % % The Lua interface recognizes the following options. When unspecified, the % value of a key is taken from the \luamdef{defaultOptions} table. @@ -2081,7 +2082,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. } { \msg_error:nnnV - { @@ } + { markdown } { failed-typecheck-for-boolean-option } { #1 } \l_tmpa_tl @@ -2090,7 +2091,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. } } \msg_new:nnn - { @@ } + { markdown } { failed-typecheck-for-boolean-option } { Option~#1~has~value~#2,~ @@ -2139,7 +2140,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_bool { \msg_error:nnn - { @@ } + { markdown } { undefined-option } { #1 } } @@ -2148,7 +2149,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_tl { \msg_error:nnnV - { @@ } + { markdown } { unknown-option-type } { #1 } \l_tmpa_tl @@ -2158,13 +2159,13 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_tl } \msg_new:nnn - { @@ } + { markdown } { unknown-option-type } { Option~#1~has~unknown~type~#2. } \msg_new:nnn - { @@ } + { markdown } { undefined-option } { Option~#1~is~undefined. @@ -2191,7 +2192,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_bool { \msg_error:nnn - { @@ } + { markdown } { undefined-option } { #1 } } @@ -2247,7 +2248,17 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \tl_tail:n { #1 } } } -\seq_new:N \g_@@_cases_seq +% \end{macrocode} +% \par +% \begin{markdown} +% +% To make it easier to support different coding styles in the interface, +% engines, we define the \mdef{\@\@_with_various_cases:nn} function +% that allows us to generate different variants of a string using +% different cases. +% +% \end{markdown} +% \begin{macrocode} \cs_new:Nn \@@_with_various_cases:nn { \seq_clear:N @@ -2268,6 +2279,29 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_seq { #2 } } +% \end{macrocode} +% \par +% \begin{markdown} +% +% To interrupt the \mref{\@\@_with_various_cases:nn} function +% prematurely, use the \mdef{\@\@_with_various_cases_break:} function. +% +% \end{markdown} +% \begin{macrocode} +\cs_new:Nn \@@_with_various_cases_break: + { + \seq_map_break: + } +% \end{macrocode} +% \begin{markdown} +% +% By default, camelCase and snake\\\_case are supported. +% Additional cases can be added by adding functions to the +% \mdef{g_\@\@_cases_seq} sequence. +% +% \end{markdown} +% \begin{macrocode} +\seq_new:N \g_@@_cases_seq \cs_new:Nn \@@_camel_case:N { \regex_replace_all:nnN @@ -2641,13 +2675,13 @@ defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" extensible subset of the \acro{peg} grammar of markdown % (see the \luamref{walkable_syntax} hash table) after built-in syntax extensions -% (see Section <#sec:luabuiltinextensions>) +% (see Section <#sec:lua-built-in-extensions>) % \iffalse (see options \Opt{citations}, \Opt{contentBlocks}, \Opt{definitionLists}, etc.) % \fi and user-defined syntax extensions -% (see Section <#sec:luauserextensions>) +% (see Section <#sec:lua-user-extensions>) % \iffalse (see option \Opt{extensions}) % \fi @@ -2881,7 +2915,7 @@ Hi *world*! ``````` Last, invoke pdfTeX without shell access from the terminal: ``` sh -texexec --passon=--no-shell-escape frozen-document.tex +context frozen-document.tex `````` A PDF document named `frozen-document.pdf` should be produced and contain the text “Hello *world*!” Since we used the contents of the frozen cache using @@ -4622,13 +4656,13 @@ defaultOptions.contentBlocks = false extensible subset of the \acro{peg} grammar of markdown % (see the \luamref{walkable_syntax} hash table) after built-in syntax extensions -% (see Section <#sec:luabuiltinextensions>) +% (see Section <#sec:lua-built-in-extensions>) % \iffalse (see options \Opt{citations}, \Opt{contentBlocks}, \Opt{definitionLists}, etc.) % \fi and user-defined syntax extensions -% (see Section <#sec:luauserextensions>) +% (see Section <#sec:lua-user-extensions>) % \iffalse (see option \Opt{extensions}) % \fi @@ -5194,7 +5228,7 @@ metadata.grammar_version = 2 % markdown using the interface of a Lua \luamref{reader} object, such as % the \luamref{reader->insert_pattern} and % \luamref{reader->add_special_character} methods, -% see Section <#luauserextensions>. +% see Section <#lua-user-extensions>. % % \end{markdown} % \iffalse @@ -5857,7 +5891,7 @@ Hi *world*! ``````` Last, invoke pdfTeX without shell access from the terminal: ``` sh -texexec --passon=--no-shell-escape document.tex +context 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 @@ -10323,7 +10357,7 @@ for i = 1, #arg do % Unless the `-`{}`-` argument has been specified before, an argument % containing the equals sign (`=`) is assumed to be an option specification in % a \meta{key}`=`\meta{value} format. The available options are listed in -% Section <#sec:luaoptions>. +% Section <#sec:lua-options>. % \end{markdown} % \begin{macrocode} elseif arg[i]:match("=") then @@ -10491,7 +10525,7 @@ pdftex --shell-escape document.tex % % The plain \TeX{} interface provides macros for the typesetting of markdown % input from within plain \TeX{}, for setting the Lua interface options (see -% Section <#sec:luaoptions>) used during the conversion from markdown to +% Section <#sec:lua-options>) used during the conversion from markdown to % plain \TeX{} and for changing the way markdown the tokens are rendered. % % \end{markdown} @@ -10510,7 +10544,7 @@ pdftex --shell-escape document.tex % \noindent It is expected that the special plain \TeX{} characters have the % expected category codes, when `\input`ting the file. % -%### Typesetting Markdown {#textypesetting} +%### Typesetting Markdown {#tex-typesetting} % % The interface exposes the \mdef{markdownBegin}, \mdef{markdownEnd}, % \mdef{markdownInput}, and \mdef{markdownEscape} macros. @@ -10607,11 +10641,11 @@ pdftex --shell-escape document.tex % \par % \begin{markdown} % -%### Options {#texoptions} +%### Options {#tex-options} % % The plain \TeX{} options are represented by \TeX{} commands. Some of them map % directly to the options recognized by the Lua interface (see -% Section <#sec:luaoptions>), while some of them are specific to the plain +% Section <#sec:lua-options>), while some of them are specific to the plain % \TeX{} interface. % % To enable the enumeration of plain \TeX{} options, we will maintain the @@ -10880,7 +10914,7 @@ For more information, see the examples for the \Opt{finalizeCache} option. % % Furthemore, we also define macros that map directly to the options recognized % by the Lua interface, such as \mdef{markdownOptionHybrid} for the -% \Opt{hybrid} Lua option (see Section <#sec:luaoptions>), which are not +% \Opt{hybrid} Lua option (see Section <#sec:lua-options>), which are not % processed by the plain \TeX{} implementation, only passed along to Lua. % % For the macros that correspond to the non-boolean options recognized by the @@ -11125,7 +11159,7 @@ In this section, I will describe the individual token renderers. % % The following \TeX{} macros may occur inside the output of the % converter functions exposed by the Lua interface (see Section -% <#sec:luaconversion>) and represent the parsed markdown tokens. These +% <#sec:lua-conversion>) and represent the parsed markdown tokens. These % macros are intended to be redefined by the user who is typesetting a % document. By default, they point to the corresponding prototypes (see Section % <#sec:texrendererprototypes>). @@ -12637,8 +12671,8 @@ list is not tight). The macro receives no arguments. % \begin{markdown} The \mdef{markdownRendererDlBeginTight} macro represents the beginning of a -definition list that contains an item with several paragraphs of text (the -list is not tight). This macro will only be produced, when the +definition list that contains no item with several paragraphs of text (the +list is tight). This macro will only be produced, when the \Opt{tightLists} option is disabled. The macro receives no arguments. % \end{markdown} @@ -18540,7 +18574,7 @@ following text: % \begin{markdown} % The macro is exposed in the interface, so that the user can create their own % markdown environments. Due to the way the arguments are passed to Lua (see -% Section <#sec:directlua>), the first argument may not contain the +% Section <#sec:direct-lua>), the first argument may not contain the % string `]]` (regardless of the category code of the bracket symbol (`]`)). % % The \mdef{markdownMode} macro specifies how the plain \TeX{} implementation @@ -18677,7 +18711,7 @@ pdflatex --shell-escape document.tex % Section <#sec:texinterface>). % % The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see -% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`, +% Section <#sec:tex-interface-logging>) to use the \LaTeX{} `\PackageInfo`, % `\PackageWarning`, and `\PackageError` macros. % % \end{markdown} @@ -18697,10 +18731,10 @@ pdflatex --shell-escape document.tex % \end{Verbatim} % \begin{markdown} % where \meta{options} are the \LaTeX{} interface options (see Section -% <#sec:latexoptions>). Note that \meta{options} inside the `\usepackage` +% <#sec:latex-options>). Note that \meta{options} inside the `\usepackage` % macro may not set the `markdownRenderers` (see Section -% <#sec:latexrenderers>) and `markdownRendererPrototypes` (see Section -% <#sec:latexrendererprototypes>) keys. Furthermore, although the +% <#sec:latex-renderers>) and `markdownRendererPrototypes` (see Section +% <#sec:latex-renderer-prototypes>) keys. Furthermore, although the % base variant of the `import` key that loads a single \LaTeX{} theme % (see Section <#sec:latexthemes>) can be used, the extended variant % that can load multiple themes and import snippets from them (see @@ -18718,7 +18752,7 @@ pdflatex --shell-escape document.tex % The \envmref{markdown} and \envmref{markdown*} \LaTeX{} environments are used to % typeset markdown document fragments. The starred version of the % \envmref{markdown} environment accepts \LaTeX{} interface options (see -% Section <#sec:latexoptions>) as its only argument. These options will +% Section <#sec:latex-options>) as its only argument. These options will % only influence this markdown document fragment. % % \end{markdown} @@ -18755,7 +18789,7 @@ pdflatex --shell-escape document.tex % the filename of a markdown document and expands to the result of the % conversion of the input markdown document to plain \TeX{}. Unlike the % \mref{markdownInput} macro provided by the plain \TeX{} interface, this macro -% also accepts \LaTeX{} interface options (see Section <#sec:latexoptions>) +% also accepts \LaTeX{} interface options (see Section <#sec:latex-options>) % as its optional argument. These options will only influnce this markdown % document. % @@ -18771,7 +18805,7 @@ pdflatex --shell-escape document.tex % \end{document} % ``````` % -%### Options {#latexoptions} +%### Options {#latex-options} % % The \LaTeX{} options are represented by a comma-delimited list of % \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value} @@ -18780,9 +18814,9 @@ pdflatex --shell-escape document.tex % % Except for the `plain` option described in Section <#sec:latexplain>, and % the \LaTeX{} themes described in Section <#sec:latexthemes>, and the -% \LaTeX{} snippets described in Section <#sec:latexsetupsnippets>, +% \LaTeX{} snippets described in Section <#sec:latex-setup-snippets>, % \LaTeX{} options map directly to the options recognized by the plain -% \TeX{} interface (see Section <#sec:texoptions>) and to the markdown token +% \TeX{} interface (see Section <#sec:tex-options>) and to the markdown token % renderers and their prototypes recognized by the plain \TeX{} interface (see % Sections <#sec:texrenderersuser> and <#sec:texrendererprototypes>). % @@ -18807,7 +18841,7 @@ pdflatex --shell-escape document.tex % \end{macrocode} % \begin{markdown} % -%#### \LaTeX{} snippets {#latexsetupsnippets} +%#### \LaTeX{} snippets {#latex-setup-snippets} % % We may also set up \LaTeX{} options as *snippets* using the % \mdef{markdownSetupSnippet} macro and invoke them later. The @@ -18939,9 +18973,9 @@ other packages used in a document. Additionally, if we redefine token renderers and renderer prototypes ourselves, the default definitions will bring no benefit to us. Using the `plain` package option, we can keep the default definitions from the plain \TeX{} implementation -% (see Section <#sec:textokenrendererprototypes>) +% (see Section <#sec:tex-token-renderer-prototypes>) and prevent the soft \LaTeX{} prerequisites -% in Section <#sec:latexprerequisites> +% in Section <#sec:latex-prerequisites> 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. @@ -19112,7 +19146,7 @@ would use the following code in the preamble of your document: % \begin{markdown} % % The \LaTeX{} themes have a useful synergy with snippets (see Section -% <#sec:latexsetupsnippets>): To make it less likely that different themes +% <#sec:latex-setup-snippets>): To make it less likely that different themes % will set up snippets with the same name, we will prepend \meta{theme % name}`/` before the snippet name and use the result as the snippet name. % For example, if the `witiko/dot` theme sets up the `product` snippet, the @@ -19406,7 +19440,7 @@ following text, where the middot (`·`) denotes a non-breaking space: % \par % \begin{markdown} % -% Please, see Section <#sec:latexthemesimplementation> for implementation +% Please, see Section <#sec:latex-themes-implementation> for implementation % details of the example themes. #### \LaTeX{} snippets {#latexsnippets} @@ -19483,7 +19517,8 @@ The following ordered list will be preceded by roman numerals: ``````` If the `romanNumerals` snippet were defined in the `jdoe/lists` theme, -we can import the theme and use the qualified name of the snippet: +we could import the `jdoe/lists` theme and use the qualified name +`jdoe/lists/romanNumerals` to invoke the snippet: ``` tex \markdownSetup{import=jdoe/lists} @@ -19499,7 +19534,7 @@ The following ordered list will be preceded by roman numerals: Alternatively, we can use the extended variant of the `import` \LaTeX{} option that allows us to import the `romanNumerals` snippet to the -current namespace, so that we can invoke the snippet with less typing: +current namespace for easier access: ``` tex \markdownSetup{ @@ -19518,8 +19553,9 @@ The following ordered list will be preceded by roman numerals: ``````` Furthermore, we can also specify the name of the snippet in the current -namespace, which is different from the name of the snippet in the -`jdoe/lists` theme: +namespace, which can be different from the name of the snippet in the +`jdoe/lists` theme. For example, we can make the snippet +`jdoe/lists/romanNumerals` available under the name `roman`. ``` tex \markdownSetup{ @@ -19538,7 +19574,23 @@ The following ordered list will be preceded by roman numerals: ``````` Several themes and/or snippets can be loaded at once using the extended -variant of the `import` \LaTeX{} option. +variant of the `import` \LaTeX{} option: + +``` tex +\markdownSetup{ + import = { + jdoe/longpackagename/lists = { + arabic as arabic1, + roman, + alphabetic, + }, + jdoe/anotherlongpackagename/lists = { + arabic as arabic2, + }, + jdoe/yetanotherlongpackagename, + }, +} +``````` % \markdownEnd % \iffalse @@ -19752,7 +19804,7 @@ variant of the `import` \LaTeX{} option. { s } { \msg_error:nnn - { @@ } + { markdown } { malformed-name-for-clist-option } { #3 } } @@ -19798,7 +19850,7 @@ variant of the `import` \LaTeX{} option. { en } { F } \msg_new:nnn - { @@ } + { markdown } { malformed-name-for-clist-option } { Clist~option~name~#1~does~not~end~with~-s. @@ -19851,12 +19903,13 @@ variant of the `import` \LaTeX{} option. % } % ``````` % -%#### Plain \TeX{} Markdown Token Renderers {#latexrenderers} +%#### Plain \TeX{} Markdown Token Renderers {#latex-renderers} % % The \LaTeX{} interface recognizes an option with the `renderers` key, -% whose value must be a list of options that map directly to the markdown token -% renderer macros exposed by the plain \TeX{} interface (see Section -% <#sec:texrenderersuser>). +% whose value must be a list of key-values, where the keys correspond +% to the markdown token renderer macros exposed by the plain \TeX{} +% interface (see Section <#sec:texrenderersuser>) and the values are +% new definitions of these token renderers. % % \end{markdown} % \begin{macrocode} @@ -19932,12 +19985,119 @@ variant of the `import` \LaTeX{} option. % } % ``````` % -%#### Plain \TeX{} Markdown Token Renderer Prototypes {#latexrendererprototypes} +% In addition to exact token renderer names, we also support wildcards +% that match multiple token renderer names. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\tl_new:N + \l_@@_renderer_definition_tl +\keys_define:nn + { markdown/latex-options/renderers } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l_@@_renderer_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g_@@_renderers_seq + { + \@@_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \@@_renderer_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g_@@_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l_@@_renderer_definition_tl + \int_incr:N + \l_tmpa_int + \@@_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer } + { + Renderer~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-wildcard } + { + Wildcard~#1~matches~no~renderers. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff +% \end{macrocode} +% \begin{markdown} +% +%#### Plain \TeX{} Markdown Token Renderer Prototypes {#latex-renderer-prototypes} % -% The \LaTeX{} interface recognizes an option with the `rendererPrototypes` -% key, whose value must be a list of options that map directly to the markdown -% token renderer prototype macros exposed by the plain \TeX{} interface (see -% Section <#sec:texrendererprototypes>). +% The \LaTeX{} interface recognizes an option with the +% `rendererPrototypes` key, whose value must be a list of key-values, +% where the keys correspond to the markdown token renderer prototype +% macros exposed by the plain \TeX{} interface (see Section +% <#sec:texrendererprototypes>) and the values are new definitions of +% these token renderer prototypes. % % \end{markdown} % \begin{macrocode} @@ -20000,6 +20160,111 @@ variant of the `import` \LaTeX{} option. % } % ``````` % +% In addition to exact token renderer prototype names, we also support +% wildcards that match multiple token renderer prototype names. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\tl_new:N + \l_@@_renderer_prototype_definition_tl +\keys_define:nn + { markdown/latex-options/renderer-prototypes } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l_@@_renderer_prototype_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g_@@_renderers_seq + { + \@@_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \@@_renderer_prototype_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g_@@_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l_@@_renderer_prototype_definition_tl + \int_incr:N + \l_tmpa_int + \@@_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-prototype-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer-prototype } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer-prototype } + { + Renderer~prototype~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-prototype-wildcard } + { + Wildcard~#1~matches~no~renderer~prototypes. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff +% \end{macrocode} +% \begin{markdown} +% % \iffalse % %<*context> @@ -20052,11 +20317,6 @@ following text: > *equals* > . -Invoking pdfTeX should have the same effect: -``` sh -texexec --passon=--shell-escape document.tex -`````` - % %<*context> % \fi @@ -20077,7 +20337,7 @@ texexec --passon=--shell-escape document.tex % \begin{markdown} % % The \Hologo{ConTeXt} implementation redefines the plain \TeX{} logging macros -% (see Section <#sec:texinterfacelogging>) to use the \Hologo{ConTeXt} +% (see Section <#sec:tex-interface-logging>) to use the \Hologo{ConTeXt} % `\writestatus` macro. % % \end{markdown} @@ -20137,7 +20397,7 @@ texexec --passon=--shell-escape document.tex % the conversion of the input markdown document to plain \TeX{}. Unlike the % \mref{markdownInput} macro provided by the plain \TeX{} interface, this macro % also accepts \Hologo{ConTeXt} interface options (see Section -% <#sec:contextoptions>) as its optional argument. These options will only +% <#sec:context-options>) as its optional argument. These options will only % influnce this markdown document. % % The following example \LaTeX{} code showcases the usage of the @@ -20151,7 +20411,7 @@ texexec --passon=--shell-escape document.tex % \stoptext % ``````` % -%### Options {#contextoptions} +%### Options {#context-options} % % The \Hologo{ConTeXt} options are represented by a comma-delimited list of % \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value} @@ -20160,7 +20420,7 @@ texexec --passon=--shell-escape document.tex % omitted. % % \Hologo{ConTeXt} options map directly to the options recognized by the plain -% \TeX{} interface (see Section <#sec:texoptions>). +% \TeX{} interface (see Section <#sec:tex-options>). % % The \Hologo{ConTeXt} options may be specified when using the % \mref{inputmarkdown} macro (see Section <#sec:contextinterface>), or via the @@ -22764,7 +23024,7 @@ end % \par % \begin{markdown} % -%### Plain \TeX{} Writer {#texwriter} +%### Plain \TeX{} Writer {#tex-writer} % % This section documents the \luamref{writer} object, which implements the % routines for producing the \TeX{} output. The object is an amalgamate of the @@ -22787,7 +23047,7 @@ M.writer = {} % % The \luamdef{writer.new} method creates and returns a new \TeX{} writer % object associated with the Lua interface options (see Section -% <#sec:luaoptions>) `options`. When `options` are unspecified, it is +% <#sec:lua-options>) `options`. When `options` are unspecified, it is % assumed that an empty table was passed to the method. % % The objects produced by the \luamref{writer.new} method expose instance methods @@ -23085,7 +23345,7 @@ function M.writer.new(options) {"\\markdownRendererCodeSpan{", self.escape(s), "}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererCodeSpanAttributeContextEnd ") + "\\markdownRendererCodeSpanAttributeContextEnd{}") end return buf end @@ -23113,7 +23373,7 @@ function M.writer.new(options) "{",self.string(tit or ""),"}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererLinkAttributeContextEnd ") + "\\markdownRendererLinkAttributeContextEnd{}") end return buf end @@ -23141,7 +23401,7 @@ function M.writer.new(options) "{",self.string(tit or ""),"}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererImageAttributeContextEnd ") + "\\markdownRendererImageAttributeContextEnd{}") end return buf end @@ -23385,30 +23645,53 @@ function M.writer.new(options) % \begin{markdown} % % Define \luamdef{writer->attributes} as a function that will transform -% input attributes `attr` to the output format. +% input attributes `attrs` to the output format. % % \end{markdown} % \begin{macrocode} - function self.attributes(attr) - local buf = {} + function self.attributes(attributes) + local expanded_attributes = {} + local key_value_regex = "([^= ]+)%s*=%s*(.*)" + local key, value + for _, attribute in ipairs(attributes) do + if attribute:sub(1, 1) == "#" or attribute:sub(1, 1) == "." then + table.insert(expanded_attributes, attribute) + else + key, value = attribute:match(key_value_regex) + if key:lower() == "id" then + table.insert(expanded_attributes, "#" .. value) + elseif key:lower() == "class" then + local classes = {} + for class in value:gmatch("%S+") do + table.insert(classes, class) + end + table.sort(classes) + for _, class in ipairs(classes) do + table.insert(expanded_attributes, "." .. class) + end + else + table.insert(expanded_attributes, attribute) + end + end + end + table.sort(expanded_attributes) - table.sort(attr) + local buf = {} local seen = {} - local key, value - for i = 1, #attr do - if seen[attr[i]] ~= nil then + for _, attribute in ipairs(expanded_attributes) do + if seen[attribute] ~= nil then goto continue -- prevent duplicate attributes else - seen[attr[i]] = true + seen[attribute] = true end - if attr[i]:sub(1, 1) == "#" then + if attribute:sub(1, 1) == "#" then table.insert(buf, {"\\markdownRendererAttributeIdentifier{", - attr[i]:sub(2), "}"}) - elseif attr[i]:sub(1, 1) == "." then + attribute:sub(2), "}"}) + elseif attribute:sub(1, 1) == "." then table.insert(buf, {"\\markdownRendererAttributeClassName{", - attr[i]:sub(2), "}"}) + attribute:sub(2), "}"}) else - key, value = attr[i]:match("([^= ]+)%s*=%s*(.*)") + key, value = attribute:match(key_value_regex) table.insert(buf, {"\\markdownRendererAttributeKeyValue{", key, "}{", value, "}"}) end @@ -23866,13 +24149,16 @@ parsers.commented_line = Cg(Cc(""), "backslashes") parsers.chunk = parsers.line * (parsers.optionallyindentedline - parsers.blankline)^0 -parsers.attribute_key_char = parsers.alphanumeric + S("_-") +parsers.attribute_key_char = parsers.alphanumeric + S("-_:.") parsers.attribute_key = (parsers.attribute_key_char - parsers.dash - parsers.digit) * parsers.attribute_key_char^0 parsers.attribute_value = ( (parsers.dquote / "") * (parsers.anyescaped - parsers.dquote)^0 * (parsers.dquote / "")) + + ( (parsers.squote / "") + * (parsers.anyescaped - parsers.squote)^0 + * (parsers.squote / "")) + ( parsers.anyescaped - parsers.dquote - parsers.rbrace - parsers.space)^0 @@ -24247,7 +24533,7 @@ end % \par % \begin{markdown} % -%### Markdown Reader {#markdownreader} +%### Markdown Reader {#markdown-reader} % % This section documents the \luamref{reader} object, which implements the % routines for parsing the markdown input. The object corresponds to the @@ -24256,7 +24542,7 @@ end % % The \luamdef{reader.new} method creates and returns a new \TeX{} reader % object associated with the Lua interface options (see Section -% <#sec:luaoptions>) `options` and with a writer object `writer`. When +% <#sec:lua-options>) `options` and with a writer object `writer`. When % `options` are unspecified, it is assumed that an empty table was passed to % the method. % @@ -25321,7 +25607,7 @@ end % \begin{markdown} % % Although the interface of the \luamref{reader->insert_pattern} method does -% document this (see Section <#sec:luauserextensions>), we allow the +% document this (see Section <#sec:lua-user-extensions>), we allow the % \luamref{reader->insert_pattern} and \luamref{reader->update_rule} % methods to insert not just \acro{peg} patterns, but also rule names that % reference the \acro{peg} grammar of Markdown. @@ -25438,7 +25724,7 @@ end % \begin{markdown} % When determining the name of the cache file, create salt for the hashing % function out of the package version and the passed options recognized by the -% Lua interface (see Section <#sec:luaoptions>). The \Opt{cacheDir} option +% Lua interface (see Section <#sec:lua-options>). The \Opt{cacheDir} option % is disregarded. % \end{markdown} % \begin{macrocode} @@ -25509,7 +25795,7 @@ end % \end{macrocode} % \begin{markdown} % -%### Built-In Syntax Extensions {#luabuiltinextensions} +%### Built-In Syntax Extensions {#lua-built-in-extensions} % % Create \luamref{extensions} hash table that contains built-in syntax % extensions. Syntax extensions are functions that produce objects with two @@ -27611,6 +27897,7 @@ M.extensions.jekyll_data = function(expect_jekyll_data) , function(s, i, text) -- luacheck: ignore s i local data local ran_ok, _ = pcall(function() + -- TODO: Replace with `require("tinyyaml")` in TeX Live 2023 local tinyyaml = require("markdown-tinyyaml") data = tinyyaml.parse(text, {timestamps=false}) end) @@ -27654,7 +27941,7 @@ end % % The \luamref{new} function returns a conversion function that takes a % markdown string and turns it into a plain \TeX{} output. See Section -% <#sec:luaconversion>. +% <#sec:lua-conversion>. % % \end{markdown} % \begin{macrocode} @@ -27883,7 +28170,7 @@ function M.new(options) % % Finally, cast the user-defined syntax extension to the internal format % of user extensions used by the Markdown package (see Section -% <#sec:luabuiltinextensions>.) +% <#sec:lua-built-in-extensions>.) % % \end{markdown} % \begin{macrocode} @@ -28004,7 +28291,7 @@ end % used to implement the macros for the conversion from markdown to plain \TeX{} % exposed by the plain \TeX{} interface (see Section <#sec:texinterface>). % -%### Logging Facilities {#texinterfacelogging} +%### Logging Facilities {#tex-interface-logging} % % \end{markdown} % \begin{macrocode} @@ -28025,7 +28312,7 @@ end % \par % \begin{markdown} % -%### Token Renderer Prototypes {#textokenrendererprototypes} +%### Token Renderer Prototypes {#tex-token-renderer-prototypes} % % The following definitions should be considered placeholder. % @@ -28205,7 +28492,7 @@ end % \par % \begin{markdown} % -%#### YAML Metadata Renderer Prototypes {#expl3yamlmetadataimplementation} +%#### YAML Metadata Renderer Prototypes {#expl3-yaml-metadata-implementation} % % To keep track of the current type of structure we inhabit when we are % traversing a \acro{yaml} document, we will maintain the @@ -28445,8 +28732,8 @@ end %### Lua Snippets % After the \mdef{markdownPrepareLuaOptions} macro has been fully expanded, % the \mdef{markdownLuaOptions} macro will expands to a Lua table that -% contains the plain \TeX{} options (see Section <#sec:texoptions>) in a -% format recognized by Lua (see Section <#sec:luaoptions>). +% contains the plain \TeX{} options (see Section <#sec:tex-options>) in a +% format recognized by Lua (see Section <#sec:lua-options>). % % \end{markdown} % \begin{macrocode} @@ -28573,8 +28860,9 @@ end % \end{markdown} % \begin{macrocode} \ExplSyntaxOn -\cs_new:Nn - \@@_if_option:nTF +\prg_new_conditional:Nnn + \@@_if_option:n + { TF, T, F } { \@@_get_option_type:nN { #1 } @@ -28584,7 +28872,7 @@ end \c_@@_option_type_boolean_tl { \msg_error:nnxx - { @@ } + { markdown } { expected-boolean-option } { #1 } { \l_tmpa_tl } @@ -28595,11 +28883,11 @@ end \str_if_eq:NNTF \l_tmpa_tl \c_@@_option_value_true_tl - { #2 } - { #3 } + { \prg_return_true: } + { \prg_return_false: } } \msg_new:nnn - { @@ } + { markdown } { expected-boolean-option } { Option~#1~has~type~#2,~ @@ -28812,14 +29100,14 @@ end % \end{macrocode} % \begin{markdown} % -%### Lua Shell Escape Bridge {#luabridge} +%### Lua Shell Escape Bridge {#lua-bridge} % % The following \TeX{} code is intended for \TeX{} engines that do not provide % direct access to Lua, but expose the shell of the operating system. This % corresponds to the \mref{markdownMode} values of `0` and `1`. % % The \mref{markdownLuaExecute} macro defined here and in Section -% <#sec:directlua> are meant to be indistinguishable to the remaining code. +% <#sec:direct-lua> are meant to be indistinguishable to the remaining code. % % The package assumes that although the user is not using the Lua\TeX{} engine, % their \TeX{} distribution contains it, and uses shell access to produce and @@ -29001,11 +29289,11 @@ end % \par % \begin{markdown} % -%### Direct Lua Access {#directlua} +%### Direct Lua Access {#direct-lua} % % The following \TeX{} code is intended for \TeX{} engines that provide % direct access to Lua (Lua\TeX{}). The macro \mref{markdownLuaExecute} defined -% here and in Section <#sec:luabridge> are meant to be indistinguishable to +% here and in Section <#sec:lua-bridge> are meant to be indistinguishable to % the remaining code. This corresponds to the \mref{markdownMode} value of `2`. % % \end{markdown} @@ -29021,7 +29309,7 @@ end % The direct Lua access version of the \mref{markdownLuaExecute} macro is defined % in terms of the `\directlua` primitive. The `print` function is set as % an alias to the `tex.print` method in order to mimic the behaviour of the -% \mref{markdownLuaExecute} definition from Section <#sec:luabridge>, +% \mref{markdownLuaExecute} definition from Section <#sec:lua-bridge>, % % \end{markdown} % \begin{macrocode} @@ -29199,7 +29487,7 @@ end % %### Logging Facilities % The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see -% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`, +% Section <#sec:tex-interface-logging>) to use the \LaTeX{} `\PackageInfo`, % `\PackageWarning`, and `\PackageError` macros. % % \end{markdown} @@ -29212,7 +29500,7 @@ end % The \mdef{markdownInputPlainTeX} macro is used to store the original plain % \TeX{} implementation of the \mref{markdownInput} macro. The \mref{markdownInput} % is then redefined to accept an optional argument with options recognized by -% the \LaTeX{} interface (see Section <#sec:latexoptions>). +% the \LaTeX{} interface (see Section <#sec:latex-options>). % % \end{markdown} % \begin{macrocode} @@ -29258,7 +29546,7 @@ end % \par % \begin{markdown} % -%#### \LaTeX{} Themes {#latexthemesimplementation} +%#### \LaTeX{} Themes {#latex-themes-implementation} % % This section implements the theme-loading mechanism and the example themes % provided with the Markdown package. @@ -29320,7 +29608,7 @@ end % \begin{markdown} % % We load the \pkg{ifthen} and \pkg{grffile} packages, see also -% Section <#sec:latexprerequisites>: +% Section <#sec:latex-prerequisites>: % % \end{markdown} % \begin{macrocode} @@ -29394,7 +29682,7 @@ end % \begin{markdown} % % We load the \pkg{catchfile} and \pkg{grffile} packages, see also -% Section <#sec:latexprerequisites>: +% Section <#sec:latex-prerequisites>: % % \end{markdown} % \begin{macrocode} @@ -29655,7 +29943,7 @@ end % \par % \begin{markdown} % -%### Token Renderer Prototypes {#latexdefaultrendererprototypes} +%### Token Renderer Prototypes {#latex-default-renderer-prototypes} % % The following configuration should be considered placeholder. If the `plain` % package option has been enabled (see Section <#sec:latexplain>), none of @@ -29742,8 +30030,25 @@ end { #2 } } \markdownSetup{rendererPrototypes={ - ulBeginTight = {\begin{compactitem}}, - ulEndTight = {\end{compactitem}}, +% \end{macrocode} +% \par +% \begin{markdown} +% +% Make tight bullet lists a little less compact by adding extra vertical space +% above and below them. +% +% \end{markdown} +% \begin{macrocode} + ulBeginTight = {% + \group_begin: + \pltopsep=\topsep + \plpartopsep=\partopsep + \begin{compactitem} + }, + ulEndTight = { + \end{compactitem} + \group_end: + }, fancyOlBegin = { \group_begin: \tl_set:Nn @@ -29767,8 +30072,25 @@ end \end{enumerate} \group_end: }, - olBeginTight = {\begin{compactenum}}, - olEndTight = {\end{compactenum}}, +% \end{macrocode} +% \par +% \begin{markdown} +% +% Make tight ordered lists a little less compact by adding extra vertical +% space above and below them. +% +% \end{markdown} +% \begin{macrocode} + olBeginTight = {% + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum} + }, + olEndTight = { + \end{compactenum} + \group_end: + }, fancyOlBeginTight = { \group_begin: \tl_set:Nn @@ -29779,7 +30101,11 @@ end { #2 } \tl_set:Nn \l_tmpa_tl - { \begin{compactenum}[ } + { + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum}[ + } \tl_put_right:Nx \l_tmpa_tl { \@@_latex_paralist_style:nn { #1 } { #2 } } @@ -29801,8 +30127,25 @@ end { #1 } ] }, - dlBeginTight = {\begin{compactdesc}}, - dlEndTight = {\end{compactdesc}}}} +% \end{macrocode} +% \par +% \begin{markdown} +% +% Make tight definition lists a little less compact by adding extra +% vertical space above and below them. +% +% \end{markdown} +% \begin{macrocode} + dlBeginTight = { + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactdesc} + }, + dlEndTight = { + \end{compactdesc} + \group_end: + }}} \cs_generate_variant:Nn \@@_latex_fancy_list_item_label:nnn { VVn } @@ -30595,7 +30938,7 @@ end % \par % \begin{markdown} % -%#### YAML Metadata {#latexyamlmetadata} +%#### YAML Metadata {#latex-yaml-metadata} % % The default setup of \acro{yaml} metadata will invoke the `\title`, % `\author`, and `\date` macros when scalar values for keys that @@ -30701,7 +31044,7 @@ end % \end{markdown} % \begin{macrocode} \ExplSyntaxOn -\@@_if_option:nTF +\@@_if_option:nT { linkAttributes } { \RequirePackage{graphicx} @@ -30725,7 +31068,6 @@ end }, } } - { } \ExplSyntaxOff % \end{macrocode} % \par @@ -30846,7 +31188,7 @@ end %### Typesetting Markdown % The \mref{inputmarkdown} is defined to accept an optional argument with % options recognized by the \Hologo{ConTeXt} interface (see Section -% <#sec:contextoptions>). +% <#sec:context-options>). % % \end{markdown} % \begin{macrocode} diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index 0d71a2f98e3..8ad545ea609 100644 --- a/Master/texmf-dist/tex/generic/markdown/markdown.tex +++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex @@ -107,7 +107,7 @@ } { \msg_error:nnnV - { __markdown } + { markdown } { failed-typecheck-for-boolean-option } { #1 } \l_tmpa_tl @@ -116,7 +116,7 @@ } } \msg_new:nnn - { __markdown } + { markdown } { failed-typecheck-for-boolean-option } { Option~#1~has~value~#2,~ @@ -165,7 +165,7 @@ \l_tmpa_bool { \msg_error:nnn - { __markdown } + { markdown } { undefined-option } { #1 } } @@ -174,7 +174,7 @@ \l_tmpa_tl { \msg_error:nnnV - { __markdown } + { markdown } { unknown-option-type } { #1 } \l_tmpa_tl @@ -184,13 +184,13 @@ \l_tmpa_tl } \msg_new:nnn - { __markdown } + { markdown } { unknown-option-type } { Option~#1~has~unknown~type~#2. } \msg_new:nnn - { __markdown } + { markdown } { undefined-option } { Option~#1~is~undefined. @@ -217,7 +217,7 @@ \l_tmpa_bool { \msg_error:nnn - { __markdown } + { markdown } { undefined-option } { #1 } } @@ -273,7 +273,6 @@ \tl_tail:n { #1 } } } -\seq_new:N \g__markdown_cases_seq \cs_new:Nn \__markdown_with_various_cases:nn { \seq_clear:N @@ -294,6 +293,11 @@ \l_tmpa_seq { #2 } } +\cs_new:Nn \__markdown_with_various_cases_break: + { + \seq_map_break: + } +\seq_new:N \g__markdown_cases_seq \cs_new:Nn \__markdown_camel_case:N { \regex_replace_all:nnN @@ -552,8 +556,8 @@ { boolean } { true } \ExplSyntaxOff -\def\markdownLastModified{2023-04-02}% -\def\markdownVersion{2.22.0-0-g5a3d0fe}% +\def\markdownLastModified{2023-04-27}% +\def\markdownVersion{2.23.0-0-g0b22f91}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax @@ -2547,8 +2551,9 @@ local convert = md.new(\markdownLuaOptions) }% \ExplSyntaxOn -\cs_new:Nn - \__markdown_if_option:nTF +\prg_new_conditional:Nnn + \__markdown_if_option:n + { TF, T, F } { \__markdown_get_option_type:nN { #1 } @@ -2558,7 +2563,7 @@ \c__markdown_option_type_boolean_tl { \msg_error:nnxx - { __markdown } + { markdown } { expected-boolean-option } { #1 } { \l_tmpa_tl } @@ -2569,11 +2574,11 @@ \str_if_eq:NNTF \l_tmpa_tl \c__markdown_option_value_true_tl - { #2 } - { #3 } + { \prg_return_true: } + { \prg_return_false: } } \msg_new:nnn - { __markdown } + { markdown } { expected-boolean-option } { Option~#1~has~type~#2,~ diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index c887db1c16a..661ea377553 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -318,7 +318,7 @@ { s } { \msg_error:nnn - { __markdown } + { markdown } { malformed-name-for-clist-option } { #3 } } @@ -364,7 +364,7 @@ { en } { F } \msg_new:nnn - { __markdown } + { markdown } { malformed-name-for-clist-option } { Clist~option~name~#1~does~not~end~with~-s. @@ -430,6 +430,103 @@ { ncV } \ExplSyntaxOff \ExplSyntaxOn +\tl_new:N + \l__markdown_renderer_definition_tl +\keys_define:nn + { markdown/latex-options/renderers } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l__markdown_renderer_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g__markdown_renderers_seq + { + \__markdown_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \__markdown_renderer_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g__markdown_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l__markdown_renderer_definition_tl + \int_incr:N + \l_tmpa_int + \__markdown_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer } + { + Renderer~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-wildcard } + { + Wildcard~#1~matches~no~renderers. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff +\ExplSyntaxOn \cs_new:Nn \__markdown_latex_define_renderer_prototypes: { \seq_map_function:NN @@ -472,6 +569,103 @@ \__markdown_latex_define_renderer_prototype:nNn { ncV } \ExplSyntaxOff +\ExplSyntaxOn +\tl_new:N + \l__markdown_renderer_prototype_definition_tl +\keys_define:nn + { markdown/latex-options/renderer-prototypes } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l__markdown_renderer_prototype_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g__markdown_renderers_seq + { + \__markdown_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \__markdown_renderer_prototype_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g__markdown_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l__markdown_renderer_prototype_definition_tl + \int_incr:N + \l_tmpa_int + \__markdown_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-prototype-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer-prototype } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer-prototype } + { + Renderer~prototype~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-prototype-wildcard } + { + Wildcard~#1~matches~no~renderer~prototypes. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff \def\markdownVersionSpace{ }% \ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v% \markdownVersion\markdownVersionSpace markdown renderer]% @@ -666,8 +860,16 @@ { #2 } } \markdownSetup{rendererPrototypes={ - ulBeginTight = {\begin{compactitem}}, - ulEndTight = {\end{compactitem}}, + ulBeginTight = {% + \group_begin: + \pltopsep=\topsep + \plpartopsep=\partopsep + \begin{compactitem} + }, + ulEndTight = { + \end{compactitem} + \group_end: + }, fancyOlBegin = { \group_begin: \tl_set:Nn @@ -691,8 +893,16 @@ \end{enumerate} \group_end: }, - olBeginTight = {\begin{compactenum}}, - olEndTight = {\end{compactenum}}, + olBeginTight = {% + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum} + }, + olEndTight = { + \end{compactenum} + \group_end: + }, fancyOlBeginTight = { \group_begin: \tl_set:Nn @@ -703,7 +913,11 @@ { #2 } \tl_set:Nn \l_tmpa_tl - { \begin{compactenum}[ } + { + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum}[ + } \tl_put_right:Nx \l_tmpa_tl { \__markdown_latex_paralist_style:nn { #1 } { #2 } } @@ -725,8 +939,16 @@ { #1 } ] }, - dlBeginTight = {\begin{compactdesc}}, - dlEndTight = {\end{compactdesc}}}} + dlBeginTight = { + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactdesc} + }, + dlEndTight = { + \end{compactdesc} + \group_end: + }}} \cs_generate_variant:Nn \__markdown_latex_fancy_list_item_label:nnn { VVn } @@ -1390,7 +1612,7 @@ } }{} \ExplSyntaxOn -\__markdown_if_option:nTF +\__markdown_if_option:nT { linkAttributes } { \RequirePackage{graphicx} @@ -1414,7 +1636,6 @@ }, } } - { } \ExplSyntaxOff \ExplSyntaxOn \cs_gset:Npn diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown-tinyyaml.lua b/Master/texmf-dist/tex/luatex/markdown/markdown-tinyyaml.lua index 7a57ef2422d..074ad79446e 100644 --- a/Master/texmf-dist/tex/luatex/markdown/markdown-tinyyaml.lua +++ b/Master/texmf-dist/tex/luatex/markdown/markdown-tinyyaml.lua @@ -38,6 +38,8 @@ local tonumber = tonumber local math = math local getmetatable = getmetatable local error = error +local end_symbol = "..." +local end_break_symbol = "...\n" local UNESCAPES = { ['0'] = "\x00", z = "\x00", N = "\x85", @@ -183,7 +185,14 @@ function Parser:parsestring(line, stopper) if not i then return nil, line end - return ssub(line, 2, i-1), ssub(line, i+1) + -- Unescape repeated single quotes. + while i < #line and ssub(line, i+1, i+1) == "'" do + i = sfind(line, "'", i + 2, true) + if not i then + return nil, line + end + end + return ssub(line, 2, i-1):gsub("''", "'"), ssub(line, i+1) end if q == '"' then local i, buf = 2, '' @@ -702,6 +711,13 @@ function Parser:parsemap(line, lines, indent) while #lines > 0 do -- Check for a new document line = lines[1] + if line == end_symbol or line == end_break_symbol then + for i, _ in ipairs(lines) do + lines[i] = nil + end + return map + end + if startswith(line, '---') then while #lines > 0 and not startswith(lines, '---') do tremove(lines, 1) diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index 1e68b8ae84f..225428abe03 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.22.0-0-g5a3d0fe", + version = "2.23.0-0-g0b22f91", 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", @@ -2503,7 +2503,7 @@ function M.writer.new(options) {"\\markdownRendererCodeSpan{", self.escape(s), "}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererCodeSpanAttributeContextEnd ") + "\\markdownRendererCodeSpanAttributeContextEnd{}") end return buf end @@ -2520,7 +2520,7 @@ function M.writer.new(options) "{",self.string(tit or ""),"}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererLinkAttributeContextEnd ") + "\\markdownRendererLinkAttributeContextEnd{}") end return buf end @@ -2537,7 +2537,7 @@ function M.writer.new(options) "{",self.string(tit or ""),"}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererImageAttributeContextEnd ") + "\\markdownRendererImageAttributeContextEnd{}") end return buf end @@ -2640,26 +2640,49 @@ function M.writer.new(options) return buf end - function self.attributes(attr) - local buf = {} + function self.attributes(attributes) + local expanded_attributes = {} + local key_value_regex = "([^= ]+)%s*=%s*(.*)" + local key, value + for _, attribute in ipairs(attributes) do + if attribute:sub(1, 1) == "#" or attribute:sub(1, 1) == "." then + table.insert(expanded_attributes, attribute) + else + key, value = attribute:match(key_value_regex) + if key:lower() == "id" then + table.insert(expanded_attributes, "#" .. value) + elseif key:lower() == "class" then + local classes = {} + for class in value:gmatch("%S+") do + table.insert(classes, class) + end + table.sort(classes) + for _, class in ipairs(classes) do + table.insert(expanded_attributes, "." .. class) + end + else + table.insert(expanded_attributes, attribute) + end + end + end + table.sort(expanded_attributes) - table.sort(attr) + local buf = {} local seen = {} - local key, value - for i = 1, #attr do - if seen[attr[i]] ~= nil then + for _, attribute in ipairs(expanded_attributes) do + if seen[attribute] ~= nil then goto continue -- prevent duplicate attributes else - seen[attr[i]] = true + seen[attribute] = true end - if attr[i]:sub(1, 1) == "#" then + if attribute:sub(1, 1) == "#" then table.insert(buf, {"\\markdownRendererAttributeIdentifier{", - attr[i]:sub(2), "}"}) - elseif attr[i]:sub(1, 1) == "." then + attribute:sub(2), "}"}) + elseif attribute:sub(1, 1) == "." then table.insert(buf, {"\\markdownRendererAttributeClassName{", - attr[i]:sub(2), "}"}) + attribute:sub(2), "}"}) else - key, value = attr[i]:match("([^= ]+)%s*=%s*(.*)") + key, value = attribute:match(key_value_regex) table.insert(buf, {"\\markdownRendererAttributeKeyValue{", key, "}{", value, "}"}) end @@ -2971,13 +2994,16 @@ parsers.commented_line = Cg(Cc(""), "backslashes") parsers.chunk = parsers.line * (parsers.optionallyindentedline - parsers.blankline)^0 -parsers.attribute_key_char = parsers.alphanumeric + S("_-") +parsers.attribute_key_char = parsers.alphanumeric + S("-_:.") parsers.attribute_key = (parsers.attribute_key_char - parsers.dash - parsers.digit) * parsers.attribute_key_char^0 parsers.attribute_value = ( (parsers.dquote / "") * (parsers.anyescaped - parsers.dquote)^0 * (parsers.dquote / "")) + + ( (parsers.squote / "") + * (parsers.anyescaped - parsers.squote)^0 + * (parsers.squote / "")) + ( parsers.anyescaped - parsers.dquote - parsers.rbrace - parsers.space)^0 @@ -5652,6 +5678,7 @@ M.extensions.jekyll_data = function(expect_jekyll_data) , function(s, i, text) -- luacheck: ignore s i local data local ran_ok, _ = pcall(function() + -- TODO: Replace with `require("tinyyaml")` in TeX Live 2023 local tinyyaml = require("markdown-tinyyaml") data = tinyyaml.parse(text, {timestamps=false}) end) -- cgit v1.2.3- -Emil -Tobias -Linus -- -16 -14 -10 -