From 69c679a19d6d919414bc1268718ab445e225d930 Mon Sep 17 00:00:00 2001
From: Karl Berry 2.21.0-0-gee15b88 2023-02-28 2.22.0-0-g5a3d0fe 2023-04-02Markdown Package User Manual
-
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\def\markdownOptionFinalizeCache{true}
-\markdownBegin
-
- Hello *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFinalizeCache{true}
+\markdownBegin
+
+ Hello *world*!\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache will also be
produced as we requested using the finalizeCache
option.
Next, change the content of document.tex
as follows:
\input markdown
-\def\markdownOptionFrozenCache{true}
-\markdownBegin
-
- Hi *world*!\markdownEnd
-\bye
\input markdown
+\def\markdownOptionFrozenCache{true}
+\markdownBegin
+
+ Hi *world*!\markdownEnd
+\bye
Last, invoke pdfTeX without shell access from the terminal:
-pdftex -no-shell-escape document.tex
pdftex -no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3513,37 +3527,37 @@ contents of the frozen cache using the
the document without accessing the shell or invoking Lua, but the change
in the content of the markdown document from “Hello world!” to
“Hi world!” was not reflected.
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass[finalizecache]{article}
-\usepackage{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced as we requested using the finalizecache
-option.
Next, change the content of document.tex
as follows:
\documentclass[frozencache]{article}
+class="sourceCode tex">\documentclass[finalizecache]{article}
\usepackage{markdown}
\begin{document}
\begin{markdown}
-
+ Hi *world*!
Hello *world*!\end{markdown}
\end{document}
Last, invoke pdfTeX without shell access from the terminal:
+Next, invoke LuaTeX from the terminal:
pdflatex -no-shell-escape document.tex
lualatex document.tex
+A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced as we requested using the finalizecache
+option.
Next, change the content of document.tex
as follows:
\documentclass[frozencache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hi *world*!\end{markdown}
+\end{document}
Last, invoke pdfTeX without shell access from the terminal:
+pdflatex -no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3555,33 +3569,33 @@ in the content of the markdown document from “Hello world!” to
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
-\setupmarkdown[finalizeCache = yes]
-\starttext
-\startmarkdown
-
- Hello *world*!\stopmarkdown
-\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced in the cache.tex
output file as we requested using
-the finalizeCache
option.
Next, change the content of document.tex
as follows:
\usemodule[t][markdown]
-\setupmarkdown[frozenCache = yes]
+\setupmarkdown[finalizeCache = yes]
\starttext
\startmarkdown
-
+ Hi *world*!
Hello *world*!\stopmarkdown
\stoptext
Last, invoke pdfTeX without shell access from the terminal:
+Next, invoke LuaTeX from the terminal:
texexec --passon=--no-shell-escape document.tex
context document.tex
+A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced in the cache.tex
output file as we requested using
+the finalizeCache
option.
Next, change the content of document.tex
as follows:
\usemodule[t][markdown]
+\setupmarkdown[frozenCache = yes]
+\starttext
+\startmarkdown
+
+ Hi *world*!\stopmarkdown
+\stoptext
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
@@ -3589,8 +3603,8 @@ contents of the frozen cache using the
the document without accessing the shell or invoking Lua, but the change
in the content of the markdown document from “Hello world!” to
“Hi world!” was not reflected.
frozenCacheCounter
frozenCacheCounter
(default value: 0
)Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
- local firstInput = "Hello"
- local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
- local secondInput = "*world*!"
- tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
+ local firstInput = "Hello"
+ local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
+ local secondInput = "*world*!"
+ tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache with two entries
will also be produced as we requested using the
frozenCacheCounter
option.
hardLineBreaks
hardLineBreaks
(default value: false
)Using a text editor, create a text document named
document.tex
with the following content:
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-
- 'Twas brillig, and the slithy toves
- Did gyre and gimble in the wabe;
- All mimsy were the borogoves,
- And the mome raths outgrabe.\end{markdown}
-
-\begin{markdown*}{hardLineBreaks}
-
- 'Twas brillig, and the slithy toves
- Did gyre and gimble in the wabe;
- All mimsy were the borogoves,
- And the mome raths outgrabe.\end{markdown*}
-
-\end{document}
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+
+ 'Twas brillig, and the slithy toves
+ Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
+ And the mome raths outgrabe.\end{markdown}
+
+\begin{markdown*}{hardLineBreaks}
+
+ 'Twas brillig, and the slithy toves
+ Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
+ And the mome raths outgrabe.\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3684,8 +3698,8 @@ All mimsy were the borogoves, And the mome raths outgrabe.-’Twas brillig, and the slithy toves Did gyre and gimble in the wabe; All mimsy were the borogoves, And the mome raths outgrabe.
hashEnumerators
hashEnumerators
(default value:
@@ -3696,10 +3710,10 @@ class="header-section-number">2.2.1.26 Option
Enable the use of hash symbols (#
) as ordered item list
markers:
- #. Bird
- #. McHale #. Parish
+ #. Bird
+ #. McHale #. Parish
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-
- #. Bird
- #. McHale
- #. Parish\end{markdown}
-
-\begin{markdown*}{hashEnumerators}
-
- #. Bird
- #. McHale
- #. Parish\end{markdown*}
-
-\end{document}
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+
+ #. Bird
+ #. McHale
+ #. Parish\end{markdown}
+
+\begin{markdown*}{hashEnumerators}
+
+ #. Bird
+ #. McHale
+ #. Parish\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3754,27 +3768,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:@@ -3787,8 +3801,8 @@ contain the following text:-Parish 2.2.1.27 Option +
2.2.1.28 Option
headerAttributes
@@ -3817,8 +3831,8 @@ class="sourceCode md">
headerAttributes
(default value: @@ -3798,13 +3812,13 @@ class="header-section-number">2.2.1.27 Option- true
Enable the assignment of HTML attributes to headings:
-+# My first heading {#foo} - -## My second heading ## {#bar .baz} - - - Yet another heading {key=value}===================
# My first heading {#foo} + +## My second heading ## {#bar .baz} + + + Yet another heading {key=value}===================
-
2.2.1.28 Option +
Example2.2.1.29 Option
html
- @@ -3847,33 +3861,33 @@ will be rendered as plain text.
html
(default value:false
)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:@@ -3886,27 +3900,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~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -3928,73 +3942,33 @@ 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:+\bye\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">
\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._\end{markdown*} +\markdownEnd -\end{document}
Next, invoke LuaTeX from the terminal:
+class="sourceCode sh">lualatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4004,37 +3978,37 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
ConTeXt Example
+LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:+\end{document}\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 +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._\stopmarkdown +\end{markdown*} -\stoptext
Next, invoke LuaTeX from the terminal:
+class="sourceCode sh">context document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4044,8 +4018,48 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
2.2.1.29 Option +
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:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++<div>There is no block tag support.</div> There is no +<inline tag=”tag”></inline> support. There is no <!– +comment –> support. There is no <? HTML instruction ?> +support.
+There is support. There is support. There is support.
+2.2.1.30 Option
hybrid
-
- @@ -4081,27 +4095,27 @@ prepared with this package in mind. Example
hybrid
(default value:false
)Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local input, convert_safe, convert_unsafe, paragraph -$\string\sqrt{-1}$ *equals* $i$.]] - input = [[ - convert_safe = markdown.new() - convert_unsafe = markdown.new({hybrid = true})\par]] - paragraph = [[ - - tex.sprint( - convert_safe(input) .. paragraph .. - convert_unsafe(input) - ) - }\bye
\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local input, convert_safe, convert_unsafe, paragraph +$\string\sqrt{-1}$ *equals* $i$.]] + input = [[ + convert_safe = markdown.new() + convert_unsafe = markdown.new({hybrid = true})\par]] + paragraph = [[ + + tex.sprint( + convert_safe(input) .. paragraph .. + convert_unsafe(input) + ) + }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4112,25 +4126,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 @@ -4151,23 +4165,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:@@ -4175,27 +4189,27 @@ contain the following text:-equals .
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} -$\sqrt{-1}$ *equals* $i$. -\end{markdown} - -\begin{markdown*}{hybrid} -$\sqrt{-1}$ *equals* $i$. -\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} +$\sqrt{-1}$ *equals* $i$. +\end{markdown} + +\begin{markdown*}{hybrid} +$\sqrt{-1}$ *equals* $i$. +\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4207,23 +4221,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:@@ -4231,20 +4245,21 @@ contain the following text:-equals .
2.2.1.30 Option -
+inlineNotes
2.2.1.31 Option +
inlineCodeAttributes
-
- +
inlineNotes
(default value:false
)inlineCodeAttributes
(default value: +false
)- @@ -4252,80 +4267,75 @@ class="sourceCode md">
- true
- -
Enable the Pandoc inline note syntax extension:
-+- Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and move down to type the note.]
Enable the Pandoc inline +code span attribute extension:
+`<$>`{.haskell}
- false
- -
Disable the Pandoc inline note syntax extension.
+Enable the Pandoc inline code span attribute extension.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[inlineNotes]{markdown} -\begin{document} -\begin{markdown} - - Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and - move down to type the note.]\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
--lualatex document.tex
A PDF document named
-document.pdf
should be produced and -contain the following text:--Here is an inline note.1
-ConTeXt Example
-Using a text editor, create a text document named -
document.tex
with the following content:+class="sourceCode tex">\usemodule[t][markdown] -\setupmarkdown[inlineNotes = yes] -\starttext -\startmarkdown - - Here is an inline note.^[Inlines notes are easier to - write, since you don't have to pick an identifier and - move down to type the note.]\stopmarkdown -\stoptext
\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:
+class="sourceCode sh">context document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--Here is an inline note.2
+Here is some
colored text
.2.2.1.31 Option -
+jekyllData
2.2.1.32 Option +
inlineNotes
-
-- +
jekyllData
(default value:false
)inlineNotes
(default value:false
)- @@ -4333,73 +4343,156 @@ class="sourceCode yaml">
- true
- -
Enable the Pandoc
+yaml_metadata_block
syntax extension -for entering metadata in yaml:Enable the Pandoc inline note +syntax extension:
+class="sourceCode md">--- -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.---
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.]
- false
- -
Disable the Pandoc
+yaml_metadata_block
syntax extension -for entering metadata in yaml.Disable the Pandoc inline note syntax extension.
Plain TeX Example
+LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:+class="sourceCode tex">\input markdown -\def\markdownOptionJekyllData{true} -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\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:
+class="sourceCode sh">luatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--Jane Doe is 99 years old.
+Here is an inline note.1
LaTeX Example
+ConTeXt Example
Using a text editor, create a text document named
document.tex
with the following content:+class="sourceCode tex">\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\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:
+class="sourceCode sh">lualatex document.tex
context document.tex
+A PDF document named
+document.pdf
should be produced and +contain the following text:++Here is an inline note.2
+2.2.1.33 Option +
+jekyllData
+
+- +
jekyllData
(default value:false
)- +
++
+- true
+- +
+Enable the Pandoc yaml +metadata block syntax extension for entering metadata in +yaml:
++--- +title: 'This is the title: it contains a colon' +author: +- Author One +- Author Two +keywords: [nothing, nothingness] +abstract: | + + This is the abstract. + + It consists of two paragraphs.---
- +
++
+- false
+- +
+Disable the Pandoc yaml metadata block syntax extension +for entering metadata in yaml.
+Plain TeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++Jane Doe is 99 years old.
+LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4409,39 +4502,111 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
2.2.1.32 Option +
2.2.1.34 Option +
+linkAttributes
+
+- +
linkAttributes
(default value:false
)- +
++
+- true
+- +
+Enable 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}
- +
++
+- false
+- +
+Enable the Pandoc link and image attribute syntax extension.
+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}
Next, invoke LuaTeX from the terminal:
++lualatex document.tex
A PDF document named
+document.pdf
should be produced and +contain an example image (from Martin Scharrer’s mwe +package) displayed at size 5cm × 4cm.2.2.1.35 Option
lineBlocks
-
- @@ -4449,13 +4614,15 @@ class="header-section-number">2.2.1.32 Option
lineBlocks
(default value:false
)@@ -4472,19 +4639,19 @@ class="sourceCode md">
- true
- -
Enable the Pandoc line block syntax extension.
-+- | this is a line block that - | spans multiple - | even - discontinuous | lines
Enable the Pandoc line block +syntax extension:
++ | 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:@@ -4493,24 +4660,24 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[lineBlocks]{markdown} -\begin{document} -\begin{markdown} - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\end{markdown} -\end{document}
\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:@@ -4523,20 +4690,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:@@ -4545,8 +4712,8 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.2.2.1.33 Option +
2.2.1.36 Option
notes
-
- @@ -4554,25 +4721,27 @@ class="header-section-number">2.2.1.33 Option
notes
(default value:false
)@@ -4585,37 +4754,37 @@ class="sourceCode md">
- true
- -
Enable the Pandoc note syntax extension:
-+[^1] and another.[^longnote] - Here is a note reference, -[^1]: Here is the note. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - - belong to the previous note. - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - - This paragraph won't be part of the note, because it isn't indented.
Enable the Pandoc note syntax +extension:
+[^1] and another.[^longnote] + Here is a note reference, +[^1]: Here is the note. + +[^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + + belong to the previous note. + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + + This paragraph won't be part of the note, because it isn't indented.
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:@@ -4630,33 +4799,33 @@ indented. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\starttext -\startmarkdown - - Here is a note reference,[^1] and another.[^longnote] - - [^1]: Here is the note. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous note. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\starttext +\startmarkdown + + Here is a note reference,[^1] and another.[^longnote] + + [^1]: Here is the note. + + [^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + belong to the previous note. + + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + This paragraph won't be part of the note, because it + isn't indented.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4667,8 +4836,8 @@ role="doc-noteref">6-This paragraph won’t be part of the note, because it isn’t indented.
2.2.1.34 Option +
2.2.1.37 Option
pipeTables
@@ -4696,25 +4865,25 @@ extension.
- @@ -4677,12 +4846,12 @@ class="header-section-number">2.2.1.34 Option
pipeTables
(default value:false
)- true
Enable the PHP Markdown pipe table syntax extension:
-+- | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
+ | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables]{markdown} -\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 |\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables]{markdown} +\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 |\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4753,21 +4922,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:@@ -4802,8 +4971,8 @@ contain the following text:-2.2.1.35 Option +
2.2.1.38 Option
preserveTabs
-
- @@ -4824,8 +4993,8 @@ class="header-section-number">2.2.1.35 Option
preserveTabs
(default value:false
)2.2.1.36 Option +
2.2.1.39 Option
rawAttribute
-
- @@ -4833,21 +5002,23 @@ class="header-section-number">2.2.1.36 Option
rawAttribute
(default value:false
)
- true
- -
Enable the Pandoc raw attribute syntax extension:
-+`$H_2 O$`{=tex} is a liquid.
Enable the Pandoc raw +attribute syntax extension:
+`$H_2 O$`{=tex} is a liquid.
To enable raw blocks, the
-fencedCode
option must also be enabled:+Here is a mathematical formula: -``` {=tex} -\[distance[i] = - \begin{dcases} - a & b \\ - c & d - \end{dcases} -\] -```
Here is a mathematical formula: +``` {=tex} +\[distance[i] = + \begin{dcases} + a & b \\ + c & d + \end{dcases} +\] +```
The
rawAttribute
option is a good alternative to thehybrid
option. Unlike thehybrid
option, which affects the @@ -4865,33 +5036,33 @@ allows you to isolate the parts of your documents that use TeX:LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[rawAttribute, fencedCode]{markdown} -\usepackage{expl3} -\begin{document} -\begin{markdown} -$H_2 O$`{=tex} is a liquid. - ` - - ``` {=html} - <p>Here is some HTML content that will be ignored.</p> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[rawAttribute, fencedCode]{markdown} +\usepackage{expl3} +\begin{document} +\begin{markdown} +$H_2 O$`{=tex} is a liquid. + ` + + ``` {=html} + <p>Here is some HTML content that will be ignored.</p> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H2O is a liquid.
2.2.1.37 Option +
2.2.1.40 Option
relativeReferences
@@ -4923,30 +5094,30 @@ class="sourceCode md">
relativeReferences
(default value: @@ -4903,14 +5074,14 @@ class="header-section-number">2.2.1.37 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!
+ 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:@@ -4955,8 +5126,8 @@ contain the following text:-In this paper, we have discovered that most grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
2.2.1.38 Option +
Example2.2.1.41 Option
shiftHeadings
- @@ -4972,32 +5143,32 @@ when ⟨shift amount⟩ is positive, and to level 1, when class="tex">TeX
shiftHeadings
(default value:0
)Using a text editor, create a text document named
-example.md
with the following content:+## A section
## A section
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\font\normal=cmr10\normal -\font\big=cmr10 at 12pt -\def\markdownRendererHeadingTwo#1{{\big #1\par}} -\font\bigger=cmr10 scaled 1440 -\def\markdownRendererHeadingOne#1{{\bigger #1\par}} - -\def\markdownOptionShiftHeadings{-1} -\markdownInput{example.md} - -\def\markdownOptionShiftHeadings{0} -\markdownInput{example.md} - -\def\markdownOptionShiftHeadings{+1} -\markdownInput{example.md} - -\bye
\input markdown + +\font\normal=cmr10\normal +\font\big=cmr10 at 12pt +\def\markdownRendererHeadingTwo#1{{\big #1\par}} +\font\bigger=cmr10 scaled 1440 +\def\markdownRendererHeadingOne#1{{\bigger #1\par}} + +\def\markdownOptionShiftHeadings{-1} +\markdownInput{example.md} + +\def\markdownOptionShiftHeadings{0} +\markdownInput{example.md} + +\def\markdownOptionShiftHeadings{+1} +\markdownInput{example.md} + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5005,24 +5176,24 @@ contain the following text:-A section
A section
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{filecontents}[overwrite,nosearch,noheader]{example.md} - - ## A section\end{filecontents} -\begin{document} -\markdownInput[shiftHeadings=-1]{example.md} -\markdownInput{example.md} -\markdownInput[shiftHeadings=+1]{example.md} -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{filecontents}[overwrite,nosearch,noheader]{example.md} + + ## A section\end{filecontents} +\begin{document} +\markdownInput[shiftHeadings=-1]{example.md} +\markdownInput{example.md} +\markdownInput[shiftHeadings=+1]{example.md} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5034,22 +5205,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:@@ -5057,8 +5228,8 @@ contain the following text:-A section
A section
2.2.1.39 Option +
2.2.1.42 Option
slice
-
- @@ -5093,43 +5264,43 @@ i.e. the entire section with the HTML attribute class="tex">TeX Example
slice
(default value:^ $
)Using a text editor, create a text document named
-hamlet.md
with the following content:+# The Tragedy of Hamlet - - Shakespeare's longest play. -## Act III {#act-3} - - Hamlet kills Polonius. -## Act V {#act-5} - - Hamlet dies. -## Act I {#act-1} - Hamlet talks to ghost.
# The Tragedy of Hamlet + + Shakespeare's longest play. +## Act III {#act-3} + + Hamlet kills Polonius. +## Act V {#act-5} + + Hamlet dies. +## Act I {#act-1} + Hamlet talks to ghost.
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionHeaderAttributes{true} - -\font\normal=cmr10\normal -\font\big=cmr10 at 12pt -\def\markdownRendererHeadingTwo#1{{\big #1\par}} -\font\bigger=cmr10 scaled 1440 -\def\markdownRendererHeadingOne#1{{\bigger #1\par}} - -\def\markdownOptionSlice{^ ^act-3} -\markdownInput{hamlet.md} - -\def\markdownOptionSlice{act-1} -\markdownInput{hamlet.md} - -\def\markdownOptionSlice{act-3 act-5} -\markdownInput{hamlet.md} - -\bye
\input markdown +\def\markdownOptionHeaderAttributes{true} + +\font\normal=cmr10\normal +\font\big=cmr10 at 12pt +\def\markdownRendererHeadingTwo#1{{\big #1\par}} +\font\bigger=cmr10 scaled 1440 +\def\markdownRendererHeadingOne#1{{\bigger #1\par}} + +\def\markdownOptionSlice{^ ^act-3} +\markdownInput{hamlet.md} + +\def\markdownOptionSlice{act-1} +\markdownInput{hamlet.md} + +\def\markdownOptionSlice{act-3 act-5} +\markdownInput{hamlet.md} + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5142,34 +5313,34 @@ contain the following text:-Act V
Hamlet dies.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes]{markdown} -\begin{filecontents}[overwrite,nosearch,noheader]{hamlet.md} - - # The Tragedy of Hamlet - Shakespeare's longest play. - - ## Act III {#act-3} - Hamlet kills Polonius. - - ## Act V {#act-5} - Hamlet dies. - - ## Act I {#act-1} - Hamlet talks to ghost.\end{filecontents} -\begin{document} -\markdownInput[slice=^ ^act-3]{hamlet.md} -\markdownInput[slice=act-1]{hamlet.md} -\markdownInput[slice=act-3 act-5]{hamlet.md} -\end{document}
\documentclass{article} +\usepackage[headerAttributes]{markdown} +\begin{filecontents}[overwrite,nosearch,noheader]{hamlet.md} + + # The Tragedy of Hamlet + Shakespeare's longest play. + + ## Act III {#act-3} + Hamlet kills Polonius. + + ## Act V {#act-5} + Hamlet dies. + + ## Act I {#act-1} + Hamlet talks to ghost.\end{filecontents} +\begin{document} +\markdownInput[slice=^ ^act-3]{hamlet.md} +\markdownInput[slice=act-1]{hamlet.md} +\markdownInput[slice=act-3 act-5]{hamlet.md} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5186,33 +5357,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:@@ -5225,8 +5396,8 @@ contain the following text:-Act V
Hamlet dies.
2.2.1.40 Option +
2.2.1.43 Option
smartEllipses
-
- @@ -5253,25 +5424,25 @@ class="tex">TeX macro. Example
smartEllipses
(default value:false
)Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local input = "These are just three regular dots ..." - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({smartEllipses = true}) - local input = "... and this is a victorian ellipsis." - tex.sprint(convert(input)) }\bye
\input markdown +\def\markdownRendererEllipsis{. . .} +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local input = "These are just three regular dots ..." + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({smartEllipses = true}) + local input = "... and this is a victorian ellipsis." + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5281,23 +5452,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 @@ -5318,55 +5489,55 @@ 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:-These are just three regular dots …
. . . and this is a victorian ellipsis.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - ellipsis = {. . .} - } - }\begin{document} - -\begin{markdown} - - These are just three regular dots ...\end{markdown} - -\begin{markdown*}{smartEllipses} - - ... and this is a victorian ellipsis.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + ellipsis = {. . .} + } + }\begin{document} + +\begin{markdown} + + These are just three regular dots ...\end{markdown} + +\begin{markdown*}{smartEllipses} + + ... and this is a victorian ellipsis.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5377,32 +5548,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] -\def\markdownRendererEllipsis{. . .} -\starttext - -\startmarkdown - - These are just three regular dots ...\stopmarkdown - -\setupmarkdown[smartEllipses = yes] -\startmarkdown - - ... and this is a victorian ellipsis.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\def\markdownRendererEllipsis{. . .} +\starttext + +\startmarkdown + + These are just three regular dots ...\stopmarkdown + +\setupmarkdown[smartEllipses = yes] +\startmarkdown + + ... and this is a victorian ellipsis.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-These are just three regular dots …
. . . and this is a victorian ellipsis.
2.2.1.41 Option +
2.2.1.44 Option
startNumber
- @@ -5428,36 +5599,36 @@ class="tex">TeX macro.
startNumber
(default value:true
)LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\end{markdown} - -\begin{markdown*}{startNumber=false} - - The following list does not respect the numbers specified in the - markup: - - 3. third item - 4. fourth item - 5. fifth item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\end{markdown} + +\begin{markdown*}{startNumber=false} + + The following list does not respect the numbers specified in the + markup: + + 3. third item + 4. fourth item + 5. fifth item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5479,30 +5650,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:@@ -5520,8 +5691,8 @@ markup:-- fifth item
2.2.1.42 Option +
2.2.1.45 Option
strikeThrough
-
- @@ -5529,9 +5700,11 @@ class="header-section-number">2.2.1.42 Option
strikeThrough
(default value:false
)@@ -5548,44 +5721,44 @@ class="sourceCode md">
- true
- -
Enable the Pandoc strike-through syntax extension:
-+This ~~is deleted text.~~
Enable the Pandoc strike-through +syntax extension:
+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:-This is
a lunar roving vehiclestrike-through text.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5595,25 +5768,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] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[strikeThrough = yes] +\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} +\starttext +\startmarkdown + + This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.2.2.1.43 Option +
2.2.1.46 Option
stripIndent
@@ -5649,54 +5822,54 @@ document. class="tex">TeX Example
- @@ -5624,14 +5797,14 @@ class="header-section-number">2.2.1.43 Option
stripIndent
(default value:false
)Strip the minimal indentation of non-blank lines from all lines in a markdown document. Requires that the
-preserveTabs
Lua option is disabled:+\documentclass{article} -\usepackage[stripIndent]{markdown} -\begin{document} -\begin{markdown} - - Hello *world*!\end{markdown} - \end{document}
\documentclass{article} +\usepackage[stripIndent]{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} + \end{document}
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.44 Option +
2.2.1.47 Option
subscripts
-
- @@ -5704,9 +5877,11 @@ class="header-section-number">2.2.1.44 Option
subscripts
(default value:false
)@@ -5719,21 +5894,21 @@ class="sourceCode md">
- true
- -
Enable the Pandoc subscript syntax extension:
-+H~2~O is a liquid.
Enable the Pandoc subscript +syntax extension:
+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:@@ -5743,24 +5918,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[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:-H2O is a liquid.
2.2.1.45 Option +
2.2.1.48 Option
superscripts
-
- @@ -5768,9 +5943,11 @@ class="header-section-number">2.2.1.45 Option
superscripts
(default value:false
)@@ -5783,21 +5960,21 @@ class="sourceCode md">
- true
- -
Enable the Pandoc superscript syntax extension:
-+2^10^ is 1024.
Enable the Pandoc superscript +syntax extension:
+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:@@ -5807,24 +5984,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[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:-210 is 1024.
2.2.1.46 Option +
2.2.1.49 Option
tableCaptions
- @@ -5832,16 +6009,18 @@ class="header-section-number">2.2.1.46 Option
tableCaptions
(default value:false
)@@ -5849,32 +6028,32 @@ class="sourceCode md">
- true
- -
Enable the Pandoc
-table_captions
syntax extension for pipe tables.+- | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - : Demonstration of pipe table syntax.
Enable the Pandoc 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.
- false
- -
Disable the Pandoc
+table_captions
syntax extension.Disable the Pandoc table caption syntax extension.
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:@@ -5914,27 +6093,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:@@ -5970,8 +6149,8 @@ contain the following text:-2.2.1.47 Option +
2.2.1.50 Option
taskLists
- @@ -5979,11 +6158,13 @@ class="header-section-number">2.2.1.47 Option
taskLists
(default value:false
)@@ -5991,35 +6172,35 @@ class="sourceCode md">
- true
- -
Enable the Pandoc
-task_lists
syntax extension.+- [ ] an unticked task list item -- [/] a half-checked task list item -- [X] a ticked task list item
Enable the Pandoc task list +syntax extension:
+- [ ] an unticked task list item +- [/] a half-checked task list item +- [X] a ticked task list item
- false
- -
Disable the Pandoc
+task_lists
syntax extension.Disable the Pandoc task list syntax extension.
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:@@ -6033,22 +6214,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:@@ -6058,8 +6239,8 @@ contain the following text:-Yes I can! 2.2.1.48 Option +
2.2.1.51 Option
texComments
- @@ -6068,15 +6249,15 @@ class="header-section-number">2.2.1.48 Option
texComments
(default value:false
)- true
- @@ -6096,68 +6277,426 @@ 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
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}
Next, invoke LuaTeX from the terminal:
++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
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the text “Hello world!”2.2.1.52 Option +
+texMathDollars
+
+- +
texMathDollars
(default value:false
)- +
++
+- true
+- +
+Enable the Pandoc dollar +math syntax extension:
++inline math: $E=mc^2$ + + display math: $$E=mc^2$$
- +
++
+- false
+- +
+Disable the Pandoc dollar math syntax extension.
+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 = 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
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+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
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$$
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
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 +orC:\Users\
⟨Your +username⟩\texmf\scripts\markdown\markdown-cli.lua
on +Windows systems. Use the command +kpsewhich -a markdown-cli.lua
to locate the Lua CLI script +file using Kpathsea.A PDF document named
+document.pdf
should be produced and +contain the following text:++$E=mc^2$
+$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x +\right ) e^{-i2\pi \xi x} dx$$
+E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+Plain TeX Example
+Using 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
Next, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+LaTeX Example
+Using 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}
Next, invoke LuaTeX from the terminal:
++lualatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+ConTeXt Example
+Using 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
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+2.2.1.53 Option +
+texMathDoubleBackslash
+
+- +
texMathDoubleBackslash
(default value: +false
)- +
++
+- true
+- +
+Enable the Pandoc double +backslash math syntax extension:
++inline math: \\(E=mc^2\\) + +\\[E=mc^2\\] display math:
- +
++
+- false
+- +
+Disable the Pandoc double backslash math syntax extension.
+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 = 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
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+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
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\\]
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
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 +orC:\Users\
⟨Your +username⟩\texmf\scripts\markdown\markdown-cli.lua
on +Windows systems. Use the command +kpsewhich -a markdown-cli.lua
to locate the Lua CLI script +file using Kpathsea.A PDF document named
+document.pdf
should be produced and +contain the following text:++\(E=mc^2\)
+\$$\hat{f} \left ( \xi \right )= +\int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} +dx\$$
+E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+Plain TeX Example
+Using 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
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!”+
++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+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[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 text “Hello world!”Con +
++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+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[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 text “Hello world!”2.2.1.49 Option -
+contain the following text: +texMathDollars
++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+2.2.1.54 Option +
texMathSingleBackslash
-
- +
texMathDollars
(default value:false
)texMathSingleBackslash
(default value: +false
)- @@ -6165,31 +6704,30 @@ display math: $$E=mc^2$$
- true
- -
Enable the Pandoc
-tex_math_dollars
syntax extension.+inline math: $E=mc^2$ - -display math: $$E=mc^2$$
Enable the Pandoc single +backslash math syntax extension:
+inline math: \(E=mc^2\) + +\[E=mc^2\] display math:
-
- false
- -
Disable the Pandoc
+tex_math_dollars
syntax -extension.Disable the Pandoc single backslash math syntax extension.
Lua Module +
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 = 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({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:@@ -6198,27 +6736,27 @@ class="math inline">E = mc2-f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
Lua CLI Example
+Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+- $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⟩ 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 @@ -6231,32 +6769,32 @@ title="Kpathsea - TeX Users Group">Kpathsea.A PDF document named
document.pdf
should be produced and contain the following text:--$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]
E = mc2
f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
Plain Plain TeX Example
Using 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\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:@@ -6265,25 +6803,25 @@ class="math inline">E = mc2-f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
LaTeX Example
Using 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[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:@@ -6292,25 +6830,25 @@ class="math inline">E = mc2-f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
ConConTeXt Example
Using 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[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:@@ -6319,8 +6857,8 @@ class="math inline">E = mc2-f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
2.2.1.50 Option +
2.2.1.55 Option
tightLists
@@ -6356,43 +6894,43 @@ multiple paragraphs. -
- @@ -6332,16 +6870,16 @@ class="header-section-number">2.2.1.50 Option paragraphs will be considered tight. Tight lists will produce tight renderers that may produce different output than lists that are not tight: -
tightLists
(default value:true
)+- This is -- a tight -- unordered list. - -- This is - - - not a tight -- unordered list.
- This is +- a tight +- unordered list. + +- This is + + + not a tight +- unordered list.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - The following list is tight: - - - first item - - second item - - third item - - The following list is loose: - - - first item - - second item that spans - - multiple paragraphs - - third item\end{markdown} - -\begin{markdown*}{tightLists=false} - - The following list is now also loose: - - - first item - - second item - - third item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + The following list is tight: + + - first item + - second item + - third item + + The following list is loose: + + - first item + - second item that spans + + multiple paragraphs + - third item\end{markdown} + +\begin{markdown*}{tightLists=false} + + The following list is now also loose: + + - first item + - second item + - third item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6416,8 +6954,8 @@ contain the following text:-third item
2.2.1.51 Option +
2.2.1.56 Option
underscores
@@ -6447,27 +6985,27 @@ constantly escape subscripts. -
- @@ -6427,11 +6965,11 @@ class="header-section-number">2.2.1.51 Option
underscores
(default value:true
)Both underscores and asterisks can be used to denote emphasis and strong emphasis:
-+- *single asterisks* - _single underscores_ - **double asterisks** __double underscores__
+ *single asterisks* + _single underscores_ + **double asterisks** __double underscores__
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionHybrid{true} - -\markdownBegin -$m\_n$. - This is _emphasized text_ and this is a math subscript: \markdownEnd - -\def\markdownOptionUnderscores{false} -\markdownBegin -$m_n$. - This is *emphasized text* and this is a math subscript: \markdownEnd - -\bye
\input markdown +\def\markdownOptionHybrid{true} + +\markdownBegin +$m\_n$. + This is _emphasized text_ and this is a math subscript: \markdownEnd + +\def\markdownOptionUnderscores{false} +\markdownBegin +$m_n$. + This is *emphasized text* and this is a math subscript: \markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6476,27 +7014,27 @@ contain the following text:-This is emphasized text and this is a math subscript: mₙ.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[hybrid]{markdown} -\begin{document} - -\begin{markdown} -$m\_n$. - This is _emphasized text_ and this is a math subscript: \end{markdown} - -\begin{markdown*}{underscores=false} -$m_n$. - This is *emphasized text* and this is a math subscript: \end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[hybrid]{markdown} +\begin{document} + +\begin{markdown} +$m\_n$. + This is _emphasized text_ and this is a math subscript: \end{markdown} + +\begin{markdown*}{underscores=false} +$m_n$. + This is *emphasized text* and this is a math subscript: \end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6505,28 +7043,28 @@ contain the following text:-This is emphasized text and this is a math subscript: mₙ.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[hybrid = yes] -\starttext - -\startmarkdown -$m\_n$. - This is _emphasized text_ and this is a math subscript: \stopmarkdown - -\setupmarkdown[underscores = yes] -\startmarkdown -$m_n$. - This is *emphasized text* and this is a math subscript: \stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[hybrid = yes] +\starttext + +\startmarkdown +$m\_n$. + This is _emphasized text_ and this is a math subscript: \stopmarkdown + +\setupmarkdown[underscores = yes] +\startmarkdown +$m_n$. + This is *emphasized text* and this is a math subscript: \stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6553,8 +7091,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
@@ -6604,24 +7142,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
@@ -6634,8 +7172,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 @@ -6664,21 +7202,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
LaTeX options allow us to disable the redefinition of the default renderer prototypes from plain TeX, load user-defined themes, -and invoke user-defined setup snippets.
+and invoke user-defined set-up snippets.2.2.3.1 Setting Lua and plain 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 @@ -6709,10 +7247,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
@@ -6727,8 +7265,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
@@ -6741,11 +7279,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[ - - theme = witiko/beamer/MU, - theme = 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.
-LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[theme=witiko/dot]{markdown} -\setkeys{Gin}{ -\columnwidth, - width=\paperheight, - height=0.65 - keepaspectratio}\begin{document} -\begin{markdown} - - ``` dot Various formats of mathemathical formulae - digraph tree { - margin = 0; - rankdir = "LR"; - - latex -> pmml; - latex -> cmml; - pmml -> slt; - cmml -> opt; - cmml -> prefix; - cmml -> infix; - pmml -> mterms [style=dashed]; - cmml -> mterms; - - latex [label = "LaTeX"]; - pmml [label = "Presentation MathML"]; - cmml [label = "Content MathML"]; - slt [label = "Symbol Layout Tree"]; - opt [label = "Operator Tree"]; - prefix [label = "Prefix"]; - infix [label = "Infix"]; - mterms [label = "M-Terms"]; - } - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[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
@@ -6830,22 +7368,22 @@ Wget or cURL installed. The theme also requires shell access unless the class="tex">TeX option is enabled. -document.pdf
should be produced and contain a drawing of a directed graph similar to Figure 1 from the following conference article:LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[theme=witiko/graphicx/http]{markdown} -\begin{document} -\begin{markdown} - - ![img](https://github.com/witiko/markdown/raw/main/markdown.png - "The banner of the Markdown package")\end{markdown} -\end{document}
\documentclass{article} +\usepackage[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:@@ -6864,61 +7402,113 @@ non-breaking space even when the-hybrid
Lua option is disabled. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[theme=witiko/tilde]{markdown} -\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage[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
document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
2.2.3.4 LaTeX setup snippets
+class="latex">LaTeX snippetsUser-defined LaTeX themes provide global control over high-level goals. However, it is often desirable to change only some local aspects of a document. LaTeX setup snippets provide +class="latex">LaTeX snippets provide syntactic sugar for defining and invoking various options locally.
-Here is how we can use setup snippets to store options and invoke -them later:
-+\markdownSetupSnippet{romanNumerals}{ - - renderers = {% - olItemWithNumber = {\item[\romannumeral#1\relax.]% - - }, - }, - }\begin{markdown} - - - The following ordered list will be preceded by arabic numerals: - - 1. wahid - 2. aithnayn -\end{markdown} -\begin{markdown*}{snippet=romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
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*}
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*}
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:+\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:+\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
import
LaTeX option.2.3 Markdown Tokens
A key feature of the Markdown package is the support for manipulating @@ -6955,46 +7545,46 @@ attribute in the form ⟨key⟩
-=
⟨value⟩ that is neither an identifier nor a class name. The macro receives two attributes that correspond to the ⟨key⟩ and the ⟨value⟩, respectively.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes, underscores=false]{markdown} -\markdownSetup{ - - renderers = {% - attributeIdentifier = {\par - \emph{(Identifier: #1)} - \par - - },% - attributeClassName = {\par - \emph{(Class name: #1)} - \par - - },% - attributeKeyValue = {\par - \emph{(Key: #1, Value: #2)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - # First top-level heading {jane=doe} - - ## A subheading {#identifier} - - # Second top-level heading {.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes, underscores=false]{markdown} +\markdownSetup{ + + renderers = {% + attributeIdentifier = {\par + \emph{(Identifier: #1)} + \par + + },% + attributeClassName = {\par + \emph{(Class name: #1)} + \par + + },% + attributeKeyValue = {\par + \emph{(Key: #1, Value: #2)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + + # First top-level heading {jane=doe} + + ## A subheading {#identifier} + + # Second top-level heading {.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7011,35 +7601,35 @@ class="header-section-number">2.3.1.2 Block Quote Renderers the beginning of a block quote. The macro receives no arguments.-The
-\markdownRendererBlockQuoteEnd
macro represents the end of a block quote. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererBlockQuoteBegin{% -\begingroup - \vskip\parindent - \leftskip=2\parindent - \parindent=0pt - - }\def\markdownRendererBlockQuoteEnd{% -\par - \vskip\parindent - \endgroup - - }\markdownBegin - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\markdownEnd -\bye
\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:@@ -7050,32 +7640,32 @@ fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\begin{quote}}, - blockQuoteBegin = {\end{quote}}, - blockQuoteEnd = { - }, - }\begin{document} -\begin{markdown} - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\begin{quote}}, + blockQuoteBegin = {\end{quote}}, + blockQuoteEnd = { + }, + }\begin{document} +\begin{markdown} + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7086,27 +7676,27 @@ fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererBlockQuoteBegin{\startquotation} -\def\markdownRendererBlockQuoteEnd{\stopquotation} -\starttext -\startmarkdown - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererBlockQuoteBegin{\startquotation} +\def\markdownRendererBlockQuoteEnd{\stopquotation} +\starttext +\startmarkdown + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7128,29 +7718,29 @@ and\markdownRendererBracketedSpanAttributeContextEnd
macros represent the beginning and the end of an inline bracketed span in which the attributes of the span apply. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[bracketedSpans]{markdown} -\markdownSetup{ - - renderers = { - 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:@@ -7179,56 +7769,56 @@ of a bulleted 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. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTightLists{true} - -\def\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:@@ -7241,61 +7831,61 @@ item).-This is the third item.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[tightLists]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = { - interblockSeparator = {}, - ulBeginTight = { (},% - ulItem = {\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }, - ulItemEnd = {}, - ulEndTight = {).}, - }, - } - This is a tight list - - - the first item - - the second item - - the third item\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\par - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{itemize}}, - ulBeginTight = {\item}, - ulItem = { - ulItemEnd = {.},\end{itemize}}, - ulEnd = { - }, - } - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + ulBeginTight = { (},% + ulItem = {\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }, + ulItemEnd = {}, + ulEndTight = {).}, + }, + } + This is a tight list + + - the first item + - the second item + - the third item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{itemize}}, + ulBeginTight = {\item}, + ulItem = { + ulItemEnd = {.},\end{itemize}}, + ulEnd = { + }, + } + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7308,57 +7898,57 @@ item).-This is the third item.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[tightLists = yes] -\starttext - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererUlBeginTight{ (} -\def\markdownRendererUlItem{% -\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }\def\markdownRendererUlItemEnd{} -\def\markdownRendererUlEndTight{).} - -\startmarkdown - - This is a tight list - - - the first item - - the second item - - the third item\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererUlBegin{\startitemize} -\def\markdownRendererUlItem{\item} -\def\markdownRendererUlItemEnd{.} -\def\markdownRendererUlEnd{\stopitemize} - -\startmarkdown - - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[tightLists = yes] +\starttext + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererUlBeginTight{ (} +\def\markdownRendererUlItem{% +\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }\def\markdownRendererUlItemEnd{} +\def\markdownRendererUlEndTight{).} + +\startmarkdown + + This is a tight list + + - the first item + - the second item + - the third item\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererUlBegin{\startitemize} +\def\markdownRendererUlItem{\item} +\def\markdownRendererUlItemEnd{.} +\def\markdownRendererUlEnd{\stopitemize} + +\startmarkdown + + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7381,114 +7971,114 @@ fenced code block. This macro will only be produced, when the-fencedCode
option is enabled. The macro receives two arguments that correspond to the filename of a file contaning the code block contents and to the code fence infostring. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{verbatim} -\usepackage[hyphens]{url} -\usepackage[fencedCode]{markdown} -\markdownSetup{ - - renderers = { - interblockSeparator = {\def\markdownRendererInterblockSeparator{% - \par - \def\markdownRendererInterblockSeparator{% - \def\markdownRendererInterblockSeparator{% - \par - % - }% - }% - } - }, - inputVerbatim = {\url{#1}:% - is contained in file \verbatiminput{#1}% - - }, - inputFencedCode = {\markdownRendererInputVerbatim{#1}% - in #2 - }, - }, - }\begin{document} -\begin{markdown} - - The following code - - def foo(bar): - if len(bar) <= 1: - return bar[0] - elif len(bar) == 2: - return sorted(bar) - else: - baz = len(bar) // 2 - return foo(bar[baz:], bar[:baz]) - - The following code - - ~~~ Python - >>> foo([4, 2, 1, 3]) - [1, 2, 3, 4] - ~~~~~~~~~~\end{markdown} -\end{document}
\documentclass{article} +\usepackage{verbatim} +\usepackage[hyphens]{url} +\usepackage[fencedCode]{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {\def\markdownRendererInterblockSeparator{% + \par + \def\markdownRendererInterblockSeparator{% + \def\markdownRendererInterblockSeparator{% + \par + % + }% + }% + } + }, + inputVerbatim = {\url{#1}:% + is contained in file \verbatiminput{#1}% + + }, + inputFencedCode = {\markdownRendererInputVerbatim{#1}% + in #2 + }, + }, + }\begin{document} +\begin{markdown} + + The following code + + def foo(bar): + if len(bar) <= 1: + return bar[0] + elif len(bar) == 2: + return sorted(bar) + else: + baz = len(bar) // 2 + return foo(bar[baz:], bar[:baz]) + + The following code + + ~~~ Python + >>> foo([4, 2, 1, 3]) + [1, 2, 3, 4] + ~~~~~~~~~~\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text except for the filename, which may differ:The following code is contained in file
-./_markdown_document/882453149edcf288976647f6fe147ada.verbatim
:+def foo(bar): -if len(bar) <= 1: - return bar[:1] - elif len(bar) == 2: - return sorted(bar) - else: - = bar[len(bar) // 2] - baz return ( - for qux in bar if qux < baz]) + [baz] + - foo([qux for qux in bar if qux > baz]) - foo([qux )
def foo(bar): +if len(bar) <= 1: + return bar[:1] + elif len(bar) == 2: + return sorted(bar) + else: + = bar[len(bar) // 2] + baz return ( + for qux in bar if qux < baz]) + [baz] + + foo([qux for qux in bar if qux > baz]) + foo([qux )
The following code in Python contained in file
-./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim
:+>>> foo([4, 2, 1, 3]) -1, 2, 3, 4] [
>>> foo([4, 2, 1, 3]) +1, 2, 3, 4] [
2.3.1.6 Code Span Renderer
The
-\markdownRendererCodeSpan
macro represents inline code span in the input text. It receives a single argument that corresponds to the inline code span.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts - -\def\markdownRendererCodeSpan#1{#1} - -\markdownBegin -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\markdownEnd - -\def\markdownOptionHybrid{true} -\markdownBegin -$\sqrt{-1}$ *equals* $i$ -\markdownEnd - -\bye
\input markdown +\input lmfonts + +\def\markdownRendererCodeSpan#1{#1} + +\markdownBegin +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\markdownEnd + +\def\markdownOptionHybrid{true} +\markdownBegin +$\sqrt{-1}$ *equals* $i$ +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7497,34 +8087,66 @@ contain the following text:-equals .
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[smartEllipses]{markdown} -\markdownSetup{ - - renderers = { - codeSpan = {#1}, - }, - }\begin{document} - -\begin{markdown} -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\end{markdown} - -\begin{markdown*}{hybrid} -$\sqrt{-1}$ *equals* $i$ -\end{markdown*} - -\end{document}
+\documentclass{article} +\usepackage[smartEllipses]{markdown} +\markdownSetup{ + + renderers = { + codeSpan = {#1}, + }, + }\begin{document} + +\begin{markdown} +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\end{markdown} + +\begin{markdown*}{hybrid} +$\sqrt{-1}$ *equals* $i$ +\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
++lualatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++$\sqrt{-1}$ *equals* $i$.
+$\sqrt{-1}$ equals $i$.
++equals .
+ConTeXt Example
+Using a text editor, create a text document named +
+document.tex
with the following content:\usemodule[t][markdown] +\def\markdownRendererCodeSpan#1{#1} +\starttext + +\startmarkdown +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\stopmarkdown + +\setupmarkdown[hybrid = yes] +\startmarkdown +$\sqrt{-1}$ *equals* $i$ +\stopmarkdown + +\bye
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7533,40 +8155,49 @@ contain the following text:-equals .
ConTeXt Example
+2.3.1.7 Code Span Attribute Context +Renderers
+The following macros are only produced, when the +
+inlineCodeAttributes
option is +enabled.The
+\markdownRendererCodeSpanAttributeContextBegin
and +\markdownRendererCodeSpanAttributeContextEnd
macros +represent the beginning and the end of an inline code span in which the +attributes of the inline code span apply. The macros receive no +arguments.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererCodeSpan#1{#1} -\starttext - -\startmarkdown -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\stopmarkdown - -\setupmarkdown[hybrid = yes] -\startmarkdown -$\sqrt{-1}$ *equals* $i$ -\stopmarkdown - -\bye
\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:
-+context document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--$\sqrt{-1}$ *equals* $i$.
-$\sqrt{-1}$ equals $i$.
--equals .
+foo (bar) baz
2.3.1.7 Content Block +
2.3.1.8 Content Block Renderers
The
-\markdownRendererContentBlock
macro represents an iA Writer content block. It receives four arguments: the local file or @@ -7606,38 +8237,38 @@ highlighting. TheLanguages.json
file provided by Anton Sotkov is a good starting point.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionContentBlocks{true} -\def\markdownRendererContentBlock#1#2#3#4{% -\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:@@ -7649,38 +8280,38 @@ extensions and programming language names.-This is the image
https://tug.org/tugboat/noword.jpg
, the logotype of TUGboat.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json} - - { - "json": "JavaScript Object Notation", - }\end{filecontents} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {\texttt{#2}, #4.}, - contentBlock = {This is \texttt{#2}, #4.}, - contentBlockOnlineImage = {This is the image % - contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5. - This is the #2 ( - }, - }, - }\begin{document} -\begin{markdown} - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\end{markdown} -\end{document}
\documentclass{article} +\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json} + + { + "json": "JavaScript Object Notation", + }\end{filecontents} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {\texttt{#2}, #4.}, + contentBlock = {This is \texttt{#2}, #4.}, + contentBlockOnlineImage = {This is the image % + contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5. + This is the #2 ( + }, + }, + }\begin{document} +\begin{markdown} + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7692,39 +8323,39 @@ extensions and programming language names.-This is the image
https://tug.org/tugboat/noword.jpg
, the logotype of TUGboat.ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[contentBlocks = yes] -\def\markdownRendererContentBlock#1#2#3#4{% -\tt #2}, #4. - This is { - }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% -\tt #2}, #4. - This is the image { - }\def\markdownRendererContentBlockCode#1#2#3#4#5{% -\uppercase{#1}) document {\tt #3}, #5. - This is the #2 ( - }\starttext -\startmarkdown - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[contentBlocks = yes] +\def\markdownRendererContentBlock#1#2#3#4{% +\tt #2}, #4. + This is { + }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% +\tt #2}, #4. + This is the image { + }\def\markdownRendererContentBlockCode#1#2#3#4#5{% +\uppercase{#1}) document {\tt #3}, #5. + This is the #2 ( + }\starttext +\startmarkdown + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\stopmarkdown +\stoptext
Create also a text document named
-markdown-languages.json
with the following content:+- {"json": "JavaScript Object Notation", - }
+ {"json": "JavaScript Object Notation", + }
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7736,8 +8367,8 @@ extensions and programming language names.-This is the image
https://tug.org/tugboat/noword.jpg
, the logotype of TUGboat.2.3.1.8 Definition List +
2.3.1.9 Definition List Renderers
The following macros are only produced, when the
@@ -7769,92 +8400,92 @@ of a definition list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when thedefinitionLists
option is enabled.tightLists
option is disabled. The macro receives no arguments. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionDefinitionLists{true} -\def\markdownOptionTightLists{true} - -\def\markdownRendererInterblockSeparator{% -% - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBeginTight{% -\begingroup - \parindent=0pt - - }\def\markdownRendererDlItem#1{% -\par{\bf#1}% - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em} -\def\markdownRendererDlEndTight{\endgroup} - -\markdownBegin - - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBegin{} -\def\markdownRendererDlItem#1{% - - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionEnd{} -\def\markdownRendererDlEnd{.} - -\markdownBegin - - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\markdownEnd - -\bye
\input markdown +\def\markdownOptionDefinitionLists{true} +\def\markdownOptionTightLists{true} + +\def\markdownRendererInterblockSeparator{% +% + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBeginTight{% +\begingroup + \parindent=0pt + + }\def\markdownRendererDlItem#1{% +\par{\bf#1}% + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em} +\def\markdownRendererDlEndTight{\endgroup} + +\markdownBegin + + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBegin{} +\def\markdownRendererDlItem#1{% + + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionEnd{} +\def\markdownRendererDlEnd{.} + +\markdownBegin + + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7876,94 +8507,94 @@ prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.-LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[definitionLists, tightLists]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {% - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{description}}, - dlBeginTight = {% - dlItem = {\item[#1] - \begin{itemize} - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - },\end{itemize}}, - dlItemEnd = {\item, - dlDefinitionBegin = \end{description}}, - dlEndTight = { - }, - } - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\def\markdownRendererInterblockSeparator{\par}% - - }, - dlBegin = {},% - dlItem = { - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }, - dlItemEnd = {}, - dlDefinitionEnd = {}, - dlEnd = {.}, - }, - } - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[definitionLists, tightLists]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {% + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{description}}, + dlBeginTight = {% + dlItem = {\item[#1] + \begin{itemize} + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + },\end{itemize}}, + dlItemEnd = {\item, + dlDefinitionBegin = \end{description}}, + dlEndTight = { + }, + } + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\def\markdownRendererInterblockSeparator{\par}% + + }, + dlBegin = {},% + dlItem = { + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }, + dlItemEnd = {}, + dlDefinitionEnd = {}, + dlEnd = {.}, + }, + } + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7985,94 +8616,94 @@ prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.-ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - definitionLists = yes, - tightLists = yes, - ]\starttext - -\def\markdownRendererInterblockSeparator{% -% - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBeginTight{} -\def\markdownRendererDlItem#1{% -\par{\bf#1}% - \startitemize - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - }\def\markdownRendererDlItemEnd{\stopitemize} -\def\markdownRendererDlDefinitionBegin{\item} -\def\markdownRendererDlEndTight{} - -\startmarkdown - - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBegin{} -\def\markdownRendererDlItem#1{% - - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionEnd{} -\def\markdownRendererDlEnd{.} - -\startmarkdown - - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + definitionLists = yes, + tightLists = yes, + ]\starttext + +\def\markdownRendererInterblockSeparator{% +% + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBeginTight{} +\def\markdownRendererDlItem#1{% +\par{\bf#1}% + \startitemize + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + }\def\markdownRendererDlItemEnd{\stopitemize} +\def\markdownRendererDlDefinitionBegin{\item} +\def\markdownRendererDlEndTight{} + +\startmarkdown + + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBegin{} +\def\markdownRendererDlItem#1{% + + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionEnd{} +\def\markdownRendererDlEnd{.} + +\startmarkdown + + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8094,73 +8725,73 @@ prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.-2.3.1.9 Ellipsis Renderer
+2.3.1.10 Ellipsis Renderer
The
-\markdownRendererEllipsis
macro replaces any occurance of ASCII ellipses in the input text. This macro will only be produced, when thesmartEllipses
option is enabled. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSmartEllipses{true} -\def\markdownRendererEllipsis{{\it SHAZAM}!} -\markdownBegin - - The secret word is ...\markdownEnd -\bye
\input markdown +\def\markdownOptionSmartEllipses{true} +\def\markdownRendererEllipsis{{\it SHAZAM}!} +\markdownBegin + + The secret word is ...\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-The secret word is SHAZAM!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[smartEllipses]{markdown} -\markdownSetup{ - - renderers = {\emph{SHAZAM}!, - ellipsis = - }, - }\begin{document} -\begin{markdown} - - The secret word is ...\end{markdown} -\end{document}
\documentclass{article} +\usepackage[smartEllipses]{markdown} +\markdownSetup{ + + renderers = {\emph{SHAZAM}!, + ellipsis = + }, + }\begin{document} +\begin{markdown} + + The secret word is ...\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-The secret word is SHAZAM!
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[smartEllipses = yes] -\def\markdownRendererEllipsis{\emph{SHAZAM}!} -\starttext -\startmarkdown - - The secret word is ...\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[smartEllipses = yes] +\def\markdownRendererEllipsis{\emph{SHAZAM}!} +\starttext +\startmarkdown + + The secret word is ...\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8168,81 +8799,81 @@ contain the following text:-(The end of a block)
Foo bar!
2.3.1.10 Emphasis Renderers
+2.3.1.11 Emphasis Renderers
The
-\markdownRendererEmphasis
macro represents an emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEmphasis#1{{\it#1}} -\def\markdownRendererStrongEmphasis#1{{\bf#1}} -\markdownBegin - - This is *emphasis*. - - This is **strong emphasis**.\markdownEnd -\bye
\input markdown +\def\markdownRendererEmphasis#1{{\it#1}} +\def\markdownRendererStrongEmphasis#1{{\bf#1}} +\markdownBegin + + This is *emphasis*. + + This is **strong emphasis**.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is emphasis.
This is strong emphasis.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\emph{#1}}, - emphasis = {\textbf{#1}}, - strongEmphasis = { - }, - }\begin{document} -\begin{markdown} - - This is *emphasis*. - - This is **strong emphasis**.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\emph{#1}}, + emphasis = {\textbf{#1}}, + strongEmphasis = { + }, + }\begin{document} +\begin{markdown} + + This is *emphasis*. + + This is **strong emphasis**.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is emphasis.
This is strong emphasis.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererEmphasis#1{\emph{#1}} -\def\markdownRendererStrongEmphasis#1{\bold{#1}} -\starttext -\startmarkdown - - This is *emphasis*. - - This is **strong emphasis**.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererEmphasis#1{\emph{#1}} +\def\markdownRendererStrongEmphasis#1{\bold{#1}} +\starttext +\startmarkdown + + This is *emphasis*. + + This is **strong emphasis**.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8252,9 +8883,9 @@ contain the following text:-The
-\markdownRendererStrongEmphasis
macro represents a strongly emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.2.3.1.11 Fenced Code Attribute +class="header-section-number">2.3.1.12 Fenced Code Attribute Context Renderers
The following macros are only produced, when the
@@ -8262,110 +8893,107 @@ Context RenderersfencedCode
option is enabled.\markdownRendererFencedCodeAttributeContextEnd
macros represent the beginning and the end of a context in which the attributes of a fenced code apply. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[fencedCode, -markdown} - fencedCodeAttributes]{\usepackage{minted} -\markdownSetup{ - - renderers = {% - fencedCodeAttributeContextBegin = {\begingroup - \markdownSetup{ - - renderers = {% - attributeKeyValue = {\setminted{{#1} = {#2}}% - - }, - },% - } - },% - fencedCodeAttributeContextEnd = {\endgroup - - }, - }, - }\begin{document} -\begin{markdown} - - ``` js {linenos=true} - if (a > 3) { - moveShip(5 * gravity, DOWN); }
\end{markdown} \end{document}
-+Next, invoke LuaTeX from the terminal: -``` sh -lualatex --shell-escape document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ``` js {.linenos} -> 1. if (a > 3) { -> 2. moveShip(5 * gravity, DOWN); -> 3. } -> `````` - - -#### Fenced Div Attribute Context Renderers -The following macros are only produced, when the **`fencedDiv`** option is -enabled. - -The `\markdownRendererFencedDivAttributeContextBegin` and -`\markdownRendererFencedDivAttributeContextEnd` macros represent the beginning -and the end of a div in which the attributes of the div apply. The macros -receive no arguments. - - -##### <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\documentclass{article} -\usepackage[fencedDivs]{markdown} -\markdownSetup{ - renderers = { - fencedDivAttributeContextBegin = {% - \par - \emph{(The beginning of a fenced div attribute context)} - \par - }, - fencedDivAttributeContextEnd = {% - \par - \emph{(The end of a fenced div attribute context)} - \par - }, - }, -} -\begin{document} -\begin{markdown} - -::: {key=value} - -foo - -:::: {#identifier} - -bar - -:::: - -::: - -::: {.class_name} - -baz - -::: - -\end{markdown} -\end{document}
\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 document.tex
+lualatex --shell-escape document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++``` js {.linenos} 1. if (a > 3) { 2. moveShip(5 * gravity, DOWN); +3. } ``````
+2.3.1.13 Fenced Div Attribute +Context Renderers
+The following macros are only produced, when the +
+fencedDiv
option is enabled.The
+\markdownRendererFencedDivAttributeContextBegin
and +\markdownRendererFencedDivAttributeContextEnd
macros +represent the beginning and the end of a div in which the attributes of +the div apply. The macros receive no arguments.LaTeX Example
+Using 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}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8379,8 +9007,8 @@ contain the following text:-baz
(The end of a fenced div attribute context)
2.3.1.12 Header Attribute Context +
2.3.1.14 Header Attribute Context Renderers
The following macros are only produced, when the
@@ -8388,41 +9016,41 @@ RenderersheaderAttributes
option is enabled.\markdownRendererHeaderAttributeContextEnd
macros represent the beginning and the end of a section in which the attributes of a heading apply. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes]{markdown} -\markdownSetup{ - - renderers = {% - headerAttributeContextBegin = {\par - \emph{(The beginning of a header attribute context)} - \par - - },% - headerAttributeContextEnd = {\par - \emph{(The end of a header attribute context)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - # First top-level heading - - ## A subheading {#identifier} - - # Second top-level heading {.class_name} -\end{markdown} -\end{document}
\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:@@ -8434,8 +9062,8 @@ contain the following text:-Second top-level heading
(The end of a header attribute context)
2.3.1.13 Heading Renderers
+2.3.1.15 Heading Renderers
The
@@ -8454,102 +9082,102 @@ corresponds to the heading text.\markdownRendererHeadingOne
macro represents a first level heading. The macro receives a single argument that corresponds to the heading text.The
-\markdownRendererHeadingSix
macro represents a sixth level heading. The macro receives a single argument that corresponds to the heading text.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\markdownBegin - - ###### - ##### - ##### - ### - ######\markdownEnd -\bye
\input markdown +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\markdownBegin + + ###### + ##### + ##### + ### + ######\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-65536
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - interblockSeparator = {}, - headingOne = 1, - headingTwo = 2, - headingThree = 3, - headingFour = 4, - headingFive = 5, - headingSix = 6, - }, - }\begin{document} -\begin{markdown} - - ###### - ##### - ##### - ### - ######\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {}, + headingOne = 1, + headingTwo = 2, + headingThree = 3, + headingFour = 4, + headingFive = 5, + headingSix = 6, + }, + }\begin{document} +\begin{markdown} + + ###### + ##### + ##### + ### + ######\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-65536
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\starttext -\startmarkdown - - ###### - ##### - ##### - ### - ######\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\starttext +\startmarkdown + + ###### + ##### + ##### + ### + ######\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-65536
2.3.1.14 HTML Comment +
2.3.1.16 HTML Comment Renderers
The
\markdownRendererInlineHtmlComment
macro represents the contents of an inline HTML comment. This macro will @@ -8560,40 +9188,40 @@ contents of the HTML comment.\markdownRendererBlockHtmlCommentEnd
macros represent the beginning and the end of a block HTML comment. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\markdownSetup{ - - renderers = {\marginnote{#1}}, - inlineHtmlComment = {\begin{quote}}, - blockHtmlCommentBegin = {\end{quote}}, - blockHtmlCommentEnd = { - }, - }\begin{document} -\begin{markdown} - - A useful use of inline HTML comments are side notes. - <!-- Side notes are displayed in the horizontal margins next to the relevant - passages, which makes them *easier for the reader to find* than notes. --> - - We can render block HTML comments as blockquotes: - - <!-- - Here is a block HTML comment with a code example that a programmer might understand: - - foo = bar + baz - 42 - -->\end{markdown} -\end{document}
\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\markdownSetup{ + + renderers = {\marginnote{#1}}, + inlineHtmlComment = {\begin{quote}}, + blockHtmlCommentBegin = {\end{quote}}, + blockHtmlCommentEnd = { + }, + }\begin{document} +\begin{markdown} + + A useful use of inline HTML comments are side notes. + <!-- Side notes are displayed in the horizontal margins next to the relevant + passages, which makes them *easier for the reader to find* than notes. --> + + We can render block HTML comments as blockquotes: + + <!-- + Here is a block HTML comment with a code example that a programmer might understand: + + foo = bar + baz - 42 + -->\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -8611,8 +9239,8 @@ might understand: relevant passages, which makes them easier for the reader to find than notes.-2.3.1.15 HTML Tag and Element +
2.3.1.17 HTML Tag and Element Renderers
The
-\markdownRendererInlineHtmlTag
macro represents an opening, closing, or empty inline HTML tag. This macro will @@ -8624,86 +9252,86 @@ represents a block HTML element. This macro will only be produced, when thehtml
option is enabled. The macro receives a single argument that filename of a file containing the contents of the HTML element.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\usepackage{verbatim} -\markdownSetup{ - - renderers = {\textbf{#1}}, - inlineHtmlTag = {\verbatiminput{#1}}, - inputBlockHtmlElement = { - }, - }\begin{document} -\begin{markdown} - - <b>_Hello,_ world!</b><br/> - - <div>_Hello,_ world!</div>\end{markdown} -\end{document}
\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\usepackage{verbatim} +\markdownSetup{ + + renderers = {\textbf{#1}}, + inlineHtmlTag = {\verbatiminput{#1}}, + inputBlockHtmlElement = { + }, + }\begin{document} +\begin{markdown} + + <b>_Hello,_ world!</b><br/> + + <div>_Hello,_ world!</div>\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:-_Hello,_ world!
<div>_Hello,_ world!</div>
2.3.1.16 Image Renderer
+2.3.1.18 Image Renderer
The
-\markdownRendererImage
macro represents an image. It receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\begingroup -\catcode`\@=11 -\catcode`\%=12 -\catcode`\^^A=14 -\global\def\markdownRendererImage#1#2#3#4{^^A -\immediate\write18{^^A
-if printf '%s' "#3" | grep -q ^http; then - OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A - $(printf '%s' "#3" | sed 's/.*[.]//')"; -if ! [ -e "$OUTPUT" ]; then - wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; - convert "$OUTPUT" png:"$OUTPUT"; - fi; - printf '%s%%' "$OUTPUT" > \jobname.fetched; - else - printf '%s%%' "#3" > \jobname.fetched; - fi^^A
+- }^^A - {^^A\everyeof={\noexpand}^^A - \edef\filename{\__markdowninput"\jobname.fetched" }^^A - \includegraphics[width=\textwidth]{\filename}^^A - - }^^A - }\endgroup -\begin{document} -\begin{markdown} - - ![TUGboat](https://tug.org/tugboat/noword.jpg)\end{markdown} -\end{document}
+\documentclass{article} +\usepackage{markdown} +\begingroup +\catcode`\@=11 +\catcode`\%=12 +\catcode`\^^A=14 +\global\def\markdownRendererImage#1#2#3#4{^^A +\immediate\write18{^^A
+if printf '%s' "#3" | grep -q ^http; then + OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A + $(printf '%s' "#3" | sed 's/.*[.]//')"; +if ! [ -e "$OUTPUT" ]; then + wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; + convert "$OUTPUT" png:"$OUTPUT"; + fi; + printf '%s%%' "$OUTPUT" > \jobname.fetched; + else + printf '%s%%' "#3" > \jobname.fetched; + fi^^A
+ }^^A + {^^A\everyeof={\noexpand}^^A + \edef\filename{\__markdowninput"\jobname.fetched" }^^A + \includegraphics[width=\textwidth]{\filename}^^A + + }^^A + }\endgroup +\begin{document} +\begin{markdown} + + ![TUGboat](https://tug.org/tugboat/noword.jpg)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following content. This assumes that you use a Unix-like operating system with Bourne or Bourne again shell as the default shell @@ -8718,32 +9346,70 @@ title="The Communications of the TeX Users Group" alt="TUGboat" />2.3.1.17 Interblock Separator +
2.3.1.19 Image Attribute Context +Renderers
+The following macros are only produced, when the +
+linkAttributes
option is enabled.The
+\markdownRendererImageAttributeContextBegin
and +\markdownRendererImageAttributeContextEnd
macros represent +the beginning and the end of an image in which the attributes of the +image apply. The macros receive no arguments.LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage[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
A PDF document named
+document.pdf
should be produced and +contain the following text:++foo (bar) baz
+2.3.1.20 Interblock Separator Renderer
The
-\markdownRendererInterblockSeparator
macro represents a separator between two markdown block elements. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\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:@@ -8751,32 +9417,32 @@ contain the following text:-(The end of a block)
Foo bar!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - interblockSeparator = {\par - \emph{(The end of a block)}% - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - _Foo_ bar!\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + interblockSeparator = {\par + \emph{(The end of a block)}% + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + _Foo_ bar!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8784,27 +9450,27 @@ contain the following text:-(The end of a block)
Foo bar!
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{% -\par - \emph{(The end of a block)}% - \par - - }\starttext -\startmarkdown - - Hello *world*! - - _Foo_ bar!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{% +\par + \emph{(The end of a block)}% + \par + + }\starttext +\startmarkdown + + Hello *world*! + + _Foo_ bar!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8812,31 +9478,31 @@ contain the following text:-(The end of a block)
Foo bar!
2.3.1.18 Line Block Renderer
+2.3.1.21 Line Block Renderer
The following macros are only produced, when the
lineBlocks
option is enabled.The
-\markdownRendererLineBlockBegin
and\markdownRendererLineBlockEnd
macros represent the beginning and the end of a line block. The macros receive no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionLineBlocks{true} -\markdownBegin - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\markdownEnd -\bye
\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:@@ -8845,24 +9511,24 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[lineBlocks]{markdown} -\begin{document} -\begin{markdown} - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\end{markdown} -\end{document}
\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:@@ -8871,24 +9537,24 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[lineBlocks = yes] -\starttext -\startmarkdown - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\stopmarkdown -\stoptext
\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:@@ -8897,23 +9563,23 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.2.3.1.19 Line Break Renderer
+2.3.1.22 Line Break Renderer
The
-\markdownRendererHardLineBreak
macro represents a hard line break. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\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 @@ -8922,8 +9588,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:@@ -8931,25 +9597,25 @@ contain the following text:-(A hard line break)
Foo bar!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - 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 @@ -8958,8 +9624,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:@@ -8967,31 +9633,63 @@ contain the following text:-(A hard line break)
Foo bar!
2.3.1.20 Link Renderer
+2.3.1.23 Link Renderer
The
-\markdownRendererLink
macro represents a hyperlink. It receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled {\it#4}% - #1 { - }\markdownBegin - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\markdownEnd -\bye
\input markdown +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled {\it#4}% + #1 { + }\markdownBegin + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
+luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++Please visit the link https://ctan.org/ titled the Comprehensive TeX +Archive Network.
+LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + link = {\texttt{#2} titled \emph{#4}% + #1 + }, + }, + }\begin{document} +\begin{markdown} + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8999,31 +9697,26 @@ contain the following text: class="uri">https://ctan.org/ titled the Comprehensive TeX Archive Network.-LaTeX Example
+ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - link = {\texttt{#2} titled \emph{#4}% - #1 - }, - }, - }\begin{document} -\begin{markdown} - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\end{markdown} -\end{document}
\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:
-+lualatex document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9031,35 +9724,46 @@ contain the following text: class="uri">https://ctan.org/ titled the Comprehensive TeX Archive Network.-ConTeXt Example
+2.3.1.24 Link Attribute Context +Renderers
+The following macros are only produced, when the +
+linkAttributes
option is enabled.The
+\markdownRendererLinkAttributeContextBegin
and +\markdownRendererLinkAttributeContextEnd
macros represent +the beginning and the end of a hyperlink in which the attributes of the +hyperlink apply. The macros receive no arguments.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled \emph{#4}% - #1 { - }\starttext -\startmarkdown - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\stopmarkdown -\stoptext
\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:
-+context document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:--Please visit the link https://ctan.org/ titled the Comprehensive TeX -Archive Network.
+foo (bar) baz
2.3.1.21 Markdown Document +
2.3.1.25 Markdown Document Renderers
The
-\markdownRendererDocumentBegin
and\markdownRendererDocumentEnd
macros represent the beginning @@ -9070,81 +9774,81 @@ number of markdown documents. Additionally, markdown documents may appear not only in a sequence, but several markdown documents may also be nested. Redefinitions of the macros should take this into account.LaTeX Example
Using a text editor, create a text document named
-nested.md
with the following content:+This is a *nested* markdown document.
This is a *nested* markdown document.
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {% - contentBlock = {\markdownInput{#3}% - - },% - documentBegin = {\par - \emph{(The beginning of a document)} - \par - \begingroup - \markdownSetup{snippet=first-nesting-level}% - - },% - documentEnd = {\endgroup - \par - \emph{(The end of a document)} - \par - - }, - }, - }\markdownSetupSnippet{first-nesting-level}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - \markdownSetup{snippet=second-nesting-level-and-below} - - }, - }, - }\markdownSetupSnippet{second-nesting-level-and-below}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - - }, - documentEnd = {\endgroup - \par - \emph{(The end of a nested document)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - /nested.md - - _Foo_ bar!\end{markdown} -\begin{markdown} - - - Bar baz! -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {% + contentBlock = {\markdownInput{#3}% + + },% + documentBegin = {\par + \emph{(The beginning of a document)} + \par + \begingroup + \markdownSetup{snippet=first-nesting-level}% + + },% + documentEnd = {\endgroup + \par + \emph{(The end of a document)} + \par + + }, + }, + }\markdownSetupSnippet{first-nesting-level}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + \markdownSetup{snippet=second-nesting-level-and-below} + + }, + }, + }\markdownSetupSnippet{second-nesting-level-and-below}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + + }, + documentEnd = {\endgroup + \par + \emph{(The end of a nested document)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + /nested.md + + _Foo_ bar!\end{markdown} +\begin{markdown} + + + Bar baz! +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9159,51 +9863,51 @@ contain the following text:-Bar baz!
(The end of a document)
2.3.1.22 Non-Breaking Space +
2.3.1.26 Non-Breaking Space Renderer
The
-\markdownRendererNbsp
macro represents a non-breaking space.LaTeX Example
Using a text editor, create a text document named
-document.bib
with the following content:+@book{knuth:tex, -author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[ - - citations, - citationNbsps,markdown} - ]{\markdownSetup{ - - renderers = {$\cdot$}, - nbsp = { - }, - }\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} - -\bibliographystyle{plain} -\bibliography{document.bib} - -\end{document}
\documentclass{article} +\usepackage[ + + citations, + citationNbsps,markdown} + ]{\markdownSetup{ + + renderers = {$\cdot$}, + nbsp = { + }, + }\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} + +\bibliographystyle{plain} +\bibliography{document.bib} + +\end{document}
Next, invoke LuaTeX and BibTeX from the terminal:
-+lualatex document.tex -bibtex document.aux -lualatex document.tex -lualatex document.tex
lualatex document.tex +bibtex document.aux +lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9214,95 +9918,95 @@ href="https://datatracker.ietf.org/doc/html/rfc3986#section-4.2">1 Donald Ervin Knuth. The TeXbook, volume A of Computers and typesetting. Addison-Wesley, 1984.-2.3.1.23 Note Renderer
+2.3.1.27 Note Renderer
The
-\markdownRendererNote
macro represents a note. This macro will only be produced, when thenotes
option is enabled. The macro receives a single argument that corresponds to the note text.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionNotes{true} -\def\markdownRendererNote#1{ (and \lowercase{#1})} -\markdownBegin - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\markdownEnd -\bye
\input markdown +\def\markdownOptionNotes{true} +\def\markdownRendererNote#1{ (and \lowercase{#1})} +\markdownBegin + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a note) and this is some other text (and this is some other note).
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[notes]{markdown} -\markdownSetup{ - - renderers = {\MakeLowercase{#1})}, - note = { (and - }, - }\begin{document} -\begin{markdown} - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\end{markdown} -\end{document}
\documentclass{article} +\usepackage[notes]{markdown} +\markdownSetup{ + + renderers = {\MakeLowercase{#1})}, + note = { (and + }, + }\begin{document} +\begin{markdown} + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a note) and this is some other text (and this is some other note).
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\def\markdownRendererNote#1{ (and \lowercase{#1})} -\starttext -\startmarkdown - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\def\markdownRendererNote#1{ (and \lowercase{#1})} +\starttext +\startmarkdown + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a note) and this is some other text (and this is some other note).
2.3.1.24 Ordered List +
2.3.1.28 Ordered List Renderers
The
-\markdownRendererOlBegin
macro represents the beginning of an ordered list that contains an item with several @@ -9386,74 +10090,74 @@ paragraphs of text (the list is tight). This macro will only be produced, when thefancyLists
andtightLists
options are enabled. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTightLists{true} -\def\markdownOptionStartNumber{true} - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererOlBeginTight{ (} -\def\markdownRendererOlItemWithNumber#1{% -\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }\def\markdownRendererOlItemEnd{} -\def\markdownRendererOlEndTight{).} - -\markdownBegin - - This is a tight list - - 1. item - 2. item - 3. item\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererOlBegin{} -\def\markdownRendererOlItemWithNumber#1{% -\kern 0.5em% - #1. - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{} - -\markdownBegin - - This is a loose list - - 1. item - - 2. item - - 3. item\markdownEnd - -\bye
\input markdown +\def\markdownOptionTightLists{true} +\def\markdownOptionStartNumber{true} + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\markdownBegin + + This is a tight list + + 1. item + 2. item + 3. item\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{} +\def\markdownRendererOlItemWithNumber#1{% +\kern 0.5em% + #1. + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{} + +\markdownBegin + + This is a loose list + + 1. item + + 2. item + + 3. item\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9466,77 +10170,77 @@ item).-This is the third item.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[tightLists, startNumber]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = { - interblockSeparator = {}, - olBeginTight = { (},% - olItemWithNumber = {\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }, - olItemEnd = {}, - olEndTight = {).}, - }, - } - This is a tight list - - 1. item - 2. item - 3. item\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\par - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{enumerate}}, - olBeginTight = {% - olItemWithNumber = {\item This is the - \ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }, - olItemEnd = {.},\end{enumerate}}, - olEnd = { - }, - } - This is a loose list - - 1. item - - 2. item - - 3. item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists, startNumber]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + olBeginTight = { (},% + olItemWithNumber = {\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }, + olItemEnd = {}, + olEndTight = {).}, + }, + } + This is a tight list + + 1. item + 2. item + 3. item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{enumerate}}, + olBeginTight = {% + olItemWithNumber = {\item This is the + \ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }, + olItemEnd = {.},\end{enumerate}}, + olEnd = { + }, + } + This is a loose list + + 1. item + + 2. item + + 3. item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9549,78 +10253,78 @@ item).-This is the third item.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - tightLists = yes, - startNumber = yes, - ]\starttext - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererOlBeginTight{ (} -\def\markdownRendererOlItemWithNumber#1{% -\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }\def\markdownRendererOlItemEnd{} -\def\markdownRendererOlEndTight{).} - -\startmarkdown - - This is a tight list - - 1. item - 2. item - 3. item\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererOlBegin{\startitemize} -\def\markdownRendererOlItemWithNumber#1{% -\sym{#1.} - - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{\stopitemize} - -\startmarkdown - - This is a loose list - - 1. item - - 2. item - - 3. item\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + tightLists = yes, + startNumber = yes, + ]\starttext + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\startmarkdown + + This is a tight list + + 1. item + 2. item + 3. item\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{\startitemize} +\def\markdownRendererOlItemWithNumber#1{% +\sym{#1.} + + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{\stopitemize} + +\startmarkdown + + This is a loose list + + 1. item + + 2. item + + 3. item\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9633,8 +10337,8 @@ item).-This is the third item.
2.3.1.25 Parenthesized Citations +
2.3.1.29 Parenthesized Citations Renderer
The
-\markdownRendererCite
macro represents a string of one or more parenthetical citations. This macro will only be produced, @@ -9645,54 +10349,54 @@ citations⟩}
followed by ⟨suppress author⟩ repeated ⟨number of citations⟩ times. The ⟨suppress author⟩ parameter is either the token-
, when the author’s name is to be suppressed, or+
otherwise.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a parenthesized citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \ifx\relax#3\relax\else - \ and a postfix \emph{#3}% - \fi - \fi - \ifnum\citationsCounter>\citationsTotal\relax - % - .\expandafter\@gobble - \else - - , and\fi\citations} - \makeatother -\markdownSetup{ - - renderers = {% - cite = {\citationsCounter=1% - \citationsTotal=#1% - - This is\expandafter\citations - - }, - }, - }\begin{document} -\begin{markdown} - - [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a parenthesized citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \ifx\relax#3\relax\else + \ and a postfix \emph{#3}% + \fi + \fi + \ifnum\citationsCounter>\citationsTotal\relax + % + .\expandafter\@gobble + \else + + , and\fi\citations} + \makeatother +\markdownSetup{ + + renderers = {% + cite = {\citationsCounter=1% + \citationsTotal=#1% + + This is\expandafter\citations + + }, + }, + }\begin{document} +\begin{markdown} + + [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9700,8 +10404,8 @@ contain the following text: see and a postfix pp. 12, and a citation eijkhout91 with a postfix pp. 34.-2.3.1.26 Raw Content Renderers
+2.3.1.30 Raw Content Renderers
The
-\markdownRendererInputRawInline
macro represents an inline raw span. The macro receives two arguments: the filename of a file contaning the inline raw span contents and the raw attribute that @@ -9714,63 +10418,63 @@ contaning the raw block and the raw attribute that designates the format of the raw block. This macro will only be produced, when therawAttribute
andfencedCode
options are enabled.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[rawAttribute, fencedCode]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\cs_new:Nn -\display_raw_content:nn - - {% If the raw attribute is TeX, execute the content as a TeX document. - \str_if_eq:nnTF - - { #2 } - { tex }\markdownEscape { #1 } } - { % Otherwise, ignore the content. - - { } - }\markdownSetup{ - - renderers = {\display_raw_content:nn { #1 } { #2 } }, - rawInline = { \display_raw_content:nn { #1 } { #2 } } - rawBlock = { - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} -$H_2 O$`{=tex} is a liquid. - ` - - ``` {=html} - <p>Here is some HTML content that will be ignored.</p> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[rawAttribute, fencedCode]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\cs_new:Nn +\display_raw_content:nn + + {% If the raw attribute is TeX, execute the content as a TeX document. + \str_if_eq:nnTF + + { #2 } + { tex }\markdownEscape { #1 } } + { % Otherwise, ignore the content. + + { } + }\markdownSetup{ + + renderers = {\display_raw_content:nn { #1 } { #2 } }, + rawInline = { \display_raw_content:nn { #1 } { #2 } } + rawBlock = { + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} +$H_2 O$`{=tex} is a liquid. + ` + + ``` {=html} + <p>Here is some HTML content that will be ignored.</p> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H2O is a liquid.
2.3.1.27 Section Renderers
+2.3.1.31 Section Renderers
The
-\markdownRendererSectionBegin
and\markdownRendererSectionEnd
macros represent the beginning and the end of a section based on headings.2.3.1.28 Replacement Character +
2.3.1.32 Replacement Character Renderers
The
-\markdownRendererReplacementCharacter
macro represents the U+0000 and U+FFFD Unicode characters. The macro receives no arguments.2.3.1.29 Special Character +
2.3.1.33 Special Character Renderers
The following macros replace any special plain TeX characters, including the active pipe @@ -9800,306 +10504,306 @@ class="tex">TeXt, in the input text:
- \markdownRendererUnderscore
replaces the underscore (_
).Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\input markdown -\def\markdownRendererTilde{~} -\markdownBegin - - Bartel~Leendert van~der~Waerden\markdownEnd -\bye
\input markdown +\def\markdownRendererTilde{~} +\markdownBegin + + Bartel~Leendert van~der~Waerden\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - tilde = ~, - }, - }\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + tilde = ~, + }, + }\begin{document} +\begin{markdown} + + Bartel~Leendert van~der~Waerden\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\usemodule[t][markdown] -\def\markdownRendererTilde{~} -\starttext -\startmarkdown - - Bartel~Leendert van~der~Waerden\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTilde{~} +\starttext +\startmarkdown + + Bartel~Leendert van~der~Waerden\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
2.3.1.30 Strike-Through +
2.3.1.34 Strike-Through Renderer
The
-\markdownRendererStrikeThrough
macro represents a strike-through span of text. The macro receives a single argument that corresponds to the striked-out span of text. This macro will only be produced, when thestrikeThrough
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStrikeThrough{true} -\input soulutf8.sty -\def\markdownRendererStrikeThrough#1{\st{#1}} -\markdownBegin - - This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd -\bye
\input markdown +\def\markdownOptionStrikeThrough{true} +\input soulutf8.sty +\def\markdownRendererStrikeThrough#1{\st{#1}} +\markdownBegin + + This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[strikeThrough = yes] +\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} +\starttext +\startmarkdown + + This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.2.3.1.31 Subscript Renderer
+2.3.1.35 Subscript Renderer
The
-\markdownRendererSubscript
macro represents a subscript span of text. The macro receives a single argument that corresponds to the subscript span of text. This macro will only be produced, when thesubscripts
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSubscripts{true} -\def\markdownRendererSubscript#1{ (#1 moles) and } -\markdownBegin - - H~2~O is a liquid.\markdownEnd -\bye
\input markdown +\def\markdownOptionSubscripts{true} +\def\markdownRendererSubscript#1{ (#1 moles) and } +\markdownBegin + + H~2~O is a liquid.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H (2 moles) and O is a liquid.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[subscripts]{markdown} -\markdownSetup{ - - renderers = { - subscript = { (#1 moles) and }, - }, - }\begin{document} -\begin{markdown} - - H~2~O is a liquid.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[subscripts]{markdown} +\markdownSetup{ + + renderers = { + subscript = { (#1 moles) and }, + }, + }\begin{document} +\begin{markdown} + + H~2~O is a liquid.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H (2 moles) and O is a liquid.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[subscripts = yes] -\def\markdownRendererSubscript#1{ (#1 moles) and } -\starttext -\startmarkdown - - H~2~O is a liquid.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[subscripts = yes] +\def\markdownRendererSubscript#1{ (#1 moles) and } +\starttext +\startmarkdown + + H~2~O is a liquid.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H (2 moles) and O is a liquid.
2.3.1.32 Superscript Renderer
+2.3.1.36 Superscript Renderer
The
-\markdownRendererSuperscript
macro represents a superscript span of text. The macro receives a single argument that corresponds to the superscript span of text. This macro will only be produced, when thesuperscripts
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSuperscripts{true} -\def\markdownRendererSuperscript#1{ taken to the power of #1} -\markdownBegin - - 2^10^ is 1024.\markdownEnd -\bye
\input markdown +\def\markdownOptionSuperscripts{true} +\def\markdownRendererSuperscript#1{ taken to the power of #1} +\markdownBegin + + 2^10^ is 1024.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-2 taken to the power of 10 is 1024.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[superscripts]{markdown} -\markdownSetup{ - - renderers = { - superscript = { taken to the power of #1}, - }, - }\begin{document} -\begin{markdown} - - 2^10^ is 1024.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[superscripts]{markdown} +\markdownSetup{ + + renderers = { + superscript = { taken to the power of #1}, + }, + }\begin{document} +\begin{markdown} + + 2^10^ is 1024.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-2 taken to the power of 10 is 1024.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[superscripts = yes] -\def\markdownRendererSuperscript#1{ taken to the power of #1} -\starttext -\startmarkdown - - 2^10^ is 1024.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[superscripts = yes] +\def\markdownRendererSuperscript#1{ taken to the power of #1} +\starttext +\startmarkdown + + 2^10^ is 1024.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-2 taken to the power of 10 is 1024.
2.3.1.33 Table Renderer
+2.3.1.37 Table Renderer
The
\markdownRendererTable
macro represents a table. This macro will only be produced, when thepipeTables
option is enabled. The macro @@ -10120,71 +10824,71 @@ one of the following:c
– The corresponding column is centered.- r
– The corresponding column is right-aligned.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[pipeTables, tableCaptions]{markdown} -\newcount\rowCounter -\newcount\columnCounter -\makeatletter -\def\processRow#1{% -\columnCounter=1% - \ifnum\rowCounter=0\relax - - As for the alignment,\else - \the\rowCounter, - In row \fi - \processColumn#1 - \advance\rowCounter by 1\relax - \ifnum\rowCounter>\rowTotal\relax - \expandafter\@gobble - \fi\processRow}% - \def\processColumn#1{% -\the\columnCounter{} - column number \ifnum\rowCounter=0\relax - \if#1d{}has default alignment\fi - \if#1l{}is left-aligned\fi - \if#1c{}is centered\fi - \if#1r{}is right-aligned\fi - \else - \emph{#1}% - says \fi - \advance\columnCounter by 1\relax - \ifnum\columnCounter<\columnTotal\relax, \fi - \ifnum\columnCounter=\columnTotal\relax, and \fi - \ifnum\columnCounter>\columnTotal\relax - \expandafter\@gobble - .\fi\processColumn}% - \makeatother -\markdownSetup{ - - renderers = {% - table = {\emph{#1} that is #3 colums wide - This is a table with caption - and #2 rows long.\rowCounter=0% - \def\rowTotal{#2}% - \def\columnTotal{#3}% - \processRow - - }, - }, - }\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[pipeTables, tableCaptions]{markdown} +\newcount\rowCounter +\newcount\columnCounter +\makeatletter +\def\processRow#1{% +\columnCounter=1% + \ifnum\rowCounter=0\relax + + As for the alignment,\else + \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
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10202,32 +10906,35 @@ column number 4 says 12. In row 3, column number 1 says number 1 says 1, column number 2 says 1, column number 3 says 1, and column number 4 says 1.-2.3.1.34 Tex Math Renderers
+2.3.1.38 Tex Math Renderers
The
-\markdownRendererInlineMath
and\markdownRendererDisplayMath
macros represent inline and display TeX math. Both macros receive a single argument that corresponds to the tex math content. These macros will only be produced, when the -texMathDollars
option is enabled.Plain
texMathDollars
, +texMathSingleBackslash
, or +texMathDoubleBackslash
option are +enabled. +Plain TeX Example
Using 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:@@ -10237,26 +10944,26 @@ class="math inline">E = mc2…< \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\eqno(1)$$LaTeX Example
Using 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:@@ -10265,25 +10972,25 @@ class="math inline">E = mc2…<-f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx (1)
ConConTeXt Example
Using 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:@@ -10292,62 +10999,62 @@ class="math inline">E = mc2…<-f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx (1)
2.3.1.35 Text Citations +
2.3.1.39 Text Citations Renderer
The
-\markdownRendererTextCite
macro represents a string of one or more text citations. This macro will only be produced, when thecitations
option is enabled. The macro receives parameters in the same format as the\markdownRendererCite
macro.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a text citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \ifx\relax#3\relax\else - \ and a postfix \emph{#3}% - \fi - \fi - \ifnum\citationsCounter>\citationsTotal\relax - % - .\expandafter\@gobble - \else - - , and\fi\citations} - \makeatother -\markdownSetup{ - - renderers = {% - textCite = {\citationsCounter=1% - \citationsTotal=#1% - - This is\expandafter\citations - - }, - }, - }\begin{document} -\begin{markdown} - - @abrahams90 [pp. 12; also @eijkhout91]\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\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
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10355,29 +11062,29 @@ contain the following text: pp. 12, and a citation eijkhout91 with a prefix also.-2.3.1.36 Thematic Break +
2.3.1.40 Thematic Break Renderer
The
-\markdownRendererThematicBreak
macro represents a thematic break. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererThematicBreak{\vfil\break} -\markdownBegin - - This is the first page. - - *** - - This is the second page.\markdownEnd -\bye
\input markdown +\def\markdownRendererThematicBreak{\vfil\break} +\markdownBegin + + This is the first page. + + *** + + This is the second page.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10385,30 +11092,30 @@ contain the following text:-
This is the second page.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\newpage, - thematicBreak = - }, - }\begin{document} -\begin{markdown} - - This is the first page. - - *** - - This is the second page.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\newpage, + thematicBreak = + }, + }\begin{document} +\begin{markdown} + + This is the first page. + + *** + + This is the second page.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10416,25 +11123,25 @@ contain the following text:-
This is the second page.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererThematicBreak{\page[yes]} -\starttext -\startmarkdown - - This is the first page. - - *** - - This is the second page.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererThematicBreak{\page[yes]} +\starttext +\startmarkdown + + This is the first page. + + *** + + This is the second page.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10442,8 +11149,8 @@ contain the following text:-
This is the second page.
2.3.1.37 Tickbox Renderers
+2.3.1.41 Tickbox Renderers
The macros named
-\markdownRendererTickedBox
,\markdownRendererHalfTickedBox
, and\markdownRendererUntickedBox
represent ticked and unticked @@ -10452,28 +11159,28 @@ boxes, respectively. These macros will either be produced, when the Ballot Box with X (☒, U+2612), Hourglass (⌛, U+231B) or Ballot Box (☐, U+2610) Unicode characters are encountered in the markdown input, respectively.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[taskLists]{markdown} -\markdownSetup{ - - renderers = { - untickedBox = No, - tickedBox = Yes, - }, - }\begin{document} -\begin{markdown} - - - [ ] you can't. - - [x] I can!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[taskLists]{markdown} +\markdownSetup{ + + renderers = { + untickedBox = No, + tickedBox = Yes, + }, + }\begin{document} +\begin{markdown} + + - [ ] you can't. + - [x] I can!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10482,24 +11189,24 @@ contain the following text:-Yes I can! ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[taskLists = yes] -\def\markdownRendererUntickedBox{No} -\def\markdownRendererTickedBox{Yes} -\starttext -\startmarkdown - - - [ ] you can't. - - [x] I can!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[taskLists = yes] +\def\markdownRendererUntickedBox{No} +\def\markdownRendererTickedBox{Yes} +\starttext +\startmarkdown + + - [ ] you can't. + - [x] I can!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10508,8 +11215,8 @@ contain the following text:-Yes I can! 2.3.1.38 YAML Metadata +
2.3.1.42 YAML Metadata Renderers
The
-\markdownRendererJekyllDataBegin
macro represents the beginning of a yaml document. This macro will only be @@ -10567,88 +11274,88 @@ be produced when thejekyllData
option is enabled. The macro receives one argument: the scalar key in the parent structure, cast to a string following yaml serialization rules.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionJekyllData{true} -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\input markdown +\def\markdownOptionJekyllData{true} +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - renderers = {\gdef\name{#2}}, - jekyllDataString = {\gdef\age{#2}}, - jekyllDataNumber = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\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
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\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:@@ -10660,93 +11367,93 @@ PrototypesBy default, token renderers point to package-defined TeX macros, further referred to as prototypes, which provide useful default definitions.
-Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\markdownBegin - - ~\markdownEnd - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\markdownBegin - - ~\markdownEnd -\bye
\input markdown +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\markdownBegin + + ~\markdownEnd + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\markdownBegin + + ~\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Packages can specify token renderer prototypes.
User-defined token renderers take precedence.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - rendererPrototypes = { - tilde = {Packages can specify token renderer prototypes.}, - }, - }\begin{document} -\begin{markdown} - - ~\end{markdown} - -\begin{markdown*}{ - - renderers = { - tilde = {User-defined token renderers take precedence.}, - }, - } - ~\end{markdown*} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + rendererPrototypes = { + tilde = {Packages can specify token renderer prototypes.}, + }, + }\begin{document} +\begin{markdown} + + ~\end{markdown} + +\begin{markdown*}{ + + renderers = { + tilde = {User-defined token renderers take precedence.}, + }, + } + ~\end{markdown*} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Packages can specify token renderer prototypes.
User-defined token renderers take precedence.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\starttext -\startmarkdown - - ~\stopmarkdown - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\startmarkdown - - ~\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\starttext +\startmarkdown + + ~\stopmarkdown + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\startmarkdown + + ~\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10760,102 +11467,102 @@ Prototypes high-level interface that can be programmed using themarkdown/jekyllData
key–values from the l3keys module of the LaTeX3 kernel. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\input markdown -\def\markdownOptionJekyllData{true} -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
+\input markdown +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
+luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf index 1b7b16cb5ca..68b87a09605 100644 Binary files a/Master/texmf-dist/doc/generic/markdown/markdown.pdf and b/Master/texmf-dist/doc/generic/markdown/markdown.pdf differ -- cgit v1.2.3