\texmf\scripts\markdown\markdown-cli.lua` on Windows
systems. Use the command `kpsewhich 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:
> \Is there block tag support?\
> Is there \\ support?
> Is there \ support?
> Is there HTML instruction ?> support?
>
> Is there support? Is there support? Is there support?
###### Plain TeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
\input lmfonts
\markdownBegin
*There is no block tag support.*
*There is no support.*
_There is no support._
_There is no HTML instruction ?> support._
\markdownEnd
\def\markdownOptionHtml{true}
\markdownBegin
*There is block tag support.*
*There is support.*
_There is support._
_There is HTML instruction ?> support._
\markdownEnd
\bye
```````
Next, invoke LuaTeX from the terminal:
``` sh
luatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \There is no block tag support.\
> There is no \\ support.
> There is no \ support.
> There is no HTML instruction ?> support.
>
> There is support. There is support. There is support.
###### LaTeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage{markdown}
\begin{document}
\begin{markdown}
*There is no block tag support.*
*There is no support.*
_There is no support._
_There is no HTML instruction ?> support._
\end{markdown}
\begin{markdown*}{html}
*There is block tag support.*
*There is support.*
_There is support._
_There is HTML instruction ?> support._
\end{markdown*}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \There is no block tag support.\
> There is no \\ support.
> There is no \ support.
> There is no HTML instruction ?> support.
>
> There is support. There is support. There is support.
###### ConTeXt example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
\starttext
\startmarkdown
*There is no block tag support.*
*There is no support.*
_There is no support._
_There is no HTML instruction ?> support._
\stopmarkdown
\def\markdownOptionHtml{true}
\startmarkdown
*There is block tag support.*
*There is support.*
_There is support._
_There is HTML instruction ?> support._
\stopmarkdown
\stoptext
````````
Next, invoke LuaTeX from the terminal:
``` sh
context document.tex
`````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \There is no block tag support.\
> There is no \\ support.
> There is no \ support.
> There is no HTML instruction ?> support.
>
> There is support. There is support. There is support.
##### Option `hybrid`
`hybrid` (default value: `true`)
: true
: Disable the escaping of special plain TeX characters, which makes it
possible to intersperse your markdown markup with TeX code. The
intended usage is in documents prepared manually by a human author.
In such documents, it can often be desirable to mix TeX and markdown
markup freely.
: false
: Enable the escaping of special plain TeX characters outside verbatim
environments, so that they are not interpretted by TeX. This is
encouraged when typesetting automatically generated content or
markdown documents that were not prepared with this package in mind.
###### Lua module example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
\input lmfonts
\directlua{
local markdown = require("markdown")
local convert_safe = markdown.new()
local convert_unsafe = markdown.new({hybrid = true})
local input = [[$\noexpand\sqrt{-1}$ *equals* $i$.]]
tex.sprint(convert_safe(input) .. " " .. convert_unsafe(input)) }
\bye
```````
Then, invoke LuaTeX from the terminal:
``` sh
luatex document.tex
```````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \$\\sqrt {-1}\$ *equals* \$i\$.
> √-̅1̅ *equals* $i$.
###### Lua CLI example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
\input lmfonts
\input optionfalse
\input optiontrue
\bye
```````
Using a text editor, create a text document named `content.md` with the
following content:
``` md
$\sqrt{-1}$ *equals* $i$.
``````
Next, invoke LuaTeX from the terminal:
``` sh
texlua -- content.md optionfalse.tex
texlua hybrid=true -- content.md optiontrue.tex
luatex document.tex
```````
where `` corresponds to the location of the Lua CLI script file,
such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
`C:\Users\\texmf\scripts\markdown\markdown-cli.lua` on Windows
systems. Use the command `kpsewhich 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:
> \$\\sqrt {-1}\$ *equals* \$i\$.
> √-̅1̅ *equals* $i$.
###### Plain TeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\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:
``` sh
luatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \$\\sqrt {-1}\$ *equals* \$i\$.
> √-̅1̅ *equals* $i$.
###### LaTeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\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:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \$\\sqrt {-1}\$ *equals* \$i\$.
> √-̅1̅ *equals* $i$.
###### ConTeXt example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
\starttext
\startmarkdown
$\sqrt{-1}$ *equals* $i$.
\stopmarkdown
\def\markdownOptionHybrid{true}
\startmarkdown
$\sqrt{-1}$ *equals* $i$.
\stopmarkdown
\stoptext
````````
Next, invoke LuaTeX from the terminal:
``` sh
context document.tex
`````
A PDF document named `document.pdf` should be produced and contain the
following text:
> \$\\sqrt {-1}\$ *equals* \$i\$.
> √-̅1̅ *equals* $i$.
##### Option `inlineFootnotes`
`inlineFootnotes` (default value: `false`)
: true
: Enable the pandoc inline footnote syntax extension:
``` md
Here is an inline note.^[Inlines notes are easier to
write, since you don't have to pick an identifier and
move down to type the note.]
``````
: false
: Disable the pandoc inline footnote syntax extension.
###### LaTeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage[footnotes, inlineFootnotes]{markdown}
\begin{document}
\begin{markdown}
Here is an inline note.^[Inlines notes are easier to
write, since you don't have to pick an identifier and
move down to type the note.]
\end{markdown}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> 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.]
###### ConTeXt example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
\def\markdownOptionFootnotes{true}
\def\markdownOptionInlineFootnotes{true}
\starttext
\startmarkdown
Here is an inline note.^[Inlines notes are easier to
write, since you don't have to pick an identifier and
move down to type the note.]
\stopmarkdown
\stoptext
````````
Next, invoke LuaTeX from the terminal:
``` sh
context document.tex
`````
A PDF document named `document.pdf` should be produced and contain the
following text:
> 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.]
##### Option `preserveTabs`
`preserveTabs` (default value: `false`)
: true
: Preserve all tabs in the input.
: false
: Convert any tabs in the input to spaces.
This option is currently non-functional. See [the corresponding
issue][issue-38] in the package repository.
[issue-38]: https://github.com/Witiko/markdown/issues/38
(Tabs are stripped even with the `preserveTabs=true`
Lua option enabled)
##### Option `smartEllipses`
`smartEllipses` (default value: `false`)
: true
: Convert any ellipses in the input to the
`\markdownRendererEllipsis` TeX macro.
: false
: Preserve all ellipses in the input.
###### Lua module example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
\def\markdownRendererEllipsis{. . .}
\input lmfonts
\directlua{
local markdown = require("markdown")
local convert = markdown.new()
input = "These are just three regular dots ..."
tex.sprint(convert(input)) }
\par
\directlua{
local markdown = require("markdown")
local convert = markdown.new({smartEllipses = true})
input = "... and this is a victorian ellipsis."
tex.sprint(convert(input)) }
\bye
```````
Then, invoke LuaTeX from the terminal:
``` sh
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.
###### Lua CLI example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\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:
``` md
Are these just three regular dots, a victorian ellipsis, or ... ?
``````
Next, invoke LuaTeX from the terminal:
``` sh
texlua -- content.md optionfalse.tex
texlua smartEllipses=true -- content.md optiontrue.tex
luatex document.tex
```````
where `` corresponds to the location of the Lua CLI script file,
such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or
`C:\Users\\texmf\scripts\markdown\markdown-cli.lua` on Windows
systems. Use the command `kpsewhich 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:
> Are these just three regular dots, a victorian ellipsis, or ... ?
>
> Are these just three regular dots, a victorian ellipsis, or . . . ?
###### Plain TeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\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:
``` sh
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 {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage{markdown}
\markdownSetup{
renderers = {
ellipsis = {. . .} }}
\begin{document}
\begin{markdown}
These are just three regular dots ...
\end{markdown}
\begin{markdown*}{smartEllipses}
... and this is a victorian ellipsis.
\end{markdown*}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> These are just three regular dots ...
>
> . . . and this is a victorian ellipsis.
###### ConTeXt example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
\def\markdownRendererEllipsis{. . .}
\starttext
\startmarkdown
These are just three regular dots ...
\stopmarkdown
\def\markdownOptionSmartEllipses{true}
\startmarkdown
... and this is a victorian ellipsis.
\stopmarkdown
\stoptext
````````
Next, invoke LuaTeX from the terminal:
``` sh
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.
##### Option `startNumber`
`startNumber` (default value: `true`)
: true
: Make the number in the first item of an ordered lists significant. The
item numbers will be passed to the
`\markdownRendererOlItemWithNumber` TeX macro.
: false
: Ignore the numbers in the ordered list items. Each item will only
produce a
`\markdownRendererOlItem` TeX macro.
###### LaTeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage{markdown}
\begin{document}
\begin{markdown}
The following list respects the numbers specified in the markup:
3. third item
4. fourth item
5. fifth item
\end{markdown}
\begin{markdown*}{startNumber=false}
The following list does not respect the numbers specified in the
markup:
3. third item
4. fourth item
5. fifth item
\end{markdown*}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> The following list respects the numbers specified in the markup:
>
> 3. third item
> 4. fourth item
> 5. fifth item
>
> The following list does not respect the numbers specified in the markup:
>
> 1. third item
> 2. fourth item
> 3. fifth item
###### ConTeXt example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
\starttext
\startmarkdown
The following list respects the numbers specified in the markup:
3. third item
4. fourth item
5. fifth item
\stopmarkdown
\def\markdownOptionStartNumber{false}
\startmarkdown
The following list respects the numbers specified in the markup:
3. third item
4. fourth item
5. fifth item
\stopmarkdown
\stoptext
````````
Next, invoke LuaTeX from the terminal:
``` sh
context document.tex
`````
A PDF document named `document.pdf` should be produced and contain the
following text:
> The following list respects the numbers specified in the markup:
>
> 3. third item
> 4. fourth item
> 5. fifth item
>
> The following list does not respect the numbers specified in the markup:
>
> 1. third item
> 2. fourth item
> 3. fifth item
##### Option `tightLists`
`tightLists` (default value: `true`)
: true
: Lists whose bullets do not consist of multiple paragraphs will be
passed to the
`\markdownRendererOlBeginTight`, `\markdownRendererOlEndTight`,
`\markdownRendererUlBeginTight`, `\markdownRendererUlEndTight`,
`\markdownRendererDlBeginTight`, and
`\markdownRendererDlEndTight` TeX macros.
: false
: Lists whose bullets do not consist of multiple paragraphs will be
treated the same way as lists that do consist of multiple paragraphs.
###### LaTeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage{markdown}
\begin{document}
\begin{markdown}
The following list is tight:
- first item
- second item
- third item
The following list is loose:
- first item
- second item that spans
multiple paragraphs
- third item
\end{markdown}
\begin{markdown*}{tightLists=false}
The following list is now also loose:
- first item
- second item
- third item
\end{markdown*}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> 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
>
> The following list is now also loose:
>
> - first item
>
> - second item
>
> - third item
##### Option `underscores`
`underscores` (default value: `true`)
: true
: Both underscores and asterisks can be used to denote emphasis and
strong emphasis:
``` md
*single asterisks*
_single underscores_
**double asterisks**
__double underscores__
``````
: false
: Only asterisks can be used to denote emphasis and strong emphasis.
This makes it easy to write math with the \Opt{hybrid} option
without the need to constantly escape subscripts.
###### Plain TeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\input markdown
\def\markdownOptionHybrid{true}
\markdownBegin
This is _emphasized text_ and this is a math subscript: $m\_n$.
\markdownEnd
\def\markdownOptionUnderscores{false}
\markdownBegin
This is *emphasized text* and this is a math subscript: $m_n$.
\markdownEnd
\bye
```````
Next, invoke LuaTeX from the terminal:
``` sh
luatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> This is _emphasized text_ and this is a math subscript: *mₙ*.
>
> This is _emphasized text_ and this is a math subscript: *mₙ*.
###### LaTeX example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\documentclass{article}
\usepackage[hybrid]{markdown}
\begin{document}
\begin{markdown}
This is _emphasized text_ and this is a math subscript: $m\_n$.
\end{markdown}
\begin{markdown*}{underscores=false}
This is *emphasized text* and this is a math subscript: $m_n$.
\end{markdown*}
\end{document}
```````
Next, invoke LuaTeX from the terminal:
``` sh
lualatex document.tex
``````
A PDF document named `document.pdf` should be produced and contain the
following text:
> This is _emphasized text_ and this is a math subscript: *mₙ*.
>
> This is _emphasized text_ and this is a math subscript: *mₙ*.
###### ConTeXt example {.unnumbered}
Using a text editor, create a text document named `document.tex` with the
following content:
``` tex
\usemodule[t][markdown]
\def\markdownOptionHybrid{true}
\starttext
\startmarkdown
This is _emphasized text_ and this is a math subscript: $m\_n$.
\stopmarkdown
\def\markdownOptionUnderscores{false}
\startmarkdown
This is *emphasized text* and this is a math subscript: $m_n$.
\stopmarkdown
\stoptext
````````
Next, invoke LuaTeX from the terminal:
``` sh
context document.tex
`````
A PDF document named `document.pdf` should be produced and contain the
following text:
> This is _emphasized text_ and this is a math subscript: *mₙ*.
>
> This is _emphasized text_ and this is a math subscript: *mₙ*.
Plain TeX
---------
The plain TeX macro package provides TeX commands for typesetting markdown
documents that invoke the Lua parser in the background. Beside TeX commands
that correspond to the Lua options, the macro package also provides commands
corresponding to additional plain TeX-specific options, and so-called *token
renderer* commands that define how the individual markdown elements will be
typeset.
### Interfaces
### Options
### Token renderers
LaTeX
-----
The LaTeX macro package provides additional syntactic sugar on top of the plain
TeX macro package and provides sane default definitions of the token renderers.
### Interfaces
### Options
### Token renderers
ConTeXt
-------
The ConTeXt macro package provides additional syntactic sugar on top of the
plain TeX macro package and provides sane default definitions of the token
renderers.
### Interfaces
### Options
### Token renderers