diff options
author | Karl Berry <karl@freefriends.org> | 2019-04-05 21:09:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-04-05 21:09:01 +0000 |
commit | d559ccaca60acb46c6a12c256ea2a1dcc867d0f8 (patch) | |
tree | 919f27f11992e782235c38a4f7d9a3b4fbb2edb2 /Master/texmf-dist/doc/generic/markdown | |
parent | 22e129ab927e016254a610d8682ea25095aacee6 (diff) |
markdown (5apr19)
git-svn-id: svn://tug.org/texlive/trunk@50784 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/generic/markdown')
-rw-r--r-- | Master/texmf-dist/doc/generic/markdown/markdown.css | 25 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/markdown/markdown.html | 5670 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/markdown/markdown.md | 3324 | ||||
-rw-r--r-- | Master/texmf-dist/doc/generic/markdown/markdown.pdf | bin | 398905 -> 412653 bytes |
4 files changed, 4048 insertions, 4971 deletions
diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.css b/Master/texmf-dist/doc/generic/markdown/markdown.css index 2e2f4fb6c44..5abe7013b44 100644 --- a/Master/texmf-dist/doc/generic/markdown/markdown.css +++ b/Master/texmf-dist/doc/generic/markdown/markdown.css @@ -323,3 +323,28 @@ table td { } } +.tex sub, .latex sub, .latex sup { + text-transform: uppercase; +} + +.tex sub, .latex sub { + vertical-align: -0.1ex; + margin-left: -0.1667em; + margin-right: -0.125em; +} + +.tex, .latex, .tex sub, .latex sub { + font-size: 1em; +} + +.latex sup { + font-size: 0.85em; + vertical-align: -0.35em; + margin-left: -0.36em; + margin-right: -0.15em; +} + +abbr { + font-variant: small-caps; +} + diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.html b/Master/texmf-dist/doc/generic/markdown/markdown.html index 523805f0347..203c1be5121 100644 --- a/Master/texmf-dist/doc/generic/markdown/markdown.html +++ b/Master/texmf-dist/doc/generic/markdown/markdown.html @@ -1,150 +1,149 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> +<!DOCTYPE html> +<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang=""> <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - <meta http-equiv="Content-Style-Type" content="text/css" /> + <meta charset="utf-8" /> <meta name="generator" content="pandoc" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" /> <meta name="author" content="Vít Novotný" /> <title>Markdown Package User Manual</title> - <style type="text/css">code{white-space: pre;}</style> <style type="text/css"> -div.sourceCode { overflow-x: auto; } -table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode { - margin: 0; padding: 0; vertical-align: baseline; border: none; } -table.sourceCode { width: 100%; line-height: 100%; } -td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; } -td.sourceCode { padding-left: 5px; } -code > span.kw { color: #007020; font-weight: bold; } /* Keyword */ -code > span.dt { color: #902000; } /* DataType */ -code > span.dv { color: #40a070; } /* DecVal */ -code > span.bn { color: #40a070; } /* BaseN */ -code > span.fl { color: #40a070; } /* Float */ -code > span.ch { color: #4070a0; } /* Char */ -code > span.st { color: #4070a0; } /* String */ -code > span.co { color: #60a0b0; font-style: italic; } /* Comment */ -code > span.ot { color: #007020; } /* Other */ -code > span.al { color: #ff0000; font-weight: bold; } /* Alert */ -code > span.fu { color: #06287e; } /* Function */ -code > span.er { color: #ff0000; font-weight: bold; } /* Error */ -code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ -code > span.cn { color: #880000; } /* Constant */ -code > span.sc { color: #4070a0; } /* SpecialChar */ -code > span.vs { color: #4070a0; } /* VerbatimString */ -code > span.ss { color: #bb6688; } /* SpecialString */ -code > span.im { } /* Import */ -code > span.va { color: #19177c; } /* Variable */ -code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ -code > span.op { color: #666666; } /* Operator */ -code > span.bu { } /* BuiltIn */ -code > span.ex { } /* Extension */ -code > span.pp { color: #bc7a00; } /* Preprocessor */ -code > span.at { color: #7d9029; } /* Attribute */ -code > span.do { color: #ba2121; font-style: italic; } /* Documentation */ -code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ -code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ -code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ + code{white-space: pre-wrap;} + span.smallcaps{font-variant: small-caps;} + span.underline{text-decoration: underline;} + div.column{display: inline-block; vertical-align: top; width: 50%;} </style> - <link rel="stylesheet" href="markdown.css" type="text/css" /> + <style type="text/css"> +a.sourceLine { display: inline-block; line-height: 1.25; } +a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; } +a.sourceLine:empty { height: 1.2em; position: absolute; } +.sourceCode { overflow: visible; } +code.sourceCode { white-space: pre; position: relative; } +div.sourceCode { margin: 1em 0; } +pre.sourceCode { margin: 0; } +@media screen { +div.sourceCode { overflow: auto; } +} +@media print { +code.sourceCode { white-space: pre-wrap; } +a.sourceLine { text-indent: -1em; padding-left: 1em; } +} +pre.numberSource a.sourceLine + { position: relative; } +pre.numberSource a.sourceLine:empty + { position: absolute; } +pre.numberSource a.sourceLine::before + { content: attr(data-line-number); + position: absolute; left: -5em; text-align: right; vertical-align: baseline; + border: none; pointer-events: all; + -webkit-touch-callout: none; -webkit-user-select: none; + -khtml-user-select: none; -moz-user-select: none; + -ms-user-select: none; user-select: none; + padding: 0 4px; width: 4em; + color: #aaaaaa; + } +pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa; padding-left: 4px; } +div.sourceCode + { } +@media screen { +a.sourceLine::before { text-decoration: underline; } +} +code span.al { color: #ff0000; font-weight: bold; } /* Alert */ +code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ +code span.at { color: #7d9029; } /* Attribute */ +code span.bn { color: #40a070; } /* BaseN */ +code span.bu { } /* BuiltIn */ +code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */ +code span.ch { color: #4070a0; } /* Char */ +code span.cn { color: #880000; } /* Constant */ +code span.co { color: #60a0b0; font-style: italic; } /* Comment */ +code span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */ +code span.do { color: #ba2121; font-style: italic; } /* Documentation */ +code span.dt { color: #902000; } /* DataType */ +code span.dv { color: #40a070; } /* DecVal */ +code span.er { color: #ff0000; font-weight: bold; } /* Error */ +code span.ex { } /* Extension */ +code span.fl { color: #40a070; } /* Float */ +code span.fu { color: #06287e; } /* Function */ +code span.im { } /* Import */ +code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */ +code span.kw { color: #007020; font-weight: bold; } /* Keyword */ +code span.op { color: #666666; } /* Operator */ +code span.ot { color: #007020; } /* Other */ +code span.pp { color: #bc7a00; } /* Preprocessor */ +code span.sc { color: #4070a0; } /* SpecialChar */ +code span.ss { color: #bb6688; } /* SpecialString */ +code span.st { color: #4070a0; } /* String */ +code span.va { color: #19177c; } /* Variable */ +code span.vs { color: #4070a0; } /* VerbatimString */ +code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */ + </style> + <link rel="stylesheet" href="markdown.css" /> + <!--[if lt IE 9]> + <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script> + <![endif]--> </head> <body> -<div id="header"> +<header> <h1 class="title">Markdown Package User Manual</h1> -<h2 class="author">Vít Novotný</h2> -</div> -<div id="TOC"> +<p class="author">Vít Novotný</p> +<p class="date">v2.7.0 (2019/04/04)</p> +</header> +<nav id="TOC"> <ul> <li><a href="#introduction"><span class="toc-section-number">1</span> Introduction</a><ul> <li><a href="#requirements"><span class="toc-section-number">1.1</span> Requirements</a></li> <li><a href="#installation"><span class="toc-section-number">1.2</span> Installation</a><ul> -<li><a href="#local-installation"><span class="toc-section-number">1.2.1</span> Local installation</a></li> -<li><a href="#portable-installation"><span class="toc-section-number">1.2.2</span> Portable installation</a></li> -</ul></li> -<li><a href="#first-document"><span class="toc-section-number">1.3</span> First document</a><ul> -<li><a href="#using-lua"><span class="toc-section-number">1.3.1</span> Using Lua</a><ul> -<li><a href="#using-the-lua-module"><span class="toc-section-number">1.3.1.1</span> Using the Lua module</a></li> -<li><a href="#using-the-lua-cli"><span class="toc-section-number">1.3.1.2</span> Using the Lua CLI</a></li> +<li><a href="#local-installation"><span class="toc-section-number">1.2.1</span> Local Installation</a></li> +<li><a href="#portable-installation"><span class="toc-section-number">1.2.2</span> Portable Installation</a></li> </ul></li> -<li><a href="#using-plain-tex"><span class="toc-section-number">1.3.2</span> Using plain TeX</a></li> -<li><a href="#using-latex"><span class="toc-section-number">1.3.3</span> Using LaTeX</a></li> -<li><a href="#using-context"><span class="toc-section-number">1.3.4</span> Using ConTeXt</a></li> +<li><a href="#first-document"><span class="toc-section-number">1.3</span> First Document</a><ul> +<li><a href="#using-lua"><span class="toc-section-number">1.3.1</span> Using Lua</a></li> +<li><a href="#using-plain-tex"><span class="toc-section-number">1.3.2</span> Using Plain <span class="tex">T<sub>e</sub>X</span></a></li> +<li><a href="#using-latex"><span class="toc-section-number">1.3.3</span> Using <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></a></li> +<li><a href="#using-context"><span class="toc-section-number">1.3.4</span> Using Con<span class="tex">T<sub>e</sub>X</span>t</a></li> </ul></li> </ul></li> <li><a href="#examples"><span class="toc-section-number">2</span> Examples</a><ul> -<li><a href="#lua"><span class="toc-section-number">2.1</span> Lua</a><ul> -<li><a href="#interfaces"><span class="toc-section-number">2.1.1</span> Interfaces</a><ul> -<li><a href="#the-lua-module"><span class="toc-section-number">2.1.1.1</span> The Lua module</a></li> -<li><a href="#the-lua-cli"><span class="toc-section-number">2.1.1.2</span> The Lua CLI</a></li> -</ul></li> -<li><a href="#options"><span class="toc-section-number">2.1.2</span> Options</a><ul> -<li><a href="#file-and-directory-names"><span class="toc-section-number">2.1.2.1</span> File and Directory Names</a><ul> -<li><a href="#option-cachedir"><span class="toc-section-number">2.1.2.1.1</span> Option <code>cacheDir</code></a></li> -</ul></li> -<li><a href="#parser-options"><span class="toc-section-number">2.1.2.2</span> Parser Options</a><ul> -<li><a href="#option-blankbeforeblockquote"><span class="toc-section-number">2.1.2.2.1</span> Option <code>blankBeforeBlockquote</code></a></li> -<li><a href="#option-blankbeforecodefence"><span class="toc-section-number">2.1.2.2.2</span> Option <code>blankBeforeCodeFence</code></a></li> -<li><a href="#option-blankbeforeheading"><span class="toc-section-number">2.1.2.2.3</span> Option <code>blankBeforeHeading</code></a></li> -<li><a href="#option-breakableblockquotes"><span class="toc-section-number">2.1.2.2.4</span> Option <code>breakableBlockquotes</code></a></li> -<li><a href="#option-citationnbsps"><span class="toc-section-number">2.1.2.2.5</span> Option <code>citationNbsps</code></a></li> -<li><a href="#option-citations"><span class="toc-section-number">2.1.2.2.6</span> Option <code>citations</code></a></li> -<li><a href="#option-codespans"><span class="toc-section-number">2.1.2.2.7</span> Option <code>codeSpans</code></a></li> -<li><a href="#option-contentblocks"><span class="toc-section-number">2.1.2.2.8</span> Option <code>contentBlocks</code></a></li> -<li><a href="#option-contentblockslanguagemap"><span class="toc-section-number">2.1.2.2.9</span> Option <code>contentBlocksLanguageMap</code></a></li> -<li><a href="#option-definitionlists"><span class="toc-section-number">2.1.2.2.10</span> Option <code>definitionLists</code></a></li> -<li><a href="#option-fencedcode"><span class="toc-section-number">2.1.2.2.11</span> Option <code>fencedCode</code></a></li> -<li><a href="#option-footnotes"><span class="toc-section-number">2.1.2.2.12</span> Option <code>footnotes</code></a></li> -<li><a href="#option-hashenumerators"><span class="toc-section-number">2.1.2.2.13</span> Option <code>hashEnumerators</code></a></li> -<li><a href="#option-html"><span class="toc-section-number">2.1.2.2.14</span> Option <code>html</code></a></li> -<li><a href="#option-hybrid"><span class="toc-section-number">2.1.2.2.15</span> Option <code>hybrid</code></a></li> -<li><a href="#option-inlinefootnotes"><span class="toc-section-number">2.1.2.2.16</span> Option <code>inlineFootnotes</code></a></li> -<li><a href="#option-preservetabs"><span class="toc-section-number">2.1.2.2.17</span> Option <code>preserveTabs</code></a></li> -<li><a href="#option-smartellipses"><span class="toc-section-number">2.1.2.2.18</span> Option <code>smartEllipses</code></a></li> -<li><a href="#option-startnumber"><span class="toc-section-number">2.1.2.2.19</span> Option <code>startNumber</code></a></li> -<li><a href="#option-tightlists"><span class="toc-section-number">2.1.2.2.20</span> Option <code>tightLists</code></a></li> -<li><a href="#option-underscores"><span class="toc-section-number">2.1.2.2.21</span> Option <code>underscores</code></a></li> +<li><a href="#interfaces"><span class="toc-section-number">2.1</span> Interfaces</a><ul> +<li><a href="#lua"><span class="toc-section-number">2.1.1</span> Lua</a></li> +<li><a href="#plain-tex"><span class="toc-section-number">2.1.2</span> Plain <span class="tex">T<sub>e</sub>X</span></a></li> +<li><a href="#latex"><span class="toc-section-number">2.1.3</span> <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></a></li> +<li><a href="#context"><span class="toc-section-number">2.1.4</span> Con<span class="tex">T<sub>e</sub>X</span>t</a></li> </ul></li> +<li><a href="#options"><span class="toc-section-number">2.2</span> Options</a><ul> +<li><a href="#lua-1"><span class="toc-section-number">2.2.1</span> Lua</a></li> +<li><a href="#plain-tex-1"><span class="toc-section-number">2.2.2</span> Plain <span class="tex">T<sub>e</sub>X</span></a></li> </ul></li> -</ul></li> -<li><a href="#plain-tex"><span class="toc-section-number">2.2</span> Plain TeX</a><ul> -<li><a href="#interfaces-1"><span class="toc-section-number">2.2.1</span> Interfaces</a></li> -<li><a href="#options-1"><span class="toc-section-number">2.2.2</span> Options</a></li> -<li><a href="#token-renderers"><span class="toc-section-number">2.2.3</span> Token renderers</a></li> -</ul></li> -<li><a href="#latex"><span class="toc-section-number">2.3</span> LaTeX</a><ul> -<li><a href="#interfaces-2"><span class="toc-section-number">2.3.1</span> Interfaces</a></li> -<li><a href="#options-2"><span class="toc-section-number">2.3.2</span> Options</a></li> -<li><a href="#token-renderers-1"><span class="toc-section-number">2.3.3</span> Token renderers</a></li> -</ul></li> -<li><a href="#context"><span class="toc-section-number">2.4</span> ConTeXt</a><ul> -<li><a href="#interfaces-3"><span class="toc-section-number">2.4.1</span> Interfaces</a></li> -<li><a href="#options-3"><span class="toc-section-number">2.4.2</span> Options</a></li> -<li><a href="#token-renderers-2"><span class="toc-section-number">2.4.3</span> Token renderers</a></li> +<li><a href="#markdown-tokens"><span class="toc-section-number">2.3</span> Markdown Tokens</a><ul> +<li><a href="#token-renderers"><span class="toc-section-number">2.3.1</span> Token Renderers</a></li> +<li><a href="#token-renderer-prototypes"><span class="toc-section-number">2.3.2</span> Token Renderer Prototypes</a></li> </ul></li> </ul></li> </ul> -</div> +</nav> <p><link href="https://afeld.github.io/emoji-css/emoji.css" rel="stylesheet" /></p> <h1 id="introduction"><span class="header-section-number">1</span> Introduction</h1> -<p>The <a href="https://ctan.org/pkg/markdown" title="CTAN: Package markdown">Markdown package</a> converts <a href="https://daringfireball.net/projects/markdown/basics/" title="Daring Fireball: Markdown Basics">markdown</a> markup to TeX commands. The functionality is provided both as a Lua module, and as plain TeX, LaTeX, and ConTeXt macro packages that can be used to directly typeset TeX documents containing markdown markup. Unlike other convertors, the Markdown package makes it easy to redefine how each and every markdown element is rendered. Creative abuse of the markdown syntax is encouraged. <i class="em em-wink"></i></p> -<p>This document is a user manual for the <a href="https://ctan.org/pkg/markdown" title="CTAN: Package markdown">Markdown package</a>. It provides beginner tutorials and code examples. For an in-depth description of the package requirements, interfaces, and implementation, please refer to the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for TeX">technical documentation</a>.</p> +<p>The <a href="https://ctan.org/pkg/markdown" title="CTAN: Package markdown">Markdown package</a> converts <a href="https://daringfireball.net/projects/markdown/basics/" title="Daring Fireball: Markdown Basics">markdown</a> markup to <span class="tex">T<sub>e</sub>X</span> commands. The functionality is provided both as a Lua module and as plain <span class="tex">T<sub>e</sub>X</span>, <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span>, and Con<span class="tex">T<sub>e</sub>X</span>t macro packages that can be used to directly typeset documents containing markdown markup. Unlike other convertors, the Markdown package makes it easy to redefine how each and every markdown element is rendered. Creative abuse of the markdown syntax is encouraged. <i class="em em-wink"></i></p> +<p>This document is a user manual for the <a href="https://ctan.org/pkg/markdown" title="CTAN: Package markdown">Markdown package</a>. It provides tutorials and code examples. For an in-depth description of the package requirements, interfaces, and implementation, please refer to the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for <span class="tex">T<sub>e</sub>X</span>">technical documentation</a>.</p> <h2 id="requirements"><span class="header-section-number">1.1</span> Requirements</h2> -<p>The package requires a working TeX distribution. <a href="https://www.tug.org/texlive/" title="TeX Live - TeX Users Group">TeX Live</a> ≥ 2013 is known to work and so are recent installation of <a href="https://miktex.org/" title="Home - MiKTeXorg">MikTeX</a>. If you are using a minimal installation of a TeX distribution, please consult the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for TeX">technical documentation</a> for a detailed list of required packages.</p> +<p>The package requires a working <span class="tex">T<sub>e</sub>X</span> distribution. <a href="https://www.tug.org/texlive/" title="TeX Live - TeX Users Group"><span class="tex">T<sub>e</sub>X</span> Live</a> ≥ 2013 is known to work and so are recent installation of <a href="https://miktex.org/" title="Home - MiKTeXorg">Mik<span class="tex">T<sub>e</sub>X</span></a>. If you are using a minimal installation of a <span class="tex">T<sub>e</sub>X</span> distribution, please consult the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for <span class="tex">T<sub>e</sub>X</span>">technical documentation</a> for a detailed list of required packages.</p> <h2 id="installation"><span class="header-section-number">1.2</span> Installation</h2> -<p>The package comes pre-installed with <a href="https://www.tug.org/texlive/" title="TeX Live - TeX Users Group">TeX Live</a> ≥ 2016 and with recent installations of <a href="https://miktex.org/" title="Home - MiKTeXorg">MikTeX</a>. Unless you explicitly wish to use the latest version of the package, you are encouraged to skip this step.</p> +<p>The package comes pre-installed with <a href="https://www.tug.org/texlive/" title="TeX Live - TeX Users Group"><span class="tex">T<sub>e</sub>X</span> Live</a> ≥ 2016 and with recent installations of <a href="https://miktex.org/" title="Home - MiKTeXorg">MikTeX</a>. Unless you explicitly wish to use the latest version of the package, you are encouraged to skip this step.</p> <p>To install the package, first download the package from the repository using Git:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="fu">git</span> clone https://github.com/witiko/markdown</code></pre></div> -<p>Next, enter the directory named <code>markdown</code> and interpret the file named <code>markdown.ins</code> file using a Unicode-aware TeX engine, such as XeTeX or LuaTeX:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="bu">cd</span> markdown -<span class="ex">luatex</span> markdown.ins</code></pre></div> +<div class="sourceCode" id="cb1"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb1-1" data-line-number="1"><span class="fu">git</span> clone https://github.com/witiko/markdown</a></code></pre></div> +<p>Next, enter the directory named <code>markdown</code> and interpret the file named <code>markdown.ins</code> file using a Unicode-aware <span class="tex">T<sub>e</sub>X</span> engine, such as XeTeX or LuaTeX:</p> +<div class="sourceCode" id="cb2"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb2-1" data-line-number="1"><span class="bu">cd</span> markdown</a> +<a class="sourceLine" id="cb2-2" data-line-number="2"><span class="ex">luatex</span> markdown.ins</a></code></pre></div> <p>This should produce the following files:</p> <ul> -<li><code>markdown.lua</code> – the Lua module,</li> -<li><code>markdown-cli.lua</code> – the Lua command-line interface,</li> -<li><code>markdown.tex</code> – the plain TeX macro package,</li> -<li><code>markdown.sty</code> – the LaTeX package, and</li> -<li><code>t-markdown.tex</code> – the ConTeXt module.</li> +<li><code>markdown.lua</code>, the Lua module,</li> +<li><code>markdown-cli.lua</code>, the Lua command-line interface,</li> +<li><code>markdown.tex</code>, the plain <span class="tex">T<sub>e</sub>X</span> macro package,</li> +<li><code>markdown.sty</code>, the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> package, and</li> +<li><code>t-markdown.tex</code>, the Con<span class="tex">T<sub>e</sub>X</span>t module.</li> </ul> -<h3 id="local-installation"><span class="header-section-number">1.2.1</span> Local installation</h3> -<p>To perform a local installation, place the above files into your TeX directory structure. This is generally where the individual files should be placed:</p> +<h3 id="local-installation"><span class="header-section-number">1.2.1</span> Local Installation</h3> +<p>To perform a local installation, place the above files into your <span class="tex">T<sub>e</sub>X</span> directory structure. This is generally where the individual files should be placed:</p> <ul> <li><code><TEXMF>/tex/luatex/markdown/markdown.lua</code></li> <li><code><TEXMF>/scripts/markdown/markdown-cli.lua</code></li> @@ -152,223 +151,335 @@ code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Inf <li><code><TEXMF>/tex/latex/markdown/markdown.sty</code></li> <li><code><TEXMF>/tex/context/third/markdown/t-markdown.tex</code></li> </ul> -<p>where <code><TEXMF></code> corresponds to a root of your TeX distribution, such as <code>/usr/share/texmf</code> and <code>~/texmf</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf</code> on Windows systems. When in doubt, consult the manual of your TeX distribution.</p> -<h3 id="portable-installation"><span class="header-section-number">1.2.2</span> Portable installation</h3> -<p>Alternatively, you can also store the above files in the same folder as your TeX document and distribute them together. This way your document can be portably typeset on legacy TeX distributions.</p> -<h2 id="first-document"><span class="header-section-number">1.3</span> First document</h2> -<p>In this section, we will take the necessary steps to typeset our first markdown document in TeX. This will serve as our first hands-on experience with the package and also as a reassurance that the package has been correctly installed.</p> +<p>where <code><TEXMF></code> corresponds to a root of your <span class="tex">T<sub>e</sub>X</span> distribution, such as <code>/usr/share/texmf</code> and <code>~/texmf</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf</code> on Windows systems. When in doubt, consult the manual of your <span class="tex">T<sub>e</sub>X</span> distribution.</p> +<h3 id="portable-installation"><span class="header-section-number">1.2.2</span> Portable Installation</h3> +<p>Alternatively, you can also store the above files in the same folder as your <span class="tex">T<sub>e</sub>X</span> document and distribute them together. This way your document can be portably typeset on legacy <span class="tex">T<sub>e</sub>X</span> distributions.</p> +<h2 id="first-document"><span class="header-section-number">1.3</span> First Document</h2> +<p>In this section, we will take the necessary steps to typeset our first markdown document in <span class="tex">T<sub>e</sub>X</span>. This will serve as our first hands-on experience with the package and also as a reassurance that the package has been correctly installed.</p> <h3 id="using-lua"><span class="header-section-number">1.3.1</span> Using Lua</h3> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> hello -<span class="fu">\bye</span></code></pre></div> -<h4 id="using-the-lua-module"><span class="header-section-number">1.3.1.1</span> Using the Lua module</h4> +<div class="sourceCode" id="cb3"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb3-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb3-2" data-line-number="2"><span class="fu">\input</span> hello</a> +<a class="sourceLine" id="cb3-3" data-line-number="3"><span class="fu">\bye</span></a></code></pre></div> +<h4 id="using-the-lua-module"><span class="header-section-number">1.3.1.1</span> Using the Lua Module</h4> <p>Using a text editor, create a text document named <code>hello.lua</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode lua"><code class="sourceCode lua"><span class="ot">#</span>!<span class="ot">/</span>usr<span class="ot">/</span>bin<span class="ot">/</span>env texlua -<span class="kw">local</span> kpse <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"kpse"</span><span class="ot">)</span> -kpse<span class="ot">.</span>set_program_name<span class="ot">(</span><span class="st">"luatex"</span><span class="ot">)</span> -<span class="kw">local</span> markdown <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"markdown"</span><span class="ot">)</span> -<span class="kw">local</span> convert <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">()</span> -<span class="fu">print</span><span class="ot">(</span>convert<span class="ot">(</span><span class="st">"Hello *world*!"</span><span class="ot">))</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> hello.lua <span class="op">></span> hello.tex -<span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb4"><pre class="sourceCode lua"><code class="sourceCode lua"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="ot">#</span>!<span class="ot">/</span>usr<span class="ot">/</span>bin<span class="ot">/</span>env texlua</a> +<a class="sourceLine" id="cb4-2" data-line-number="2"><span class="kw">local</span> kpse <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"kpse"</span><span class="ot">)</span></a> +<a class="sourceLine" id="cb4-3" data-line-number="3">kpse<span class="ot">.</span>set_program_name<span class="ot">(</span><span class="st">"luatex"</span><span class="ot">)</span></a> +<a class="sourceLine" id="cb4-4" data-line-number="4"><span class="kw">local</span> markdown <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"markdown"</span><span class="ot">)</span></a> +<a class="sourceLine" id="cb4-5" data-line-number="5"><span class="kw">local</span> convert <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">()</span></a> +<a class="sourceLine" id="cb4-6" data-line-number="6"><span class="fu">print</span><span class="ot">(</span>convert<span class="ot">(</span><span class="st">"Hello *world*!"</span><span class="ot">))</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb5"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb5-1" data-line-number="1"><span class="ex">texlua</span> hello.lua <span class="op">></span> hello.tex</a> +<a class="sourceLine" id="cb5-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> hello.lua <span class="op">></span> hello.tex -<span class="ex">pdftex</span> document.tex</code></pre></div> -<h4 id="using-the-lua-cli"><span class="header-section-number">1.3.1.2</span> Using the Lua CLI</h4> +<div class="sourceCode" id="cb6"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb6-1" data-line-number="1"><span class="ex">texlua</span> hello.lua <span class="op">></span> hello.tex</a> +<a class="sourceLine" id="cb6-2" data-line-number="2"><span class="ex">pdftex</span> document.tex</a></code></pre></div> +<h4 id="using-the-lua-command-line-interface"><span class="header-section-number">1.3.1.2</span> Using the Lua Command-Line Interface</h4> <p>Using a text editor, create a text document named <code>hello.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Hello *world*!</code></pre></div> +<div class="sourceCode" id="cb7"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb7-1" data-line-number="1">Hello *world*!</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- hello.md hello.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb8"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb8-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- hello.md hello.tex</a> +<a class="sourceLine" id="cb8-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- hello.md hello.tex -<span class="ex">pdftex</span> document.tex</code></pre></div> -<h3 id="using-plain-tex"><span class="header-section-number">1.3.2</span> Using plain TeX</h3> +<div class="sourceCode" id="cb9"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb9-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- hello.md hello.tex</a> +<a class="sourceLine" id="cb9-2" data-line-number="2"><span class="ex">pdftex</span> document.tex</a></code></pre></div> +<h3 id="using-plain-tex"><span class="header-section-number">1.3.2</span> Using Plain <span class="tex">T<sub>e</sub>X</span></h3> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\markdownBegin</span> -Hello *world*! -<span class="fu">\markdownEnd</span> -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb10"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb10-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb10-2" data-line-number="2"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb10-3" data-line-number="3">Hello *world*!</a> +<a class="sourceLine" id="cb10-4" data-line-number="4"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb10-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb11"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb11-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">pdftex</span> --shell-escape document.tex</code></pre></div> -<h3 id="using-latex"><span class="header-section-number">1.3.3</span> Using LaTeX</h3> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -Hello *world*! -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb12"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb12-1" data-line-number="1"><span class="ex">pdftex</span> --shell-escape document.tex</a></code></pre></div> +<h3 id="using-latex"><span class="header-section-number">1.3.3</span> Using <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></h3> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb13"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb13-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb13-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb13-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb13-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb13-5" data-line-number="5">Hello *world*!</a> +<a class="sourceLine" id="cb13-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb13-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb14"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb14-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">pdflatex</span> --shell-escape document.tex</code></pre></div> +<div class="sourceCode" id="cb15"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb15-1" data-line-number="1"><span class="ex">pdflatex</span> --shell-escape document.tex</a></code></pre></div> <hr /> <p>As the next step, try typesetting the example documents distributed along with the Markdown package:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="fu">git</span> clone https://github.com/witiko/markdown -<span class="bu">cd</span> markdown/examples -<span class="ex">lualatex</span> latex.tex</code></pre></div> +<div class="sourceCode" id="cb16"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb16-1" data-line-number="1"><span class="fu">git</span> clone https://github.com/witiko/markdown</a> +<a class="sourceLine" id="cb16-2" data-line-number="2"><span class="bu">cd</span> markdown/examples</a> +<a class="sourceLine" id="cb16-3" data-line-number="3"><span class="ex">lualatex</span> latex.tex</a></code></pre></div> <p>A PDF document named <code>latex.pdf</code> should be produced. Open the text documents <code>latex.tex</code> and <code>example.md</code> in a text editor to see how the example documents are structured. Try changing the documents and typesetting them as follows:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> latex.tex</code></pre></div> +<div class="sourceCode" id="cb17"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb17-1" data-line-number="1"><span class="ex">lualatex</span> latex.tex</a></code></pre></div> <p>to see the effect of your changes.</p> -<h3 id="using-context"><span class="header-section-number">1.3.4</span> Using ConTeXt</h3> +<h3 id="using-context"><span class="header-section-number">1.3.4</span> Using Con<span class="tex">T<sub>e</sub>X</span>t</h3> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -Hello *world*! -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb18"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb18-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb18-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb18-3" data-line-number="3"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb18-4" data-line-number="4">Hello *world*!</a> +<a class="sourceLine" id="cb18-5" data-line-number="5"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb18-6" data-line-number="6"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb19"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb19-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texexec</span> --passon=--shell-escape document.tex</code></pre></div> +<div class="sourceCode" id="cb20"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb20-1" data-line-number="1"><span class="ex">texexec</span> --passon=--shell-escape document.tex</a></code></pre></div> <hr /> <p>As the next step, try typesetting the example documents distributed along with the Markdown package:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="fu">git</span> clone https://github.com/witiko/markdown -<span class="bu">cd</span> markdown/examples -<span class="ex">context</span> context.tex</code></pre></div> +<div class="sourceCode" id="cb21"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb21-1" data-line-number="1"><span class="fu">git</span> clone https://github.com/witiko/markdown</a> +<a class="sourceLine" id="cb21-2" data-line-number="2"><span class="bu">cd</span> markdown/examples</a> +<a class="sourceLine" id="cb21-3" data-line-number="3"><span class="ex">context</span> context.tex</a></code></pre></div> <p>A PDF document named <code>context.pdf</code> should be produced. Open the text documents <code>context.tex</code> and <code>example.md</code> in a text editor to see how the example documents are structured. Try changing the documents and typesetting them as follows:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> context.tex</code></pre></div> +<div class="sourceCode" id="cb22"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb22-1" data-line-number="1"><span class="ex">context</span> context.tex</a></code></pre></div> <p>to see the effect of your changes.</p> <h1 id="examples"><span class="header-section-number">2</span> Examples</h1> -<p>This section will show how to use the package by example.</p> -<h2 id="lua"><span class="header-section-number">2.1</span> Lua</h2> -<p>The Lua part of the package makes it possible to convert a markdown document into TeX commands and typeset it later when convenient. Although the typical user will not find this terribly useful and will instead use the plain TeX, LaTeX, and ConTeXt macro packages to convert and typeset the markdown documents in a single step, they will still benefit from learning the options that control the behavior of the Lua parser.</p> -<h3 id="interfaces"><span class="header-section-number">2.1.1</span> Interfaces</h3> -<p>The Lua part of the package exposes two interfaces – the <code>markdown</code> Lua module, and the Lua command-line interface (CLI).</p> -<h4 id="the-lua-module"><span class="header-section-number">2.1.1.1</span> The Lua module</h4> -<p>The <code>markdown</code> Lua module exposes the <code>new(options)</code> method, which creates a converter function from markdown to TeX. The properties of the converter function are specified by the Lua table <code>options</code>. The parameter is optional; when unspecified, the behaviour will be the same as if <code>options</code> were an empty table.</p> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> example -<span class="fu">\bye</span></code></pre></div> +<p>In this section, I will describe the individual parts of the Markdown package. Each part will be shown by example, leaving the implementation details to the <a href="http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf" title="A Markdown Interpreter for <span class="tex">T<sub>e</sub>X</span>">technical documentation</a>.</p> +<h2 id="interfaces"><span class="header-section-number">2.1</span> Interfaces</h2> +<p>In this section, I will describe the individual interfaces exposed by the Markdown package starting with the low-level Lua interfaces and all the way up to the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> and Con<span class="tex">T<sub>e</sub>X</span>t interfaces intended for the ordinary user.</p> +<h3 id="lua"><span class="header-section-number">2.1.1</span> Lua</h3> +<p>The Lua programming language is what drives the conversion from markdown to <span class="tex">T<sub>e</sub>X</span> in the Markdown package. Based on the <a href="https://github.com/jgm/lunamark" title="Lua library for conversion between markup formats">Lunamark</a> Lua library by John MacFarlane, the Lua implementation is largely independent on <span class="tex">T<sub>e</sub>X</span>, and can be used separately from typesetting a document. Lua provides two interfaces: a Lua module and a command-line interface (CLI).</p> +<h4 id="lua-module"><span class="header-section-number">2.1.1.1</span> Lua Module</h4> +<p>A Lua module is a software library that can be used from in other programs. The <code>markdown</code> Lua module makes it possible to convert markdown to <span class="tex">T<sub>e</sub>X</span> from within Lua<span class="tex">T<sub>e</sub>X</span> documents and Lua scripts.</p> +<p>The <code>markdown</code> Lua module exposes the <code>new(</code>⟨<em>options</em>⟩<code>)</code> method, which creates a converter function from markdown to <span class="tex">T<sub>e</sub>X</span>. The properties of the converter function are specified by the Lua table <code>options</code>. The parameter is optional; when unspecified, the behaviour will be the same as if ⟨<em>options</em>⟩ were an empty table.</p> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb23"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb23-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb23-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb23-3" data-line-number="3"><span class="fu">\input</span> example</a> +<a class="sourceLine" id="cb23-4" data-line-number="4"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>example.lua</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode lua"><code class="sourceCode lua"><span class="ot">#</span>!<span class="ot">/</span>usr<span class="ot">/</span>bin<span class="ot">/</span>env texlua -<span class="kw">local</span> kpse <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"kpse"</span><span class="ot">)</span> -kpse<span class="ot">.</span>set_program_name<span class="ot">(</span><span class="st">"luatex"</span><span class="ot">)</span> -<span class="kw">local</span> markdown <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"markdown"</span><span class="ot">)</span> -<span class="kw">local</span> convert_safe <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">()</span> -<span class="kw">local</span> convert_unsafe <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">({</span>hybrid <span class="ot">=</span> <span class="kw">true</span><span class="ot">})</span> -<span class="kw">local</span> input <span class="ot">=</span> <span class="st">[[$\sqrt{-1}$ *equals* $i$.]]</span> -<span class="fu">print</span><span class="ot">(</span>convert_safe<span class="ot">(</span>input<span class="ot">)</span> <span class="ot">..</span> <span class="st">" "</span> <span class="ot">..</span> convert_unsafe<span class="ot">(</span>input<span class="ot">))</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> example.lua <span class="op">></span> example.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “$\sqrt{-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> example.lua <span class="op">></span> example.tex -<span class="ex">pdftex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb24"><pre class="sourceCode lua"><code class="sourceCode lua"><a class="sourceLine" id="cb24-1" data-line-number="1"><span class="ot">#</span>!<span class="ot">/</span>usr<span class="ot">/</span>bin<span class="ot">/</span>env texlua</a> +<a class="sourceLine" id="cb24-2" data-line-number="2"><span class="kw">local</span> kpse <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"kpse"</span><span class="ot">)</span></a> +<a class="sourceLine" id="cb24-3" data-line-number="3">kpse<span class="ot">.</span>set_program_name<span class="ot">(</span><span class="st">"luatex"</span><span class="ot">)</span></a> +<a class="sourceLine" id="cb24-4" data-line-number="4"><span class="kw">local</span> markdown <span class="ot">=</span> <span class="fu">require</span><span class="ot">(</span><span class="st">"markdown"</span><span class="ot">)</span></a> +<a class="sourceLine" id="cb24-5" data-line-number="5"><span class="kw">local</span> input<span class="ot">,</span> convert_safe<span class="ot">,</span> convert_unsafe<span class="ot">,</span> paragraph</a> +<a class="sourceLine" id="cb24-6" data-line-number="6"></a> +<a class="sourceLine" id="cb24-7" data-line-number="7">input <span class="ot">=</span> <span class="st">[[$\sqrt{-1}$ *equals* $i$.]]</span></a> +<a class="sourceLine" id="cb24-8" data-line-number="8">convert_safe <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">()</span></a> +<a class="sourceLine" id="cb24-9" data-line-number="9">convert_unsafe <span class="ot">=</span> markdown<span class="ot">.</span>new<span class="ot">({</span>hybrid <span class="ot">=</span> <span class="kw">true</span><span class="ot">})</span></a> +<a class="sourceLine" id="cb24-10" data-line-number="10">paragraph <span class="ot">=</span> <span class="st">[[\par]]</span></a> +<a class="sourceLine" id="cb24-11" data-line-number="11"></a> +<a class="sourceLine" id="cb24-12" data-line-number="12"><span class="fu">print</span><span class="ot">(</span></a> +<a class="sourceLine" id="cb24-13" data-line-number="13"> convert_safe<span class="ot">(</span>input<span class="ot">)</span> <span class="ot">..</span> paragraph <span class="ot">..</span></a> +<a class="sourceLine" id="cb24-14" data-line-number="14"> convert_unsafe<span class="ot">(</span>input<span class="ot">)</span></a> +<a class="sourceLine" id="cb24-15" data-line-number="15"><span class="ot">)</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb25"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb25-1" data-line-number="1"><span class="ex">texlua</span> example.lua <span class="op">></span> example.tex</a> +<a class="sourceLine" id="cb25-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<p>Invoking pdfTeX should have the same effect:</p> +<div class="sourceCode" id="cb26"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb26-1" data-line-number="1"><span class="ex">texlua</span> example.lua <span class="op">></span> example.tex</a> +<a class="sourceLine" id="cb26-2" data-line-number="2"><span class="ex">pdftex</span> document.tex</a></code></pre></div> <hr /> <p>Rather than use the <code>texlua</code> interpreter, we can also access the <code>markdown</code> Lua module directly from our document. Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert_safe = markdown.new() - local convert_unsafe = markdown.new({hybrid = true}) - local input = [[<span class="ss">$</span><span class="sc">\noexpand\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.]] - tex.sprint(convert_safe(input) .. " " .. convert_unsafe(input)) } -<span class="fu">\bye</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “$\sqrt {-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.” In this case, we cannot use pdfTeX, because pdfTeX does not define the <code>\directlua</code> TeX command.</p> -<h4 id="the-lua-cli"><span class="header-section-number">2.1.1.2</span> The Lua CLI</h4> -<p>The Lua command-line interface (CLI) accepts the same options as the <code>markdown</code> Lua module, but now the options are specified as command-line parameters.</p> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> safe<span class="fu">\ \input</span> unsafe -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb27"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb27-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb27-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb27-3" data-line-number="3"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb27-4" data-line-number="4"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb27-5" data-line-number="5"> local input, convert_safe, convert_unsafe, paragraph</a> +<a class="sourceLine" id="cb27-6" data-line-number="6"></a> +<a class="sourceLine" id="cb27-7" data-line-number="7"> input = [[<span class="ss">$</span><span class="sc">\string\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.]]</a> +<a class="sourceLine" id="cb27-8" data-line-number="8"> convert_safe = markdown.new()</a> +<a class="sourceLine" id="cb27-9" data-line-number="9"> convert_unsafe = markdown.new({hybrid = true})</a> +<a class="sourceLine" id="cb27-10" data-line-number="10"> paragraph = [[<span class="fu">\par</span>]]</a> +<a class="sourceLine" id="cb27-11" data-line-number="11"></a> +<a class="sourceLine" id="cb27-12" data-line-number="12"> tex.sprint(</a> +<a class="sourceLine" id="cb27-13" data-line-number="13"> convert_safe(input) .. paragraph ..</a> +<a class="sourceLine" id="cb27-14" data-line-number="14"> convert_unsafe(input)</a> +<a class="sourceLine" id="cb27-15" data-line-number="15"> )</a> +<a class="sourceLine" id="cb27-16" data-line-number="16">}</a> +<a class="sourceLine" id="cb27-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb28"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb28-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<p>In this case, we cannot use pdfTeX, because pdfTeX does not define the <code>\directlua</code> <span class="tex">T<sub>e</sub>X</span> command.</p> +<h4 id="lua-command-line-interface"><span class="header-section-number">2.1.1.2</span> Lua Command-Line Interface</h4> +<p>The Lua command-line interface (CLI) of the Markdown package makes the functionality of the Lua module accessible from the command line. This makes it possible to convert documents from markdown to <span class="tex">T<sub>e</sub>X</span> manually without any knowledge of the Lua programming language.</p> +<p>The Lua command-line interface accepts the same options as the <code>markdown</code> Lua module, but now the options are specified as command-line parameters.</p> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb29"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb29-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb29-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb29-3" data-line-number="3"><span class="fu">\input</span> safe</a> +<a class="sourceLine" id="cb29-4" data-line-number="4"></a> +<a class="sourceLine" id="cb29-5" data-line-number="5"><span class="fu">\input</span> unsafe</a> +<a class="sourceLine" id="cb29-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>example.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">$\sqrt{-1}$ *equals* $i$.</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- example.md safe.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> hybrid=true -- example.md unsafe.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “$\sqrt{-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.” Invoking pdfTeX should have the same effect:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- example.md safe.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> hybrid=true -- example.md unsafe.tex -<span class="ex">pdftex</span> document.tex</code></pre></div> -<h3 id="options"><span class="header-section-number">2.1.2</span> Options</h3> -<p>This section will cover the options recognized by the Lua interface. The interfaces of the plain TeX, LaTeX, and ConTeXt macro packages recognize these options as well, in addition to their own options.</p> -<h4 id="file-and-directory-names"><span class="header-section-number">2.1.2.1</span> File and Directory Names</h4> -<h5 id="option-cachedir"><span class="header-section-number">2.1.2.1.1</span> Option <code>cacheDir</code></h5> +<div class="sourceCode" id="cb30"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb30-1" data-line-number="1">$\sqrt{-1}$ *equals* $i$.</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb31"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb31-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- example.md safe.tex</a> +<a class="sourceLine" id="cb31-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex</a> +<a class="sourceLine" id="cb31-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<p>Invoking pdfTeX should have the same effect:</p> +<div class="sourceCode" id="cb32"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb32-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- example.md safe.tex</a> +<a class="sourceLine" id="cb32-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ hybrid=true -- example.md unsafe.tex</a> +<a class="sourceLine" id="cb32-3" data-line-number="3"><span class="ex">pdftex</span> document.tex</a></code></pre></div> +<h3 id="plain-tex"><span class="header-section-number">2.1.2</span> Plain <span class="tex">T<sub>e</sub>X</span></h3> +<p>The plain <span class="tex">T<sub>e</sub>X</span> interface provides <span class="tex">T<sub>e</sub>X</span> commands that typeset markdown documents by using the Lua interface behind the scenes. Unlike the Lua interface, the plain TeX interface does not provide low-level tools for converting markdown to <span class="tex">T<sub>e</sub>X</span>. Instead, its goal is to provide high-level typesetting capabilities.</p> +<p>The plain <span class="tex">T<sub>e</sub>X</span> interface accepts the same options as the <code>markdown</code> Lua module, in addition to its own options, but now the options are specified as <span class="tex">T<sub>e</sub>X</span> commands.</p> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb33"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb33-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb33-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb33-3" data-line-number="3"></a> +<a class="sourceLine" id="cb33-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb33-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb33-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb33-7" data-line-number="7"></a> +<a class="sourceLine" id="cb33-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb33-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb33-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb33-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb33-12" data-line-number="12"></a> +<a class="sourceLine" id="cb33-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb34"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb34-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<p>Invoking pdfTeX should have the same effect:</p> +<div class="sourceCode" id="cb35"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb35-1" data-line-number="1"><span class="ex">pdftex</span> --shell-escape document.tex</a></code></pre></div> +<h3 id="latex"><span class="header-section-number">2.1.3</span> <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span></h3> +<p>The <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> interface provides the same level of functionality as the plain <span class="tex">T<sub>e</sub>X</span> interface by using the plain <span class="tex">T<sub>e</sub>X</span> interface behind the scenes. Unlike the plain <span class="tex">T<sub>e</sub>X</span> interface, the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> interface uses familiar <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> idioms, such as package options and environments.</p> +<p>The <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> interface accepts the same options as the plain <span class="tex">T<sub>e</sub>X</span> interface, but now the options are specified as ⟨<em>key</em>⟩<span class="math inline"> = </span>⟨<em>value</em>⟩ pairs and they are passed either as package options, in the <code>\markdownSetup</code> command, or as parameters for the <code>markdown*</code> <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> environment.</p> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb36"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb36-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb36-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb36-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb36-4" data-line-number="4"></a> +<a class="sourceLine" id="cb36-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb36-6" data-line-number="6"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb36-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb36-8" data-line-number="8"></a> +<a class="sourceLine" id="cb36-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid}</a> +<a class="sourceLine" id="cb36-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb36-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb36-12" data-line-number="12"></a> +<a class="sourceLine" id="cb36-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb37"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb37-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<p>Invoking pdfTeX should have the same effect:</p> +<div class="sourceCode" id="cb38"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb38-1" data-line-number="1"><span class="ex">pdflatex</span> --shell-escape document.tex</a></code></pre></div> +<h3 id="context"><span class="header-section-number">2.1.4</span> Con<span class="tex">T<sub>e</sub>X</span>t</h3> +<p>The Con<span class="tex">T<sub>e</sub>X</span>t interface provides the same level of functionality as the plain <span class="tex">T<sub>e</sub>X</span> interface by using the plain <span class="tex">T<sub>e</sub>X</span> interface behind the scenes. Unlike the plain <span class="tex">T<sub>e</sub>X</span> interface, the Con<span class="tex">T<sub>e</sub>X</span>t interface uses familiar Con<span class="tex">T<sub>e</sub>X</span>t idioms, such as environments.</p> +<p>The Con<span class="tex">T<sub>e</sub>X</span>t interface accepts the same options as the plain <span class="tex">T<sub>e</sub>X</span> interface.</p> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb39"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb39-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb39-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb39-3" data-line-number="3"></a> +<a class="sourceLine" id="cb39-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb39-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb39-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb39-7" data-line-number="7"></a> +<a class="sourceLine" id="cb39-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb39-9" data-line-number="9"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb39-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb39-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb39-12" data-line-number="12"></a> +<a class="sourceLine" id="cb39-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb40"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb40-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<p>Invoking pdfTeX should have the same effect:</p> +<div class="sourceCode" id="cb41"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb41-1" data-line-number="1"><span class="ex">texexec</span> --passon=--shell-escape document.tex</a></code></pre></div> +<h2 id="options"><span class="header-section-number">2.2</span> Options</h2> +<p>In this section, I will describe all the options recognized by the Markdown package.</p> +<h3 id="lua-1"><span class="header-section-number">2.2.1</span> Lua</h3> +<p>Lua options control the conversion from markdown to <span class="tex">T<sub>e</sub>X</span>. They are supported by all interfaces of the Markdown package starting with the low-level Lua interfaces and all the way up to the <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> and Con<span class="tex">T<sub>e</sub>X</span>t interfaces.</p> +<h4 id="option-cachedir"><span class="header-section-number">2.2.1.1</span> Option <code>cacheDir</code></h4> <dl> <dt><code>cacheDir</code> (default value: <code>"."</code>)</dt> -<dd><p>A path to the directory containing auxiliary cache files. If the last segment of the path does not exist, it will be created by the Lua command-line and plain TeX implementations. The Lua implementation expects that the entire path already exists.</p> +<dd><p>A path to the directory containing auxiliary cache files. If the last segment of the path does not exist, it will be created by the Lua command-line and plain <span class="tex">T<sub>e</sub>X</span> implementations. The Lua implementation expects that the entire path already exists.</p> <p>When iteratively writing and typesetting a markdown document, the cache files are going to accumulate over time. You are advised to clean the cache directory every now and then, or to set it to a temporary filesystem (such as <code>/tmp</code> on UN*X systems), which gets periodically emptied.</p> </dd> </dl> -<h6 id="lua-module-example" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert = markdown.new({cacheDir = "cache"}) - local input = "Hello *world*!" - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb42"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb42-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb42-2" data-line-number="2"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb42-3" data-line-number="3"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb42-4" data-line-number="4"> local convert = markdown.new({cacheDir = "cache"})</a> +<a class="sourceLine" id="cb42-5" data-line-number="5"> local input = "Hello *world*!"</a> +<a class="sourceLine" id="cb42-6" data-line-number="6"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb42-7" data-line-number="7"><span class="fu">\bye</span></a></code></pre></div> <p>Create an empty directory named <code>cache</code> next to our text document. Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb43"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb43-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” Several cache files of the Markdown package will also be produced in the <code>cache</code> directory as we requested using the <code>cacheDir</code> option.</p> -<h6 id="lua-cli-example" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> hello -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb44"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb44-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb44-2" data-line-number="2"><span class="fu">\input</span> hello</a> +<a class="sourceLine" id="cb44-3" data-line-number="3"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>hello.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Hello *world*!</code></pre></div> +<div class="sourceCode" id="cb45"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb45-1" data-line-number="1">Hello *world*!</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> cacheDir=cache -- hello.md hello.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb46"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb46-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ cacheDir=cache -- hello.md hello.tex</a> +<a class="sourceLine" id="cb46-2" data-line-number="2"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p> -<h6 id="plain-tex-example" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\def</span>\markdownOptionCacheDir{cache} -<span class="fu">\markdownBegin</span> -Hello *world*! -<span class="fu">\markdownEnd</span> -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb47"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb47-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb47-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionCacheDir{cache}</a> +<a class="sourceLine" id="cb47-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb47-4" data-line-number="4">Hello *world*!</a> +<a class="sourceLine" id="cb47-5" data-line-number="5"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb47-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb48"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb48-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p> -<h6 id="latex-example" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[cacheDir=cache]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -Hello *world*! -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb49"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb49-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb49-2" data-line-number="2"><span class="bu">\usepackage</span>[cacheDir=cache]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb49-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb49-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb49-5" data-line-number="5">Hello *world*!</a> +<a class="sourceLine" id="cb49-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb49-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb50"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb50-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p> -<h6 id="context-example" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionCacheDir{cache} -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -Hello *world*! -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb51"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb51-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb51-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionCacheDir{cache}</a> +<a class="sourceLine" id="cb51-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb51-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb51-5" data-line-number="5">Hello *world*!</a> +<a class="sourceLine" id="cb51-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb51-7" data-line-number="7"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb52"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb52-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!” A directory named <code>cache</code> containing several cache files of the Markdown package will also be produced as we requested using the <code>cacheDir</code> option.</p> -<h4 id="parser-options"><span class="header-section-number">2.1.2.2</span> Parser Options</h4> -<h5 id="option-blankbeforeblockquote"><span class="header-section-number">2.1.2.2.1</span> Option <code>blankBeforeBlockquote</code></h5> +<h4 id="option-blankbeforeblockquote"><span class="header-section-number">2.2.1.2</span> Option <code>blankBeforeBlockquote</code></h4> <dl> <dt><code>blankBeforeBlockquote</code> (default value: <code>false</code>)</dt> <dd><dl> @@ -381,27 +492,27 @@ Hello *world*! </dl> </dd> </dl> -<h6 id="lua-module-example-1" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "A paragraph." .. newline .. - "> A quote." .. newline - tex.sprint(convert(input)) - - convert = markdown.new({blankBeforeBlockquote = true}) - input = "A paragraph." .. newline .. - "> Not a quote." .. newline - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-1" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb53"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb53-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb53-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb53-3" data-line-number="3"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb53-4" data-line-number="4"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb53-5" data-line-number="5"> local newline = [[^^J^^J]]</a> +<a class="sourceLine" id="cb53-6" data-line-number="6"> local convert, input</a> +<a class="sourceLine" id="cb53-7" data-line-number="7"></a> +<a class="sourceLine" id="cb53-8" data-line-number="8"> convert = markdown.new()</a> +<a class="sourceLine" id="cb53-9" data-line-number="9"> input = "A paragraph." .. newline ..</a> +<a class="sourceLine" id="cb53-10" data-line-number="10"> "> A quote." .. newline</a> +<a class="sourceLine" id="cb53-11" data-line-number="11"> tex.sprint(convert(input))</a> +<a class="sourceLine" id="cb53-12" data-line-number="12"></a> +<a class="sourceLine" id="cb53-13" data-line-number="13"> convert = markdown.new({blankBeforeBlockquote = true})</a> +<a class="sourceLine" id="cb53-14" data-line-number="14"> input = "A paragraph." .. newline ..</a> +<a class="sourceLine" id="cb53-15" data-line-number="15"> "> Not a quote." .. newline</a> +<a class="sourceLine" id="cb53-16" data-line-number="16"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb53-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb54"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb54-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> @@ -410,21 +521,21 @@ Hello *world*! </blockquote> <p>A paragraph > Not a quote.</p> </blockquote> -<h6 id="lua-cli-example-1" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-1" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb55"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb55-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb55-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb55-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb55-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb55-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">A paragraph. -><span class="dt"> A quote?</span></code></pre></div> +<div class="sourceCode" id="cb56"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb56-1" data-line-number="1">A paragraph.</a> +<a class="sourceLine" id="cb56-2" data-line-number="2">><span class="dt"> A quote?</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> blankBeforeBlockquote=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb57"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb57-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb57-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ blankBeforeBlockquote=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb57-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> @@ -433,24 +544,24 @@ Hello *world*! </blockquote> <p>A paragraph. > A quote?</p> </blockquote> -<h6 id="plain-tex-example-1" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-1" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown - -<span class="fu">\markdownBegin</span> -A paragraph. -> A quote. -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionBlankBeforeBlockquote{true} -<span class="fu">\markdownBegin</span> -A paragraph. -> Not a quote. -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb58"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb58-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb58-2" data-line-number="2"></a> +<a class="sourceLine" id="cb58-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb58-4" data-line-number="4">A paragraph.</a> +<a class="sourceLine" id="cb58-5" data-line-number="5">> A quote.</a> +<a class="sourceLine" id="cb58-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb58-7" data-line-number="7"></a> +<a class="sourceLine" id="cb58-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionBlankBeforeBlockquote{true}</a> +<a class="sourceLine" id="cb58-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb58-10" data-line-number="10">A paragraph.</a> +<a class="sourceLine" id="cb58-11" data-line-number="11">> Not a quote.</a> +<a class="sourceLine" id="cb58-12" data-line-number="12"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb58-13" data-line-number="13"></a> +<a class="sourceLine" id="cb58-14" data-line-number="14"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb59"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb59-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> @@ -459,25 +570,25 @@ A paragraph. </blockquote> <p>A paragraph > Not a quote.</p> </blockquote> -<h6 id="latex-example-1" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-1" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -A paragraph. -> A quote. -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeBlockquote} -A paragraph. -> Not a quote. -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb60"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb60-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb60-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb60-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb60-4" data-line-number="4"></a> +<a class="sourceLine" id="cb60-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb60-6" data-line-number="6">A paragraph.</a> +<a class="sourceLine" id="cb60-7" data-line-number="7">> A quote.</a> +<a class="sourceLine" id="cb60-8" data-line-number="8"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb60-9" data-line-number="9"></a> +<a class="sourceLine" id="cb60-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeBlockquote}</a> +<a class="sourceLine" id="cb60-11" data-line-number="11">A paragraph.</a> +<a class="sourceLine" id="cb60-12" data-line-number="12">> Not a quote.</a> +<a class="sourceLine" id="cb60-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb60-14" data-line-number="14"></a> +<a class="sourceLine" id="cb60-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb61"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb61-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> @@ -486,25 +597,25 @@ A paragraph. </blockquote> <p>A paragraph > Not a quote.</p> </blockquote> -<h6 id="context-example-1" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-1" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -A paragraph. -> A quote. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionBlankBeforeBlockquote{true} -<span class="fu">\startmarkdown</span> -A paragraph. -> Not a quote. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb62"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb62-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb62-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb62-3" data-line-number="3"></a> +<a class="sourceLine" id="cb62-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb62-5" data-line-number="5">A paragraph.</a> +<a class="sourceLine" id="cb62-6" data-line-number="6">> A quote.</a> +<a class="sourceLine" id="cb62-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb62-8" data-line-number="8"></a> +<a class="sourceLine" id="cb62-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionBlankBeforeBlockquote{true}</a> +<a class="sourceLine" id="cb62-10" data-line-number="10"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb62-11" data-line-number="11">A paragraph.</a> +<a class="sourceLine" id="cb62-12" data-line-number="12">> Not a quote.</a> +<a class="sourceLine" id="cb62-13" data-line-number="13"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb62-14" data-line-number="14"></a> +<a class="sourceLine" id="cb62-15" data-line-number="15"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb63"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb63-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> @@ -513,7 +624,7 @@ A paragraph. </blockquote> <p>A paragraph > Not a quote.</p> </blockquote> -<h5 id="option-blankbeforecodefence"><span class="header-section-number">2.1.2.2.2</span> Option <code>blankBeforeCodeFence</code></h5> +<h4 id="option-blankbeforecodefence"><span class="header-section-number">2.2.1.3</span> Option <code>blankBeforeCodeFence</code></h4> <dl> <dt><code>blankBeforeCodeFence</code> (default value: <code>false</code>)</dt> <dd><dl> @@ -526,150 +637,150 @@ A paragraph. </dl> </dd> </dl> -<h6 id="lua-module-example-2" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new({fencedCode = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "A code fence." .. newline .. - "```" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({ - fencedCode = true, blankBeforeCodeFence = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "Not a code fence." .. newline .. - "```" .. newline - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-2" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb64"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb64-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb64-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb64-3" data-line-number="3"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb64-4" data-line-number="4"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb64-5" data-line-number="5"> local newline = [[^^J^^J]]</a> +<a class="sourceLine" id="cb64-6" data-line-number="6"> local convert, input</a> +<a class="sourceLine" id="cb64-7" data-line-number="7"></a> +<a class="sourceLine" id="cb64-8" data-line-number="8"> convert = markdown.new({fencedCode = true})</a> +<a class="sourceLine" id="cb64-9" data-line-number="9"> input = "A paragraph." .. newline ..</a> +<a class="sourceLine" id="cb64-10" data-line-number="10"> "```" .. newline ..</a> +<a class="sourceLine" id="cb64-11" data-line-number="11"> "A code fence." .. newline ..</a> +<a class="sourceLine" id="cb64-12" data-line-number="12"> "```" .. newline</a> +<a class="sourceLine" id="cb64-13" data-line-number="13"> tex.sprint(convert(input))</a> +<a class="sourceLine" id="cb64-14" data-line-number="14"></a> +<a class="sourceLine" id="cb64-15" data-line-number="15"> convert = markdown.new({</a> +<a class="sourceLine" id="cb64-16" data-line-number="16"> fencedCode = true, blankBeforeCodeFence = true})</a> +<a class="sourceLine" id="cb64-17" data-line-number="17"> input = "A paragraph." .. newline ..</a> +<a class="sourceLine" id="cb64-18" data-line-number="18"> "```" .. newline ..</a> +<a class="sourceLine" id="cb64-19" data-line-number="19"> "Not a code fence." .. newline ..</a> +<a class="sourceLine" id="cb64-20" data-line-number="20"> "```" .. newline</a> +<a class="sourceLine" id="cb64-21" data-line-number="21"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb64-22" data-line-number="22"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb65"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb65-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <pre><code>A code fence.</code></pre> <p>A paragraph. <code>Not a code fence.</code></p> </blockquote> -<h6 id="lua-cli-example-2" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-2" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb67"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb67-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb67-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb67-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb67-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb67-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">A paragraph. -``` -A code fence? -```</code></pre></div> +<div class="sourceCode" id="cb68"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb68-1" data-line-number="1">A paragraph.</a> +<a class="sourceLine" id="cb68-2" data-line-number="2">```</a> +<a class="sourceLine" id="cb68-3" data-line-number="3">A code fence?</a> +<a class="sourceLine" id="cb68-4" data-line-number="4">```</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> fencedCode=true -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb69"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb69-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ fencedCode=true -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb69-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb69-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <pre><code>A code fence?</code></pre> <p>A paragraph. <code>A code fence?</code></p> </blockquote> -<h6 id="plain-tex-example-2" class="unnumbered">Plain TeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\def</span>\markdownOptionFencedCode{true} - -<span class="fu">\markdownBegin</span> -A paragraph. -``` -A code fence. -``` -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionBlankBeforeCodeFence{true} -<span class="fu">\markdownBegin</span> -A paragraph. -``` -Not a code fence. -``` -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<h5 id="plain-tex-example-2" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb71"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb71-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb71-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFencedCode{true}</a> +<a class="sourceLine" id="cb71-3" data-line-number="3"></a> +<a class="sourceLine" id="cb71-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb71-5" data-line-number="5">A paragraph.</a> +<a class="sourceLine" id="cb71-6" data-line-number="6">```</a> +<a class="sourceLine" id="cb71-7" data-line-number="7">A code fence.</a> +<a class="sourceLine" id="cb71-8" data-line-number="8">```</a> +<a class="sourceLine" id="cb71-9" data-line-number="9"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb71-10" data-line-number="10"></a> +<a class="sourceLine" id="cb71-11" data-line-number="11"><span class="fu">\def</span>\markdownOptionBlankBeforeCodeFence{true}</a> +<a class="sourceLine" id="cb71-12" data-line-number="12"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb71-13" data-line-number="13">A paragraph.</a> +<a class="sourceLine" id="cb71-14" data-line-number="14">```</a> +<a class="sourceLine" id="cb71-15" data-line-number="15">Not a code fence.</a> +<a class="sourceLine" id="cb71-16" data-line-number="16">```</a> +<a class="sourceLine" id="cb71-17" data-line-number="17"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb71-18" data-line-number="18"></a> +<a class="sourceLine" id="cb71-19" data-line-number="19"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb72"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb72-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <pre><code>A code fence.</code></pre> <p>A paragraph. <code>Not a code fence.</code></p> </blockquote> -<h6 id="latex-example-2" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -A paragraph. -``` -A code fence. -``` -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeCodeFence} -A paragraph. -``` -Not a code fence. -``` -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<h5 id="latex-example-2" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb74"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb74-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb74-2" data-line-number="2"><span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb74-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb74-4" data-line-number="4"></a> +<a class="sourceLine" id="cb74-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb74-6" data-line-number="6">A paragraph.</a> +<a class="sourceLine" id="cb74-7" data-line-number="7">```</a> +<a class="sourceLine" id="cb74-8" data-line-number="8">A code fence.</a> +<a class="sourceLine" id="cb74-9" data-line-number="9">```</a> +<a class="sourceLine" id="cb74-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb74-11" data-line-number="11"></a> +<a class="sourceLine" id="cb74-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeCodeFence}</a> +<a class="sourceLine" id="cb74-13" data-line-number="13">A paragraph.</a> +<a class="sourceLine" id="cb74-14" data-line-number="14">```</a> +<a class="sourceLine" id="cb74-15" data-line-number="15">Not a code fence.</a> +<a class="sourceLine" id="cb74-16" data-line-number="16">```</a> +<a class="sourceLine" id="cb74-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb74-18" data-line-number="18"></a> +<a class="sourceLine" id="cb74-19" data-line-number="19"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb75"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb75-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <pre><code>A code fence.</code></pre> <p>A paragraph. <code>Not a code fence.</code></p> </blockquote> -<h6 id="context-example-2" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionFencedCode{true} -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -A paragraph. -``` -A code fence. -``` -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionBlankBeforeCodeFence{true} -<span class="fu">\startmarkdown</span> -A paragraph. -``` -Not a code fence. -``` -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<h5 id="context-example-2" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb77"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb77-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb77-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFencedCode{true}</a> +<a class="sourceLine" id="cb77-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb77-4" data-line-number="4"></a> +<a class="sourceLine" id="cb77-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb77-6" data-line-number="6">A paragraph.</a> +<a class="sourceLine" id="cb77-7" data-line-number="7">```</a> +<a class="sourceLine" id="cb77-8" data-line-number="8">A code fence.</a> +<a class="sourceLine" id="cb77-9" data-line-number="9">```</a> +<a class="sourceLine" id="cb77-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb77-11" data-line-number="11"></a> +<a class="sourceLine" id="cb77-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionBlankBeforeCodeFence{true}</a> +<a class="sourceLine" id="cb77-13" data-line-number="13"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb77-14" data-line-number="14">A paragraph.</a> +<a class="sourceLine" id="cb77-15" data-line-number="15">```</a> +<a class="sourceLine" id="cb77-16" data-line-number="16">Not a code fence.</a> +<a class="sourceLine" id="cb77-17" data-line-number="17">```</a> +<a class="sourceLine" id="cb77-18" data-line-number="18"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb77-19" data-line-number="19"></a> +<a class="sourceLine" id="cb77-20" data-line-number="20"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb78"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb78-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <pre><code>A code fence.</code></pre> <p>A paragraph. <code>Not a code fence.</code></p> </blockquote> -<h5 id="option-blankbeforeheading"><span class="header-section-number">2.1.2.2.3</span> Option <code>blankBeforeHeading</code></h5> +<h4 id="option-blankbeforeheading"><span class="header-section-number">2.2.1.4</span> Option <code>blankBeforeHeading</code></h4> <dl> <dt><code>blankBeforeHeading</code> (default value: <code>false</code>)</dt> <dd><dl> @@ -682,139 +793,139 @@ Not a code fence. </dl> </dd> </dl> -<h6 id="lua-module-example-3" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bf #1}\par} -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "A paragraph." .. newline .. - "A heading." .. newline .. - "==========" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({blankBeforeHeading = true}) - input = "A paragraph." .. newline .. - "Not a heading." .. newline .. - "==============" .. newline - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-3" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb80"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb80-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb80-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb80-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bf #1}\par}</a> +<a class="sourceLine" id="cb80-4" data-line-number="4"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb80-5" data-line-number="5"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb80-6" data-line-number="6"> local newline = [[^^J^^J]]</a> +<a class="sourceLine" id="cb80-7" data-line-number="7"> local convert, input</a> +<a class="sourceLine" id="cb80-8" data-line-number="8"></a> +<a class="sourceLine" id="cb80-9" data-line-number="9"> convert = markdown.new()</a> +<a class="sourceLine" id="cb80-10" data-line-number="10"> input = "A paragraph." .. newline ..</a> +<a class="sourceLine" id="cb80-11" data-line-number="11"> "A heading." .. newline ..</a> +<a class="sourceLine" id="cb80-12" data-line-number="12"> "==========" .. newline</a> +<a class="sourceLine" id="cb80-13" data-line-number="13"> tex.sprint(convert(input))</a> +<a class="sourceLine" id="cb80-14" data-line-number="14"></a> +<a class="sourceLine" id="cb80-15" data-line-number="15"> convert = markdown.new({blankBeforeHeading = true})</a> +<a class="sourceLine" id="cb80-16" data-line-number="16"> input = "A paragraph." .. newline ..</a> +<a class="sourceLine" id="cb80-17" data-line-number="17"> "Not a heading." .. newline ..</a> +<a class="sourceLine" id="cb80-18" data-line-number="18"> "==============" .. newline</a> +<a class="sourceLine" id="cb80-19" data-line-number="19"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb80-20" data-line-number="20"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb81"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb81-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <h1 id="a-heading.">A heading.</h1> <p>A paragraph. Not a heading. ==============</p> </blockquote> -<h6 id="lua-cli-example-3" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-3" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb82"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb82-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb82-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb82-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb82-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb82-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">A paragraph. -A heading? -==========</code></pre></div> +<div class="sourceCode" id="cb83"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb83-1" data-line-number="1">A paragraph.</a> +<a class="sourceLine" id="cb83-2" data-line-number="2">A heading?</a> +<a class="sourceLine" id="cb83-3" data-line-number="3">==========</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> blankBeforeHeading=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb84"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb84-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb84-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ blankBeforeHeading=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb84-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <h1 id="a-heading">A heading?</h1> <p>A paragraph. A heading? ==========</p> </blockquote> -<h6 id="plain-tex-example-3" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-3" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown - -<span class="fu">\markdownBegin</span> -A paragraph. -A heading. -========== -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionBlankBeforeHeading{true} -<span class="fu">\markdownBegin</span> -A paragraph. -Not a heading. -============== -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb85"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb85-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb85-2" data-line-number="2"></a> +<a class="sourceLine" id="cb85-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb85-4" data-line-number="4">A paragraph.</a> +<a class="sourceLine" id="cb85-5" data-line-number="5">A heading.</a> +<a class="sourceLine" id="cb85-6" data-line-number="6">==========</a> +<a class="sourceLine" id="cb85-7" data-line-number="7"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb85-8" data-line-number="8"></a> +<a class="sourceLine" id="cb85-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionBlankBeforeHeading{true}</a> +<a class="sourceLine" id="cb85-10" data-line-number="10"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb85-11" data-line-number="11">A paragraph.</a> +<a class="sourceLine" id="cb85-12" data-line-number="12">Not a heading.</a> +<a class="sourceLine" id="cb85-13" data-line-number="13">==============</a> +<a class="sourceLine" id="cb85-14" data-line-number="14"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb85-15" data-line-number="15"></a> +<a class="sourceLine" id="cb85-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb86"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb86-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <h1 id="a-heading.-1">A heading.</h1> <p>A paragraph. Not a heading. ==============</p> </blockquote> -<h6 id="latex-example-3" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -A paragraph. -A heading. -========== -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeHeading} -A paragraph. -Not a heading. -============== -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<h5 id="latex-example-3" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb87"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb87-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb87-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb87-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb87-4" data-line-number="4"></a> +<a class="sourceLine" id="cb87-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb87-6" data-line-number="6">A paragraph.</a> +<a class="sourceLine" id="cb87-7" data-line-number="7">A heading.</a> +<a class="sourceLine" id="cb87-8" data-line-number="8">==========</a> +<a class="sourceLine" id="cb87-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb87-10" data-line-number="10"></a> +<a class="sourceLine" id="cb87-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{blankBeforeHeading}</a> +<a class="sourceLine" id="cb87-12" data-line-number="12">A paragraph.</a> +<a class="sourceLine" id="cb87-13" data-line-number="13">Not a heading.</a> +<a class="sourceLine" id="cb87-14" data-line-number="14">==============</a> +<a class="sourceLine" id="cb87-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb87-16" data-line-number="16"></a> +<a class="sourceLine" id="cb87-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb88"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb88-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <h1 id="a-heading.-2">A heading.</h1> <p>A paragraph. Not a heading. ==============</p> </blockquote> -<h6 id="context-example-3" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -A paragraph. -A heading. -========== -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionBlankBeforeHeading{true} -<span class="fu">\startmarkdown</span> -A paragraph. -Not a heading. -============== -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<h5 id="context-example-3" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb89"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb89-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb89-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb89-3" data-line-number="3"></a> +<a class="sourceLine" id="cb89-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb89-5" data-line-number="5">A paragraph.</a> +<a class="sourceLine" id="cb89-6" data-line-number="6">A heading.</a> +<a class="sourceLine" id="cb89-7" data-line-number="7">==========</a> +<a class="sourceLine" id="cb89-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb89-9" data-line-number="9"></a> +<a class="sourceLine" id="cb89-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionBlankBeforeHeading{true}</a> +<a class="sourceLine" id="cb89-11" data-line-number="11"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb89-12" data-line-number="12">A paragraph.</a> +<a class="sourceLine" id="cb89-13" data-line-number="13">Not a heading.</a> +<a class="sourceLine" id="cb89-14" data-line-number="14">==============</a> +<a class="sourceLine" id="cb89-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb89-16" data-line-number="16"></a> +<a class="sourceLine" id="cb89-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb90"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb90-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>A paragraph.</p> <h1 id="a-heading.-3">A heading.</h1> <p>A paragraph. Not a heading. ==============</p> </blockquote> -<h5 id="option-breakableblockquotes"><span class="header-section-number">2.1.2.2.4</span> Option <code>breakableBlockquotes</code></h5> +<h4 id="option-breakableblockquotes"><span class="header-section-number">2.2.1.5</span> Option <code>breakableBlockquotes</code></h4> <dl> <dt><code>breakableBlockquotes</code> (default value: <code>false</code>)</dt> <dd><dl> @@ -827,28 +938,28 @@ Not a heading. </dl> </dd> </dl> -<h6 id="lua-module-example-4" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bf #1}\par} -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "> A single" .. newline .. newline .. - "> block quote." .. newline - tex.sprint(convert(input)) - - convert = markdown.new({breakableBlockquotes = true}) - input = "> A block quote." .. newline .. newline .. - "> Another block quote." .. newline - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-4" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb91"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb91-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb91-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb91-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bf #1}\par}</a> +<a class="sourceLine" id="cb91-4" data-line-number="4"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb91-5" data-line-number="5"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb91-6" data-line-number="6"> local newline = [[^^J^^J]]</a> +<a class="sourceLine" id="cb91-7" data-line-number="7"> local convert, input</a> +<a class="sourceLine" id="cb91-8" data-line-number="8"></a> +<a class="sourceLine" id="cb91-9" data-line-number="9"> convert = markdown.new()</a> +<a class="sourceLine" id="cb91-10" data-line-number="10"> input = "> A single" .. newline .. newline ..</a> +<a class="sourceLine" id="cb91-11" data-line-number="11"> "> block quote." .. newline</a> +<a class="sourceLine" id="cb91-12" data-line-number="12"> tex.sprint(convert(input))</a> +<a class="sourceLine" id="cb91-13" data-line-number="13"></a> +<a class="sourceLine" id="cb91-14" data-line-number="14"> convert = markdown.new({breakableBlockquotes = true})</a> +<a class="sourceLine" id="cb91-15" data-line-number="15"> input = "> A block quote." .. newline .. newline ..</a> +<a class="sourceLine" id="cb91-16" data-line-number="16"> "> Another block quote." .. newline</a> +<a class="sourceLine" id="cb91-17" data-line-number="17"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb91-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb92"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb92-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <blockquote> @@ -861,22 +972,22 @@ Not a heading. <p>Another block quote.</p> </blockquote> </blockquote> -<h6 id="lua-cli-example-4" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-4" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb93"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb93-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb93-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb93-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb93-4" data-line-number="4"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb93-5" data-line-number="5"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">><span class="dt"> A single block quote</span> - -<span class="dt">> or two block quotes?</span></code></pre></div> +<div class="sourceCode" id="cb94"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb94-1" data-line-number="1">><span class="dt"> A single block quote</span></a> +<a class="sourceLine" id="cb94-2" data-line-number="2"></a> +<a class="sourceLine" id="cb94-3" data-line-number="3">><span class="dt"> or two block quotes?</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> breakableBlockquotes=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb95"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb95-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb95-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ breakableBlockquotes=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb95-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <blockquote> @@ -889,26 +1000,26 @@ Not a heading. <p>or two block quotes?</p> </blockquote> </blockquote> -<h6 id="plain-tex-example-4" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-4" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown - -<span class="fu">\markdownBegin</span> -> A single - -> block quote. -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionBreakableBlockquotes{true} -<span class="fu">\markdownBegin</span> -> A block quote. - -> Another block quote. -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb96"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb96-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb96-2" data-line-number="2"></a> +<a class="sourceLine" id="cb96-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb96-4" data-line-number="4">> A single</a> +<a class="sourceLine" id="cb96-5" data-line-number="5"></a> +<a class="sourceLine" id="cb96-6" data-line-number="6">> block quote.</a> +<a class="sourceLine" id="cb96-7" data-line-number="7"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb96-8" data-line-number="8"></a> +<a class="sourceLine" id="cb96-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionBreakableBlockquotes{true}</a> +<a class="sourceLine" id="cb96-10" data-line-number="10"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb96-11" data-line-number="11">> A block quote.</a> +<a class="sourceLine" id="cb96-12" data-line-number="12"></a> +<a class="sourceLine" id="cb96-13" data-line-number="13">> Another block quote.</a> +<a class="sourceLine" id="cb96-14" data-line-number="14"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb96-15" data-line-number="15"></a> +<a class="sourceLine" id="cb96-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb97"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb97-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <blockquote> @@ -921,27 +1032,27 @@ Not a heading. <p>Another block quote.</p> </blockquote> </blockquote> -<h6 id="latex-example-4" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-4" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -> A single - -> block quote. -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{breakableBlockquotes} -> A block quote. - -> Another block quote. -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb98"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb98-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb98-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb98-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb98-4" data-line-number="4"></a> +<a class="sourceLine" id="cb98-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb98-6" data-line-number="6">> A single</a> +<a class="sourceLine" id="cb98-7" data-line-number="7"></a> +<a class="sourceLine" id="cb98-8" data-line-number="8">> block quote.</a> +<a class="sourceLine" id="cb98-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb98-10" data-line-number="10"></a> +<a class="sourceLine" id="cb98-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{breakableBlockquotes}</a> +<a class="sourceLine" id="cb98-12" data-line-number="12">> A block quote.</a> +<a class="sourceLine" id="cb98-13" data-line-number="13"></a> +<a class="sourceLine" id="cb98-14" data-line-number="14">> Another block quote.</a> +<a class="sourceLine" id="cb98-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb98-16" data-line-number="16"></a> +<a class="sourceLine" id="cb98-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb99"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb99-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <blockquote> @@ -954,27 +1065,27 @@ Not a heading. <p>Another block quote.</p> </blockquote> </blockquote> -<h6 id="context-example-4" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-4" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -> A single - -> block quote. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionBreakableBlockquotes{true} -<span class="fu">\startmarkdown</span> -> A block quote. - -> Another block quote. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb100"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb100-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb100-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb100-3" data-line-number="3"></a> +<a class="sourceLine" id="cb100-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb100-5" data-line-number="5">> A single</a> +<a class="sourceLine" id="cb100-6" data-line-number="6"></a> +<a class="sourceLine" id="cb100-7" data-line-number="7">> block quote.</a> +<a class="sourceLine" id="cb100-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb100-9" data-line-number="9"></a> +<a class="sourceLine" id="cb100-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionBreakableBlockquotes{true}</a> +<a class="sourceLine" id="cb100-11" data-line-number="11"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb100-12" data-line-number="12">> A block quote.</a> +<a class="sourceLine" id="cb100-13" data-line-number="13"></a> +<a class="sourceLine" id="cb100-14" data-line-number="14">> Another block quote.</a> +<a class="sourceLine" id="cb100-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb100-16" data-line-number="16"></a> +<a class="sourceLine" id="cb100-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb101"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb101-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <blockquote> @@ -987,7 +1098,7 @@ Not a heading. <p>Another block quote.</p> </blockquote> </blockquote> -<h5 id="option-citationnbsps"><span class="header-section-number">2.1.2.2.5</span> Option <code>citationNbsps</code></h5> +<h4 id="option-citationnbsps"><span class="header-section-number">2.2.1.6</span> Option <code>citationNbsps</code></h4> <dl> <dt><code>citationNbsps</code> (default value: <code>true</code>)</dt> <dd><dl> @@ -1000,60 +1111,61 @@ Not a heading. </dl> </dd> </dl> -<h6 id="latex-example-5" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-5" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.bib</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode bib"><code class="sourceCode bibtex"><span class="va">@book</span>{<span class="ot">knuth:tex</span>, - <span class="dt">author</span> = "<span class="st">Knuth, Donald Ervin</span>", - <span class="dt">title</span> = "<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>", - <span class="dt">publisher</span> = "<span class="st">Addison-Wesley</span>", - <span class="dt">year</span> = "<span class="st">1984</span>" }</code></pre></div> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -The TeXbook [@knuth:tex, p. 123 and 130] is good. -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{citationNbsps = false} -The TeXbook [@knuth:tex, p. 123 and 130] is good. -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="bu">\bibliographystyle</span>{<span class="ex">plain</span>} -<span class="bu">\bibliography</span>{<span class="ex">document.bib</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb102"><pre class="sourceCode bib"><code class="sourceCode bibtex"><a class="sourceLine" id="cb102-1" data-line-number="1"><span class="va">@book</span>{<span class="ot">knuth:tex</span>,</a> +<a class="sourceLine" id="cb102-2" data-line-number="2"> <span class="dt">author</span> = "<span class="st">Knuth, Donald Ervin</span>",</a> +<a class="sourceLine" id="cb102-3" data-line-number="3"> <span class="dt">title</span> = "<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>",</a> +<a class="sourceLine" id="cb102-4" data-line-number="4"> <span class="dt">publisher</span> = "<span class="st">Addison-Wesley</span>",</a> +<a class="sourceLine" id="cb102-5" data-line-number="5"> <span class="dt">year</span> = "<span class="st">1984</span>"</a> +<a class="sourceLine" id="cb102-6" data-line-number="6">}</a></code></pre></div> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb103"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb103-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb103-2" data-line-number="2"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb103-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb103-4" data-line-number="4"></a> +<a class="sourceLine" id="cb103-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb103-6" data-line-number="6">The TeXbook [@knuth:tex, p. 123 and 130] is good.</a> +<a class="sourceLine" id="cb103-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb103-8" data-line-number="8"></a> +<a class="sourceLine" id="cb103-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{citationNbsps = false}</a> +<a class="sourceLine" id="cb103-10" data-line-number="10">The TeXbook [@knuth:tex, p. 123 and 130] is good.</a> +<a class="sourceLine" id="cb103-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb103-12" data-line-number="12"></a> +<a class="sourceLine" id="cb103-13" data-line-number="13"><span class="bu">\bibliographystyle</span>{<span class="ex">plain</span>}</a> +<a class="sourceLine" id="cb103-14" data-line-number="14"><span class="bu">\bibliography</span>{<span class="ex">document.bib</span>}</a> +<a class="sourceLine" id="cb103-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX and BibTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex -<span class="ex">bibtex</span> document.aux -<span class="ex">lualatex</span> document.tex -<span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb104"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb104-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a> +<a class="sourceLine" id="cb104-2" data-line-number="2"><span class="ex">bibtex</span> document.aux</a> +<a class="sourceLine" id="cb104-3" data-line-number="3"><span class="ex">lualatex</span> document.tex</a> +<a class="sourceLine" id="cb104-4" data-line-number="4"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p> <blockquote> <p>The TeXbook [1, p.·123·and·130] is good.</p> -<p>The TeXbook [1, p. 123 and 130] is good.</p> +<p>The TeXbook [1, p. 123 and 130] is good.</p> <h3 id="references">References</h3> <p>[1] Donald·Ervin Knuth. <em>The TeXbook, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p> </blockquote> -<h5 id="option-citations"><span class="header-section-number">2.1.2.2.6</span> Option <code>citations</code></h5> +<h4 id="option-citations"><span class="header-section-number">2.2.1.7</span> Option <code>citations</code></h4> <dl> <dt><code>citations</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the pandoc citation syntax extension:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Here is a simple parenthetical citation [@doe99] and here -is a string of several [see @doe99, pp. 33-35; also -@smith04, chap. 1]. - -A parenthetical citation can have a [prenote @doe99] and -a [@smith04 postnote]. The name of the author can be -suppressed by inserting a dash before the name of an -author as follows [-@smith04]. - -Here is a simple text citation @doe99 and here is -a string of several @doe99 [pp. 33-35; also @smith04, -chap. 1]. Here is one with the name of the author -suppressed -@doe99.</code></pre></div> +<div class="sourceCode" id="cb105"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb105-1" data-line-number="1">Here is a simple parenthetical citation [@doe99] and here</a> +<a class="sourceLine" id="cb105-2" data-line-number="2">is a string of several [see @doe99, pp. 33-35; also</a> +<a class="sourceLine" id="cb105-3" data-line-number="3">@smith04, chap. 1].</a> +<a class="sourceLine" id="cb105-4" data-line-number="4"></a> +<a class="sourceLine" id="cb105-5" data-line-number="5">A parenthetical citation can have a [prenote @doe99] and</a> +<a class="sourceLine" id="cb105-6" data-line-number="6">a [@smith04 postnote]. The name of the author can be</a> +<a class="sourceLine" id="cb105-7" data-line-number="7">suppressed by inserting a dash before the name of an</a> +<a class="sourceLine" id="cb105-8" data-line-number="8">author as follows [-@smith04].</a> +<a class="sourceLine" id="cb105-9" data-line-number="9"></a> +<a class="sourceLine" id="cb105-10" data-line-number="10">Here is a simple text citation @doe99 and here is</a> +<a class="sourceLine" id="cb105-11" data-line-number="11">a string of several @doe99 [pp. 33-35; also @smith04,</a> +<a class="sourceLine" id="cb105-12" data-line-number="12">chap. 1]. Here is one with the name of the author</a> +<a class="sourceLine" id="cb105-13" data-line-number="13">suppressed -@doe99.</a></code></pre></div> </dd> </dl> </dd> @@ -1064,45 +1176,46 @@ suppressed -@doe99.</code></pre></div> </dl> </dd> </dl> -<h6 id="latex-example-6" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-6" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.bib</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode bib"><code class="sourceCode bibtex"><span class="va">@book</span>{<span class="ot">knuth:tex</span>, - <span class="dt">author</span> = "<span class="st">Knuth, Donald Ervin</span>", - <span class="dt">title</span> = "<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>", - <span class="dt">publisher</span> = "<span class="st">Addison-Wesley</span>", - <span class="dt">year</span> = "<span class="st">1984</span>" }</code></pre></div> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[backend=biber]{<span class="ex">biblatex</span>} -<span class="fu">\addbibresource</span>{document.bib} -<span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex. -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="fu">\printbibliography</span> -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb106"><pre class="sourceCode bib"><code class="sourceCode bibtex"><a class="sourceLine" id="cb106-1" data-line-number="1"><span class="va">@book</span>{<span class="ot">knuth:tex</span>,</a> +<a class="sourceLine" id="cb106-2" data-line-number="2"> <span class="dt">author</span> = "<span class="st">Knuth, Donald Ervin</span>",</a> +<a class="sourceLine" id="cb106-3" data-line-number="3"> <span class="dt">title</span> = "<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>",</a> +<a class="sourceLine" id="cb106-4" data-line-number="4"> <span class="dt">publisher</span> = "<span class="st">Addison-Wesley</span>",</a> +<a class="sourceLine" id="cb106-5" data-line-number="5"> <span class="dt">year</span> = "<span class="st">1984</span>"</a> +<a class="sourceLine" id="cb106-6" data-line-number="6">}</a></code></pre></div> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb107"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb107-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb107-2" data-line-number="2"><span class="bu">\usepackage</span>[backend=biber]{<span class="ex">biblatex</span>}</a> +<a class="sourceLine" id="cb107-3" data-line-number="3"><span class="fu">\addbibresource</span>{document.bib}</a> +<a class="sourceLine" id="cb107-4" data-line-number="4"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb107-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb107-6" data-line-number="6"></a> +<a class="sourceLine" id="cb107-7" data-line-number="7"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb107-8" data-line-number="8">The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex.</a> +<a class="sourceLine" id="cb107-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb107-10" data-line-number="10"></a> +<a class="sourceLine" id="cb107-11" data-line-number="11"><span class="fu">\printbibliography</span></a> +<a class="sourceLine" id="cb107-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX and Biber from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex -<span class="ex">biber</span> document.bcf -<span class="ex">lualatex</span> document.tex -<span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb108"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb108-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a> +<a class="sourceLine" id="cb108-2" data-line-number="2"><span class="ex">biber</span> document.bcf</a> +<a class="sourceLine" id="cb108-3" data-line-number="3"><span class="ex">lualatex</span> document.tex</a> +<a class="sourceLine" id="cb108-4" data-line-number="4"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>The TeXbook [1, p.·123 and 130] was written by Knuth [1].</p> <h3 id="references-1">References</h3> -<p>[1] Donald Ervin Knuth. <em>The TeXbook, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p> +<p>[1] Donald Ervin Knuth. <em>The <span class="tex">T<sub>e</sub>X</span>book, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p> </blockquote> -<h5 id="option-codespans"><span class="header-section-number">2.1.2.2.7</span> Option <code>codeSpans</code></h5> +<h4 id="option-codespans"><span class="header-section-number">2.2.1.8</span> Option <code>codeSpans</code></h4> <dl> <dt><code>codeSpans</code> (default value: <code>true</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the code span syntax:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Use the <span class="bn">`printf()`</span> function. -`<span class="bn">`There is a literal backtick (`</span>) here.``</code></pre></div> +<div class="sourceCode" id="cb109"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb109-1" data-line-number="1">Use the <span class="bn">`printf()`</span> function.</a> +<a class="sourceLine" id="cb109-2" data-line-number="2">`<span class="bn">`There is a literal backtick (`</span>) here.``</a></code></pre></div> </dd> </dl> </dd> @@ -1114,136 +1227,136 @@ The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex. </dl> </dd> </dl> -<h6 id="lua-module-example-5" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert = markdown.new() - local input = - "``This is a code span.'' " .. - "``This is no longer a code span.''" - tex.sprint(convert(input)) } -<span class="fu">\par</span> -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert = markdown.new({codeSpans = false}) - local input = - "``This is a quote.'' " .. - "``This is another quote.''" - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-5" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb111"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb111-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb111-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb111-3" data-line-number="3"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb111-4" data-line-number="4"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb111-5" data-line-number="5"> local convert = markdown.new()</a> +<a class="sourceLine" id="cb111-6" data-line-number="6"> local input =</a> +<a class="sourceLine" id="cb111-7" data-line-number="7"> "``This is a code span.'' " ..</a> +<a class="sourceLine" id="cb111-8" data-line-number="8"> "``This is no longer a code span.''"</a> +<a class="sourceLine" id="cb111-9" data-line-number="9"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb111-10" data-line-number="10"><span class="fu">\par</span></a> +<a class="sourceLine" id="cb111-11" data-line-number="11"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb111-12" data-line-number="12"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb111-13" data-line-number="13"> local convert = markdown.new({codeSpans = false})</a> +<a class="sourceLine" id="cb111-14" data-line-number="14"> local input =</a> +<a class="sourceLine" id="cb111-15" data-line-number="15"> "``This is a quote.'' " ..</a> +<a class="sourceLine" id="cb111-16" data-line-number="16"> "``This is another quote.''"</a> +<a class="sourceLine" id="cb111-17" data-line-number="17"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb111-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb112"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb112-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p><code>This is a code span.''</code>This is no longer a code span.''</p> +<p><code>This is a code span.''</code>This is no longer a code span.’’</p> <p>“This is a quote.” “This is another quote.”</p> </blockquote> -<h6 id="lua-cli-example-5" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-5" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\par</span> -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb113"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb113-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb113-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb113-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb113-4" data-line-number="4"><span class="fu">\par</span></a> +<a class="sourceLine" id="cb113-5" data-line-number="5"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb113-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">`<span class="bn">`Is this a code span?'' `</span>`Or a quote?''</code></pre></div> +<div class="sourceCode" id="cb114"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb114-1" data-line-number="1">`<span class="bn">`Is this a code span?'' `</span>`Or a quote?''</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> codeSpans=false -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb115"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb115-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ codeSpans=false -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb115-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb115-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>“Is this a code span?” “Or a quote?”</p> -<p><code>Is this a code span?''</code>Or a quote?''</p> +<p><code>Is this a code span?''</code>Or a quote?’’</p> </blockquote> -<h6 id="plain-tex-example-5" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-5" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown - -<span class="fu">\markdownBegin</span> -``This is a code span.'' -``This is no longer a code span.'' -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionCodeSpans{false} -<span class="fu">\markdownBegin</span> -``This is a quote.'' -``This is another quote.'' -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb116"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb116-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb116-2" data-line-number="2"></a> +<a class="sourceLine" id="cb116-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb116-4" data-line-number="4">``This is a code span.''</a> +<a class="sourceLine" id="cb116-5" data-line-number="5">``This is no longer a code span.''</a> +<a class="sourceLine" id="cb116-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb116-7" data-line-number="7"></a> +<a class="sourceLine" id="cb116-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionCodeSpans{false}</a> +<a class="sourceLine" id="cb116-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb116-10" data-line-number="10">``This is a quote.''</a> +<a class="sourceLine" id="cb116-11" data-line-number="11">``This is another quote.''</a> +<a class="sourceLine" id="cb116-12" data-line-number="12"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb116-13" data-line-number="13"></a> +<a class="sourceLine" id="cb116-14" data-line-number="14"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb117"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb117-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p><code>This is a code span.''</code>This is no longer a code span.''</p> +<p><code>This is a code span.''</code>This is no longer a code span.’’</p> <p>“This is a quote.” “This is another quote.”</p> </blockquote> -<h6 id="latex-example-7" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-7" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -``This is a code span.'' -``This is no longer a code span.'' -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{codeSpans=false} -``This is a quote.'' -``This is another quote.'' -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb118"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb118-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb118-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb118-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb118-4" data-line-number="4"></a> +<a class="sourceLine" id="cb118-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb118-6" data-line-number="6">``This is a code span.''</a> +<a class="sourceLine" id="cb118-7" data-line-number="7">``This is no longer a code span.''</a> +<a class="sourceLine" id="cb118-8" data-line-number="8"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb118-9" data-line-number="9"></a> +<a class="sourceLine" id="cb118-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{codeSpans=false}</a> +<a class="sourceLine" id="cb118-11" data-line-number="11">``This is a quote.''</a> +<a class="sourceLine" id="cb118-12" data-line-number="12">``This is another quote.''</a> +<a class="sourceLine" id="cb118-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb118-14" data-line-number="14"></a> +<a class="sourceLine" id="cb118-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb119"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb119-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p><code>This is a code span.''</code>This is no longer a code span.''</p> +<p><code>This is a code span.''</code>This is no longer a code span.’’</p> <p>“This is a quote.” “This is another quote.”</p> </blockquote> -<h6 id="context-example-5" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-5" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -``This is a code span.'' -``This is no longer a code span.'' -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionCodeSpans{false} -<span class="fu">\startmarkdown</span> -``This is a quote.'' -``This is another quote.'' -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb120"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb120-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb120-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb120-3" data-line-number="3"></a> +<a class="sourceLine" id="cb120-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb120-5" data-line-number="5">``This is a code span.''</a> +<a class="sourceLine" id="cb120-6" data-line-number="6">``This is no longer a code span.''</a> +<a class="sourceLine" id="cb120-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb120-8" data-line-number="8"></a> +<a class="sourceLine" id="cb120-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionCodeSpans{false}</a> +<a class="sourceLine" id="cb120-10" data-line-number="10"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb120-11" data-line-number="11">``This is a quote.''</a> +<a class="sourceLine" id="cb120-12" data-line-number="12">``This is another quote.''</a> +<a class="sourceLine" id="cb120-13" data-line-number="13"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb120-14" data-line-number="14"></a> +<a class="sourceLine" id="cb120-15" data-line-number="15"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb121"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb121-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p><code>This is a code span.''</code>This is no longer a code span.''</p> +<p><code>This is a code span.''</code>This is no longer a code span.’’</p> <p>“This is a quote.” “This is another quote.”</p> </blockquote> -<h5 id="option-contentblocks"><span class="header-section-number">2.1.2.2.8</span> Option <code>contentBlocks</code></h5> +<h4 id="option-contentblocks"><span class="header-section-number">2.2.1.9</span> Option <code>contentBlocks</code></h4> <dl> <dt><code>contentBlocks</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the iA Writer content blocks syntax extension:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">http://example.com/minard.jpg (Napoleon's - disastrous Russian campaign of 1812) -/Flowchart.png "Engineering Flowchart" -/Savings Account.csv 'Recent Transactions' -/Example.swift -/Lorem Ipsum.txt</code></pre></div> +<div class="sourceCode" id="cb122"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb122-1" data-line-number="1">http://example.com/minard.jpg (Napoleon's</a> +<a class="sourceLine" id="cb122-2" data-line-number="2"> disastrous Russian campaign of 1812)</a> +<a class="sourceLine" id="cb122-3" data-line-number="3">/Flowchart.png "Engineering Flowchart"</a> +<a class="sourceLine" id="cb122-4" data-line-number="4">/Savings Account.csv 'Recent Transactions'</a> +<a class="sourceLine" id="cb122-5" data-line-number="5">/Example.swift</a> +<a class="sourceLine" id="cb122-6" data-line-number="6">/Lorem Ipsum.txt</a></code></pre></div> </dd> </dl> </dd> @@ -1254,33 +1367,33 @@ The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex. </dl> </dd> </dl> -<h6 id="latex-example-8" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-8" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p> <pre class="csv"><code>Name,Surname,Born Albert,Einstein,1879 Marie,Curie,1867 Thomas,Edison,1847</code></pre> <p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode js"><code class="sourceCode javascript"><span class="op">{</span> - <span class="st">"tex"</span><span class="op">:</span> <span class="st">"LaTeX"</span> -<span class="op">}</span></code></pre></div> +<div class="sourceCode" id="cb124"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb124-1" data-line-number="1"><span class="op">{</span></a> +<a class="sourceLine" id="cb124-2" data-line-number="2"> <span class="st">"tex"</span><span class="op">:</span> <span class="st">"LaTeX"</span></a> +<a class="sourceLine" id="cb124-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> <p>Create also a text document named <code>code.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\LaTeX</span>.</code></pre></div> +<div class="sourceCode" id="cb125"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb125-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div> <p>Create also a text document named <code>part.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">This is a *transcluded markdown document*.</code></pre></div> +<div class="sourceCode" id="cb126"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb126-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div> <p>Create also a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">minted</span>} -<span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb127"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb127-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb127-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">minted</span>}</a> +<a class="sourceLine" id="cb127-3" data-line-number="3"><span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb127-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb127-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb127-6" data-line-number="6">/table.csv (An example table)</a> +<a class="sourceLine" id="cb127-7" data-line-number="7">/code.tex (An example code listing)</a> +<a class="sourceLine" id="cb127-8" data-line-number="8">/part.md (A file transclusion example)</a> +<a class="sourceLine" id="cb127-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb127-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> --shell-escape document.tex</code></pre></div> +<div class="sourceCode" id="cb128"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb128-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <table> @@ -1310,37 +1423,37 @@ Thomas,Edison,1847</code></pre> </tbody> </table> <p>Table 1: An example table</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\LaTeX</span>.</code></pre></div> +<div class="sourceCode" id="cb129"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb129-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div> <p>This is a <em>transcluded markdown document</em>.</p> </blockquote> -<h6 id="context-example-6" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-6" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p> <pre class="csv"><code>Name,Surname,Born Albert,Einstein,1879 Marie,Curie,1867 Thomas,Edison,1847</code></pre> <p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode js"><code class="sourceCode javascript"><span class="op">{</span> - <span class="st">"tex"</span><span class="op">:</span> <span class="st">"ConTeXt"</span> -<span class="op">}</span></code></pre></div> +<div class="sourceCode" id="cb131"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb131-1" data-line-number="1"><span class="op">{</span></a> +<a class="sourceLine" id="cb131-2" data-line-number="2"> <span class="st">"tex"</span><span class="op">:</span> <span class="st">"ConTeXt"</span></a> +<a class="sourceLine" id="cb131-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> <p>Create also a text document named <code>code.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\ConTeXt</span>.</code></pre></div> +<div class="sourceCode" id="cb132"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb132-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div> <p>Create also a text document named <code>part.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">This is a *transcluded markdown document*.</code></pre></div> +<div class="sourceCode" id="cb133"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb133-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div> <p>Create also a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionContentBlocks{true} -<span class="fu">\definetyping</span> [ConTeXt] -<span class="fu">\setuptyping</span> [ConTeXt] [option=TEX] -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb134"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb134-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb134-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a> +<a class="sourceLine" id="cb134-3" data-line-number="3"><span class="fu">\definetyping</span> [ConTeXt]</a> +<a class="sourceLine" id="cb134-4" data-line-number="4"><span class="fu">\setuptyping</span> [ConTeXt] [option=TEX]</a> +<a class="sourceLine" id="cb134-5" data-line-number="5"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb134-6" data-line-number="6"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb134-7" data-line-number="7">/table.csv (An example table)</a> +<a class="sourceLine" id="cb134-8" data-line-number="8">/code.tex (An example code listing)</a> +<a class="sourceLine" id="cb134-9" data-line-number="9">/part.md (A file transclusion example)</a> +<a class="sourceLine" id="cb134-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb134-11" data-line-number="11"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb135"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb135-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <table> @@ -1370,45 +1483,45 @@ Thomas,Edison,1847</code></pre> </tbody> </table> <p>Table 1: An example table</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\ConTeXt</span>.</code></pre></div> +<div class="sourceCode" id="cb136"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb136-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div> <p>This is a <em>transcluded markdown document</em>.</p> </blockquote> -<h5 id="option-contentblockslanguagemap"><span class="header-section-number">2.1.2.2.9</span> Option <code>contentBlocksLanguageMap</code></h5> +<h4 id="option-contentblockslanguagemap"><span class="header-section-number">2.2.1.10</span> Option <code>contentBlocksLanguageMap</code></h4> <dl> <dt><code>contentBlocksLanguageMap</code> (default value: <code>"markdown-languages.json"</code>)</dt> <dd><p>The filename of the JSON file that maps filename extensions to programming language names in the iA Writer content blocks.</p> </dd> </dl> -<h6 id="latex-example-9" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-9" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p> <pre class="csv"><code>Name,Surname,Born Albert,Einstein,1879 Marie,Curie,1867 Thomas,Edison,1847</code></pre> <p>Create also a text document named <code>language-map.json</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode js"><code class="sourceCode javascript"><span class="op">{</span> - <span class="st">"tex"</span><span class="op">:</span> <span class="st">"LaTeX"</span> -<span class="op">}</span></code></pre></div> +<div class="sourceCode" id="cb138"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb138-1" data-line-number="1"><span class="op">{</span></a> +<a class="sourceLine" id="cb138-2" data-line-number="2"> <span class="st">"tex"</span><span class="op">:</span> <span class="st">"LaTeX"</span></a> +<a class="sourceLine" id="cb138-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> <p>Create also a text document named <code>code.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\LaTeX</span>.</code></pre></div> +<div class="sourceCode" id="cb139"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb139-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div> <p>Create also a text document named <code>part.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">This is a *transcluded markdown document*.</code></pre></div> +<div class="sourceCode" id="cb140"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb140-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div> <p>Create also a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">minted</span>} -<span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>} -<span class="fu">\markdownSetup</span>{ - contentBlocksLanguageMap = {language-map.json}, -} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb141"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb141-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb141-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">minted</span>}</a> +<a class="sourceLine" id="cb141-3" data-line-number="3"><span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb141-4" data-line-number="4"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb141-5" data-line-number="5"> contentBlocksLanguageMap = {language-map.json},</a> +<a class="sourceLine" id="cb141-6" data-line-number="6">}</a> +<a class="sourceLine" id="cb141-7" data-line-number="7"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb141-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb141-9" data-line-number="9">/table.csv (An example table)</a> +<a class="sourceLine" id="cb141-10" data-line-number="10">/code.tex (An example code listing)</a> +<a class="sourceLine" id="cb141-11" data-line-number="11">/part.md (A file transclusion example)</a> +<a class="sourceLine" id="cb141-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb141-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> --shell-escape document.tex</code></pre></div> +<div class="sourceCode" id="cb142"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb142-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <table> @@ -1438,38 +1551,38 @@ Thomas,Edison,1847</code></pre> </tbody> </table> <p>Table 1: An example table</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\LaTeX</span>.</code></pre></div> +<div class="sourceCode" id="cb143"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb143-1" data-line-number="1">This is an example code listing in <span class="fu">\LaTeX</span>.</a></code></pre></div> <p>This is a <em>transcluded markdown document</em>.</p> </blockquote> -<h6 id="context-example-7" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-7" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>table.csv</code> with the following content:</p> <pre class="csv"><code>Name,Surname,Born Albert,Einstein,1879 Marie,Curie,1867 Thomas,Edison,1847</code></pre> <p>Create also a text document named <code>language-map.json</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode js"><code class="sourceCode javascript"><span class="op">{</span> - <span class="st">"tex"</span><span class="op">:</span> <span class="st">"ConTeXt"</span> -<span class="op">}</span></code></pre></div> +<div class="sourceCode" id="cb145"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb145-1" data-line-number="1"><span class="op">{</span></a> +<a class="sourceLine" id="cb145-2" data-line-number="2"> <span class="st">"tex"</span><span class="op">:</span> <span class="st">"ConTeXt"</span></a> +<a class="sourceLine" id="cb145-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> <p>Create also a text document named <code>code.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\ConTeXt</span>.</code></pre></div> +<div class="sourceCode" id="cb146"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb146-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div> <p>Create also a text document named <code>part.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">This is a *transcluded markdown document*.</code></pre></div> +<div class="sourceCode" id="cb147"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb147-1" data-line-number="1">This is a *transcluded markdown document*.</a></code></pre></div> <p>Create also a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionContentBlocks{true} -<span class="fu">\def</span>\markdownOptionContentBlocksLanguageMap{language-map.json} -<span class="fu">\definetyping</span> [ConTeXt] -<span class="fu">\setuptyping</span> [ConTeXt] [option=TEX] -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb148"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb148-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb148-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a> +<a class="sourceLine" id="cb148-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionContentBlocksLanguageMap{language-map.json}</a> +<a class="sourceLine" id="cb148-4" data-line-number="4"><span class="fu">\definetyping</span> [ConTeXt]</a> +<a class="sourceLine" id="cb148-5" data-line-number="5"><span class="fu">\setuptyping</span> [ConTeXt] [option=TEX]</a> +<a class="sourceLine" id="cb148-6" data-line-number="6"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb148-7" data-line-number="7"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb148-8" data-line-number="8">/table.csv (An example table)</a> +<a class="sourceLine" id="cb148-9" data-line-number="9">/code.tex (An example code listing)</a> +<a class="sourceLine" id="cb148-10" data-line-number="10">/part.md (A file transclusion example)</a> +<a class="sourceLine" id="cb148-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb148-12" data-line-number="12"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb149"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb149-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <table> @@ -1499,26 +1612,26 @@ Thomas,Edison,1847</code></pre> </tbody> </table> <p>Table 1: An example table</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex">This is an example code listing in <span class="fu">\ConTeXt</span>.</code></pre></div> +<div class="sourceCode" id="cb150"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb150-1" data-line-number="1">This is an example code listing in <span class="fu">\ConTeXt</span>.</a></code></pre></div> <p>This is a <em>transcluded markdown document</em>.</p> </blockquote> -<h5 id="option-definitionlists"><span class="header-section-number">2.1.2.2.10</span> Option <code>definitionLists</code></h5> +<h4 id="option-definitionlists"><span class="header-section-number">2.2.1.11</span> Option <code>definitionLists</code></h4> <dl> <dt><code>definitionLists</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the pandoc definition list syntax extension:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Term 1 - -: Definition 1 - -Term 2 with *inline markup* - -: Definition 2 - -<span class="bn"> { some code, part of Definition 2 }</span> - -<span class="bn"> Third paragraph of definition 2.</span></code></pre></div> +<div class="sourceCode" id="cb151"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb151-1" data-line-number="1">Term 1</a> +<a class="sourceLine" id="cb151-2" data-line-number="2"></a> +<a class="sourceLine" id="cb151-3" data-line-number="3">: Definition 1</a> +<a class="sourceLine" id="cb151-4" data-line-number="4"></a> +<a class="sourceLine" id="cb151-5" data-line-number="5">Term 2 with *inline markup*</a> +<a class="sourceLine" id="cb151-6" data-line-number="6"></a> +<a class="sourceLine" id="cb151-7" data-line-number="7">: Definition 2</a> +<a class="sourceLine" id="cb151-8" data-line-number="8"></a> +<a class="sourceLine" id="cb151-9" data-line-number="9"><span class="bn"> { some code, part of Definition 2 }</span></a> +<a class="sourceLine" id="cb151-10" data-line-number="10"></a> +<a class="sourceLine" id="cb151-11" data-line-number="11"><span class="bn"> Third paragraph of definition 2.</span></a></code></pre></div> </dd> </dl> </dd> @@ -1529,27 +1642,27 @@ Term 2 with *inline markup* </dl> </dd> </dl> -<h6 id="latex-example-10" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[definitionLists]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -Term 1 - -: Definition 1 - -Term 2 with *inline markup* - -: Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2. -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<h5 id="latex-example-10" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb152"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb152-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb152-2" data-line-number="2"><span class="bu">\usepackage</span>[definitionLists]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb152-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb152-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb152-5" data-line-number="5">Term 1</a> +<a class="sourceLine" id="cb152-6" data-line-number="6"></a> +<a class="sourceLine" id="cb152-7" data-line-number="7">: Definition 1</a> +<a class="sourceLine" id="cb152-8" data-line-number="8"></a> +<a class="sourceLine" id="cb152-9" data-line-number="9">Term 2 with *inline markup*</a> +<a class="sourceLine" id="cb152-10" data-line-number="10"></a> +<a class="sourceLine" id="cb152-11" data-line-number="11">: Definition 2</a> +<a class="sourceLine" id="cb152-12" data-line-number="12"></a> +<a class="sourceLine" id="cb152-13" data-line-number="13"> { some code, part of Definition 2 }</a> +<a class="sourceLine" id="cb152-14" data-line-number="14"></a> +<a class="sourceLine" id="cb152-15" data-line-number="15"> Third paragraph of definition 2.</a> +<a class="sourceLine" id="cb152-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb152-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb153"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb153-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <dl> @@ -1563,27 +1676,27 @@ Term 2 with *inline markup* </dd> </dl> </blockquote> -<h6 id="context-example-8" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionDefinitionLists{true} -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -Term 1 - -: Definition 1 - -Term 2 with *inline markup* - -: Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2. -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<h5 id="context-example-8" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb155"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb155-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb155-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionDefinitionLists{true}</a> +<a class="sourceLine" id="cb155-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb155-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb155-5" data-line-number="5">Term 1</a> +<a class="sourceLine" id="cb155-6" data-line-number="6"></a> +<a class="sourceLine" id="cb155-7" data-line-number="7">: Definition 1</a> +<a class="sourceLine" id="cb155-8" data-line-number="8"></a> +<a class="sourceLine" id="cb155-9" data-line-number="9">Term 2 with *inline markup*</a> +<a class="sourceLine" id="cb155-10" data-line-number="10"></a> +<a class="sourceLine" id="cb155-11" data-line-number="11">: Definition 2</a> +<a class="sourceLine" id="cb155-12" data-line-number="12"></a> +<a class="sourceLine" id="cb155-13" data-line-number="13"> { some code, part of Definition 2 }</a> +<a class="sourceLine" id="cb155-14" data-line-number="14"></a> +<a class="sourceLine" id="cb155-15" data-line-number="15"> Third paragraph of definition 2.</a> +<a class="sourceLine" id="cb155-16" data-line-number="16"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb155-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb156"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb156-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <dl> @@ -1597,28 +1710,28 @@ Term 2 with *inline markup* </dd> </dl> </blockquote> -<h5 id="option-fencedcode"><span class="header-section-number">2.1.2.2.11</span> Option <code>fencedCode</code></h5> +<h4 id="option-fencedcode"><span class="header-section-number">2.2.1.12</span> Option <code>fencedCode</code></h4> <dl> <dt><code>fencedCode</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the commonmark fenced code block extension:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">~~~ js -if (a > 3) { -<span class="bn"> moveShip(5 * gravity, DOWN);</span> -} -~~~~~~ - - ``` html - <pre> -<span class="bn"> <code></span> -<span class="bn"> // Some comments</span> -<span class="bn"> line 1 of code</span> -<span class="bn"> line 2 of code</span> -<span class="bn"> line 3 of code</span> -<span class="bn"> </code></span> - </pre> - ```</code></pre></div> +<div class="sourceCode" id="cb158"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb158-1" data-line-number="1">~~~ js</a> +<a class="sourceLine" id="cb158-2" data-line-number="2">if (a > 3) {</a> +<a class="sourceLine" id="cb158-3" data-line-number="3"><span class="bn"> moveShip(5 * gravity, DOWN);</span></a> +<a class="sourceLine" id="cb158-4" data-line-number="4">}</a> +<a class="sourceLine" id="cb158-5" data-line-number="5">~~~~~~</a> +<a class="sourceLine" id="cb158-6" data-line-number="6"></a> +<a class="sourceLine" id="cb158-7" data-line-number="7"> ``` html</a> +<a class="sourceLine" id="cb158-8" data-line-number="8"> <pre></a> +<a class="sourceLine" id="cb158-9" data-line-number="9"><span class="bn"> <code></span></a> +<a class="sourceLine" id="cb158-10" data-line-number="10"><span class="bn"> // Some comments</span></a> +<a class="sourceLine" id="cb158-11" data-line-number="11"><span class="bn"> line 1 of code</span></a> +<a class="sourceLine" id="cb158-12" data-line-number="12"><span class="bn"> line 2 of code</span></a> +<a class="sourceLine" id="cb158-13" data-line-number="13"><span class="bn"> line 3 of code</span></a> +<a class="sourceLine" id="cb158-14" data-line-number="14"><span class="bn"> </code></span></a> +<a class="sourceLine" id="cb158-15" data-line-number="15"> </pre></a> +<a class="sourceLine" id="cb158-16" data-line-number="16"> ```</a></code></pre></div> </dd> </dl> </dd> @@ -1629,113 +1742,113 @@ if (a > 3) { </dl> </dd> </dl> -<h6 id="latex-example-11" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">minted</span>} -<span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -~~~ js -if (a > 3) { - moveShip(5 * gravity, DOWN); -} -~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ``` -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> --shell-escape document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<div class="sourceCode"><pre class="sourceCode js"><code class="sourceCode javascript"><span class="cf">if</span> (a <span class="op">></span> <span class="dv">3</span>) <span class="op">{</span> - <span class="at">moveShip</span>(<span class="dv">5</span> <span class="op">*</span> gravity<span class="op">,</span> DOWN)<span class="op">;</span> -<span class="op">}</span></code></pre></div> -<div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><pre></span> - <span class="kw"><code></span> - // Some comments - line 1 of code - line 2 of code - line 3 of code - <span class="kw"></code></span> -<span class="kw"></pre></span></code></pre></div> -</blockquote> -<h6 id="context-example-9" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionFencedCode{true} -<span class="fu">\definetyping</span> [js] -<span class="fu">\definetyping</span> [html] -<span class="fu">\setuptyping</span> [html] [option=XML] -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -~~~ js -if (a > 3) { - moveShip(5 * gravity, DOWN); -} -~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ``` -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<div class="sourceCode"><pre class="sourceCode js"><code class="sourceCode javascript"><span class="cf">if</span> (a <span class="op">></span> <span class="dv">3</span>) <span class="op">{</span> - <span class="at">moveShip</span>(<span class="dv">5</span> <span class="op">*</span> gravity<span class="op">,</span> DOWN)<span class="op">;</span> -<span class="op">}</span></code></pre></div> -<div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><pre></span> - <span class="kw"><code></span> - // Some comments - line 1 of code - line 2 of code - line 3 of code - <span class="kw"></code></span> -<span class="kw"></pre></span></code></pre></div> -</blockquote> -<h5 id="option-footnotes"><span class="header-section-number">2.1.2.2.12</span> Option <code>footnotes</code></h5> +<h5 id="latex-example-11" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb159"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb159-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb159-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">minted</span>}</a> +<a class="sourceLine" id="cb159-3" data-line-number="3"><span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb159-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb159-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb159-6" data-line-number="6">~~~ js</a> +<a class="sourceLine" id="cb159-7" data-line-number="7">if (a > 3) {</a> +<a class="sourceLine" id="cb159-8" data-line-number="8"> moveShip(5 * gravity, DOWN);</a> +<a class="sourceLine" id="cb159-9" data-line-number="9">}</a> +<a class="sourceLine" id="cb159-10" data-line-number="10">~~~~~~</a> +<a class="sourceLine" id="cb159-11" data-line-number="11"></a> +<a class="sourceLine" id="cb159-12" data-line-number="12"> ``` html</a> +<a class="sourceLine" id="cb159-13" data-line-number="13"> <pre></a> +<a class="sourceLine" id="cb159-14" data-line-number="14"> <code></a> +<a class="sourceLine" id="cb159-15" data-line-number="15"> // Some comments</a> +<a class="sourceLine" id="cb159-16" data-line-number="16"> line 1 of code</a> +<a class="sourceLine" id="cb159-17" data-line-number="17"> line 2 of code</a> +<a class="sourceLine" id="cb159-18" data-line-number="18"> line 3 of code</a> +<a class="sourceLine" id="cb159-19" data-line-number="19"> </code></a> +<a class="sourceLine" id="cb159-20" data-line-number="20"> </pre></a> +<a class="sourceLine" id="cb159-21" data-line-number="21"> ```</a> +<a class="sourceLine" id="cb159-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb159-23" data-line-number="23"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb160"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb160-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<div class="sourceCode" id="cb161"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb161-1" data-line-number="1"><span class="cf">if</span> (a <span class="op">></span> <span class="dv">3</span>) <span class="op">{</span></a> +<a class="sourceLine" id="cb161-2" data-line-number="2"> <span class="at">moveShip</span>(<span class="dv">5</span> <span class="op">*</span> gravity<span class="op">,</span> DOWN)<span class="op">;</span></a> +<a class="sourceLine" id="cb161-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> +<div class="sourceCode" id="cb162"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb162-1" data-line-number="1"><span class="kw"><pre></span></a> +<a class="sourceLine" id="cb162-2" data-line-number="2"> <span class="kw"><code></span></a> +<a class="sourceLine" id="cb162-3" data-line-number="3"> // Some comments</a> +<a class="sourceLine" id="cb162-4" data-line-number="4"> line 1 of code</a> +<a class="sourceLine" id="cb162-5" data-line-number="5"> line 2 of code</a> +<a class="sourceLine" id="cb162-6" data-line-number="6"> line 3 of code</a> +<a class="sourceLine" id="cb162-7" data-line-number="7"> <span class="kw"></code></span></a> +<a class="sourceLine" id="cb162-8" data-line-number="8"><span class="kw"></pre></span></a></code></pre></div> +</blockquote> +<h5 id="context-example-9" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb163"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb163-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb163-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFencedCode{true}</a> +<a class="sourceLine" id="cb163-3" data-line-number="3"><span class="fu">\definetyping</span> [js]</a> +<a class="sourceLine" id="cb163-4" data-line-number="4"><span class="fu">\definetyping</span> [html]</a> +<a class="sourceLine" id="cb163-5" data-line-number="5"><span class="fu">\setuptyping</span> [html] [option=XML]</a> +<a class="sourceLine" id="cb163-6" data-line-number="6"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb163-7" data-line-number="7"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb163-8" data-line-number="8">~~~ js</a> +<a class="sourceLine" id="cb163-9" data-line-number="9">if (a > 3) {</a> +<a class="sourceLine" id="cb163-10" data-line-number="10"> moveShip(5 * gravity, DOWN);</a> +<a class="sourceLine" id="cb163-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb163-12" data-line-number="12">~~~~~~</a> +<a class="sourceLine" id="cb163-13" data-line-number="13"></a> +<a class="sourceLine" id="cb163-14" data-line-number="14"> ``` html</a> +<a class="sourceLine" id="cb163-15" data-line-number="15"> <pre></a> +<a class="sourceLine" id="cb163-16" data-line-number="16"> <code></a> +<a class="sourceLine" id="cb163-17" data-line-number="17"> // Some comments</a> +<a class="sourceLine" id="cb163-18" data-line-number="18"> line 1 of code</a> +<a class="sourceLine" id="cb163-19" data-line-number="19"> line 2 of code</a> +<a class="sourceLine" id="cb163-20" data-line-number="20"> line 3 of code</a> +<a class="sourceLine" id="cb163-21" data-line-number="21"> </code></a> +<a class="sourceLine" id="cb163-22" data-line-number="22"> </pre></a> +<a class="sourceLine" id="cb163-23" data-line-number="23"> ```</a> +<a class="sourceLine" id="cb163-24" data-line-number="24"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb163-25" data-line-number="25"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb164"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb164-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<div class="sourceCode" id="cb165"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb165-1" data-line-number="1"><span class="cf">if</span> (a <span class="op">></span> <span class="dv">3</span>) <span class="op">{</span></a> +<a class="sourceLine" id="cb165-2" data-line-number="2"> <span class="at">moveShip</span>(<span class="dv">5</span> <span class="op">*</span> gravity<span class="op">,</span> DOWN)<span class="op">;</span></a> +<a class="sourceLine" id="cb165-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> +<div class="sourceCode" id="cb166"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb166-1" data-line-number="1"><span class="kw"><pre></span></a> +<a class="sourceLine" id="cb166-2" data-line-number="2"> <span class="kw"><code></span></a> +<a class="sourceLine" id="cb166-3" data-line-number="3"> // Some comments</a> +<a class="sourceLine" id="cb166-4" data-line-number="4"> line 1 of code</a> +<a class="sourceLine" id="cb166-5" data-line-number="5"> line 2 of code</a> +<a class="sourceLine" id="cb166-6" data-line-number="6"> line 3 of code</a> +<a class="sourceLine" id="cb166-7" data-line-number="7"> <span class="kw"></code></span></a> +<a class="sourceLine" id="cb166-8" data-line-number="8"><span class="kw"></pre></span></a></code></pre></div> +</blockquote> +<h4 id="option-footnotes"><span class="header-section-number">2.2.1.13</span> Option <code>footnotes</code></h4> <dl> <dt><code>footnotes</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the pandoc footnote syntax extension:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Here is a footnote reference,<span class="ot">[^1]</span> and another.<span class="ot">[^longnote]</span> - -<span class="ot">[^1]</span>: Here is the footnote. - -<span class="ot">[^longnote]</span>: Here's one with multiple blocks. - -<span class="bn"> Subsequent paragraphs are indented to show that they</span> -belong to the previous footnote. - -<span class="bn"> { some.code }</span> - -<span class="bn"> The whole paragraph can be indented, or just the</span> -<span class="bn"> first line. In this way, multi-paragraph footnotes</span> -<span class="bn"> work like multi-paragraph list items.</span> - -This paragraph won't be part of the note, because it -isn't indented.</code></pre></div> +<div class="sourceCode" id="cb167"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb167-1" data-line-number="1">Here is a footnote reference,<span class="ot">[^1]</span> and another.<span class="ot">[^longnote]</span></a> +<a class="sourceLine" id="cb167-2" data-line-number="2"></a> +<a class="sourceLine" id="cb167-3" data-line-number="3"><span class="ot">[^1]</span>: Here is the footnote.</a> +<a class="sourceLine" id="cb167-4" data-line-number="4"></a> +<a class="sourceLine" id="cb167-5" data-line-number="5"><span class="ot">[^longnote]</span>: Here's one with multiple blocks.</a> +<a class="sourceLine" id="cb167-6" data-line-number="6"></a> +<a class="sourceLine" id="cb167-7" data-line-number="7"><span class="bn"> Subsequent paragraphs are indented to show that they</span></a> +<a class="sourceLine" id="cb167-8" data-line-number="8">belong to the previous footnote.</a> +<a class="sourceLine" id="cb167-9" data-line-number="9"></a> +<a class="sourceLine" id="cb167-10" data-line-number="10"><span class="bn"> { some.code }</span></a> +<a class="sourceLine" id="cb167-11" data-line-number="11"></a> +<a class="sourceLine" id="cb167-12" data-line-number="12"><span class="bn"> The whole paragraph can be indented, or just the</span></a> +<a class="sourceLine" id="cb167-13" data-line-number="13"><span class="bn"> first line. In this way, multi-paragraph footnotes</span></a> +<a class="sourceLine" id="cb167-14" data-line-number="14"><span class="bn"> work like multi-paragraph list items.</span></a> +<a class="sourceLine" id="cb167-15" data-line-number="15"></a> +<a class="sourceLine" id="cb167-16" data-line-number="16">This paragraph won't be part of the note, because it</a> +<a class="sourceLine" id="cb167-17" data-line-number="17">isn't indented.</a></code></pre></div> </dd> </dl> </dd> @@ -1746,79 +1859,79 @@ isn't indented.</code></pre></div> </dl> </dd> </dl> -<h6 id="latex-example-12" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[footnotes]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -Here is a footnote reference,[^1] and another.[^longnote] - -[^1]: Here is the footnote. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they -belong to the previous footnote. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph footnotes - work like multi-paragraph list items. - -This paragraph won't be part of the note, because it -isn't indented. -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<p>Here is a footnote reference,<a href="#fn1" class="footnoteRef" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnoteRef" id="fnref2"><sup>2</sup></a></p> -<p>This paragraph won't be part of the note, because it isn't indented.</p> -</blockquote> -<h6 id="context-example-10" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionFootnotes{true} -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -Here is a footnote reference,[^1] and another.[^longnote] - -[^1]: Here is the footnote. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they -belong to the previous footnote. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph footnotes - work like multi-paragraph list items. - -This paragraph won't be part of the note, because it -isn't indented. -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<p>Here is a footnote reference,<a href="#fn3" class="footnoteRef" id="fnref3"><sup>3</sup></a> and another.<a href="#fn4" class="footnoteRef" id="fnref4"><sup>4</sup></a></p> -<p>This paragraph won't be part of the note, because it isn't indented.</p> -</blockquote> -<h5 id="option-hashenumerators"><span class="header-section-number">2.1.2.2.13</span> Option <code>hashEnumerators</code></h5> +<h5 id="latex-example-12" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb168"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb168-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb168-2" data-line-number="2"><span class="bu">\usepackage</span>[footnotes]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb168-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb168-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb168-5" data-line-number="5">Here is a footnote reference,[^1] and another.[^longnote]</a> +<a class="sourceLine" id="cb168-6" data-line-number="6"></a> +<a class="sourceLine" id="cb168-7" data-line-number="7">[^1]: Here is the footnote.</a> +<a class="sourceLine" id="cb168-8" data-line-number="8"></a> +<a class="sourceLine" id="cb168-9" data-line-number="9">[^longnote]: Here's one with multiple blocks.</a> +<a class="sourceLine" id="cb168-10" data-line-number="10"></a> +<a class="sourceLine" id="cb168-11" data-line-number="11"> Subsequent paragraphs are indented to show that they</a> +<a class="sourceLine" id="cb168-12" data-line-number="12">belong to the previous footnote.</a> +<a class="sourceLine" id="cb168-13" data-line-number="13"></a> +<a class="sourceLine" id="cb168-14" data-line-number="14"> { some.code }</a> +<a class="sourceLine" id="cb168-15" data-line-number="15"></a> +<a class="sourceLine" id="cb168-16" data-line-number="16"> The whole paragraph can be indented, or just the</a> +<a class="sourceLine" id="cb168-17" data-line-number="17"> first line. In this way, multi-paragraph footnotes</a> +<a class="sourceLine" id="cb168-18" data-line-number="18"> work like multi-paragraph list items.</a> +<a class="sourceLine" id="cb168-19" data-line-number="19"></a> +<a class="sourceLine" id="cb168-20" data-line-number="20">This paragraph won't be part of the note, because it</a> +<a class="sourceLine" id="cb168-21" data-line-number="21">isn't indented.</a> +<a class="sourceLine" id="cb168-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb168-23" data-line-number="23"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb169"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb169-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Here is a footnote reference,<a href="#fn1" class="footnote-ref" id="fnref1"><sup>1</sup></a> and another.<a href="#fn2" class="footnote-ref" id="fnref2"><sup>2</sup></a></p> +<p>This paragraph won’t be part of the note, because it isn’t indented.</p> +</blockquote> +<h5 id="context-example-10" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb171"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb171-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb171-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a> +<a class="sourceLine" id="cb171-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb171-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb171-5" data-line-number="5">Here is a footnote reference,[^1] and another.[^longnote]</a> +<a class="sourceLine" id="cb171-6" data-line-number="6"></a> +<a class="sourceLine" id="cb171-7" data-line-number="7">[^1]: Here is the footnote.</a> +<a class="sourceLine" id="cb171-8" data-line-number="8"></a> +<a class="sourceLine" id="cb171-9" data-line-number="9">[^longnote]: Here's one with multiple blocks.</a> +<a class="sourceLine" id="cb171-10" data-line-number="10"></a> +<a class="sourceLine" id="cb171-11" data-line-number="11"> Subsequent paragraphs are indented to show that they</a> +<a class="sourceLine" id="cb171-12" data-line-number="12">belong to the previous footnote.</a> +<a class="sourceLine" id="cb171-13" data-line-number="13"></a> +<a class="sourceLine" id="cb171-14" data-line-number="14"> { some.code }</a> +<a class="sourceLine" id="cb171-15" data-line-number="15"></a> +<a class="sourceLine" id="cb171-16" data-line-number="16"> The whole paragraph can be indented, or just the</a> +<a class="sourceLine" id="cb171-17" data-line-number="17"> first line. In this way, multi-paragraph footnotes</a> +<a class="sourceLine" id="cb171-18" data-line-number="18"> work like multi-paragraph list items.</a> +<a class="sourceLine" id="cb171-19" data-line-number="19"></a> +<a class="sourceLine" id="cb171-20" data-line-number="20">This paragraph won't be part of the note, because it</a> +<a class="sourceLine" id="cb171-21" data-line-number="21">isn't indented.</a> +<a class="sourceLine" id="cb171-22" data-line-number="22"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb171-23" data-line-number="23"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb172"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb172-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Here is a footnote reference,<a href="#fn3" class="footnote-ref" id="fnref3"><sup>3</sup></a> and another.<a href="#fn4" class="footnote-ref" id="fnref4"><sup>4</sup></a></p> +<p>This paragraph won’t be part of the note, because it isn’t indented.</p> +</blockquote> +<h4 id="option-hashenumerators"><span class="header-section-number">2.2.1.14</span> Option <code>hashEnumerators</code></h4> <dl> <dt><code>hashEnumerators</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the use of hash symbols (<code>#</code>) as ordered item list markers:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">#. Bird -#. McHale -#. Parish</code></pre></div> +<div class="sourceCode" id="cb174"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb174-1" data-line-number="1">#. Bird</a> +<a class="sourceLine" id="cb174-2" data-line-number="2">#. McHale</a> +<a class="sourceLine" id="cb174-3" data-line-number="3">#. Parish</a></code></pre></div> </dd> </dl> </dd> @@ -1829,27 +1942,27 @@ isn't indented. </dl> </dd> </dl> -<h6 id="latex-example-13" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -#. Bird -#. McHale -#. Parish -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hashEnumerators} -#. Bird -#. McHale -#. Parish -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<h5 id="latex-example-13" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb175"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb175-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb175-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb175-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb175-4" data-line-number="4"></a> +<a class="sourceLine" id="cb175-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb175-6" data-line-number="6">. Bird</a> +<a class="sourceLine" id="cb175-7" data-line-number="7">. McHale</a> +<a class="sourceLine" id="cb175-8" data-line-number="8">. Parish</a> +<a class="sourceLine" id="cb175-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb175-10" data-line-number="10"></a> +<a class="sourceLine" id="cb175-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hashEnumerators}</a> +<a class="sourceLine" id="cb175-12" data-line-number="12">. Bird</a> +<a class="sourceLine" id="cb175-13" data-line-number="13">. McHale</a> +<a class="sourceLine" id="cb175-14" data-line-number="14">. Parish</a> +<a class="sourceLine" id="cb175-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb175-16" data-line-number="16"></a> +<a class="sourceLine" id="cb175-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb176"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb176-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <h1 id="bird">. Bird</h1> @@ -1861,27 +1974,27 @@ isn't indented. <li>Parish</li> </ol> </blockquote> -<h6 id="context-example-11" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -#. Bird -#. McHale -#. Parish -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionHashEnumerators{true} -<span class="fu">\startmarkdown</span> -#. Bird -#. McHale -#. Parish -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<h5 id="context-example-11" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb177"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb177-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb177-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb177-3" data-line-number="3"></a> +<a class="sourceLine" id="cb177-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb177-5" data-line-number="5">. Bird</a> +<a class="sourceLine" id="cb177-6" data-line-number="6">. McHale</a> +<a class="sourceLine" id="cb177-7" data-line-number="7">. Parish</a> +<a class="sourceLine" id="cb177-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb177-9" data-line-number="9"></a> +<a class="sourceLine" id="cb177-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionHashEnumerators{true}</a> +<a class="sourceLine" id="cb177-11" data-line-number="11"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb177-12" data-line-number="12">. Bird</a> +<a class="sourceLine" id="cb177-13" data-line-number="13">. McHale</a> +<a class="sourceLine" id="cb177-14" data-line-number="14">. Parish</a> +<a class="sourceLine" id="cb177-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb177-16" data-line-number="16"></a> +<a class="sourceLine" id="cb177-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb178"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb178-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <h1 id="bird-1">. Bird</h1> @@ -1893,7 +2006,30 @@ isn't indented. <li>Parish</li> </ol> </blockquote> -<h5 id="option-html"><span class="header-section-number">2.1.2.2.14</span> Option <code>html</code></h5> +<h4 id="header-attributes"><span class="header-section-number">2.2.1.15</span> Option <code>headerAttributes</code></h4> +<dl> +<dt><code>headerAttributes</code> (default value: <code>false</code>)</dt> +<dd><dl> +<dt>true</dt> +<dd><p>Enable the assignment of HTML attributes to headings:</p> +<div class="sourceCode" id="cb179"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb179-1" data-line-number="1"><span class="fu"># My first heading {#foo}</span></a> +<a class="sourceLine" id="cb179-2" data-line-number="2"></a> +<a class="sourceLine" id="cb179-3" data-line-number="3"><span class="fu">## My second heading ## {#bar .baz}</span></a> +<a class="sourceLine" id="cb179-4" data-line-number="4"></a> +<a class="sourceLine" id="cb179-5" data-line-number="5">Yet another heading {key=value}</a> +<a class="sourceLine" id="cb179-6" data-line-number="6">===================</a></code></pre></div> +<p>These HTML attributes have currently no effect other than enabling <a href="#slice">content slicing</a>.</p> +</dd> +</dl> +</dd> +<dd><dl> +<dt>false</dt> +<dd><p>Disable the assignment of HTML attributes to headings.</p> +</dd> +</dl> +</dd> +</dl> +<h4 id="option-html"><span class="header-section-number">2.2.1.16</span> Option <code>html</code></h4> <dl> <dt><code>html</code> (default value: <code>false</code>)</dt> <dd><dl> @@ -1910,273 +2046,296 @@ isn't indented. </dd> </dl> <p>When the option is enabled, HTML entities are currently incorrectly parsed. See <a href="https://github.com/Witiko/markdown/issues/38" title="Tabs are stripped even with the `preserveTabs=true` Lua option enabled">the corresponding issue</a> in the package repository.</p> -<h6 id="lua-module-example-6" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - 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)) } -<span class="fu">\par</span> -<span class="fu">\directlua</span>{ - 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)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-6" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb180"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb180-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb180-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb180-3" data-line-number="3"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb180-4" data-line-number="4"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb180-5" data-line-number="5"> local convert = markdown.new()</a> +<a class="sourceLine" id="cb180-6" data-line-number="6"> local newline = [[^^J^^J]]</a> +<a class="sourceLine" id="cb180-7" data-line-number="7"> local input =</a> +<a class="sourceLine" id="cb180-8" data-line-number="8"> "<div>*There is no block tag support.*</div>" .. newline ..</a> +<a class="sourceLine" id="cb180-9" data-line-number="9"> "*There is no <inline tag="tag"></inline> support.*" .. newline ..</a> +<a class="sourceLine" id="cb180-10" data-line-number="10"> "_There is no <!-- comment --> support._" .. newline ..</a> +<a class="sourceLine" id="cb180-11" data-line-number="11"> "_There is no <? HTML instruction ?> support._"</a> +<a class="sourceLine" id="cb180-12" data-line-number="12"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb180-13" data-line-number="13"><span class="fu">\par</span></a> +<a class="sourceLine" id="cb180-14" data-line-number="14"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb180-15" data-line-number="15"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb180-16" data-line-number="16"> local convert = markdown.new({html = true})</a> +<a class="sourceLine" id="cb180-17" data-line-number="17"> local input =</a> +<a class="sourceLine" id="cb180-18" data-line-number="18"> "<div>*There is block tag support.*</div>" .. newline ..</a> +<a class="sourceLine" id="cb180-19" data-line-number="19"> "*There is <inline tag="tag"></inline> support.*" .. newline ..</a> +<a class="sourceLine" id="cb180-20" data-line-number="20"> "_There is <!-- comment --> support._" .. newline ..</a> +<a class="sourceLine" id="cb180-21" data-line-number="21"> "_There is <? HTML instruction ?> support._"</a> +<a class="sourceLine" id="cb180-22" data-line-number="22"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb180-23" data-line-number="23"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb181"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb181-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p><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.</p> +<p><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.</p> <p>There is support. There is support. There is support.</p> </blockquote> -<h6 id="lua-cli-example-6" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-6" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\par</span> -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb182"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb182-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb182-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb182-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb182-4" data-line-number="4"><span class="fu">\par</span></a> +<a class="sourceLine" id="cb182-5" data-line-number="5"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb182-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode html"><code class="sourceCode html"><span class="kw"><div></span> -*Is there block tag support?* -<span class="kw"></div></span> -*Is there <span class="kw"><inline</span><span class="ot"> tag=</span><span class="st">"tag"</span><span class="kw">></inline></span> support?* -_Is there <span class="co"><!-- comment --></span> support?_ -_Is there <span class="kw"><?</span> HTML instruction <span class="kw">?></span> support?_</code></pre></div> +<div class="sourceCode" id="cb183"><pre class="sourceCode html"><code class="sourceCode html"><a class="sourceLine" id="cb183-1" data-line-number="1"><span class="kw"><div></span></a> +<a class="sourceLine" id="cb183-2" data-line-number="2">*Is there block tag support?*</a> +<a class="sourceLine" id="cb183-3" data-line-number="3"><span class="kw"></div></span></a> +<a class="sourceLine" id="cb183-4" data-line-number="4">*Is there <span class="kw"><inline</span><span class="ot"> tag=</span><span class="st">"tag"</span><span class="kw">></inline></span> support?*</a> +<a class="sourceLine" id="cb183-5" data-line-number="5">_Is there <span class="co"><!-- comment --></span> support?_</a> +<a class="sourceLine" id="cb183-6" data-line-number="6">_Is there <span class="kw"><?</span> HTML instruction <span class="kw">?></span> support?_</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> html=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb184"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb184-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb184-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb184-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p><div>Is there block tag support?</div> Is there <inline tag=”tag”></inline> support? Is there <!-- comment --> support? Is there <? HTML instruction ?> support?</p> +<p><div>Is there block tag support?</div> Is there <inline tag=”tag”></inline> support? Is there <!– comment –> support? Is there <? HTML instruction ?> support?</p> <p>Is there support? Is there support? Is there support?</p> </blockquote> -<h6 id="plain-tex-example-6" class="unnumbered">Plain TeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts - -<span class="fu">\markdownBegin</span> -<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._ -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionHtml{true} -<span class="fu">\markdownBegin</span> -<div> -*There is block tag support.* -</div> -*There is <inline tag="tag"></inline> support.* -_There is <!-- comment --> support._ -_There is <? HTML instruction ?> support._ -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<p><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.</p> +<h5 id="plain-tex-example-6" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb185"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb185-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb185-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb185-3" data-line-number="3"></a> +<a class="sourceLine" id="cb185-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb185-5" data-line-number="5"><div></a> +<a class="sourceLine" id="cb185-6" data-line-number="6">*There is no block tag support.*</a> +<a class="sourceLine" id="cb185-7" data-line-number="7"></div></a> +<a class="sourceLine" id="cb185-8" data-line-number="8">*There is no <inline tag="tag"></inline> support.*</a> +<a class="sourceLine" id="cb185-9" data-line-number="9">_There is no <!-- comment --> support._</a> +<a class="sourceLine" id="cb185-10" data-line-number="10">_There is no <? HTML instruction ?> support._</a> +<a class="sourceLine" id="cb185-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb185-12" data-line-number="12"></a> +<a class="sourceLine" id="cb185-13" data-line-number="13"><span class="fu">\def</span>\markdownOptionHtml{true}</a> +<a class="sourceLine" id="cb185-14" data-line-number="14"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb185-15" data-line-number="15"><div></a> +<a class="sourceLine" id="cb185-16" data-line-number="16">*There is block tag support.*</a> +<a class="sourceLine" id="cb185-17" data-line-number="17"></div></a> +<a class="sourceLine" id="cb185-18" data-line-number="18">*There is <inline tag="tag"></inline> support.*</a> +<a class="sourceLine" id="cb185-19" data-line-number="19">_There is <!-- comment --> support._</a> +<a class="sourceLine" id="cb185-20" data-line-number="20">_There is <? HTML instruction ?> support._</a> +<a class="sourceLine" id="cb185-21" data-line-number="21"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb185-22" data-line-number="22"></a> +<a class="sourceLine" id="cb185-23" data-line-number="23"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb186"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb186-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p><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.</p> <p>There is support. There is support. There is support.</p> </blockquote> -<h6 id="latex-example-14" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -<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._ -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{html} -<div> -*There is block tag support.* -</div> -*There is <inline tag="tag"></inline> support.* -_There is <!-- comment --> support._ -_There is <? HTML instruction ?> support._ -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<p><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.</p> +<h5 id="latex-example-14" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb187"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb187-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb187-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb187-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb187-4" data-line-number="4"></a> +<a class="sourceLine" id="cb187-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb187-6" data-line-number="6"><div></a> +<a class="sourceLine" id="cb187-7" data-line-number="7">*There is no block tag support.*</a> +<a class="sourceLine" id="cb187-8" data-line-number="8"></div></a> +<a class="sourceLine" id="cb187-9" data-line-number="9">*There is no <inline tag="tag"></inline> support.*</a> +<a class="sourceLine" id="cb187-10" data-line-number="10">_There is no <!-- comment --> support._</a> +<a class="sourceLine" id="cb187-11" data-line-number="11">_There is no <? HTML instruction ?> support._</a> +<a class="sourceLine" id="cb187-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb187-13" data-line-number="13"></a> +<a class="sourceLine" id="cb187-14" data-line-number="14"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{html}</a> +<a class="sourceLine" id="cb187-15" data-line-number="15"><div></a> +<a class="sourceLine" id="cb187-16" data-line-number="16">*There is block tag support.*</a> +<a class="sourceLine" id="cb187-17" data-line-number="17"></div></a> +<a class="sourceLine" id="cb187-18" data-line-number="18">*There is <inline tag="tag"></inline> support.*</a> +<a class="sourceLine" id="cb187-19" data-line-number="19">_There is <!-- comment --> support._</a> +<a class="sourceLine" id="cb187-20" data-line-number="20">_There is <? HTML instruction ?> support._</a> +<a class="sourceLine" id="cb187-21" data-line-number="21"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb187-22" data-line-number="22"></a> +<a class="sourceLine" id="cb187-23" data-line-number="23"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb188"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb188-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p><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.</p> <p>There is support. There is support. There is support.</p> </blockquote> -<h6 id="context-example-12" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -<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._ -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionHtml{true} -<span class="fu">\startmarkdown</span> -<div> -*There is block tag support.* -</div> -*There is <inline tag="tag"></inline> support.* -_There is <!-- comment --> support._ -_There is <? HTML instruction ?> support._ -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<p><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.</p> +<h5 id="context-example-12" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb189"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb189-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb189-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb189-3" data-line-number="3"></a> +<a class="sourceLine" id="cb189-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb189-5" data-line-number="5"><div></a> +<a class="sourceLine" id="cb189-6" data-line-number="6">*There is no block tag support.*</a> +<a class="sourceLine" id="cb189-7" data-line-number="7"></div></a> +<a class="sourceLine" id="cb189-8" data-line-number="8">*There is no <inline tag="tag"></inline> support.*</a> +<a class="sourceLine" id="cb189-9" data-line-number="9">_There is no <!-- comment --> support._</a> +<a class="sourceLine" id="cb189-10" data-line-number="10">_There is no <? HTML instruction ?> support._</a> +<a class="sourceLine" id="cb189-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb189-12" data-line-number="12"></a> +<a class="sourceLine" id="cb189-13" data-line-number="13"><span class="fu">\def</span>\markdownOptionHtml{true}</a> +<a class="sourceLine" id="cb189-14" data-line-number="14"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb189-15" data-line-number="15"><div></a> +<a class="sourceLine" id="cb189-16" data-line-number="16">*There is block tag support.*</a> +<a class="sourceLine" id="cb189-17" data-line-number="17"></div></a> +<a class="sourceLine" id="cb189-18" data-line-number="18">*There is <inline tag="tag"></inline> support.*</a> +<a class="sourceLine" id="cb189-19" data-line-number="19">_There is <!-- comment --> support._</a> +<a class="sourceLine" id="cb189-20" data-line-number="20">_There is <? HTML instruction ?> support._</a> +<a class="sourceLine" id="cb189-21" data-line-number="21"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb189-22" data-line-number="22"></a> +<a class="sourceLine" id="cb189-23" data-line-number="23"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb190"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb190-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p><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.</p> <p>There is support. There is support. There is support.</p> </blockquote> -<h5 id="option-hybrid"><span class="header-section-number">2.1.2.2.15</span> Option <code>hybrid</code></h5> +<h4 id="option-hybrid"><span class="header-section-number">2.2.1.17</span> Option <code>hybrid</code></h4> <dl> <dt><code>hybrid</code> (default value: <code>true</code>)</dt> <dd><dl> <dt>true</dt> -<dd><p>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.</p> +<dd><p>Disable the escaping of special plain <span class="tex">T<sub>e</sub>X</span> characters, which makes it possible to intersperse your markdown markup with <span class="tex">T<sub>e</sub>X</span> code. The intended usage is in documents prepared manually by a human author. In such documents, it can often be desirable to mix <span class="tex">T<sub>e</sub>X</span> and markdown markup freely.</p> </dd> </dl> </dd> <dd><dl> <dt>false</dt> -<dd><p>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.</p> +<dd><p>Enable the escaping of special plain <span class="tex">T<sub>e</sub>X</span> characters outside verbatim environments, so that they are not interpretted by <span class="tex">T<sub>e</sub>X</span>. This is encouraged when typesetting automatically generated content or markdown documents that were not prepared with this package in mind.</p> </dd> </dl> </dd> </dl> -<h6 id="lua-module-example-7" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert_safe = markdown.new() - local convert_unsafe = markdown.new({hybrid = true}) - local input = [[<span class="ss">$</span><span class="sc">\noexpand\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.]] - tex.sprint(convert_safe(input) .. " " .. convert_unsafe(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-7" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb191"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb191-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb191-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb191-3" data-line-number="3"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb191-4" data-line-number="4"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb191-5" data-line-number="5"> local input, convert_safe, convert_unsafe, paragraph</a> +<a class="sourceLine" id="cb191-6" data-line-number="6"></a> +<a class="sourceLine" id="cb191-7" data-line-number="7"> input = [[<span class="ss">$</span><span class="sc">\string\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.]]</a> +<a class="sourceLine" id="cb191-8" data-line-number="8"> convert_safe = markdown.new()</a> +<a class="sourceLine" id="cb191-9" data-line-number="9"> convert_unsafe = markdown.new({hybrid = true})</a> +<a class="sourceLine" id="cb191-10" data-line-number="10"> paragraph = [[<span class="fu">\par</span>]]</a> +<a class="sourceLine" id="cb191-11" data-line-number="11"></a> +<a class="sourceLine" id="cb191-12" data-line-number="12"> tex.sprint(</a> +<a class="sourceLine" id="cb191-13" data-line-number="13"> convert_safe(input) .. paragraph ..</a> +<a class="sourceLine" id="cb191-14" data-line-number="14"> convert_unsafe(input)</a> +<a class="sourceLine" id="cb191-15" data-line-number="15"> )</a> +<a class="sourceLine" id="cb191-16" data-line-number="16">}</a> +<a class="sourceLine" id="cb191-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb192"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb192-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>$\sqrt {-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +<p>$\sqrt {-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> </blockquote> -<h6 id="lua-cli-example-7" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-7" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb193"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb193-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb193-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb193-3" data-line-number="3"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb193-4" data-line-number="4"></a> +<a class="sourceLine" id="cb193-5" data-line-number="5"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb193-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">$\sqrt{-1}$ *equals* $i$.</code></pre></div> +<div class="sourceCode" id="cb194"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb194-1" data-line-number="1">$\sqrt{-1}$ *equals* $i$.</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> hybrid=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb195"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb195-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb195-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb195-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>$\sqrt {-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +<p>$\sqrt {-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> </blockquote> -<h6 id="plain-tex-example-7" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-7" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\input</span> lmfonts -<span class="fu">\markdownBegin</span> -<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>. -<span class="fu">\markdownEnd</span> -<span class="fu">\def</span>\markdownOptionHybrid{true} -<span class="fu">\markdownBegin</span> -<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>. -<span class="fu">\markdownEnd</span> -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb196"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb196-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb196-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb196-3" data-line-number="3"></a> +<a class="sourceLine" id="cb196-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb196-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb196-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb196-7" data-line-number="7"></a> +<a class="sourceLine" id="cb196-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb196-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb196-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb196-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb196-12" data-line-number="12"></a> +<a class="sourceLine" id="cb196-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb197"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb197-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>$\sqrt {-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +<p>$\sqrt {-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> </blockquote> -<h6 id="latex-example-15" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-15" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>. -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid} -<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>. -<span class="kw">\end</span>{<span class="ex">markdown*</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb198"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb198-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb198-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb198-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb198-4" data-line-number="4"></a> +<a class="sourceLine" id="cb198-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb198-6" data-line-number="6"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb198-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb198-8" data-line-number="8"></a> +<a class="sourceLine" id="cb198-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid}</a> +<a class="sourceLine" id="cb198-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb198-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb198-12" data-line-number="12"></a> +<a class="sourceLine" id="cb198-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb199"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb199-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>$\sqrt {-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +<p>$\sqrt {-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> </blockquote> -<h6 id="context-example-13" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-13" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>. -<span class="fu">\stopmarkdown</span> -<span class="fu">\def</span>\markdownOptionHybrid{true} -<span class="fu">\startmarkdown</span> -<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>. -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb200"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb200-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb200-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb200-3" data-line-number="3"></a> +<a class="sourceLine" id="cb200-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb200-5" data-line-number="5"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb200-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb200-7" data-line-number="7"></a> +<a class="sourceLine" id="cb200-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb200-9" data-line-number="9"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb200-10" data-line-number="10"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>.</a> +<a class="sourceLine" id="cb200-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb200-12" data-line-number="12"></a> +<a class="sourceLine" id="cb200-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb201"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb201-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>$\sqrt {-1}$ <em>equals</em> $i$. √-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +<p>$\sqrt {-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> </blockquote> -<h5 id="option-inlinefootnotes"><span class="header-section-number">2.1.2.2.16</span> Option <code>inlineFootnotes</code></h5> +<h4 id="option-inlinefootnotes"><span class="header-section-number">2.2.1.18</span> Option <code>inlineFootnotes</code></h4> <dl> <dt><code>inlineFootnotes</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Enable the pandoc inline footnote syntax extension:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode 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.]</code></pre></div> +<div class="sourceCode" id="cb202"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb202-1" data-line-number="1">Here is an inline note.^[Inlines notes are easier to</a> +<a class="sourceLine" id="cb202-2" data-line-number="2">write, since you don't have to pick an identifier and</a> +<a class="sourceLine" id="cb202-3" data-line-number="3">move down to type the note.]</a></code></pre></div> </dd> </dl> </dd> @@ -2187,42 +2346,42 @@ move down to type the note.]</code></pre></div> </dl> </dd> </dl> -<h6 id="latex-example-16" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-16" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[footnotes, inlineFootnotes]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -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.] -<span class="kw">\end</span>{<span class="ex">markdown</span>} -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb203"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb203-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb203-2" data-line-number="2"><span class="bu">\usepackage</span>[footnotes, inlineFootnotes]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb203-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb203-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb203-5" data-line-number="5">Here is an inline note.^[Inlines notes are easier to</a> +<a class="sourceLine" id="cb203-6" data-line-number="6">write, since you don't have to pick an identifier and</a> +<a class="sourceLine" id="cb203-7" data-line-number="7">move down to type the note.]</a> +<a class="sourceLine" id="cb203-8" data-line-number="8"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb203-9" data-line-number="9"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb204"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb204-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>Here is an inline note.<a href="#fn5" class="footnoteRef" id="fnref5"><sup>5</sup></a></p> +<p>Here is an inline note.<a href="#fn5" class="footnote-ref" id="fnref5"><sup>5</sup></a></p> </blockquote> -<h6 id="context-example-14" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-14" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionFootnotes{true} -<span class="fu">\def</span>\markdownOptionInlineFootnotes{true} -<span class="fu">\starttext</span> -<span class="fu">\startmarkdown</span> -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.] -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb205"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb205-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb205-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a> +<a class="sourceLine" id="cb205-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionInlineFootnotes{true}</a> +<a class="sourceLine" id="cb205-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb205-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb205-6" data-line-number="6">Here is an inline note.^[Inlines notes are easier to</a> +<a class="sourceLine" id="cb205-7" data-line-number="7">write, since you don't have to pick an identifier and</a> +<a class="sourceLine" id="cb205-8" data-line-number="8">move down to type the note.]</a> +<a class="sourceLine" id="cb205-9" data-line-number="9"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb205-10" data-line-number="10"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb206"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb206-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>Here is an inline note.<a href="#fn6" class="footnoteRef" id="fnref6"><sup>6</sup></a></p> +<p>Here is an inline note.<a href="#fn6" class="footnote-ref" id="fnref6"><sup>6</sup></a></p> </blockquote> -<h5 id="option-preservetabs"><span class="header-section-number">2.1.2.2.17</span> Option <code>preserveTabs</code></h5> +<h4 id="option-preservetabs"><span class="header-section-number">2.2.1.19</span> Option <code>preserveTabs</code></h4> <dl> <dt><code>preserveTabs</code> (default value: <code>false</code>)</dt> <dd><dl> @@ -2239,12 +2398,149 @@ move down to type the note.] </dd> </dl> <p>This option is currently non-functional. See <a href="https://github.com/Witiko/markdown/issues/38" title="Tabs are stripped even with the `preserveTabs=true` Lua option enabled">the corresponding issue</a> in the package repository.</p> -<h5 id="option-smartellipses"><span class="header-section-number">2.1.2.2.18</span> Option <code>smartEllipses</code></h5> +<h4 id="slice"><span class="header-section-number">2.2.1.20</span> Option <code>slice</code></h4> +<dl> +<dt><code>slice</code> (default value: <code>^ $</code>)</dt> +<dd><p>Two space-separated selectors that specify the slice of a document that will be processed, whereas the remainder of the document will be ignored. The following selectors are recognized:</p> +<ul> +<li>The circumflex (<code>^</code>) selects the beginning of a document.</li> +<li>The dollar sign (<code>$</code>) selects the end of a document.</li> +<li><code>^</code>⟨<em>identifier</em>⟩ selects the beginning of a section with the <a href="#header-attributes">HTML attribute</a> <code>#</code>⟨<em>identifier</em>⟩.</li> +<li><code>$</code>⟨<em>identifier</em>⟩ selects the end of a section with the HTML attribute <code>#</code>⟨<em>identifier</em>⟩.</li> +<li>⟨<em>identifier</em>⟩ corresponds to <code>^</code>⟨<em>identifier</em>⟩ for the first selector and to <code>$</code>⟨<em>identifier</em>⟩ for the second selector.</li> +</ul> +<p>Specifying only a single selector, ⟨<em>identifier</em>⟩, is equivalent to specifying the two selectors ⟨<em>identifier</em>⟩ ⟨<em>identifier</em>⟩, which is equivalent to <code>^</code>⟨<em>identifier</em>⟩ <code>$</code>⟨<em>identifier</em>⟩.</p> +</dd> +</dl> +<h5 id="plain-tex-example-8" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>hamlet.md</code> with the following content:</p> +<div class="sourceCode" id="cb207"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb207-1" data-line-number="1"><span class="fu"># The Tragedy of Hamlet</span></a> +<a class="sourceLine" id="cb207-2" data-line-number="2">Shakespeare's longest play.</a> +<a class="sourceLine" id="cb207-3" data-line-number="3"></a> +<a class="sourceLine" id="cb207-4" data-line-number="4"><span class="fu">## Act III {#act-3}</span></a> +<a class="sourceLine" id="cb207-5" data-line-number="5">Hamlet kills Polonius.</a> +<a class="sourceLine" id="cb207-6" data-line-number="6"></a> +<a class="sourceLine" id="cb207-7" data-line-number="7"><span class="fu">## Act V {#act-5}</span></a> +<a class="sourceLine" id="cb207-8" data-line-number="8">Hamlet dies.</a> +<a class="sourceLine" id="cb207-9" data-line-number="9"></a> +<a class="sourceLine" id="cb207-10" data-line-number="10"><span class="fu">## Act I {#act-1}</span></a> +<a class="sourceLine" id="cb207-11" data-line-number="11">Hamlet talks to ghost.</a></code></pre></div> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb208"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb208-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb208-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHeaderAttributes{true}</a> +<a class="sourceLine" id="cb208-3" data-line-number="3"></a> +<a class="sourceLine" id="cb208-4" data-line-number="4"><span class="fu">\font\normal</span>=cmr10<span class="fu">\normal</span></a> +<a class="sourceLine" id="cb208-5" data-line-number="5"><span class="fu">\font\big</span>=cmr10 at 12pt</a> +<a class="sourceLine" id="cb208-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererHeadingTwo#1{{\big #1\par}}</a> +<a class="sourceLine" id="cb208-7" data-line-number="7"><span class="fu">\font\bigger</span>=cmr10 scaled 1440</a> +<a class="sourceLine" id="cb208-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererHeadingOne#1{{\bigger #1\par}}</a> +<a class="sourceLine" id="cb208-9" data-line-number="9"></a> +<a class="sourceLine" id="cb208-10" data-line-number="10"><span class="fu">\def</span>\markdownOptionSlice{^ ^act-3}</a> +<a class="sourceLine" id="cb208-11" data-line-number="11"><span class="fu">\markdownInput</span>{hamlet.md}</a> +<a class="sourceLine" id="cb208-12" data-line-number="12"></a> +<a class="sourceLine" id="cb208-13" data-line-number="13"><span class="fu">\def</span>\markdownOptionSlice{act-1}</a> +<a class="sourceLine" id="cb208-14" data-line-number="14"><span class="fu">\markdownInput</span>{hamlet.md}</a> +<a class="sourceLine" id="cb208-15" data-line-number="15"></a> +<a class="sourceLine" id="cb208-16" data-line-number="16"><span class="fu">\def</span>\markdownOptionSlice{act-3 act-5}</a> +<a class="sourceLine" id="cb208-17" data-line-number="17"><span class="fu">\markdownInput</span>{hamlet.md}</a> +<a class="sourceLine" id="cb208-18" data-line-number="18"></a> +<a class="sourceLine" id="cb208-19" data-line-number="19"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb209"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb209-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<h1 id="the-tragedy-of-hamlet">The Tragedy of Hamlet</h1> +<p>Shakespeare’s longest play.</p> +<h2 id="act-i">Act I</h2> +<p>Hamlet talks to ghost.</p> +<h2 id="act-iii">Act III</h2> +<p>Hamlet kills Polonius.</p> +<h2 id="act-v">Act V</h2> +<p>Hamlet dies.</p> +</blockquote> +<h5 id="latex-example-17" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb210"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb210-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb210-2" data-line-number="2"><span class="bu">\usepackage</span>[headerAttributes]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb210-3" data-line-number="3"><span class="bu">\usepackage</span>{<span class="ex">filecontents</span>}</a> +<a class="sourceLine" id="cb210-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">filecontents*</span>}{hamlet.md}</a> +<a class="sourceLine" id="cb210-5" data-line-number="5"># The Tragedy of Hamlet</a> +<a class="sourceLine" id="cb210-6" data-line-number="6">Shakespeare's longest play.</a> +<a class="sourceLine" id="cb210-7" data-line-number="7"></a> +<a class="sourceLine" id="cb210-8" data-line-number="8">## Act III {#act-3}</a> +<a class="sourceLine" id="cb210-9" data-line-number="9">Hamlet kills Polonius.</a> +<a class="sourceLine" id="cb210-10" data-line-number="10"></a> +<a class="sourceLine" id="cb210-11" data-line-number="11">## Act V {#act-5}</a> +<a class="sourceLine" id="cb210-12" data-line-number="12">Hamlet dies.</a> +<a class="sourceLine" id="cb210-13" data-line-number="13"></a> +<a class="sourceLine" id="cb210-14" data-line-number="14">## Act I {#act-1}</a> +<a class="sourceLine" id="cb210-15" data-line-number="15">Hamlet talks to ghost.</a> +<a class="sourceLine" id="cb210-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">filecontents*</span>}</a> +<a class="sourceLine" id="cb210-17" data-line-number="17"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb210-18" data-line-number="18"><span class="fu">\markdownInput</span>[slice=^ ^act-3]{hamlet.md}</a> +<a class="sourceLine" id="cb210-19" data-line-number="19"><span class="fu">\markdownInput</span>[slice=act-1]{hamlet.md}</a> +<a class="sourceLine" id="cb210-20" data-line-number="20"><span class="fu">\markdownInput</span>[slice=act-3 act-5]{hamlet.md}</a> +<a class="sourceLine" id="cb210-21" data-line-number="21"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb211"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb211-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<h1 id="the-tragedy-of-hamlet-1">The Tragedy of Hamlet</h1> +<p>Shakespeare’s longest play.</p> +<h2 id="act-i-1">Act I</h2> +<p>Hamlet talks to ghost.</p> +<h2 id="act-iii-1">Act III</h2> +<p>Hamlet kills Polonius.</p> +<h2 id="act-v-1">Act V</h2> +<p>Hamlet dies.</p> +</blockquote> +<h5 id="context-example-15" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>hamlet.md</code> with the following content:</p> +<div class="sourceCode" id="cb212"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb212-1" data-line-number="1"><span class="fu"># The Tragedy of Hamlet</span></a> +<a class="sourceLine" id="cb212-2" data-line-number="2">Shakespeare's longest play.</a> +<a class="sourceLine" id="cb212-3" data-line-number="3"></a> +<a class="sourceLine" id="cb212-4" data-line-number="4"><span class="fu">## Act III {#act-3}</span></a> +<a class="sourceLine" id="cb212-5" data-line-number="5">Hamlet kills Polonius.</a> +<a class="sourceLine" id="cb212-6" data-line-number="6"></a> +<a class="sourceLine" id="cb212-7" data-line-number="7"><span class="fu">## Act V {#act-5}</span></a> +<a class="sourceLine" id="cb212-8" data-line-number="8">Hamlet dies.</a> +<a class="sourceLine" id="cb212-9" data-line-number="9"></a> +<a class="sourceLine" id="cb212-10" data-line-number="10"><span class="fu">## Act I {#act-1}</span></a> +<a class="sourceLine" id="cb212-11" data-line-number="11">Hamlet talks to ghost.</a></code></pre></div> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb213"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb213-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb213-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHeaderAttributes{true}</a> +<a class="sourceLine" id="cb213-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb213-4" data-line-number="4"></a> +<a class="sourceLine" id="cb213-5" data-line-number="5"><span class="fu">\def</span>\markdownOptionSlice{^ ^act-3}</a> +<a class="sourceLine" id="cb213-6" data-line-number="6"><span class="fu">\markdownInput</span>{hamlet.md}</a> +<a class="sourceLine" id="cb213-7" data-line-number="7"></a> +<a class="sourceLine" id="cb213-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionSlice{act-1}</a> +<a class="sourceLine" id="cb213-9" data-line-number="9"><span class="fu">\markdownInput</span>{hamlet.md}</a> +<a class="sourceLine" id="cb213-10" data-line-number="10"></a> +<a class="sourceLine" id="cb213-11" data-line-number="11"><span class="fu">\def</span>\markdownOptionSlice{act-3 act-5}</a> +<a class="sourceLine" id="cb213-12" data-line-number="12"><span class="fu">\markdownInput</span>{hamlet.md}</a> +<a class="sourceLine" id="cb213-13" data-line-number="13"></a> +<a class="sourceLine" id="cb213-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb214"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb214-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<h1 id="the-tragedy-of-hamlet-2">The Tragedy of Hamlet</h1> +<p>Shakespeare’s longest play.</p> +<h2 id="act-i-2">Act I</h2> +<p>Hamlet talks to ghost.</p> +<h2 id="act-iii-2">Act III</h2> +<p>Hamlet kills Polonius.</p> +<h2 id="act-v-2">Act V</h2> +<p>Hamlet dies.</p> +</blockquote> +<h4 id="option-smartellipses"><span class="header-section-number">2.2.1.21</span> Option <code>smartEllipses</code></h4> <dl> <dt><code>smartEllipses</code> (default value: <code>false</code>)</dt> <dd><dl> <dt>true</dt> -<dd><p>Convert any ellipses in the input to the <code>\markdownRendererEllipsis</code> TeX macro.</p> +<dd><p>Convert any ellipses in the input to the <code>\markdownRendererEllipsis</code> <span class="tex">T<sub>e</sub>X</span> macro.</p> </dd> </dl> </dd> @@ -2255,223 +2551,223 @@ move down to type the note.] </dl> </dd> </dl> -<h6 id="lua-module-example-8" class="unnumbered">Lua module example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\def</span>\markdownRendererEllipsis{. . .} -<span class="fu">\input</span> lmfonts -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert = markdown.new() - input = "These are just three regular dots ..." - tex.sprint(convert(input)) } -<span class="fu">\par</span> -<span class="fu">\directlua</span>{ - local markdown = require("markdown") - local convert = markdown.new({smartEllipses = true}) - input = "... and this is a victorian ellipsis." - tex.sprint(convert(input)) } -<span class="fu">\bye</span></code></pre></div> +<h5 id="lua-module-example-8" class="unnumbered">Lua Module Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb215"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb215-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb215-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a> +<a class="sourceLine" id="cb215-3" data-line-number="3"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb215-4" data-line-number="4"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb215-5" data-line-number="5"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb215-6" data-line-number="6"> local convert = markdown.new()</a> +<a class="sourceLine" id="cb215-7" data-line-number="7"> local input = "These are just three regular dots ..."</a> +<a class="sourceLine" id="cb215-8" data-line-number="8"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb215-9" data-line-number="9"><span class="fu">\par</span></a> +<a class="sourceLine" id="cb215-10" data-line-number="10"><span class="fu">\directlua</span>{</a> +<a class="sourceLine" id="cb215-11" data-line-number="11"> local markdown = require("markdown")</a> +<a class="sourceLine" id="cb215-12" data-line-number="12"> local convert = markdown.new({smartEllipses = true})</a> +<a class="sourceLine" id="cb215-13" data-line-number="13"> local input = "... and this is a victorian ellipsis."</a> +<a class="sourceLine" id="cb215-14" data-line-number="14"> tex.sprint(convert(input)) }</a> +<a class="sourceLine" id="cb215-15" data-line-number="15"><span class="fu">\bye</span></a></code></pre></div> <p>Then, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb216"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb216-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>These are just three regular dots ...</p> +<p>These are just three regular dots …</p> <p>. . . and this is a victorian ellipsis.</p> </blockquote> -<h6 id="lua-cli-example-8" class="unnumbered">Lua CLI example</h6> +<h5 id="lua-cli-example-8" class="unnumbered">Lua CLI Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\def</span>\markdownRendererEllipsis{. . .} -<span class="fu">\input</span> lmfonts -<span class="fu">\input</span> optionfalse -<span class="fu">\par</span> -<span class="fu">\input</span> optiontrue -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb217"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb217-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb217-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a> +<a class="sourceLine" id="cb217-3" data-line-number="3"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb217-4" data-line-number="4"><span class="fu">\input</span> optionfalse</a> +<a class="sourceLine" id="cb217-5" data-line-number="5"><span class="fu">\par</span></a> +<a class="sourceLine" id="cb217-6" data-line-number="6"><span class="fu">\input</span> optiontrue</a> +<a class="sourceLine" id="cb217-7" data-line-number="7"><span class="fu">\bye</span></a></code></pre></div> <p>Using a text editor, create a text document named <code>content.md</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">Are these just three regular dots, a victorian ellipsis, or ... ?</code></pre></div> +<div class="sourceCode" id="cb218"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb218-1" data-line-number="1">Are these just three regular dots, a victorian ellipsis, or ... ?</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> -- content.md optionfalse.tex -<span class="ex">texlua</span> <span class="op"><</span>CLI␣PATHNAME<span class="op">></span> smartEllipses=true -- content.md optiontrue.tex -<span class="ex">luatex</span> document.tex</code></pre></div> -<p>where <code><CLI␣PATHNAME></code> corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> +<div class="sourceCode" id="cb219"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb219-1" data-line-number="1"><span class="ex">texlua</span> ⟨CLI pathname⟩ -- content.md optionfalse.tex</a> +<a class="sourceLine" id="cb219-2" data-line-number="2"><span class="ex">texlua</span> ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex</a> +<a class="sourceLine" id="cb219-3" data-line-number="3"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>where ⟨<em>CLI pathname</em>⟩ corresponds to the location of the Lua CLI script file, such as <code>~/texmf/scripts/markdown/markdown-cli.lua</code> on UN*X systems or <code>C:\Users\</code>⟨<em>Your username</em>⟩<code>\texmf\scripts\markdown\markdown-cli.lua</code> on Windows systems. Use the command <code>kpsewhich markdown-cli.lua</code> to locate the Lua CLI script file using <a href="https://tug.org/kpathsea/" title="Kpathsea - TeX Users Group">Kpathsea</a>.</p> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>Are these just three regular dots, a victorian ellipsis, or ... ?</p> +<p>Are these just three regular dots, a victorian ellipsis, or … ?</p> <p>Are these just three regular dots, a victorian ellipsis, or . . . ?</p> </blockquote> -<h6 id="plain-tex-example-8" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-9" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\def</span>\markdownRendererEllipsis{. . .} - -<span class="fu">\markdownBegin</span> -These are just three regular dots ... -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionSmartEllipses{true} -<span class="fu">\markdownBegin</span> -... and this is a victorian ellipsis. -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb220"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb220-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb220-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a> +<a class="sourceLine" id="cb220-3" data-line-number="3"></a> +<a class="sourceLine" id="cb220-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb220-5" data-line-number="5">These are just three regular dots ...</a> +<a class="sourceLine" id="cb220-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb220-7" data-line-number="7"></a> +<a class="sourceLine" id="cb220-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a> +<a class="sourceLine" id="cb220-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb220-10" data-line-number="10">... and this is a victorian ellipsis.</a> +<a class="sourceLine" id="cb220-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb220-12" data-line-number="12"></a> +<a class="sourceLine" id="cb220-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb221"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb221-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>These are just three regular dots ...</p> +<p>These are just three regular dots …</p> <p>. . . and this is a victorian ellipsis.</p> </blockquote> -<h6 id="latex-example-17" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="fu">\markdownSetup</span>{ - renderers = { - ellipsis = {. . .} }} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -These are just three regular dots ... -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{smartEllipses} -... and this is a victorian ellipsis. -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> -<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> -<blockquote> -<p>These are just three regular dots ...</p> +<h5 id="latex-example-18" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb222"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb222-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb222-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb222-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb222-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb222-5" data-line-number="5"> ellipsis = {. . .} }}</a> +<a class="sourceLine" id="cb222-6" data-line-number="6"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb222-7" data-line-number="7"></a> +<a class="sourceLine" id="cb222-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb222-9" data-line-number="9">These are just three regular dots ...</a> +<a class="sourceLine" id="cb222-10" data-line-number="10"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb222-11" data-line-number="11"></a> +<a class="sourceLine" id="cb222-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{smartEllipses}</a> +<a class="sourceLine" id="cb222-13" data-line-number="13">... and this is a victorian ellipsis.</a> +<a class="sourceLine" id="cb222-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb222-15" data-line-number="15"></a> +<a class="sourceLine" id="cb222-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb223"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb223-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>These are just three regular dots …</p> <p>. . . and this is a victorian ellipsis.</p> </blockquote> -<h6 id="context-example-15" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-16" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownRendererEllipsis{. . .} -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -These are just three regular dots ... -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionSmartEllipses{true} -<span class="fu">\startmarkdown</span> -... and this is a victorian ellipsis. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb224"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb224-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb224-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEllipsis{. . .}</a> +<a class="sourceLine" id="cb224-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb224-4" data-line-number="4"></a> +<a class="sourceLine" id="cb224-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb224-6" data-line-number="6">These are just three regular dots ...</a> +<a class="sourceLine" id="cb224-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb224-8" data-line-number="8"></a> +<a class="sourceLine" id="cb224-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a> +<a class="sourceLine" id="cb224-10" data-line-number="10"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb224-11" data-line-number="11">... and this is a victorian ellipsis.</a> +<a class="sourceLine" id="cb224-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb224-13" data-line-number="13"></a> +<a class="sourceLine" id="cb224-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb225"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb225-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> -<p>These are just three regular dots ...</p> +<p>These are just three regular dots …</p> <p>. . . and this is a victorian ellipsis.</p> </blockquote> -<h5 id="option-startnumber"><span class="header-section-number">2.1.2.2.19</span> Option <code>startNumber</code></h5> +<h4 id="option-startnumber"><span class="header-section-number">2.2.1.22</span> Option <code>startNumber</code></h4> <dl> <dt><code>startNumber</code> (default value: <code>true</code>)</dt> <dd><dl> <dt>true</dt> -<dd><p>Make the number in the first item of an ordered lists significant. The item numbers will be passed to the <code>\markdownRendererOlItemWithNumber</code> TeX macro.</p> +<dd><p>Make the number in the first item of an ordered lists significant. The item numbers will be passed to the <code>\markdownRendererOlItemWithNumber</code> <span class="tex">T<sub>e</sub>X</span> macro.</p> </dd> </dl> </dd> <dd><dl> <dt>false</dt> -<dd><p>Ignore the numbers in the ordered list items. Each item will only produce a <code>\markdownRendererOlItem</code> TeX macro.</p> +<dd><p>Ignore the numbers in the ordered list items. Each item will only produce a <code>\markdownRendererOlItem</code> <span class="tex">T<sub>e</sub>X</span> macro.</p> </dd> </dl> </dd> </dl> -<h6 id="latex-example-18" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -The following list respects the numbers specified in the markup: - -3. third item -4. fourth item -5. fifth item -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{startNumber=false} -The following list does not respect the numbers specified in the -markup: - -3. third item -4. fourth item -5. fifth item -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<h5 id="latex-example-19" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb226"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb226-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb226-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb226-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb226-4" data-line-number="4"></a> +<a class="sourceLine" id="cb226-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb226-6" data-line-number="6">The following list respects the numbers specified in the markup:</a> +<a class="sourceLine" id="cb226-7" data-line-number="7"></a> +<a class="sourceLine" id="cb226-8" data-line-number="8">3. third item</a> +<a class="sourceLine" id="cb226-9" data-line-number="9">4. fourth item</a> +<a class="sourceLine" id="cb226-10" data-line-number="10">5. fifth item</a> +<a class="sourceLine" id="cb226-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb226-12" data-line-number="12"></a> +<a class="sourceLine" id="cb226-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{startNumber=false}</a> +<a class="sourceLine" id="cb226-14" data-line-number="14">The following list does not respect the numbers specified in the</a> +<a class="sourceLine" id="cb226-15" data-line-number="15">markup:</a> +<a class="sourceLine" id="cb226-16" data-line-number="16"></a> +<a class="sourceLine" id="cb226-17" data-line-number="17">3. third item</a> +<a class="sourceLine" id="cb226-18" data-line-number="18">4. fourth item</a> +<a class="sourceLine" id="cb226-19" data-line-number="19">5. fifth item</a> +<a class="sourceLine" id="cb226-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb226-21" data-line-number="21"></a> +<a class="sourceLine" id="cb226-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb227"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb227-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>The following list respects the numbers specified in the markup:</p> -<ol start="3" style="list-style-type: decimal"> +<ol start="3" type="1"> <li>third item</li> <li>fourth item</li> <li>fifth item</li> </ol> <p>The following list does not respect the numbers specified in the markup:</p> -<ol style="list-style-type: decimal"> +<ol type="1"> <li>third item</li> <li>fourth item</li> <li>fifth item</li> </ol> </blockquote> -<h6 id="context-example-16" class="unnumbered">ConTeXt example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -The following list respects the numbers specified in the markup: - -3. third item -4. fourth item -5. fifth item -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionStartNumber{false} -<span class="fu">\startmarkdown</span> -The following list respects the numbers specified in the markup: - -3. third item -4. fourth item -5. fifth item -<span class="fu">\stopmarkdown</span> -<span class="fu">\stoptext</span></code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<h5 id="context-example-17" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb228"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb228-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb228-2" data-line-number="2"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb228-3" data-line-number="3"></a> +<a class="sourceLine" id="cb228-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb228-5" data-line-number="5">The following list respects the numbers specified in the markup:</a> +<a class="sourceLine" id="cb228-6" data-line-number="6"></a> +<a class="sourceLine" id="cb228-7" data-line-number="7">3. third item</a> +<a class="sourceLine" id="cb228-8" data-line-number="8">4. fourth item</a> +<a class="sourceLine" id="cb228-9" data-line-number="9">5. fifth item</a> +<a class="sourceLine" id="cb228-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb228-11" data-line-number="11"></a> +<a class="sourceLine" id="cb228-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionStartNumber{false}</a> +<a class="sourceLine" id="cb228-13" data-line-number="13"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb228-14" data-line-number="14">The following list respects the numbers specified in the markup:</a> +<a class="sourceLine" id="cb228-15" data-line-number="15"></a> +<a class="sourceLine" id="cb228-16" data-line-number="16">3. third item</a> +<a class="sourceLine" id="cb228-17" data-line-number="17">4. fourth item</a> +<a class="sourceLine" id="cb228-18" data-line-number="18">5. fifth item</a> +<a class="sourceLine" id="cb228-19" data-line-number="19"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb228-20" data-line-number="20"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb229"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb229-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>The following list respects the numbers specified in the markup:</p> -<ol start="3" style="list-style-type: decimal"> +<ol start="3" type="1"> <li>third item</li> <li>fourth item</li> <li>fifth item</li> </ol> <p>The following list does not respect the numbers specified in the markup:</p> -<ol style="list-style-type: decimal"> +<ol type="1"> <li>third item</li> <li>fourth item</li> <li>fifth item</li> </ol> </blockquote> -<h5 id="option-tightlists"><span class="header-section-number">2.1.2.2.20</span> Option <code>tightLists</code></h5> +<h4 id="option-tightlists"><span class="header-section-number">2.2.1.23</span> Option <code>tightLists</code></h4> <dl> <dt><code>tightLists</code> (default value: <code>true</code>)</dt> <dd><dl> <dt>true</dt> -<dd><p>Lists whose bullets do not consist of multiple paragraphs will be passed to the <code>\markdownRendererOlBeginTight</code>, <code>\markdownRendererOlEndTight</code>, <code>\markdownRendererUlBeginTight</code>, <code>\markdownRendererUlEndTight</code>, <code>\markdownRendererDlBeginTight</code>, and <code>\markdownRendererDlEndTight</code> TeX macros.</p> +<dd><p>Lists whose bullets do not consist of multiple paragraphs will be passed to the <code>\markdownRendererOlBeginTight</code>, <code>\markdownRendererOlEndTight</code>, <code>\markdownRendererUlBeginTight</code>, <code>\markdownRendererUlEndTight</code>, <code>\markdownRendererDlBeginTight</code>, and <code>\markdownRendererDlEndTight</code> <span class="tex">T<sub>e</sub>X</span> macros.</p> </dd> </dl> </dd> @@ -2482,39 +2778,39 @@ The following list respects the numbers specified in the markup: </dl> </dd> </dl> -<h6 id="latex-example-19" class="unnumbered">LaTeX example</h6> -<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -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 -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{tightLists=false} -The following list is now also loose: - - - first item - - second item - - third item -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> -<p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<h5 id="latex-example-20" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb230"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb230-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb230-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb230-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb230-4" data-line-number="4"></a> +<a class="sourceLine" id="cb230-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb230-6" data-line-number="6">The following list is tight:</a> +<a class="sourceLine" id="cb230-7" data-line-number="7"></a> +<a class="sourceLine" id="cb230-8" data-line-number="8"> - first item</a> +<a class="sourceLine" id="cb230-9" data-line-number="9"> - second item</a> +<a class="sourceLine" id="cb230-10" data-line-number="10"> - third item</a> +<a class="sourceLine" id="cb230-11" data-line-number="11"></a> +<a class="sourceLine" id="cb230-12" data-line-number="12">The following list is loose:</a> +<a class="sourceLine" id="cb230-13" data-line-number="13"></a> +<a class="sourceLine" id="cb230-14" data-line-number="14"> - first item</a> +<a class="sourceLine" id="cb230-15" data-line-number="15"> - second item that spans</a> +<a class="sourceLine" id="cb230-16" data-line-number="16"></a> +<a class="sourceLine" id="cb230-17" data-line-number="17"> multiple paragraphs</a> +<a class="sourceLine" id="cb230-18" data-line-number="18"> - third item</a> +<a class="sourceLine" id="cb230-19" data-line-number="19"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb230-20" data-line-number="20"></a> +<a class="sourceLine" id="cb230-21" data-line-number="21"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{tightLists=false}</a> +<a class="sourceLine" id="cb230-22" data-line-number="22">The following list is now also loose:</a> +<a class="sourceLine" id="cb230-23" data-line-number="23"></a> +<a class="sourceLine" id="cb230-24" data-line-number="24"> - first item</a> +<a class="sourceLine" id="cb230-25" data-line-number="25"> - second item</a> +<a class="sourceLine" id="cb230-26" data-line-number="26"> - third item</a> +<a class="sourceLine" id="cb230-27" data-line-number="27"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb230-28" data-line-number="28"></a> +<a class="sourceLine" id="cb230-29" data-line-number="29"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb231"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb231-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>The following list is tight:</p> @@ -2537,134 +2833,2114 @@ multiple paragraphs</li> <li><p>third item</p></li> </ul> </blockquote> -<h5 id="option-underscores"><span class="header-section-number">2.1.2.2.21</span> Option <code>underscores</code></h5> +<h4 id="option-underscores"><span class="header-section-number">2.2.1.24</span> Option <code>underscores</code></h4> <dl> <dt><code>underscores</code> (default value: <code>true</code>)</dt> <dd><dl> <dt>true</dt> <dd><p>Both underscores and asterisks can be used to denote emphasis and strong emphasis:</p> -<div class="sourceCode"><pre class="sourceCode md"><code class="sourceCode markdown">*single asterisks* -_single underscores_ -**double asterisks** -__double underscores__</code></pre></div> +<div class="sourceCode" id="cb232"><pre class="sourceCode md"><code class="sourceCode markdown"><a class="sourceLine" id="cb232-1" data-line-number="1">*single asterisks*</a> +<a class="sourceLine" id="cb232-2" data-line-number="2">_single underscores_</a> +<a class="sourceLine" id="cb232-3" data-line-number="3">**double asterisks**</a> +<a class="sourceLine" id="cb232-4" data-line-number="4">__double underscores__</a></code></pre></div> </dd> </dl> </dd> <dd><dl> <dt>false</dt> -<dd><p>Only asterisks can be used to denote emphasis and strong emphasis. This makes it easy to write math with the option without the need to constantly escape subscripts.</p> +<dd><p>Only asterisks can be used to denote emphasis and strong emphasis. This makes it easy to write math with the <strong><code>hybrid</code></strong> option without the need to constantly escape subscripts.</p> </dd> </dl> </dd> </dl> -<h6 id="plain-tex-example-9" class="unnumbered">Plain TeX example</h6> +<h5 id="plain-tex-example-10" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\input</span> markdown -<span class="fu">\def</span>\markdownOptionHybrid{true} - -<span class="fu">\markdownBegin</span> -This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>. -<span class="fu">\markdownEnd</span> - -<span class="fu">\def</span>\markdownOptionUnderscores{false} -<span class="fu">\markdownBegin</span> -This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>. -<span class="fu">\markdownEnd</span> - -<span class="fu">\bye</span></code></pre></div> +<div class="sourceCode" id="cb233"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb233-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb233-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb233-3" data-line-number="3"></a> +<a class="sourceLine" id="cb233-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb233-5" data-line-number="5">This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>.</a> +<a class="sourceLine" id="cb233-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb233-7" data-line-number="7"></a> +<a class="sourceLine" id="cb233-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionUnderscores{false}</a> +<a class="sourceLine" id="cb233-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb233-10" data-line-number="10">This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>.</a> +<a class="sourceLine" id="cb233-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb233-12" data-line-number="12"></a> +<a class="sourceLine" id="cb233-13" data-line-number="13"><span class="fu">\bye</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">luatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb234"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb234-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p> <p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p> </blockquote> -<h6 id="latex-example-20" class="unnumbered">LaTeX example</h6> +<h5 id="latex-example-21" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="bu">\documentclass</span>{<span class="ex">article</span>} -<span class="bu">\usepackage</span>[hybrid]{<span class="ex">markdown</span>} -<span class="kw">\begin</span>{<span class="ex">document</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown</span>} -This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>. -<span class="kw">\end</span>{<span class="ex">markdown</span>} - -<span class="kw">\begin</span>{<span class="ex">markdown*</span>}{underscores=false} -This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>. -<span class="kw">\end</span>{<span class="ex">markdown*</span>} - -<span class="kw">\end</span>{<span class="ex">document</span>}</code></pre></div> +<div class="sourceCode" id="cb235"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb235-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb235-2" data-line-number="2"><span class="bu">\usepackage</span>[hybrid]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb235-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb235-4" data-line-number="4"></a> +<a class="sourceLine" id="cb235-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb235-6" data-line-number="6">This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>.</a> +<a class="sourceLine" id="cb235-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb235-8" data-line-number="8"></a> +<a class="sourceLine" id="cb235-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{underscores=false}</a> +<a class="sourceLine" id="cb235-10" data-line-number="10">This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>.</a> +<a class="sourceLine" id="cb235-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb235-12" data-line-number="12"></a> +<a class="sourceLine" id="cb235-13" data-line-number="13"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">lualatex</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb236"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb236-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p> <p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p> </blockquote> -<h6 id="context-example-17" class="unnumbered">ConTeXt example</h6> +<h5 id="context-example-18" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> <p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> -<div class="sourceCode"><pre class="sourceCode tex"><code class="sourceCode latex"><span class="fu">\usemodule</span>[t][markdown] -<span class="fu">\def</span>\markdownOptionHybrid{true} -<span class="fu">\starttext</span> - -<span class="fu">\startmarkdown</span> -This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\def</span>\markdownOptionUnderscores{false} -<span class="fu">\startmarkdown</span> -This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>. -<span class="fu">\stopmarkdown</span> - -<span class="fu">\stoptext</span></code></pre></div> +<div class="sourceCode" id="cb237"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb237-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb237-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb237-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb237-4" data-line-number="4"></a> +<a class="sourceLine" id="cb237-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb237-6" data-line-number="6">This is _emphasized text_ and this is a math subscript: <span class="ss">$m</span><span class="sc">\_</span><span class="ss">n$</span>.</a> +<a class="sourceLine" id="cb237-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb237-8" data-line-number="8"></a> +<a class="sourceLine" id="cb237-9" data-line-number="9"><span class="fu">\def</span>\markdownOptionUnderscores{false}</a> +<a class="sourceLine" id="cb237-10" data-line-number="10"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb237-11" data-line-number="11">This is *emphasized text* and this is a math subscript: <span class="ss">$m_n$</span>.</a> +<a class="sourceLine" id="cb237-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb237-13" data-line-number="13"></a> +<a class="sourceLine" id="cb237-14" data-line-number="14"><span class="fu">\stoptext</span></a></code></pre></div> <p>Next, invoke LuaTeX from the terminal:</p> -<div class="sourceCode"><pre class="sourceCode sh"><code class="sourceCode bash"><span class="ex">context</span> document.tex</code></pre></div> +<div class="sourceCode" id="cb238"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb238-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> <p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> <blockquote> <p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p> <p>This is <em>emphasized text</em> and this is a math subscript: <em>mₙ</em>.</p> </blockquote> -<h2 id="plain-tex"><span class="header-section-number">2.2</span> Plain TeX</h2> -<p>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 <em>token renderer</em> commands that define how the individual markdown elements will be typeset.</p> -<h3 id="interfaces-1"><span class="header-section-number">2.2.1</span> Interfaces</h3> -<!-- TODO --> -<h3 id="options-1"><span class="header-section-number">2.2.2</span> Options</h3> -<!-- TODO --> -<h3 id="token-renderers"><span class="header-section-number">2.2.3</span> Token renderers</h3> -<!-- TODO --> -<h2 id="latex"><span class="header-section-number">2.3</span> LaTeX</h2> -<p>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.</p> -<!-- TODO --> -<h3 id="interfaces-2"><span class="header-section-number">2.3.1</span> Interfaces</h3> -<!-- TODO --> -<h3 id="options-2"><span class="header-section-number">2.3.2</span> Options</h3> -<!-- TODO --> -<h3 id="token-renderers-1"><span class="header-section-number">2.3.3</span> Token renderers</h3> -<!-- TODO --> -<h2 id="context"><span class="header-section-number">2.4</span> ConTeXt</h2> -<p>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.</p> -<h3 id="interfaces-3"><span class="header-section-number">2.4.1</span> Interfaces</h3> -<!-- TODO --> -<h3 id="options-3"><span class="header-section-number">2.4.2</span> Options</h3> -<!-- TODO --> -<h3 id="token-renderers-2"><span class="header-section-number">2.4.3</span> Token renderers</h3> -<!-- TODO --> -<div class="footnotes"> +<h3 id="plain-tex-1"><span class="header-section-number">2.2.2</span> Plain <span class="tex">T<sub>e</sub>X</span></h3> +<p>Plain <span class="tex">T<sub>e</sub>X</span> options control the communication between the <span class="tex">T<sub>e</sub>X</span> interface and the <code>markdown</code> Lua module. They are supported by all higher-level interfaces of the Markdown package, i.e. the plain <span class="tex">T<sub>e</sub>X</span>, <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> and Con<span class="tex">T<sub>e</sub>X</span>t interfaces.</p> +<h4 id="file-and-directory-names"><span class="header-section-number">2.2.2.1</span> File and Directory Names</h4> +<p>The plain <span class="tex">T<sub>e</sub>X</span> interface provides the following commands that you can use to specify the location of temporary files produced during the conversion from Markdown to <span class="tex">T<sub>e</sub>X</span>:</p> +<ul> +<li><code>\markdownOptionHelperScriptFileName</code>,</li> +<li><code>\markdownOptionInputTempFileName</code>,</li> +<li><code>\markdownOptionOutputTempFileName</code>,</li> +<li><code>\markdownOptionErrorTempFileName</code>,</li> +<li><code>\markdownOptionOutputDir</code>, and</li> +<li><code>\markdownOptionCacheDir</code>.</li> +</ul> +<p>Using a text editor, create a folder named <code>output-directory</code> and a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb239"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb239-1" data-line-number="1"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb239-2" data-line-number="2"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb239-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionHelperScriptFileName{helper-script.lua}</a> +<a class="sourceLine" id="cb239-4" data-line-number="4"><span class="fu">\def</span>\markdownOptionInputTempFileName{temporary-input.md}</a> +<a class="sourceLine" id="cb239-5" data-line-number="5"><span class="fu">\def</span>\markdownOptionOutputTempFileName{temporary-output.tex}</a> +<a class="sourceLine" id="cb239-6" data-line-number="6"><span class="fu">\def</span>\markdownOptionErrorTempFileName{error-output.txt}</a> +<a class="sourceLine" id="cb239-7" data-line-number="7"><span class="fu">\def</span>\markdownOptionOutputDir{output-directory}</a> +<a class="sourceLine" id="cb239-8" data-line-number="8"><span class="fu">\def</span>\markdownOptionCacheDir{output-directory/cache-directory}</a> +<a class="sourceLine" id="cb239-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb239-10" data-line-number="10">Hello *world*!</a> +<a class="sourceLine" id="cb239-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb239-12" data-line-number="12"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb240"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb240-1" data-line-number="1"><span class="ex">luatex</span> --output-directory output-directory document.tex</a></code></pre></div> +<p>A text document named <code>temporary-input.md</code> should be produced in the folder named <code>output-directory</code> and contain the following text:</p> +<blockquote> +<p>Hello *world*!</p> +</blockquote> +<p>A folder named <code>output-directory/cache-directory</code> should also be produced and contain fragments of the converted markdown document. LuaTeX does not need other temporary files to perform the conversion from markdown to <span class="tex">T<sub>e</sub>X</span>. To produce the remaining temporary files, invoke pdfTeX from the terminal:</p> +<div class="sourceCode" id="cb241"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb241-1" data-line-number="1"><span class="ex">pdftex</span> --output-directory output-directory --shell-escape document.tex</a></code></pre></div> +<p>Text documents named <code>helper-script.lua</code>, and <code>temporary-output.md</code> should be produced in the folder named <code>output-directory</code>. The document named <code>helper-script.lua</code> will contain Lua code that was executed to convert markdown to plain <span class="tex">T<sub>e</sub>X</span>. The document named <code>temporary-output.tex</code> will contain the input markdown document converted to <span class="tex">T<sub>e</sub>X</span>.</p> +<p>No document named <code>error-output.txt</code> should be produced in the folder named <code>output-directory</code>. This document would only be produced if an error had occured while executing the Lua code. If this happens, please <a href="https://github.com/witiko/markdown/issues">file a bug</a>.</p> +<h4 id="package-documentation"><span class="header-section-number">2.2.2.2</span> Package Documentation</h4> +<p>The <code>\markdownOptionStripPercentSigns</code> macro controls whether a percent sign (<code>%</code>) at the beginning of a line will be discarded when reading Markdown input from a <span class="tex">T<sub>e</sub>X</span> document. This enables the use of markdown when writing <span class="tex">T<sub>e</sub>X</span> package documentation using the <a href="https://ctan.org/pkg/doc" title="doc – Format LaTeX documentation">Doc <span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> package</a> by Frank Mittelbach.</p> +<p>Using a text editor, create a text document named <code>document.dtx</code> with the following content:</p> +<div class="sourceCode" id="cb242"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb242-1" data-line-number="1"><span class="co">% \iffalse</span></a> +<a class="sourceLine" id="cb242-2" data-line-number="2"><span class="bu">\documentclass</span>{<span class="ex">ltxdoc</span>}</a> +<a class="sourceLine" id="cb242-3" data-line-number="3"><span class="bu">\usepackage</span>[stripPercentSigns]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb242-4" data-line-number="4"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb242-5" data-line-number="5"><span class="fu">\DocInput</span>{document.dtx}</a> +<a class="sourceLine" id="cb242-6" data-line-number="6"><span class="kw">\end</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb242-7" data-line-number="7"><span class="co">% \fi</span></a> +<a class="sourceLine" id="cb242-8" data-line-number="8"><span class="co">%</span></a> +<a class="sourceLine" id="cb242-9" data-line-number="9"><span class="co">% \begin{markdown}</span></a> +<a class="sourceLine" id="cb242-10" data-line-number="10"><span class="co">% Hello *world*!</span></a> +<a class="sourceLine" id="cb242-11" data-line-number="11"><span class="co">% \end{markdown}</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb243"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb243-1" data-line-number="1"><span class="ex">lualatex</span> document.dtx</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the text “Hello <em>world</em>!”</p> +<h2 id="markdown-tokens"><span class="header-section-number">2.3</span> Markdown Tokens</h2> +<p>A key feature of the Markdown package is the support for manipulating markdown tokens, such as headings, emphasized text, links, and lists, in <span class="tex">T<sub>e</sub>X</span>. Instead of reducing <span class="tex">T<sub>e</sub>X</span> to a PDF document producer, the Markdown package allows the user to specify how every markdown token should be processed and rendered.</p> +<h3 id="token-renderers"><span class="header-section-number">2.3.1</span> Token Renderers</h3> +<p>Token renderers are user-defined <span class="tex">T<sub>e</sub>X</span> macros, which render markdown tokens. In this section, I will describe the individual token renderers.</p> +<h4 id="interblock-separator-renderer"><span class="header-section-number">2.3.1.1</span> Interblock Separator Renderer</h4> +<p>The <code>\markdownRendererInterblockSeparator</code> macro represents a separator between two markdown block elements. The macro receives no arguments.</p> +<h5 id="plain-tex-example-11" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb244"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb244-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb244-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb244-3" data-line-number="3"> \par</a> +<a class="sourceLine" id="cb244-4" data-line-number="4"> {\it(The end of a block)}<span class="co">%</span></a> +<a class="sourceLine" id="cb244-5" data-line-number="5"> \par</a> +<a class="sourceLine" id="cb244-6" data-line-number="6">}</a> +<a class="sourceLine" id="cb244-7" data-line-number="7"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb244-8" data-line-number="8">Hello *world*!</a> +<a class="sourceLine" id="cb244-9" data-line-number="9"></a> +<a class="sourceLine" id="cb244-10" data-line-number="10">_Foo_ bar!</a> +<a class="sourceLine" id="cb244-11" data-line-number="11"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb244-12" data-line-number="12"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb245"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb245-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(The end of a block)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h5 id="latex-example-22" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb246"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb246-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb246-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb246-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb246-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb246-5" data-line-number="5"> interblockSeparator = {<span class="co">%</span></a> +<a class="sourceLine" id="cb246-6" data-line-number="6"> <span class="fu">\par</span></a> +<a class="sourceLine" id="cb246-7" data-line-number="7"> <span class="fu">\emph</span>{(The end of a block)}<span class="co">%</span></a> +<a class="sourceLine" id="cb246-8" data-line-number="8"> <span class="fu">\par</span></a> +<a class="sourceLine" id="cb246-9" data-line-number="9"> },</a> +<a class="sourceLine" id="cb246-10" data-line-number="10"> },</a> +<a class="sourceLine" id="cb246-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb246-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb246-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb246-14" data-line-number="14">Hello *world*!</a> +<a class="sourceLine" id="cb246-15" data-line-number="15"></a> +<a class="sourceLine" id="cb246-16" data-line-number="16">_Foo_ bar!</a> +<a class="sourceLine" id="cb246-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb246-18" data-line-number="18"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb247"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb247-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(The end of a block)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h5 id="context-example-19" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb248"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb248-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb248-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb248-3" data-line-number="3"> \par</a> +<a class="sourceLine" id="cb248-4" data-line-number="4"> \emph{(The end of a block)}<span class="co">%</span></a> +<a class="sourceLine" id="cb248-5" data-line-number="5"> \par</a> +<a class="sourceLine" id="cb248-6" data-line-number="6">}</a> +<a class="sourceLine" id="cb248-7" data-line-number="7"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb248-8" data-line-number="8"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb248-9" data-line-number="9">Hello *world*!</a> +<a class="sourceLine" id="cb248-10" data-line-number="10"></a> +<a class="sourceLine" id="cb248-11" data-line-number="11">_Foo_ bar!</a> +<a class="sourceLine" id="cb248-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb248-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb249"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb249-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(The end of a block)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h4 id="line-break-renderer"><span class="header-section-number">2.3.1.2</span> Line Break Renderer</h4> +<p>The <code>\markdownRendererLineBreak</code> macro represents a forced line break. The macro receives no arguments.</p> +<h5 id="plain-tex-example-12" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb250"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb250-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb250-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLineBreak{<span class="co">%</span></a> +<a class="sourceLine" id="cb250-3" data-line-number="3"> \par</a> +<a class="sourceLine" id="cb250-4" data-line-number="4"> {\it(A forced linebreak)}<span class="co">%</span></a> +<a class="sourceLine" id="cb250-5" data-line-number="5"> \par</a> +<a class="sourceLine" id="cb250-6" data-line-number="6">}</a> +<a class="sourceLine" id="cb250-7" data-line-number="7"><span class="fu">\markdownInput</span>{example.md}</a> +<a class="sourceLine" id="cb250-8" data-line-number="8"><span class="fu">\bye</span></a></code></pre></div> +<p>Using a text editor, create a text document named <code>example.md</code> with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the limitations of the <span class="tex">T<sub>e</sub>X</span> input processor, hard linebreaks would be ignored if we typed them directly into the <code>document.tex</code> document.</p> +<pre><code>Hello world! <br/>_Foo_ bar!</code></pre> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb251"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb251-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(A forced linebreak)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h5 id="latex-example-23" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb252"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb252-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb252-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb252-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb252-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb252-5" data-line-number="5"> lineBreak = {<span class="co">%</span></a> +<a class="sourceLine" id="cb252-6" data-line-number="6"> <span class="fu">\par</span></a> +<a class="sourceLine" id="cb252-7" data-line-number="7"> <span class="fu">\emph</span>{(A forced linebreak)}<span class="co">%</span></a> +<a class="sourceLine" id="cb252-8" data-line-number="8"> <span class="fu">\par</span></a> +<a class="sourceLine" id="cb252-9" data-line-number="9"> },</a> +<a class="sourceLine" id="cb252-10" data-line-number="10"> },</a> +<a class="sourceLine" id="cb252-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb252-12" data-line-number="12"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb252-13" data-line-number="13"><span class="fu">\markdownInput</span>{example.md}</a> +<a class="sourceLine" id="cb252-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Using a text editor, create a text document named <code>example.md</code> with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the limitations of the <span class="tex">T<sub>e</sub>X</span> input processor, hard linebreaks would be ignored if we typed them directly into the <code>document.tex</code> document.</p> +<pre><code>Hello world! <br/>_Foo_ bar!</code></pre> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb253"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb253-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(A forced linebreak)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h5 id="context-example-20" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb254"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb254-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb254-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLineBreak{<span class="co">%</span></a> +<a class="sourceLine" id="cb254-3" data-line-number="3"> \par</a> +<a class="sourceLine" id="cb254-4" data-line-number="4"> \emph{(A forced linebreak)}<span class="co">%</span></a> +<a class="sourceLine" id="cb254-5" data-line-number="5"> \par</a> +<a class="sourceLine" id="cb254-6" data-line-number="6">}</a> +<a class="sourceLine" id="cb254-7" data-line-number="7"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb254-8" data-line-number="8"><span class="fu">\markdownInput</span>{example.md}</a> +<a class="sourceLine" id="cb254-9" data-line-number="9"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Using a text editor, create a text document named <code>example.md</code> with the following content. Note the two spaces at the end of the first line, which specify a hard linebreak. Due to the limitations of the <span class="tex">T<sub>e</sub>X</span> input processor, hard linebreaks would be ignored if we typed them directly into the <code>document.tex</code> document.</p> +<pre><code>Hello world! <br/>_Foo_ bar!</code></pre> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb255"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb255-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(A forced linebreak)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h4 id="ellipsis-renderer"><span class="header-section-number">2.3.1.3</span> Ellipsis Renderer</h4> +<p>The <code>\markdownRendererEllipsis</code> macro replaces any occurance of ASCII ellipses in the input text. This macro will only be produced, when the <strong><code>smartEllipses</code></strong> option is <code>true</code>. The macro receives no arguments.</p> +<h5 id="plain-tex-example-13" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb256"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb256-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb256-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a> +<a class="sourceLine" id="cb256-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererEllipsis{{\it SHAZAM}!}</a> +<a class="sourceLine" id="cb256-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb256-5" data-line-number="5">The secret word is ...</a> +<a class="sourceLine" id="cb256-6" data-line-number="6"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb256-7" data-line-number="7"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb257"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb257-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>The secret word is <em>SHAZAM</em>!</p> +</blockquote> +<h5 id="latex-example-24" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb258"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb258-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb258-2" data-line-number="2"><span class="bu">\usepackage</span>[smartEllipses]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb258-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb258-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb258-5" data-line-number="5"> ellipsis = <span class="fu">\emph</span>{SHAZAM}!,</a> +<a class="sourceLine" id="cb258-6" data-line-number="6"> },</a> +<a class="sourceLine" id="cb258-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb258-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb258-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb258-10" data-line-number="10">The secret word is ...</a> +<a class="sourceLine" id="cb258-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb258-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb259"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb259-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>The secret word is <em>SHAZAM</em>!</p> +</blockquote> +<h5 id="context-example-21" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb260"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb260-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb260-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionSmartEllipses{true}</a> +<a class="sourceLine" id="cb260-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererEllipsis{\emph{SHAZAM}!}</a> +<a class="sourceLine" id="cb260-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb260-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb260-6" data-line-number="6">The secret word is ...</a> +<a class="sourceLine" id="cb260-7" data-line-number="7"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb260-8" data-line-number="8"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb261"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb261-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Hello <em>world</em>!</p> +<p><em>(The end of a block)</em></p> +<p><em>Foo</em> bar!</p> +</blockquote> +<h4 id="non-breaking-space-renderer"><span class="header-section-number">2.3.1.4</span> Non-Breaking Space Renderer</h4> +<p>The <code>\markdownRendererNbsp</code> macro represents a non-breaking space.</p> +<h5 id="latex-example-25" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.bib</code> with the following content:</p> +<div class="sourceCode" id="cb262"><pre class="sourceCode bib"><code class="sourceCode bibtex"><a class="sourceLine" id="cb262-1" data-line-number="1"><span class="va">@book</span>{<span class="ot">knuth:tex</span>,</a> +<a class="sourceLine" id="cb262-2" data-line-number="2"> <span class="dt">author</span> = "<span class="st">Knuth, Donald Ervin</span>",</a> +<a class="sourceLine" id="cb262-3" data-line-number="3"> <span class="dt">title</span> = "<span class="st">The </span><span class="ch">\TeX</span><span class="st"> book, volume A of Computers and typesetting</span>",</a> +<a class="sourceLine" id="cb262-4" data-line-number="4"> <span class="dt">publisher</span> = "<span class="st">Addison-Wesley</span>",</a> +<a class="sourceLine" id="cb262-5" data-line-number="5"> <span class="dt">year</span> = "<span class="st">1984</span>"</a> +<a class="sourceLine" id="cb262-6" data-line-number="6">}</a></code></pre></div> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb263"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb263-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb263-2" data-line-number="2"><span class="bu">\usepackage</span>[</a> +<a class="sourceLine" id="cb263-3" data-line-number="3"> citations,</a> +<a class="sourceLine" id="cb263-4" data-line-number="4"> citationNbsps,</a> +<a class="sourceLine" id="cb263-5" data-line-number="5">]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb263-6" data-line-number="6"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb263-7" data-line-number="7"> renderers = {</a> +<a class="sourceLine" id="cb263-8" data-line-number="8"> nbsp = {<span class="ss">$</span><span class="sc">\cdot</span><span class="ss">$</span>},</a> +<a class="sourceLine" id="cb263-9" data-line-number="9"> },</a> +<a class="sourceLine" id="cb263-10" data-line-number="10">}</a> +<a class="sourceLine" id="cb263-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb263-12" data-line-number="12"></a> +<a class="sourceLine" id="cb263-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb263-14" data-line-number="14">The TeXbook [@knuth:tex, p. 123 and 130] is good.</a> +<a class="sourceLine" id="cb263-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb263-16" data-line-number="16"></a> +<a class="sourceLine" id="cb263-17" data-line-number="17"><span class="bu">\bibliographystyle</span>{<span class="ex">plain</span>}</a> +<a class="sourceLine" id="cb263-18" data-line-number="18"><span class="bu">\bibliography</span>{<span class="ex">document.bib</span>}</a> +<a class="sourceLine" id="cb263-19" data-line-number="19"></a> +<a class="sourceLine" id="cb263-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX and BibTeX from the terminal:</p> +<div class="sourceCode" id="cb264"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb264-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a> +<a class="sourceLine" id="cb264-2" data-line-number="2"><span class="ex">bibtex</span> document.aux</a> +<a class="sourceLine" id="cb264-3" data-line-number="3"><span class="ex">lualatex</span> document.tex</a> +<a class="sourceLine" id="cb264-4" data-line-number="4"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>The TeXbook [1, p.·123·and·130] is good.</p> +<h3 id="references-2">References</h3> +<p>[1] Donald Ervin Knuth. <em>The TeXbook, volume A of Computers and typesetting.</em> Addison-Wesley, 1984.</p> +</blockquote> +<h4 id="special-character-renderers"><span class="header-section-number">2.3.1.5</span> Special Character Renderers</h4> +<p>The following macros replace any special plain <span class="tex">T<sub>e</sub>X</span> characters, including the active pipe character (<code>|</code>) of Con<span class="tex">T<sub>e</sub>X</span>t, in the input text:</p> +<ul> +<li><code>\markdownRendererAmpersand</code> replaces the ampersand (<code>&</code>).</li> +<li><code>\markdownRendererBackslash</code> replaces the backslash (<code>\</code>).</li> +<li><code>\markdownRendererCircumflex</code> replaces the circumflex (<code>^</code>).</li> +<li><code>\markdownRendererDollarSign</code> replaces the dollar sign (<code>$</code>).</li> +<li><code>\markdownRendererHash</code> replaces the hash sign (<code>#</code>).</li> +<li><code>\markdownRendererLeftBrace</code> replaces the left brace (<code>{</code>).</li> +<li><code>\markdownRendererPercentSign</code> replaces the percent sign (<code>%</code>).</li> +<li><code>\markdownRendererPipe</code> replaces the pipe character (<code>|</code>).</li> +<li><code>\markdownRendererRightBrace</code> replaces the right brace (<code>}</code>).</li> +<li><code>\markdownRendererTilde</code> replaces the tilde (<code>~</code>).</li> +<li><code>\markdownRendererUnderscore</code> replaces the underscore (<code>_</code>).</li> +</ul> +<h5 id="plain-tex-example-14" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content. We will make the tilde behave as if it were written in <span class="tex">T<sub>e</sub>X</span>, where it represents a non-breaking space.</p> +<div class="sourceCode" id="cb265"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb265-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb265-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTilde{~}</a> +<a class="sourceLine" id="cb265-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb265-4" data-line-number="4">Bartel~Leendert van~der~Waerden</a> +<a class="sourceLine" id="cb265-5" data-line-number="5"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb265-6" data-line-number="6"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb266"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb266-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p> +<blockquote> +<p>Bartel·Leendert van·der·Waerden</p> +</blockquote> +<h5 id="latex-example-26" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content. We will make the tilde behave as if it were written in <span class="tex">T<sub>e</sub>X</span>, where it represents a non-breaking space.</p> +<div class="sourceCode" id="cb267"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb267-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb267-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb267-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb267-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb267-5" data-line-number="5"> tilde = ~,</a> +<a class="sourceLine" id="cb267-6" data-line-number="6"> },</a> +<a class="sourceLine" id="cb267-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb267-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb267-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb267-10" data-line-number="10">Bartel~Leendert van~der~Waerden</a> +<a class="sourceLine" id="cb267-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb267-12" data-line-number="12"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb268"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb268-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p> +<blockquote> +<p>Bartel·Leendert van·der·Waerden</p> +</blockquote> +<h5 id="context-example-22" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content. We will make the tilde behave as if it were written in <span class="tex">T<sub>e</sub>X</span>, where it represents a non-breaking space.</p> +<div class="sourceCode" id="cb269"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb269-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb269-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTilde{~}</a> +<a class="sourceLine" id="cb269-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb269-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb269-5" data-line-number="5">Bartel~Leendert van~der~Waerden</a> +<a class="sourceLine" id="cb269-6" data-line-number="6"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb269-7" data-line-number="7"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb270"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb270-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text, where the middot (<code>·</code>) denotes a non-breakable space:</p> +<blockquote> +<p>Bartel·Leendert van·der·Waerden</p> +</blockquote> +<h4 id="code-span-renderer"><span class="header-section-number">2.3.1.6</span> Code Span Renderer</h4> +<p>The <code>\markdownRendererCodeSpan</code> macro represents inlined code span in the input text. It receives a single argument that corresponds to the inlined code span.</p> +<h5 id="plain-tex-example-15" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb271"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb271-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb271-2" data-line-number="2"><span class="fu">\input</span> lmfonts</a> +<a class="sourceLine" id="cb271-3" data-line-number="3"></a> +<a class="sourceLine" id="cb271-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererCodeSpan#1{#1}</a> +<a class="sourceLine" id="cb271-5" data-line-number="5"></a> +<a class="sourceLine" id="cb271-6" data-line-number="6"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb271-7" data-line-number="7">`<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>`</a> +<a class="sourceLine" id="cb271-8" data-line-number="8"></a> +<a class="sourceLine" id="cb271-9" data-line-number="9"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb271-10" data-line-number="10"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb271-11" data-line-number="11"></a> +<a class="sourceLine" id="cb271-12" data-line-number="12"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb271-13" data-line-number="13"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb271-14" data-line-number="14"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb271-15" data-line-number="15"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb271-16" data-line-number="16"></a> +<a class="sourceLine" id="cb271-17" data-line-number="17"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb272"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb272-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ *equals* $i$.</p> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<h5 id="latex-example-27" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb273"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb273-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb273-2" data-line-number="2"><span class="bu">\usepackage</span>[smartEllipses]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb273-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb273-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb273-5" data-line-number="5"> codeSpan = {#1},</a> +<a class="sourceLine" id="cb273-6" data-line-number="6"> },</a> +<a class="sourceLine" id="cb273-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb273-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb273-9" data-line-number="9"></a> +<a class="sourceLine" id="cb273-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb273-11" data-line-number="11">`<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>`</a> +<a class="sourceLine" id="cb273-12" data-line-number="12"></a> +<a class="sourceLine" id="cb273-13" data-line-number="13"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb273-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb273-15" data-line-number="15"></a> +<a class="sourceLine" id="cb273-16" data-line-number="16"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{hybrid}</a> +<a class="sourceLine" id="cb273-17" data-line-number="17"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb273-18" data-line-number="18"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb273-19" data-line-number="19"></a> +<a class="sourceLine" id="cb273-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb274"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb274-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ *equals* $i$.</p> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<h5 id="context-example-23" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb275"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb275-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb275-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererCodeSpan#1{#1}</a> +<a class="sourceLine" id="cb275-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb275-4" data-line-number="4"></a> +<a class="sourceLine" id="cb275-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb275-6" data-line-number="6">`<span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span>`</a> +<a class="sourceLine" id="cb275-7" data-line-number="7"></a> +<a class="sourceLine" id="cb275-8" data-line-number="8"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb275-9" data-line-number="9"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb275-10" data-line-number="10"></a> +<a class="sourceLine" id="cb275-11" data-line-number="11"><span class="fu">\def</span>\markdownOptionHybrid{true}</a> +<a class="sourceLine" id="cb275-12" data-line-number="12"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb275-13" data-line-number="13"><span class="ss">$</span><span class="sc">\sqrt</span><span class="ss">{-1}$</span> *equals* <span class="ss">$i$</span></a> +<a class="sourceLine" id="cb275-14" data-line-number="14"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb275-15" data-line-number="15"></a> +<a class="sourceLine" id="cb275-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb276"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb276-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>$\sqrt{-1}$ *equals* $i$.</p> +<p>$\sqrt{-1}$ <em>equals</em> $i$.</p> +<p>√-̅1̅ <em>equals</em> <span class="math inline"><em>i</em></span>.</p> +</blockquote> +<h4 id="link-renderer"><span class="header-section-number">2.3.1.7</span> Link Renderer</h4> +<p>The <code>\markdownRendererLink</code> macro represents a hyperlink. It receives four arguments: the label, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the link.</p> +<h5 id="plain-tex-example-16" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb277"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb277-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb277-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLink#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb277-3" data-line-number="3"> #1 {\tt#2} titled {\it#4}<span class="co">%</span></a> +<a class="sourceLine" id="cb277-4" data-line-number="4">}</a> +<a class="sourceLine" id="cb277-5" data-line-number="5"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb277-6" data-line-number="6">Please visit [the link][ctan].</a> +<a class="sourceLine" id="cb277-7" data-line-number="7"></a> +<a class="sourceLine" id="cb277-8" data-line-number="8"> [ctan]: https://ctan.org/</a> +<a class="sourceLine" id="cb277-9" data-line-number="9"> (the Comprehensive TeX Archive Network)</a> +<a class="sourceLine" id="cb277-10" data-line-number="10"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb277-11" data-line-number="11"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb278"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb278-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Please visit the link <a href="https://ctan.org/" class="uri">https://ctan.org/</a> titled <em>the Comprehensive TeX Archive Network</em>.</p> +</blockquote> +<h5 id="latex-example-28" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb279"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb279-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb279-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb279-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb279-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb279-5" data-line-number="5"> link = {<span class="co">%</span></a> +<a class="sourceLine" id="cb279-6" data-line-number="6"> #1 <span class="fu">\texttt</span>{#2} titled <span class="fu">\emph</span>{#4}<span class="co">%</span></a> +<a class="sourceLine" id="cb279-7" data-line-number="7"> },</a> +<a class="sourceLine" id="cb279-8" data-line-number="8"> },</a> +<a class="sourceLine" id="cb279-9" data-line-number="9">}</a> +<a class="sourceLine" id="cb279-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb279-11" data-line-number="11"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb279-12" data-line-number="12">Please visit [the link][ctan].</a> +<a class="sourceLine" id="cb279-13" data-line-number="13"></a> +<a class="sourceLine" id="cb279-14" data-line-number="14"> [ctan]: https://ctan.org/</a> +<a class="sourceLine" id="cb279-15" data-line-number="15"> (the Comprehensive TeX Archive Network)</a> +<a class="sourceLine" id="cb279-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb279-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb280"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb280-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Please visit the link <a href="https://ctan.org/" class="uri">https://ctan.org/</a> titled <em>the Comprehensive TeX Archive Network</em>.</p> +</blockquote> +<h5 id="context-example-24" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb281"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb281-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb281-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererLink#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb281-3" data-line-number="3"> #1 {\tt#2} titled \emph{#4}<span class="co">%</span></a> +<a class="sourceLine" id="cb281-4" data-line-number="4">}</a> +<a class="sourceLine" id="cb281-5" data-line-number="5"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb281-6" data-line-number="6"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb281-7" data-line-number="7">Please visit [the link][ctan].</a> +<a class="sourceLine" id="cb281-8" data-line-number="8"></a> +<a class="sourceLine" id="cb281-9" data-line-number="9"> [ctan]: https://ctan.org/</a> +<a class="sourceLine" id="cb281-10" data-line-number="10"> (the Comprehensive TeX Archive Network)</a> +<a class="sourceLine" id="cb281-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb281-12" data-line-number="12"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb282"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb282-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Please visit the link <a href="https://ctan.org/" class="uri">https://ctan.org/</a> titled <em>the Comprehensive TeX Archive Network</em>.</p> +</blockquote> +<h4 id="image-renderer"><span class="header-section-number">2.3.1.8</span> Image Renderer</h4> +<p>The <code>\markdownRendererImage</code> macro represents an image. It receives four arguments: the label, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the link.</p> +<h5 id="latex-example-29" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb283"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb283-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb283-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb283-3" data-line-number="3"><span class="fu">\begingroup</span></a> +<a class="sourceLine" id="cb283-4" data-line-number="4"><span class="fu">\catcode</span>`<span class="fu">\@</span>=11</a> +<a class="sourceLine" id="cb283-5" data-line-number="5"><span class="fu">\catcode</span>`<span class="fu">\%</span>=12</a> +<a class="sourceLine" id="cb283-6" data-line-number="6"><span class="fu">\catcode</span>`<span class="fu">\^</span>^A=14</a> +<a class="sourceLine" id="cb283-7" data-line-number="7"><span class="fu">\global\def</span>\markdownRendererImage#1#2#3#4{^^A</a> +<a class="sourceLine" id="cb283-8" data-line-number="8"> \immediate\write18{^^A</a> +<a class="sourceLine" id="cb283-9" data-line-number="9"> if printf '<span class="co">%s' "#3" | grep -q ^http; then</span></a> +<a class="sourceLine" id="cb283-10" data-line-number="10"> OUTPUT="$(printf '<span class="co">%s' "#3" | md5sum | cut -d' ' -f1).^^A</span></a> +<a class="sourceLine" id="cb283-11" data-line-number="11"> $(printf '<span class="co">%s' "#3" | sed 's/.*[.]//')";</span></a> +<a class="sourceLine" id="cb283-12" data-line-number="12"> if ! [ -e "$OUTPUT" ]; then</a> +<a class="sourceLine" id="cb283-13" data-line-number="13"> wget -O "$OUTPUT" '#3' || rm "$OUTPUT";</a> +<a class="sourceLine" id="cb283-14" data-line-number="14"> convert "$OUTPUT" png:"$OUTPUT";</a> +<a class="sourceLine" id="cb283-15" data-line-number="15"> fi;</a> +<a class="sourceLine" id="cb283-16" data-line-number="16"> printf '<span class="co">%s%%' "$OUTPUT" > \jobname.fetched;</span></a> +<a class="sourceLine" id="cb283-17" data-line-number="17"> else</a> +<a class="sourceLine" id="cb283-18" data-line-number="18"> printf '<span class="co">%s%%' "#3" > \jobname.fetched;</span></a> +<a class="sourceLine" id="cb283-19" data-line-number="19"> fi^^A</a> +<a class="sourceLine" id="cb283-20" data-line-number="20"> }^^A</a> +<a class="sourceLine" id="cb283-21" data-line-number="21"> {^^A</a> +<a class="sourceLine" id="cb283-22" data-line-number="22"> \everyeof={\noexpand}^^A</a> +<a class="sourceLine" id="cb283-23" data-line-number="23"> \edef\filename{\@@input"\jobname.fetched" }^^A</a> +<a class="sourceLine" id="cb283-24" data-line-number="24"> \includegraphics[width=\textwidth]{\filename}^^A</a> +<a class="sourceLine" id="cb283-25" data-line-number="25"> }^^A</a> +<a class="sourceLine" id="cb283-26" data-line-number="26">}</a> +<a class="sourceLine" id="cb283-27" data-line-number="27"><span class="fu">\endgroup</span></a> +<a class="sourceLine" id="cb283-28" data-line-number="28"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb283-29" data-line-number="29"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb283-30" data-line-number="30">![TUGboat](https://tug.org/tugboat/noword.jpg)</a> +<a class="sourceLine" id="cb283-31" data-line-number="31"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb283-32" data-line-number="32"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb284"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb284-1" data-line-number="1"><span class="ex">lualatex</span> --shell-escape document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following content. This assumes that you use a Unix-like operating system with Bourne or Bourne again shell as the default shell of the current user. It also assumes that the <code>md5sum</code>, <code>wget</code>, and <code>convert</code> binaries are installed and that the <span class="tex">T<sub>e</sub>X</span> engine has shell access.</p> +<blockquote> +<p><img src="https://tug.org/tugboat/noword.jpg" title="The Communications of the TeX Users Group" /></p> +</blockquote> +<h4 id="content-block-renderers"><span class="header-section-number">2.3.1.9</span> Content Block Renderers</h4> +<p> The <code>\markdownRendererContentBlock</code> macro represents an iA Writer content block. It receives four arguments: the local file or online image filename extension cast to the lower case, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the content block.</p> +<p>The <code>\markdownRendererContentBlockOnlineImage</code> macro represents an iA Writer online image content block. The macro receives the same arguments as <code>\markdownRendererContentBlock</code>.</p> +<p>The <code>\markdownRendererContentBlockCode</code> macro represents an iA Writer content block that was recognized as a file in a known programming language by its filename extension <span class="math inline"><em>s</em></span>. If any <code>markdown-languages.json</code> file found by contains a record <span class="math inline">(<em>k</em>, <em>v</em>)</span>, then a non-online-image content block with the filename extension <span class="math inline"><em>s</em>, <em>s</em></span><code>:lower()</code><span class="math inline"> = <em>k</em></span> is considered to be in a known programming language <span class="math inline"><em>v</em></span>. The macro receives five arguments: the local file name extension <span class="math inline"><em>s</em></span> cast to the lower case, the language <span class="math inline"><em>v</em></span>, the fully escaped <abbr>uri</abbr> that can be directly typeset, the raw <abbr>uri</abbr> that can be used outside typesetting, and the title of the content block.</p> +<p>Note that you will need to place place a <code>markdown-languages.json</code> file inside your working directory or inside your local <span class="tex">T<sub>e</sub>X</span> directory structure. In this file, you will define a mapping between filename extensions and the language names recognized by your favorite syntax highlighter; there may exist other creative uses beside syntax highlighting. <a href="https://github.com/iainc/Markdown-Content-Blocks" title="File transclusion syntax for Markdown">The <code>Languages.json</code> file provided by Anton Sotkov</a> is a good starting point.</p> +<h5 id="plain-tex-example-17" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb285"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb285-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb285-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a> +<a class="sourceLine" id="cb285-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererContentBlock#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb285-4" data-line-number="4"> This is {\tt #2}, #4.</a> +<a class="sourceLine" id="cb285-5" data-line-number="5">}</a> +<a class="sourceLine" id="cb285-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererContentBlockOnlineImage#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb285-7" data-line-number="7"> This is the image {\tt #2}, #4.</a> +<a class="sourceLine" id="cb285-8" data-line-number="8">}</a> +<a class="sourceLine" id="cb285-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererContentBlockCode#1#2#3#4#5{<span class="co">%</span></a> +<a class="sourceLine" id="cb285-10" data-line-number="10"> This is the #2 (\uppercase{#1}) document {\tt #3}, #5.</a> +<a class="sourceLine" id="cb285-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb285-12" data-line-number="12"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb285-13" data-line-number="13">/document.tex (the document that we are currently typesetting)</a> +<a class="sourceLine" id="cb285-14" data-line-number="14">/markdown-languages.json (the mapping between filename extensions</a> +<a class="sourceLine" id="cb285-15" data-line-number="15"> and programming language names)</a> +<a class="sourceLine" id="cb285-16" data-line-number="16">https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)</a> +<a class="sourceLine" id="cb285-17" data-line-number="17"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb285-18" data-line-number="18"><span class="fu">\bye</span></a></code></pre></div> +<p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p> +<div class="sourceCode" id="cb286"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb286-1" data-line-number="1"><span class="op">{</span></a> +<a class="sourceLine" id="cb286-2" data-line-number="2"> <span class="st">"json"</span><span class="op">:</span> <span class="st">"JavaScript Object Notation"</span><span class="op">,</span></a> +<a class="sourceLine" id="cb286-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb287"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb287-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is <code>document.tex</code>, the document that we are currently typesetting.</p> +<p>This is the JavaScript Object Notation (JSON) document <code>markdown-languages.json</code>, the mapping between filename extensions and programming language names.</p> +<p>This is the image <code>https://tug.org/tugboat/noword.jpg</code>, the logotype of TUGboat.</p> +</blockquote> +<h5 id="latex-example-30" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb288"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb288-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb288-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">filecontents</span>}</a> +<a class="sourceLine" id="cb288-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">filecontents*</span>}{markdown-languages.json}</a> +<a class="sourceLine" id="cb288-4" data-line-number="4">{</a> +<a class="sourceLine" id="cb288-5" data-line-number="5"> "json": "JavaScript Object Notation",</a> +<a class="sourceLine" id="cb288-6" data-line-number="6">}</a> +<a class="sourceLine" id="cb288-7" data-line-number="7"><span class="kw">\end</span>{<span class="ex">filecontents*</span>}</a> +<a class="sourceLine" id="cb288-8" data-line-number="8"><span class="bu">\usepackage</span>[contentBlocks]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb288-9" data-line-number="9"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb288-10" data-line-number="10"> renderers = {</a> +<a class="sourceLine" id="cb288-11" data-line-number="11"> contentBlock = {This is <span class="fu">\texttt</span>{#2}, #4.},</a> +<a class="sourceLine" id="cb288-12" data-line-number="12"> contentBlockOnlineImage = {This is the image <span class="fu">\texttt</span>{#2}, #4.},</a> +<a class="sourceLine" id="cb288-13" data-line-number="13"> contentBlockCode = {<span class="co">%</span></a> +<a class="sourceLine" id="cb288-14" data-line-number="14"> This is the #2 (<span class="fu">\MakeUppercase</span>{#1}) document <span class="fu">\texttt</span>{#3}, #5.</a> +<a class="sourceLine" id="cb288-15" data-line-number="15"> },</a> +<a class="sourceLine" id="cb288-16" data-line-number="16"> },</a> +<a class="sourceLine" id="cb288-17" data-line-number="17">}</a> +<a class="sourceLine" id="cb288-18" data-line-number="18"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb288-19" data-line-number="19"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb288-20" data-line-number="20">/document.tex (the document that we are currently typesetting)</a> +<a class="sourceLine" id="cb288-21" data-line-number="21">/markdown-languages.json (the mapping between filename extensions</a> +<a class="sourceLine" id="cb288-22" data-line-number="22"> and programming language names)</a> +<a class="sourceLine" id="cb288-23" data-line-number="23">https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)</a> +<a class="sourceLine" id="cb288-24" data-line-number="24"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb288-25" data-line-number="25"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb289"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb289-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is <code>document.tex</code>, the document that we are currently typesetting.</p> +<p>This is the JavaScript Object Notation (JSON) document <code>markdown-languages.json</code>, the mapping between filename extensions and programming language names.</p> +<p>This is the image <code>https://tug.org/tugboat/noword.jpg</code>, the logotype of TUGboat.</p> +</blockquote> +<h5 id="context-example-25" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb290"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb290-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb290-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionContentBlocks{true}</a> +<a class="sourceLine" id="cb290-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererContentBlock#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb290-4" data-line-number="4"> This is {\tt #2}, #4.</a> +<a class="sourceLine" id="cb290-5" data-line-number="5">}</a> +<a class="sourceLine" id="cb290-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererContentBlockOnlineImage#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb290-7" data-line-number="7"> This is the image {\tt #2}, #4.</a> +<a class="sourceLine" id="cb290-8" data-line-number="8">}</a> +<a class="sourceLine" id="cb290-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererContentBlockCode#1#2#3#4#5{<span class="co">%</span></a> +<a class="sourceLine" id="cb290-10" data-line-number="10"> This is the #2 (\uppercase{#1}) document {\tt #3}, #5.</a> +<a class="sourceLine" id="cb290-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb290-12" data-line-number="12"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb290-13" data-line-number="13"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb290-14" data-line-number="14">/document.tex (the document that we are currently typesetting)</a> +<a class="sourceLine" id="cb290-15" data-line-number="15">/markdown-languages.json (the mapping between filename extensions</a> +<a class="sourceLine" id="cb290-16" data-line-number="16"> and programming language names)</a> +<a class="sourceLine" id="cb290-17" data-line-number="17">https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)</a> +<a class="sourceLine" id="cb290-18" data-line-number="18"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb290-19" data-line-number="19"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Create also a text document named <code>markdown-languages.json</code> with the following content:</p> +<div class="sourceCode" id="cb291"><pre class="sourceCode js"><code class="sourceCode javascript"><a class="sourceLine" id="cb291-1" data-line-number="1"><span class="op">{</span></a> +<a class="sourceLine" id="cb291-2" data-line-number="2"> <span class="st">"json"</span><span class="op">:</span> <span class="st">"JavaScript Object Notation"</span><span class="op">,</span></a> +<a class="sourceLine" id="cb291-3" data-line-number="3"><span class="op">}</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb292"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb292-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is <code>document.tex</code>, the document that we are currently typesetting.</p> +<p>This is the JavaScript Object Notation (JSON) document <code>markdown-languages.json</code>, the mapping between filename extensions and programming language names.</p> +<p>This is the image <code>https://tug.org/tugboat/noword.jpg</code>, the logotype of TUGboat.</p> +</blockquote> +<h4 id="bullet-list-renderers"><span class="header-section-number">2.3.1.10</span> Bullet List Renderers</h4> +<p>The <code>\markdownRendererUlBegin</code> macro represents the beginning of a bulleted list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p> +<p>The <code>\markdownRendererUlBeginTight</code> macro represents the beginning of a bulleted list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<p>The <code>\markdownRendererUlItem</code> macro represents an item in a bulleted list. The macro receives no arguments.</p> +<p>The <code>\markdownRendererUlItemEnd</code> macro represents the end of an item in a bulleted list. The macro receives no arguments.</p> +<p>The <code>\markdownRendererUlEnd</code> macro represents the end of a bulleted list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p> +<p>The <code>\markdownRendererUlEndTight</code> macro represents the end of a bulleted list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<h5 id="plain-tex-example-18" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb293"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb293-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb293-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a> +<a class="sourceLine" id="cb293-3" data-line-number="3"></a> +<a class="sourceLine" id="cb293-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a> +<a class="sourceLine" id="cb293-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererUlBeginTight{ (}</a> +<a class="sourceLine" id="cb293-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererUlItem{<span class="co">%</span></a> +<a class="sourceLine" id="cb293-7" data-line-number="7"> \def\markdownRendererUlItem{<span class="co">%</span></a> +<a class="sourceLine" id="cb293-8" data-line-number="8"> ,</a> +<a class="sourceLine" id="cb293-9" data-line-number="9"> \def\markdownRendererUlItem{, and }<span class="co">%</span></a> +<a class="sourceLine" id="cb293-10" data-line-number="10"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb293-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb293-12" data-line-number="12"><span class="fu">\def</span>\markdownRendererUlItemEnd{}</a> +<a class="sourceLine" id="cb293-13" data-line-number="13"><span class="fu">\def</span>\markdownRendererUlEndTight{).}</a> +<a class="sourceLine" id="cb293-14" data-line-number="14"></a> +<a class="sourceLine" id="cb293-15" data-line-number="15"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb293-16" data-line-number="16">This is a tight list</a> +<a class="sourceLine" id="cb293-17" data-line-number="17"></a> +<a class="sourceLine" id="cb293-18" data-line-number="18">- the first item</a> +<a class="sourceLine" id="cb293-19" data-line-number="19">- the second item</a> +<a class="sourceLine" id="cb293-20" data-line-number="20">- the third item</a> +<a class="sourceLine" id="cb293-21" data-line-number="21"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb293-22" data-line-number="22"></a> +<a class="sourceLine" id="cb293-23" data-line-number="23"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb293-24" data-line-number="24"> :\par</a> +<a class="sourceLine" id="cb293-25" data-line-number="25"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb293-26" data-line-number="26">}</a> +<a class="sourceLine" id="cb293-27" data-line-number="27"><span class="fu">\def</span>\markdownRendererUlBegin{}</a> +<a class="sourceLine" id="cb293-28" data-line-number="28"><span class="fu">\def</span>\markdownRendererUlItem{--\kern 0.5em}</a> +<a class="sourceLine" id="cb293-29" data-line-number="29"><span class="fu">\def</span>\markdownRendererUlItemEnd{.\par}</a> +<a class="sourceLine" id="cb293-30" data-line-number="30"><span class="fu">\def</span>\markdownRendererUlEnd{}</a> +<a class="sourceLine" id="cb293-31" data-line-number="31"></a> +<a class="sourceLine" id="cb293-32" data-line-number="32"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb293-33" data-line-number="33">This is a loose list</a> +<a class="sourceLine" id="cb293-34" data-line-number="34"></a> +<a class="sourceLine" id="cb293-35" data-line-number="35">- This is the first item</a> +<a class="sourceLine" id="cb293-36" data-line-number="36"></a> +<a class="sourceLine" id="cb293-37" data-line-number="37">- This is the second item</a> +<a class="sourceLine" id="cb293-38" data-line-number="38"></a> +<a class="sourceLine" id="cb293-39" data-line-number="39">- This is the third item</a> +<a class="sourceLine" id="cb293-40" data-line-number="40"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb293-41" data-line-number="41"></a> +<a class="sourceLine" id="cb293-42" data-line-number="42"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb294"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb294-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight list (the first item, the second item, and the third item).</p> +<p>This is a loose list:</p> +<ul> +<li><p>This is the first item.</p></li> +<li><p>This is the second item.</p></li> +<li><p>This is the third item.</p></li> +</ul> +</blockquote> +<h5 id="latex-example-31" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb295"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb295-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb295-2" data-line-number="2"><span class="bu">\usepackage</span>[tightLists]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb295-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb295-4" data-line-number="4"></a> +<a class="sourceLine" id="cb295-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb295-6" data-line-number="6"> renderers = {</a> +<a class="sourceLine" id="cb295-7" data-line-number="7"> interblockSeparator = {},</a> +<a class="sourceLine" id="cb295-8" data-line-number="8"> ulBeginTight = { (},</a> +<a class="sourceLine" id="cb295-9" data-line-number="9"> ulItem = {<span class="co">%</span></a> +<a class="sourceLine" id="cb295-10" data-line-number="10"> <span class="fu">\def</span>\markdownRendererUlItem{<span class="co">%</span></a> +<a class="sourceLine" id="cb295-11" data-line-number="11"> ,</a> +<a class="sourceLine" id="cb295-12" data-line-number="12"> \def\markdownRendererUlItem{, and }<span class="co">%</span></a> +<a class="sourceLine" id="cb295-13" data-line-number="13"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb295-14" data-line-number="14"> },</a> +<a class="sourceLine" id="cb295-15" data-line-number="15"> ulItemEnd = {},</a> +<a class="sourceLine" id="cb295-16" data-line-number="16"> ulEndTight = {).},</a> +<a class="sourceLine" id="cb295-17" data-line-number="17"> },</a> +<a class="sourceLine" id="cb295-18" data-line-number="18">}</a> +<a class="sourceLine" id="cb295-19" data-line-number="19">This is a tight list</a> +<a class="sourceLine" id="cb295-20" data-line-number="20"></a> +<a class="sourceLine" id="cb295-21" data-line-number="21">- the first item</a> +<a class="sourceLine" id="cb295-22" data-line-number="22">- the second item</a> +<a class="sourceLine" id="cb295-23" data-line-number="23">- the third item</a> +<a class="sourceLine" id="cb295-24" data-line-number="24"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb295-25" data-line-number="25"></a> +<a class="sourceLine" id="cb295-26" data-line-number="26"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb295-27" data-line-number="27"> renderers = {</a> +<a class="sourceLine" id="cb295-28" data-line-number="28"> interblockSeparator = {<span class="co">%</span></a> +<a class="sourceLine" id="cb295-29" data-line-number="29"> :<span class="fu">\par</span></a> +<a class="sourceLine" id="cb295-30" data-line-number="30"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb295-31" data-line-number="31"> },</a> +<a class="sourceLine" id="cb295-32" data-line-number="32"> ulBeginTight = {<span class="kw">\begin</span>{<span class="ex">itemize</span>}},</a> +<a class="sourceLine" id="cb295-33" data-line-number="33"> ulItem = {<span class="fu">\item</span>},</a> +<a class="sourceLine" id="cb295-34" data-line-number="34"> ulItemEnd = {.},</a> +<a class="sourceLine" id="cb295-35" data-line-number="35"> ulEnd = {<span class="kw">\end</span>{<span class="ex">itemize</span>}},</a> +<a class="sourceLine" id="cb295-36" data-line-number="36"> },</a> +<a class="sourceLine" id="cb295-37" data-line-number="37">}</a> +<a class="sourceLine" id="cb295-38" data-line-number="38">This is a loose list</a> +<a class="sourceLine" id="cb295-39" data-line-number="39"></a> +<a class="sourceLine" id="cb295-40" data-line-number="40">- This is the first item</a> +<a class="sourceLine" id="cb295-41" data-line-number="41"></a> +<a class="sourceLine" id="cb295-42" data-line-number="42">- This is the second item</a> +<a class="sourceLine" id="cb295-43" data-line-number="43"></a> +<a class="sourceLine" id="cb295-44" data-line-number="44">- This is the third item</a> +<a class="sourceLine" id="cb295-45" data-line-number="45"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb295-46" data-line-number="46"></a> +<a class="sourceLine" id="cb295-47" data-line-number="47"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb296"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb296-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight list (the first item, the second item, and the third item).</p> +<p>This is a loose list:</p> +<ul> +<li><p>This is the first item.</p></li> +<li><p>This is the second item.</p></li> +<li><p>This is the third item.</p></li> +</ul> +</blockquote> +<h5 id="context-example-26" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb297"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb297-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb297-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a> +<a class="sourceLine" id="cb297-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb297-4" data-line-number="4"></a> +<a class="sourceLine" id="cb297-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a> +<a class="sourceLine" id="cb297-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererUlBeginTight{ (}</a> +<a class="sourceLine" id="cb297-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererUlItem{<span class="co">%</span></a> +<a class="sourceLine" id="cb297-8" data-line-number="8"> \def\markdownRendererUlItem{<span class="co">%</span></a> +<a class="sourceLine" id="cb297-9" data-line-number="9"> ,</a> +<a class="sourceLine" id="cb297-10" data-line-number="10"> \def\markdownRendererUlItem{, and }<span class="co">%</span></a> +<a class="sourceLine" id="cb297-11" data-line-number="11"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb297-12" data-line-number="12">}</a> +<a class="sourceLine" id="cb297-13" data-line-number="13"><span class="fu">\def</span>\markdownRendererUlItemEnd{}</a> +<a class="sourceLine" id="cb297-14" data-line-number="14"><span class="fu">\def</span>\markdownRendererUlEndTight{).}</a> +<a class="sourceLine" id="cb297-15" data-line-number="15"></a> +<a class="sourceLine" id="cb297-16" data-line-number="16"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb297-17" data-line-number="17">This is a tight list</a> +<a class="sourceLine" id="cb297-18" data-line-number="18"></a> +<a class="sourceLine" id="cb297-19" data-line-number="19">- the first item</a> +<a class="sourceLine" id="cb297-20" data-line-number="20">- the second item</a> +<a class="sourceLine" id="cb297-21" data-line-number="21">- the third item</a> +<a class="sourceLine" id="cb297-22" data-line-number="22"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb297-23" data-line-number="23"></a> +<a class="sourceLine" id="cb297-24" data-line-number="24"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb297-25" data-line-number="25"> :\par</a> +<a class="sourceLine" id="cb297-26" data-line-number="26"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb297-27" data-line-number="27">}</a> +<a class="sourceLine" id="cb297-28" data-line-number="28"><span class="fu">\def</span>\markdownRendererUlBegin{\startitemize}</a> +<a class="sourceLine" id="cb297-29" data-line-number="29"><span class="fu">\def</span>\markdownRendererUlItem{\item}</a> +<a class="sourceLine" id="cb297-30" data-line-number="30"><span class="fu">\def</span>\markdownRendererUlItemEnd{.}</a> +<a class="sourceLine" id="cb297-31" data-line-number="31"><span class="fu">\def</span>\markdownRendererUlEnd{\stopitemize}</a> +<a class="sourceLine" id="cb297-32" data-line-number="32"></a> +<a class="sourceLine" id="cb297-33" data-line-number="33"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb297-34" data-line-number="34">This is a loose list</a> +<a class="sourceLine" id="cb297-35" data-line-number="35"></a> +<a class="sourceLine" id="cb297-36" data-line-number="36">- This is the first item</a> +<a class="sourceLine" id="cb297-37" data-line-number="37"></a> +<a class="sourceLine" id="cb297-38" data-line-number="38">- This is the second item</a> +<a class="sourceLine" id="cb297-39" data-line-number="39"></a> +<a class="sourceLine" id="cb297-40" data-line-number="40">- This is the third item</a> +<a class="sourceLine" id="cb297-41" data-line-number="41"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb297-42" data-line-number="42"></a> +<a class="sourceLine" id="cb297-43" data-line-number="43"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb298"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb298-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight list (the first item, the second item, and the third item).</p> +<p>This is a loose list:</p> +<ul> +<li><p>This is the first item.</p></li> +<li><p>This is the second item.</p></li> +<li><p>This is the third item.</p></li> +</ul> +</blockquote> +<h4 id="ordered-list-renderers"><span class="header-section-number">2.3.1.11</span> Ordered List Renderers</h4> +<p>The <code>\markdownRendererOlBegin</code> macro represents the beginning of an ordered list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p> +<p>The <code>\markdownRendererOlBeginTight</code> macro represents the beginning of an ordered list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<p>The <code>\markdownRendererOlItem</code> macro represents an item in an ordered list. This macro will only be produced, when the <strong><code>startNumber</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<p>The <code>\markdownRendererOlItemEnd</code> macro represents the end of an item in an ordered list. The macro receives no arguments.</p> +<p>The <code>\markdownRendererOlItemWithNumber</code> macro represents an item in an ordered list. This macro will only be produced, when the <strong><code>startNumber</code></strong> option is <code>true</code>. The macro receives no arguments.</p> +<p>The <code>\markdownRendererOlEnd</code> macro represents the end of an ordered list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p> +<p>The <code>\markdownRendererOlEndTight</code> macro represents the end of an ordered list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<h5 id="plain-tex-example-19" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb299"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb299-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb299-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a> +<a class="sourceLine" id="cb299-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionStartNumber{true}</a> +<a class="sourceLine" id="cb299-4" data-line-number="4"></a> +<a class="sourceLine" id="cb299-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a> +<a class="sourceLine" id="cb299-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererOlBeginTight{ (}</a> +<a class="sourceLine" id="cb299-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb299-8" data-line-number="8"> \ifnum #1=1\relax</a> +<a class="sourceLine" id="cb299-9" data-line-number="9"> the first</a> +<a class="sourceLine" id="cb299-10" data-line-number="10"> \else</a> +<a class="sourceLine" id="cb299-11" data-line-number="11"> \ifnum #1=2\relax</a> +<a class="sourceLine" id="cb299-12" data-line-number="12"> , the second</a> +<a class="sourceLine" id="cb299-13" data-line-number="13"> \else</a> +<a class="sourceLine" id="cb299-14" data-line-number="14"> , and the third</a> +<a class="sourceLine" id="cb299-15" data-line-number="15"> \fi</a> +<a class="sourceLine" id="cb299-16" data-line-number="16"> \fi</a> +<a class="sourceLine" id="cb299-17" data-line-number="17">}</a> +<a class="sourceLine" id="cb299-18" data-line-number="18"><span class="fu">\def</span>\markdownRendererOlItemEnd{}</a> +<a class="sourceLine" id="cb299-19" data-line-number="19"><span class="fu">\def</span>\markdownRendererOlEndTight{).}</a> +<a class="sourceLine" id="cb299-20" data-line-number="20"></a> +<a class="sourceLine" id="cb299-21" data-line-number="21"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb299-22" data-line-number="22">This is a tight list</a> +<a class="sourceLine" id="cb299-23" data-line-number="23"></a> +<a class="sourceLine" id="cb299-24" data-line-number="24">1. item</a> +<a class="sourceLine" id="cb299-25" data-line-number="25">2. item</a> +<a class="sourceLine" id="cb299-26" data-line-number="26">3. item</a> +<a class="sourceLine" id="cb299-27" data-line-number="27"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb299-28" data-line-number="28"></a> +<a class="sourceLine" id="cb299-29" data-line-number="29"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb299-30" data-line-number="30"> :\par</a> +<a class="sourceLine" id="cb299-31" data-line-number="31"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb299-32" data-line-number="32">}</a> +<a class="sourceLine" id="cb299-33" data-line-number="33"><span class="fu">\def</span>\markdownRendererOlBegin{}</a> +<a class="sourceLine" id="cb299-34" data-line-number="34"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb299-35" data-line-number="35"> #1.\kern 0.5em<span class="co">%</span></a> +<a class="sourceLine" id="cb299-36" data-line-number="36"> This is the</a> +<a class="sourceLine" id="cb299-37" data-line-number="37"> \ifnum #1=1\relax</a> +<a class="sourceLine" id="cb299-38" data-line-number="38"> first</a> +<a class="sourceLine" id="cb299-39" data-line-number="39"> \else</a> +<a class="sourceLine" id="cb299-40" data-line-number="40"> \ifnum #1=2\relax</a> +<a class="sourceLine" id="cb299-41" data-line-number="41"> second</a> +<a class="sourceLine" id="cb299-42" data-line-number="42"> \else</a> +<a class="sourceLine" id="cb299-43" data-line-number="43"> third</a> +<a class="sourceLine" id="cb299-44" data-line-number="44"> \fi</a> +<a class="sourceLine" id="cb299-45" data-line-number="45"> \fi</a> +<a class="sourceLine" id="cb299-46" data-line-number="46">}</a> +<a class="sourceLine" id="cb299-47" data-line-number="47"><span class="fu">\def</span>\markdownRendererOlItemEnd{.\par}</a> +<a class="sourceLine" id="cb299-48" data-line-number="48"><span class="fu">\def</span>\markdownRendererOlEnd{}</a> +<a class="sourceLine" id="cb299-49" data-line-number="49"></a> +<a class="sourceLine" id="cb299-50" data-line-number="50"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb299-51" data-line-number="51">This is a loose list</a> +<a class="sourceLine" id="cb299-52" data-line-number="52"></a> +<a class="sourceLine" id="cb299-53" data-line-number="53">1. item</a> +<a class="sourceLine" id="cb299-54" data-line-number="54"></a> +<a class="sourceLine" id="cb299-55" data-line-number="55">2. item</a> +<a class="sourceLine" id="cb299-56" data-line-number="56"></a> +<a class="sourceLine" id="cb299-57" data-line-number="57">3. item</a> +<a class="sourceLine" id="cb299-58" data-line-number="58"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb299-59" data-line-number="59"></a> +<a class="sourceLine" id="cb299-60" data-line-number="60"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb300"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb300-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight list (the first item, the second item, and the third item).</p> +<p>This is a loose list:</p> +<ol type="1"> +<li><p>This is the first item.</p></li> +<li><p>This is the second item.</p></li> +<li><p>This is the third item.</p></li> +</ol> +</blockquote> +<h5 id="latex-example-32" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb301"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb301-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb301-2" data-line-number="2"><span class="bu">\usepackage</span>[tightLists, startNumber]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb301-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb301-4" data-line-number="4"></a> +<a class="sourceLine" id="cb301-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb301-6" data-line-number="6"> renderers = {</a> +<a class="sourceLine" id="cb301-7" data-line-number="7"> interblockSeparator = {},</a> +<a class="sourceLine" id="cb301-8" data-line-number="8"> olBeginTight = { (},</a> +<a class="sourceLine" id="cb301-9" data-line-number="9"> olItemWithNumber = {<span class="co">%</span></a> +<a class="sourceLine" id="cb301-10" data-line-number="10"> <span class="fu">\ifnum</span> #1=1<span class="fu">\relax</span></a> +<a class="sourceLine" id="cb301-11" data-line-number="11"> the first</a> +<a class="sourceLine" id="cb301-12" data-line-number="12"> <span class="fu">\else</span></a> +<a class="sourceLine" id="cb301-13" data-line-number="13"> <span class="fu">\ifnum</span> #1=2<span class="fu">\relax</span></a> +<a class="sourceLine" id="cb301-14" data-line-number="14"> , the second</a> +<a class="sourceLine" id="cb301-15" data-line-number="15"> <span class="fu">\else</span></a> +<a class="sourceLine" id="cb301-16" data-line-number="16"> , and the third</a> +<a class="sourceLine" id="cb301-17" data-line-number="17"> <span class="fu">\fi</span></a> +<a class="sourceLine" id="cb301-18" data-line-number="18"> <span class="fu">\fi</span></a> +<a class="sourceLine" id="cb301-19" data-line-number="19"> },</a> +<a class="sourceLine" id="cb301-20" data-line-number="20"> olItemEnd = {},</a> +<a class="sourceLine" id="cb301-21" data-line-number="21"> olEndTight = {).},</a> +<a class="sourceLine" id="cb301-22" data-line-number="22"> },</a> +<a class="sourceLine" id="cb301-23" data-line-number="23">}</a> +<a class="sourceLine" id="cb301-24" data-line-number="24">This is a tight list</a> +<a class="sourceLine" id="cb301-25" data-line-number="25"></a> +<a class="sourceLine" id="cb301-26" data-line-number="26">1. item</a> +<a class="sourceLine" id="cb301-27" data-line-number="27">2. item</a> +<a class="sourceLine" id="cb301-28" data-line-number="28">3. item</a> +<a class="sourceLine" id="cb301-29" data-line-number="29"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb301-30" data-line-number="30"></a> +<a class="sourceLine" id="cb301-31" data-line-number="31"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb301-32" data-line-number="32"> renderers = {</a> +<a class="sourceLine" id="cb301-33" data-line-number="33"> interblockSeparator = {<span class="co">%</span></a> +<a class="sourceLine" id="cb301-34" data-line-number="34"> :<span class="fu">\par</span></a> +<a class="sourceLine" id="cb301-35" data-line-number="35"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb301-36" data-line-number="36"> },</a> +<a class="sourceLine" id="cb301-37" data-line-number="37"> olBeginTight = {<span class="kw">\begin</span>{<span class="ex">enumerate</span>}},</a> +<a class="sourceLine" id="cb301-38" data-line-number="38"> olItemWithNumber = {<span class="co">%</span></a> +<a class="sourceLine" id="cb301-39" data-line-number="39"> <span class="fu">\item</span> This is the</a> +<a class="sourceLine" id="cb301-40" data-line-number="40"> <span class="fu">\ifnum</span> #1=1<span class="fu">\relax</span></a> +<a class="sourceLine" id="cb301-41" data-line-number="41"> first</a> +<a class="sourceLine" id="cb301-42" data-line-number="42"> <span class="fu">\else</span></a> +<a class="sourceLine" id="cb301-43" data-line-number="43"> <span class="fu">\ifnum</span> #1=2<span class="fu">\relax</span></a> +<a class="sourceLine" id="cb301-44" data-line-number="44"> second</a> +<a class="sourceLine" id="cb301-45" data-line-number="45"> <span class="fu">\else</span></a> +<a class="sourceLine" id="cb301-46" data-line-number="46"> third</a> +<a class="sourceLine" id="cb301-47" data-line-number="47"> <span class="fu">\fi</span></a> +<a class="sourceLine" id="cb301-48" data-line-number="48"> <span class="fu">\fi</span></a> +<a class="sourceLine" id="cb301-49" data-line-number="49"> },</a> +<a class="sourceLine" id="cb301-50" data-line-number="50"> olItemEnd = {.},</a> +<a class="sourceLine" id="cb301-51" data-line-number="51"> olEnd = {<span class="kw">\end</span>{<span class="ex">enumerate</span>}},</a> +<a class="sourceLine" id="cb301-52" data-line-number="52"> },</a> +<a class="sourceLine" id="cb301-53" data-line-number="53">}</a> +<a class="sourceLine" id="cb301-54" data-line-number="54">This is a loose list</a> +<a class="sourceLine" id="cb301-55" data-line-number="55"></a> +<a class="sourceLine" id="cb301-56" data-line-number="56">1. item</a> +<a class="sourceLine" id="cb301-57" data-line-number="57"></a> +<a class="sourceLine" id="cb301-58" data-line-number="58">2. item</a> +<a class="sourceLine" id="cb301-59" data-line-number="59"></a> +<a class="sourceLine" id="cb301-60" data-line-number="60">3. item</a> +<a class="sourceLine" id="cb301-61" data-line-number="61"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb301-62" data-line-number="62"></a> +<a class="sourceLine" id="cb301-63" data-line-number="63"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb302"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb302-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight list (the first item, the second item, and the third item).</p> +<p>This is a loose list:</p> +<ol type="1"> +<li><p>This is the first item.</p></li> +<li><p>This is the second item.</p></li> +<li><p>This is the third item.</p></li> +</ol> +</blockquote> +<h5 id="context-example-27" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb303"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb303-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb303-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionTightLists{true}</a> +<a class="sourceLine" id="cb303-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionStartNumber{true}</a> +<a class="sourceLine" id="cb303-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb303-5" data-line-number="5"></a> +<a class="sourceLine" id="cb303-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a> +<a class="sourceLine" id="cb303-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererOlBeginTight{ (}</a> +<a class="sourceLine" id="cb303-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb303-9" data-line-number="9"> \ifnum #1=1\relax</a> +<a class="sourceLine" id="cb303-10" data-line-number="10"> the first</a> +<a class="sourceLine" id="cb303-11" data-line-number="11"> \else</a> +<a class="sourceLine" id="cb303-12" data-line-number="12"> \ifnum #1=2\relax</a> +<a class="sourceLine" id="cb303-13" data-line-number="13"> , the second</a> +<a class="sourceLine" id="cb303-14" data-line-number="14"> \else</a> +<a class="sourceLine" id="cb303-15" data-line-number="15"> , and the third</a> +<a class="sourceLine" id="cb303-16" data-line-number="16"> \fi</a> +<a class="sourceLine" id="cb303-17" data-line-number="17"> \fi</a> +<a class="sourceLine" id="cb303-18" data-line-number="18">}</a> +<a class="sourceLine" id="cb303-19" data-line-number="19"><span class="fu">\def</span>\markdownRendererOlItemEnd{}</a> +<a class="sourceLine" id="cb303-20" data-line-number="20"><span class="fu">\def</span>\markdownRendererOlEndTight{).}</a> +<a class="sourceLine" id="cb303-21" data-line-number="21"></a> +<a class="sourceLine" id="cb303-22" data-line-number="22"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb303-23" data-line-number="23">This is a tight list</a> +<a class="sourceLine" id="cb303-24" data-line-number="24"></a> +<a class="sourceLine" id="cb303-25" data-line-number="25">1. item</a> +<a class="sourceLine" id="cb303-26" data-line-number="26">2. item</a> +<a class="sourceLine" id="cb303-27" data-line-number="27">3. item</a> +<a class="sourceLine" id="cb303-28" data-line-number="28"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb303-29" data-line-number="29"></a> +<a class="sourceLine" id="cb303-30" data-line-number="30"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb303-31" data-line-number="31"> :\par</a> +<a class="sourceLine" id="cb303-32" data-line-number="32"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb303-33" data-line-number="33">}</a> +<a class="sourceLine" id="cb303-34" data-line-number="34"><span class="fu">\def</span>\markdownRendererOlBegin{\startitemize}</a> +<a class="sourceLine" id="cb303-35" data-line-number="35"><span class="fu">\def</span>\markdownRendererOlItemWithNumber#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb303-36" data-line-number="36"> \sym{#1.}</a> +<a class="sourceLine" id="cb303-37" data-line-number="37"> This is the</a> +<a class="sourceLine" id="cb303-38" data-line-number="38"> \ifnum #1=1\relax</a> +<a class="sourceLine" id="cb303-39" data-line-number="39"> first</a> +<a class="sourceLine" id="cb303-40" data-line-number="40"> \else</a> +<a class="sourceLine" id="cb303-41" data-line-number="41"> \ifnum #1=2\relax</a> +<a class="sourceLine" id="cb303-42" data-line-number="42"> second</a> +<a class="sourceLine" id="cb303-43" data-line-number="43"> \else</a> +<a class="sourceLine" id="cb303-44" data-line-number="44"> third</a> +<a class="sourceLine" id="cb303-45" data-line-number="45"> \fi</a> +<a class="sourceLine" id="cb303-46" data-line-number="46"> \fi</a> +<a class="sourceLine" id="cb303-47" data-line-number="47">}</a> +<a class="sourceLine" id="cb303-48" data-line-number="48"><span class="fu">\def</span>\markdownRendererOlItemEnd{.\par}</a> +<a class="sourceLine" id="cb303-49" data-line-number="49"><span class="fu">\def</span>\markdownRendererOlEnd{\stopitemize}</a> +<a class="sourceLine" id="cb303-50" data-line-number="50"></a> +<a class="sourceLine" id="cb303-51" data-line-number="51"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb303-52" data-line-number="52">This is a loose list</a> +<a class="sourceLine" id="cb303-53" data-line-number="53"></a> +<a class="sourceLine" id="cb303-54" data-line-number="54">1. item</a> +<a class="sourceLine" id="cb303-55" data-line-number="55"></a> +<a class="sourceLine" id="cb303-56" data-line-number="56">2. item</a> +<a class="sourceLine" id="cb303-57" data-line-number="57"></a> +<a class="sourceLine" id="cb303-58" data-line-number="58">3. item</a> +<a class="sourceLine" id="cb303-59" data-line-number="59"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb303-60" data-line-number="60"></a> +<a class="sourceLine" id="cb303-61" data-line-number="61"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb304"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb304-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight list (the first item, the second item, and the third item).</p> +<p>This is a loose list:</p> +<ol type="1"> +<li><p>This is the first item.</p></li> +<li><p>This is the second item.</p></li> +<li><p>This is the third item.</p></li> +</ol> +</blockquote> +<h4 id="definition-list-renderers"><span class="header-section-number">2.3.1.12</span> Definition List Renderers</h4> +<p>The following macros are only produced, when the <strong><code>definitionLists</code></strong> option is <code>true</code>.</p> +<p>The <code>\markdownRendererDlBegin</code> macro represents the beginning of a definition list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p> +<p>The <code>\markdownRendererDlBeginTight</code> macro represents the beginning of a definition list that contains an item with several paragraphs of text (the list is not tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<p>The <code>\markdownRendererDlItem</code> macro represents a term in a definition list. The macro receives a single argument that corresponds to the term being defined.</p> +<p>The <code>\markdownRendererDlItemEnd</code> macro represents the end of a list of definitions for a single term.</p> +<p>The <code>\markdownRendererDlDefinitionBegin</code> macro represents the beginning of a definition in a definition list. There can be several definitions for a single term.</p> +<p>The <code>\markdownRendererDlDefinitionEnd</code> macro represents the end of a definition in a definition list. There can be several definitions for a single term.</p> +<p>The <code>\markdownRendererDlEnd</code> macro represents the end of a definition list that contains an item with several paragraphs of text (the list is not tight). The macro receives no arguments.</p> +<p>The <code>\markdownRendererDlEndTight</code> macro represents the end of a definition list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when the <strong><code>tightLists</code></strong> option is <code>false</code>. The macro receives no arguments.</p> +<h5 id="plain-tex-example-20" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb305"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb305-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb305-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionDefinitionLists{true}</a> +<a class="sourceLine" id="cb305-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionTightLists{true}</a> +<a class="sourceLine" id="cb305-4" data-line-number="4"></a> +<a class="sourceLine" id="cb305-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-6" data-line-number="6"> :<span class="co">%</span></a> +<a class="sourceLine" id="cb305-7" data-line-number="7"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb305-8" data-line-number="8">}</a> +<a class="sourceLine" id="cb305-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererDlBeginTight{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-10" data-line-number="10"> \begingroup</a> +<a class="sourceLine" id="cb305-11" data-line-number="11"> \parindent=0pt</a> +<a class="sourceLine" id="cb305-12" data-line-number="12">}</a> +<a class="sourceLine" id="cb305-13" data-line-number="13"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-14" data-line-number="14"> \par{\bf#1}<span class="co">%</span></a> +<a class="sourceLine" id="cb305-15" data-line-number="15"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-16" data-line-number="16"> ,</a> +<a class="sourceLine" id="cb305-17" data-line-number="17"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-18" data-line-number="18"> , and</a> +<a class="sourceLine" id="cb305-19" data-line-number="19"> \def\markdownRendererDlDefinitionEnd{.}<span class="co">%</span></a> +<a class="sourceLine" id="cb305-20" data-line-number="20"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb305-21" data-line-number="21"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb305-22" data-line-number="22">}</a> +<a class="sourceLine" id="cb305-23" data-line-number="23"><span class="fu">\def</span>\markdownRendererDlItemEnd{}</a> +<a class="sourceLine" id="cb305-24" data-line-number="24"><span class="fu">\def</span>\markdownRendererDlDefinitionBegin{\par--\kern 0.5em}</a> +<a class="sourceLine" id="cb305-25" data-line-number="25"><span class="fu">\def</span>\markdownRendererDlEndTight{\endgroup}</a> +<a class="sourceLine" id="cb305-26" data-line-number="26"></a> +<a class="sourceLine" id="cb305-27" data-line-number="27"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb305-28" data-line-number="28">This is a tight definition list</a> +<a class="sourceLine" id="cb305-29" data-line-number="29"></a> +<a class="sourceLine" id="cb305-30" data-line-number="30">Coffee</a> +<a class="sourceLine" id="cb305-31" data-line-number="31">: black hot drink</a> +<a class="sourceLine" id="cb305-32" data-line-number="32">: prepared from roasted coffee beans</a> +<a class="sourceLine" id="cb305-33" data-line-number="33">: one of the most traded agricultural commodities in the world</a> +<a class="sourceLine" id="cb305-34" data-line-number="34"></a> +<a class="sourceLine" id="cb305-35" data-line-number="35">Milk</a> +<a class="sourceLine" id="cb305-36" data-line-number="36">: white cold drink</a> +<a class="sourceLine" id="cb305-37" data-line-number="37">: nutrient-rich</a> +<a class="sourceLine" id="cb305-38" data-line-number="38">: produced on an industrial scale</a> +<a class="sourceLine" id="cb305-39" data-line-number="39"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb305-40" data-line-number="40"></a> +<a class="sourceLine" id="cb305-41" data-line-number="41"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-42" data-line-number="42"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb305-43" data-line-number="43">}</a> +<a class="sourceLine" id="cb305-44" data-line-number="44"><span class="fu">\def</span>\markdownRendererDlBegin{}</a> +<a class="sourceLine" id="cb305-45" data-line-number="45"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-46" data-line-number="46"> . #1 is a</a> +<a class="sourceLine" id="cb305-47" data-line-number="47"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-48" data-line-number="48"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb305-49" data-line-number="49"> ,</a> +<a class="sourceLine" id="cb305-50" data-line-number="50"> \def\markdownRendererDlDefinitionBegin{, and }<span class="co">%</span></a> +<a class="sourceLine" id="cb305-51" data-line-number="51"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb305-52" data-line-number="52"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb305-53" data-line-number="53">}</a> +<a class="sourceLine" id="cb305-54" data-line-number="54"><span class="fu">\def</span>\markdownRendererDlItemEnd{}</a> +<a class="sourceLine" id="cb305-55" data-line-number="55"><span class="fu">\def</span>\markdownRendererDlDefinitionEnd{}</a> +<a class="sourceLine" id="cb305-56" data-line-number="56"><span class="fu">\def</span>\markdownRendererDlEnd{.}</a> +<a class="sourceLine" id="cb305-57" data-line-number="57"></a> +<a class="sourceLine" id="cb305-58" data-line-number="58"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb305-59" data-line-number="59">This is a loose definition list</a> +<a class="sourceLine" id="cb305-60" data-line-number="60"></a> +<a class="sourceLine" id="cb305-61" data-line-number="61">Coffee</a> +<a class="sourceLine" id="cb305-62" data-line-number="62"></a> +<a class="sourceLine" id="cb305-63" data-line-number="63">: black hot drink</a> +<a class="sourceLine" id="cb305-64" data-line-number="64"></a> +<a class="sourceLine" id="cb305-65" data-line-number="65">: prepared from roasted coffee beans</a> +<a class="sourceLine" id="cb305-66" data-line-number="66"></a> +<a class="sourceLine" id="cb305-67" data-line-number="67">: one of the most traded agricultural commodities in the world</a> +<a class="sourceLine" id="cb305-68" data-line-number="68"></a> +<a class="sourceLine" id="cb305-69" data-line-number="69">Milk</a> +<a class="sourceLine" id="cb305-70" data-line-number="70"></a> +<a class="sourceLine" id="cb305-71" data-line-number="71">: white cold drink</a> +<a class="sourceLine" id="cb305-72" data-line-number="72"></a> +<a class="sourceLine" id="cb305-73" data-line-number="73">: nutrient-rich</a> +<a class="sourceLine" id="cb305-74" data-line-number="74"></a> +<a class="sourceLine" id="cb305-75" data-line-number="75">: produced on an industrial scale</a> +<a class="sourceLine" id="cb305-76" data-line-number="76"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb305-77" data-line-number="77"></a> +<a class="sourceLine" id="cb305-78" data-line-number="78"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb306"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb306-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight definition list:</p> +<p><strong>Coffee</strong></p> +<ul> +<li>black hot drink,</li> +<li>prepared from roasted coffee beans, and</li> +<li>one of the most traded agricultural commodities in the world.</li> +</ul> +<p><strong>Milk</strong></p> +<ul> +<li>white cold drink,</li> +<li>nutrient-rich, and</li> +<li>produced on an industrial scale.</li> +</ul> +<p>This is a loose definition list. Coffee is a black hot drink, prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.</p> +</blockquote> +<h5 id="latex-example-33" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb307"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb307-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb307-2" data-line-number="2"><span class="bu">\usepackage</span>[definitionLists, tightLists]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb307-3" data-line-number="3"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb307-4" data-line-number="4"></a> +<a class="sourceLine" id="cb307-5" data-line-number="5"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb307-6" data-line-number="6"> renderers = {</a> +<a class="sourceLine" id="cb307-7" data-line-number="7"> interblockSeparator = {<span class="co">%</span></a> +<a class="sourceLine" id="cb307-8" data-line-number="8"> :<span class="co">%</span></a> +<a class="sourceLine" id="cb307-9" data-line-number="9"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb307-10" data-line-number="10"> },</a> +<a class="sourceLine" id="cb307-11" data-line-number="11"> dlBeginTight = {<span class="kw">\begin</span>{<span class="ex">description</span>}},</a> +<a class="sourceLine" id="cb307-12" data-line-number="12"> dlItem = {<span class="co">%</span></a> +<a class="sourceLine" id="cb307-13" data-line-number="13"> <span class="fu">\item</span>[#1]</a> +<a class="sourceLine" id="cb307-14" data-line-number="14"> <span class="kw">\begin</span>{<span class="ex">itemize</span>}</a> +<a class="sourceLine" id="cb307-15" data-line-number="15"> <span class="fu">\def</span>\markdownRendererDlDefinitionEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb307-16" data-line-number="16"> ,</a> +<a class="sourceLine" id="cb307-17" data-line-number="17"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb307-18" data-line-number="18"> , and</a> +<a class="sourceLine" id="cb307-19" data-line-number="19"> \def\markdownRendererDlDefinitionEnd{.}<span class="co">%</span></a> +<a class="sourceLine" id="cb307-20" data-line-number="20"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb307-21" data-line-number="21"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb307-22" data-line-number="22"> },</a> +<a class="sourceLine" id="cb307-23" data-line-number="23"> dlItemEnd = {<span class="kw">\end</span>{<span class="ex">itemize</span>}},</a> +<a class="sourceLine" id="cb307-24" data-line-number="24"> dlDefinitionBegin = <span class="fu">\item</span>,</a> +<a class="sourceLine" id="cb307-25" data-line-number="25"> dlEndTight = {<span class="kw">\end</span>{<span class="ex">description</span>}},</a> +<a class="sourceLine" id="cb307-26" data-line-number="26"> },</a> +<a class="sourceLine" id="cb307-27" data-line-number="27">}</a> +<a class="sourceLine" id="cb307-28" data-line-number="28">This is a tight definition list</a> +<a class="sourceLine" id="cb307-29" data-line-number="29"></a> +<a class="sourceLine" id="cb307-30" data-line-number="30">Coffee</a> +<a class="sourceLine" id="cb307-31" data-line-number="31">: black hot drink</a> +<a class="sourceLine" id="cb307-32" data-line-number="32">: prepared from roasted coffee beans</a> +<a class="sourceLine" id="cb307-33" data-line-number="33">: one of the most traded agricultural commodities in the world</a> +<a class="sourceLine" id="cb307-34" data-line-number="34"></a> +<a class="sourceLine" id="cb307-35" data-line-number="35">Milk</a> +<a class="sourceLine" id="cb307-36" data-line-number="36">: white cold drink</a> +<a class="sourceLine" id="cb307-37" data-line-number="37">: nutrient-rich</a> +<a class="sourceLine" id="cb307-38" data-line-number="38">: produced on an industrial scale</a> +<a class="sourceLine" id="cb307-39" data-line-number="39"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb307-40" data-line-number="40"></a> +<a class="sourceLine" id="cb307-41" data-line-number="41"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb307-42" data-line-number="42"> renderers = {</a> +<a class="sourceLine" id="cb307-43" data-line-number="43"> interblockSeparator = {<span class="co">%</span></a> +<a class="sourceLine" id="cb307-44" data-line-number="44"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb307-45" data-line-number="45"> },</a> +<a class="sourceLine" id="cb307-46" data-line-number="46"> dlBegin = {},</a> +<a class="sourceLine" id="cb307-47" data-line-number="47"> dlItem = {<span class="co">%</span></a> +<a class="sourceLine" id="cb307-48" data-line-number="48"> . #1 is a</a> +<a class="sourceLine" id="cb307-49" data-line-number="49"> <span class="fu">\def</span>\markdownRendererDlDefinitionBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb307-50" data-line-number="50"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb307-51" data-line-number="51"> ,</a> +<a class="sourceLine" id="cb307-52" data-line-number="52"> \def\markdownRendererDlDefinitionBegin{, and }<span class="co">%</span></a> +<a class="sourceLine" id="cb307-53" data-line-number="53"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb307-54" data-line-number="54"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb307-55" data-line-number="55"> },</a> +<a class="sourceLine" id="cb307-56" data-line-number="56"> dlItemEnd = {},</a> +<a class="sourceLine" id="cb307-57" data-line-number="57"> dlDefinitionEnd = {},</a> +<a class="sourceLine" id="cb307-58" data-line-number="58"> dlEnd = {.},</a> +<a class="sourceLine" id="cb307-59" data-line-number="59"> },</a> +<a class="sourceLine" id="cb307-60" data-line-number="60">}</a> +<a class="sourceLine" id="cb307-61" data-line-number="61">This is a loose definition list</a> +<a class="sourceLine" id="cb307-62" data-line-number="62"></a> +<a class="sourceLine" id="cb307-63" data-line-number="63">Coffee</a> +<a class="sourceLine" id="cb307-64" data-line-number="64"></a> +<a class="sourceLine" id="cb307-65" data-line-number="65">: black hot drink</a> +<a class="sourceLine" id="cb307-66" data-line-number="66"></a> +<a class="sourceLine" id="cb307-67" data-line-number="67">: prepared from roasted coffee beans</a> +<a class="sourceLine" id="cb307-68" data-line-number="68"></a> +<a class="sourceLine" id="cb307-69" data-line-number="69">: one of the most traded agricultural commodities in the world</a> +<a class="sourceLine" id="cb307-70" data-line-number="70"></a> +<a class="sourceLine" id="cb307-71" data-line-number="71">Milk</a> +<a class="sourceLine" id="cb307-72" data-line-number="72"></a> +<a class="sourceLine" id="cb307-73" data-line-number="73">: white cold drink</a> +<a class="sourceLine" id="cb307-74" data-line-number="74"></a> +<a class="sourceLine" id="cb307-75" data-line-number="75">: nutrient-rich</a> +<a class="sourceLine" id="cb307-76" data-line-number="76"></a> +<a class="sourceLine" id="cb307-77" data-line-number="77">: produced on an industrial scale</a> +<a class="sourceLine" id="cb307-78" data-line-number="78"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb307-79" data-line-number="79"></a> +<a class="sourceLine" id="cb307-80" data-line-number="80"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb308"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb308-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight definition list:</p> +<p><strong>Coffee</strong></p> +<ul> +<li>black hot drink,</li> +<li>prepared from roasted coffee beans, and</li> +<li>one of the most traded agricultural commodities in the world.</li> +</ul> +<p><strong>Milk</strong></p> +<ul> +<li>white cold drink,</li> +<li>nutrient-rich, and</li> +<li>produced on an industrial scale.</li> +</ul> +<p>This is a loose definition list. Coffee is a black hot drink, prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.</p> +</blockquote> +<h5 id="context-example-28" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb309"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb309-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb309-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionDefinitionLists{true}</a> +<a class="sourceLine" id="cb309-3" data-line-number="3"><span class="fu">\def</span>\markdownOptionTightLists{true}</a> +<a class="sourceLine" id="cb309-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb309-5" data-line-number="5"></a> +<a class="sourceLine" id="cb309-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-7" data-line-number="7"> :<span class="co">%</span></a> +<a class="sourceLine" id="cb309-8" data-line-number="8"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb309-9" data-line-number="9">}</a> +<a class="sourceLine" id="cb309-10" data-line-number="10"><span class="fu">\def</span>\markdownRendererDlBeginTight{}</a> +<a class="sourceLine" id="cb309-11" data-line-number="11"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-12" data-line-number="12"> \par{\bf#1}<span class="co">%</span></a> +<a class="sourceLine" id="cb309-13" data-line-number="13"> \startitemize</a> +<a class="sourceLine" id="cb309-14" data-line-number="14"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-15" data-line-number="15"> ,</a> +<a class="sourceLine" id="cb309-16" data-line-number="16"> \def\markdownRendererDlDefinitionEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-17" data-line-number="17"> , and</a> +<a class="sourceLine" id="cb309-18" data-line-number="18"> \def\markdownRendererDlDefinitionEnd{.}<span class="co">%</span></a> +<a class="sourceLine" id="cb309-19" data-line-number="19"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb309-20" data-line-number="20"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb309-21" data-line-number="21">}</a> +<a class="sourceLine" id="cb309-22" data-line-number="22"><span class="fu">\def</span>\markdownRendererDlItemEnd{\stopitemize}</a> +<a class="sourceLine" id="cb309-23" data-line-number="23"><span class="fu">\def</span>\markdownRendererDlDefinitionBegin{\item}</a> +<a class="sourceLine" id="cb309-24" data-line-number="24"><span class="fu">\def</span>\markdownRendererDlEndTight{}</a> +<a class="sourceLine" id="cb309-25" data-line-number="25"></a> +<a class="sourceLine" id="cb309-26" data-line-number="26"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb309-27" data-line-number="27">This is a tight definition list</a> +<a class="sourceLine" id="cb309-28" data-line-number="28"></a> +<a class="sourceLine" id="cb309-29" data-line-number="29">Coffee</a> +<a class="sourceLine" id="cb309-30" data-line-number="30">: black hot drink</a> +<a class="sourceLine" id="cb309-31" data-line-number="31">: prepared from roasted coffee beans</a> +<a class="sourceLine" id="cb309-32" data-line-number="32">: one of the most traded agricultural commodities in the world</a> +<a class="sourceLine" id="cb309-33" data-line-number="33"></a> +<a class="sourceLine" id="cb309-34" data-line-number="34">Milk</a> +<a class="sourceLine" id="cb309-35" data-line-number="35">: white cold drink</a> +<a class="sourceLine" id="cb309-36" data-line-number="36">: nutrient-rich</a> +<a class="sourceLine" id="cb309-37" data-line-number="37">: produced on an industrial scale</a> +<a class="sourceLine" id="cb309-38" data-line-number="38"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb309-39" data-line-number="39"></a> +<a class="sourceLine" id="cb309-40" data-line-number="40"><span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-41" data-line-number="41"> \def\markdownRendererInterblockSeparator{\par}<span class="co">%</span></a> +<a class="sourceLine" id="cb309-42" data-line-number="42">}</a> +<a class="sourceLine" id="cb309-43" data-line-number="43"><span class="fu">\def</span>\markdownRendererDlBegin{}</a> +<a class="sourceLine" id="cb309-44" data-line-number="44"><span class="fu">\def</span>\markdownRendererDlItem#1{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-45" data-line-number="45"> . #1 is a</a> +<a class="sourceLine" id="cb309-46" data-line-number="46"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-47" data-line-number="47"> \def\markdownRendererDlDefinitionBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb309-48" data-line-number="48"> ,</a> +<a class="sourceLine" id="cb309-49" data-line-number="49"> \def\markdownRendererDlDefinitionBegin{, and }<span class="co">%</span></a> +<a class="sourceLine" id="cb309-50" data-line-number="50"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb309-51" data-line-number="51"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb309-52" data-line-number="52">}</a> +<a class="sourceLine" id="cb309-53" data-line-number="53"><span class="fu">\def</span>\markdownRendererDlItemEnd{}</a> +<a class="sourceLine" id="cb309-54" data-line-number="54"><span class="fu">\def</span>\markdownRendererDlDefinitionEnd{}</a> +<a class="sourceLine" id="cb309-55" data-line-number="55"><span class="fu">\def</span>\markdownRendererDlEnd{.}</a> +<a class="sourceLine" id="cb309-56" data-line-number="56"></a> +<a class="sourceLine" id="cb309-57" data-line-number="57"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb309-58" data-line-number="58">This is a loose definition list</a> +<a class="sourceLine" id="cb309-59" data-line-number="59"></a> +<a class="sourceLine" id="cb309-60" data-line-number="60">Coffee</a> +<a class="sourceLine" id="cb309-61" data-line-number="61"></a> +<a class="sourceLine" id="cb309-62" data-line-number="62">: black hot drink</a> +<a class="sourceLine" id="cb309-63" data-line-number="63"></a> +<a class="sourceLine" id="cb309-64" data-line-number="64">: prepared from roasted coffee beans</a> +<a class="sourceLine" id="cb309-65" data-line-number="65"></a> +<a class="sourceLine" id="cb309-66" data-line-number="66">: one of the most traded agricultural commodities in the world</a> +<a class="sourceLine" id="cb309-67" data-line-number="67"></a> +<a class="sourceLine" id="cb309-68" data-line-number="68">Milk</a> +<a class="sourceLine" id="cb309-69" data-line-number="69"></a> +<a class="sourceLine" id="cb309-70" data-line-number="70">: white cold drink</a> +<a class="sourceLine" id="cb309-71" data-line-number="71"></a> +<a class="sourceLine" id="cb309-72" data-line-number="72">: nutrient-rich</a> +<a class="sourceLine" id="cb309-73" data-line-number="73"></a> +<a class="sourceLine" id="cb309-74" data-line-number="74">: produced on an industrial scale</a> +<a class="sourceLine" id="cb309-75" data-line-number="75"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb309-76" data-line-number="76"></a> +<a class="sourceLine" id="cb309-77" data-line-number="77"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb310"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb310-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a tight definition list:</p> +<p><strong>Coffee</strong></p> +<ul> +<li>black hot drink,</li> +<li>prepared from roasted coffee beans, and</li> +<li>one of the most traded agricultural commodities in the world.</li> +</ul> +<p><strong>Milk</strong></p> +<ul> +<li>white cold drink,</li> +<li>nutrient-rich, and</li> +<li>produced on an industrial scale.</li> +</ul> +<p>This is a loose definition list. Coffee is a black hot drink, prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.</p> +</blockquote> +<h4 id="emphasis-renderers"><span class="header-section-number">2.3.1.13</span> Emphasis Renderers</h4> +<p>The <code>\markdownRendererEmphasis</code> macro represents an emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.</p> +<h5 id="plain-tex-example-21" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb311"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb311-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb311-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEmphasis#1{{\it#1}}</a> +<a class="sourceLine" id="cb311-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererStrongEmphasis#1{{\bf#1}}</a> +<a class="sourceLine" id="cb311-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb311-5" data-line-number="5">This is *emphasis*.</a> +<a class="sourceLine" id="cb311-6" data-line-number="6"></a> +<a class="sourceLine" id="cb311-7" data-line-number="7">This is **strong emphasis**.</a> +<a class="sourceLine" id="cb311-8" data-line-number="8"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb311-9" data-line-number="9"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb312"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb312-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is <em>emphasis</em>.</p> +<p>This is <strong>strong emphasis</strong>.</p> +</blockquote> +<h5 id="latex-example-34" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb313"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb313-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb313-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb313-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb313-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb313-5" data-line-number="5"> emphasis = {<span class="fu">\emph</span>{#1}},</a> +<a class="sourceLine" id="cb313-6" data-line-number="6"> strongEmphasis = {<span class="fu">\textbf</span>{#1}},</a> +<a class="sourceLine" id="cb313-7" data-line-number="7"> },</a> +<a class="sourceLine" id="cb313-8" data-line-number="8">}</a> +<a class="sourceLine" id="cb313-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb313-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb313-11" data-line-number="11">This is *emphasis*.</a> +<a class="sourceLine" id="cb313-12" data-line-number="12"></a> +<a class="sourceLine" id="cb313-13" data-line-number="13">This is **strong emphasis**.</a> +<a class="sourceLine" id="cb313-14" data-line-number="14"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb313-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb314"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb314-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is <em>emphasis</em>.</p> +<p>This is <strong>strong emphasis</strong>.</p> +</blockquote> +<h5 id="context-example-29" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb315"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb315-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb315-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererEmphasis#1{\emph{#1}}</a> +<a class="sourceLine" id="cb315-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererStrongEmphasis#1{\bold{#1}}</a> +<a class="sourceLine" id="cb315-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb315-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb315-6" data-line-number="6">This is *emphasis*.</a> +<a class="sourceLine" id="cb315-7" data-line-number="7"></a> +<a class="sourceLine" id="cb315-8" data-line-number="8">This is **strong emphasis**.</a> +<a class="sourceLine" id="cb315-9" data-line-number="9"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb315-10" data-line-number="10"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb316"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb316-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is <em>emphasis</em>.</p> +<p>This is <strong>strong emphasis</strong>.</p> +</blockquote> +<p>The <code>\markdownRendererStrongEmphasis</code> macro represents a strongly emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.</p> +<h4 id="block-quote-renderers"><span class="header-section-number">2.3.1.14</span> Block Quote Renderers</h4> +<p>The <code>\markdownRendererBlockQuoteBegin</code> macro represents the beginning of a block quote. The macro receives no arguments.</p> +<h5 id="plain-tex-example-22" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb317"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb317-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb317-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererBlockQuoteBegin{<span class="co">%</span></a> +<a class="sourceLine" id="cb317-3" data-line-number="3"> \begingroup</a> +<a class="sourceLine" id="cb317-4" data-line-number="4"> \vskip\parindent</a> +<a class="sourceLine" id="cb317-5" data-line-number="5"> \leftskip=2\parindent</a> +<a class="sourceLine" id="cb317-6" data-line-number="6"> \parindent=0pt</a> +<a class="sourceLine" id="cb317-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb317-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererBlockQuoteEnd{<span class="co">%</span></a> +<a class="sourceLine" id="cb317-9" data-line-number="9"> \par</a> +<a class="sourceLine" id="cb317-10" data-line-number="10"> \vskip\parindent</a> +<a class="sourceLine" id="cb317-11" data-line-number="11"> \endgroup</a> +<a class="sourceLine" id="cb317-12" data-line-number="12">}</a> +<a class="sourceLine" id="cb317-13" data-line-number="13"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb317-14" data-line-number="14">A quote from William Shakespeare's King Lear:</a> +<a class="sourceLine" id="cb317-15" data-line-number="15"></a> +<a class="sourceLine" id="cb317-16" data-line-number="16">> This is the excellent foppery of the world that when we are</a> +<a class="sourceLine" id="cb317-17" data-line-number="17">> sick in fortune---often the surfeit of our own behavior---we</a> +<a class="sourceLine" id="cb317-18" data-line-number="18">> make guilty of our disasters the sun, the moon, and the</a> +<a class="sourceLine" id="cb317-19" data-line-number="19">> stars [...]</a> +<a class="sourceLine" id="cb317-20" data-line-number="20"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb317-21" data-line-number="21"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb318"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb318-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>A quote from William Shakespeare’s King Lear:</p> +<blockquote> +<p>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 […]</p> +</blockquote> +</blockquote> +<h5 id="latex-example-35" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb319"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb319-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb319-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb319-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb319-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb319-5" data-line-number="5"> blockQuoteBegin = {<span class="kw">\begin</span>{<span class="ex">quote</span>}},</a> +<a class="sourceLine" id="cb319-6" data-line-number="6"> blockQuoteEnd = {<span class="kw">\end</span>{<span class="ex">quote</span>}},</a> +<a class="sourceLine" id="cb319-7" data-line-number="7"> },</a> +<a class="sourceLine" id="cb319-8" data-line-number="8">}</a> +<a class="sourceLine" id="cb319-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb319-10" data-line-number="10"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb319-11" data-line-number="11">A quote from William Shakespeare's King Lear:</a> +<a class="sourceLine" id="cb319-12" data-line-number="12"></a> +<a class="sourceLine" id="cb319-13" data-line-number="13">> This is the excellent foppery of the world that when we are</a> +<a class="sourceLine" id="cb319-14" data-line-number="14">> sick in fortune---often the surfeit of our own behavior---we</a> +<a class="sourceLine" id="cb319-15" data-line-number="15">> make guilty of our disasters the sun, the moon, and the</a> +<a class="sourceLine" id="cb319-16" data-line-number="16">> stars [...]</a> +<a class="sourceLine" id="cb319-17" data-line-number="17"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb319-18" data-line-number="18"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb320"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb320-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>A quote from William Shakespeare’s King Lear:</p> +<blockquote> +<p>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 […]</p> +</blockquote> +</blockquote> +<h5 id="context-example-30" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb321"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb321-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb321-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererBlockQuoteBegin{\startquotation}</a> +<a class="sourceLine" id="cb321-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererBlockQuoteEnd{\stopquotation}</a> +<a class="sourceLine" id="cb321-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb321-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb321-6" data-line-number="6">A quote from William Shakespeare's King Lear:</a> +<a class="sourceLine" id="cb321-7" data-line-number="7"></a> +<a class="sourceLine" id="cb321-8" data-line-number="8">> This is the excellent foppery of the world that when we are</a> +<a class="sourceLine" id="cb321-9" data-line-number="9">> sick in fortune---often the surfeit of our own behavior---we</a> +<a class="sourceLine" id="cb321-10" data-line-number="10">> make guilty of our disasters the sun, the moon, and the</a> +<a class="sourceLine" id="cb321-11" data-line-number="11">> stars [...]</a> +<a class="sourceLine" id="cb321-12" data-line-number="12"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb321-13" data-line-number="13"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb322"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb322-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>A quote from William Shakespeare’s King Lear:</p> +<blockquote> +<p>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 […]</p> +</blockquote> +</blockquote> +<p>The <code>\markdownRendererBlockQuoteEnd</code> macro represents the end of a block quote. The macro receives no arguments.</p> +<h4 id="code-block-renderers"><span class="header-section-number">2.3.1.15</span> Code Block Renderers</h4> +<p>The <code>\markdownRendererInputVerbatim</code> macro represents a code block. The macro receives a single argument that corresponds to the filename of a file contaning the code block contents.</p> +<p>The <code>\markdownRendererInputFencedCode</code> macro represents a fenced code block. This macro will only be produced, when the <strong><code>fencedCode</code></strong> option is <code>true</code>. The macro receives two arguments that correspond to the filename of a file contaning the code block contents and to the code fence infostring.</p> +<h5 id="latex-example-36" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb323"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb323-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb323-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">verbatim</span>}</a> +<a class="sourceLine" id="cb323-3" data-line-number="3"><span class="bu">\usepackage</span>[hyphens]{<span class="ex">url</span>}</a> +<a class="sourceLine" id="cb323-4" data-line-number="4"><span class="bu">\usepackage</span>[fencedCode]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb323-5" data-line-number="5"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb323-6" data-line-number="6"> renderers = {</a> +<a class="sourceLine" id="cb323-7" data-line-number="7"> interblockSeparator = {</a> +<a class="sourceLine" id="cb323-8" data-line-number="8"> <span class="fu">\def</span>\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb323-9" data-line-number="9"> \par</a> +<a class="sourceLine" id="cb323-10" data-line-number="10"> \def\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb323-11" data-line-number="11"> \def\markdownRendererInterblockSeparator{<span class="co">%</span></a> +<a class="sourceLine" id="cb323-12" data-line-number="12"> \par</a> +<a class="sourceLine" id="cb323-13" data-line-number="13"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb323-14" data-line-number="14"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb323-15" data-line-number="15"> }<span class="co">%</span></a> +<a class="sourceLine" id="cb323-16" data-line-number="16"> },</a> +<a class="sourceLine" id="cb323-17" data-line-number="17"> inputVerbatim = {</a> +<a class="sourceLine" id="cb323-18" data-line-number="18"> is contained in file <span class="fu">\url</span>{#1}:<span class="co">%</span></a> +<a class="sourceLine" id="cb323-19" data-line-number="19"> <span class="fu">\verbatiminput</span>{#1}<span class="co">%</span></a> +<a class="sourceLine" id="cb323-20" data-line-number="20"> },</a> +<a class="sourceLine" id="cb323-21" data-line-number="21"> inputFencedCode = {</a> +<a class="sourceLine" id="cb323-22" data-line-number="22"> in #2 <span class="fu">\markdownRendererInputVerbatim</span>{#1}<span class="co">%</span></a> +<a class="sourceLine" id="cb323-23" data-line-number="23"> },</a> +<a class="sourceLine" id="cb323-24" data-line-number="24"> },</a> +<a class="sourceLine" id="cb323-25" data-line-number="25">}</a> +<a class="sourceLine" id="cb323-26" data-line-number="26"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb323-27" data-line-number="27"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb323-28" data-line-number="28">The following code</a> +<a class="sourceLine" id="cb323-29" data-line-number="29"></a> +<a class="sourceLine" id="cb323-30" data-line-number="30"> def foo(bar):</a> +<a class="sourceLine" id="cb323-31" data-line-number="31"> if len(bar) <= 1:</a> +<a class="sourceLine" id="cb323-32" data-line-number="32"> return bar[0]</a> +<a class="sourceLine" id="cb323-33" data-line-number="33"> elif len(bar) == 2:</a> +<a class="sourceLine" id="cb323-34" data-line-number="34"> return sorted(bar)</a> +<a class="sourceLine" id="cb323-35" data-line-number="35"> else:</a> +<a class="sourceLine" id="cb323-36" data-line-number="36"> baz = len(bar) // 2</a> +<a class="sourceLine" id="cb323-37" data-line-number="37"> return foo(bar[baz:], bar[:baz])</a> +<a class="sourceLine" id="cb323-38" data-line-number="38"></a> +<a class="sourceLine" id="cb323-39" data-line-number="39">The following code</a> +<a class="sourceLine" id="cb323-40" data-line-number="40"></a> +<a class="sourceLine" id="cb323-41" data-line-number="41">~~~ Python</a> +<a class="sourceLine" id="cb323-42" data-line-number="42">>>> foo([4, 2, 1, 3])</a> +<a class="sourceLine" id="cb323-43" data-line-number="43">[1, 2, 3, 4]</a> +<a class="sourceLine" id="cb323-44" data-line-number="44">~~~~~~~~~~</a> +<a class="sourceLine" id="cb323-45" data-line-number="45"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb323-46" data-line-number="46"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb324"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb324-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text except for the filename, which may differ:</p> +<blockquote> +<p>The following code is contained in file <code>./_markdown_document/882453149edcf288976647f6fe147ada.verbatim</code>:</p> +<div class="sourceCode" id="cb325"><pre class="sourceCode py"><code class="sourceCode python"><a class="sourceLine" id="cb325-1" data-line-number="1"><span class="kw">def</span> foo(bar):</a> +<a class="sourceLine" id="cb325-2" data-line-number="2"> <span class="cf">if</span> <span class="bu">len</span>(bar) <span class="op"><=</span> <span class="dv">1</span>:</a> +<a class="sourceLine" id="cb325-3" data-line-number="3"> <span class="cf">return</span> bar[:<span class="dv">1</span>]</a> +<a class="sourceLine" id="cb325-4" data-line-number="4"> <span class="cf">elif</span> <span class="bu">len</span>(bar) <span class="op">==</span> <span class="dv">2</span>:</a> +<a class="sourceLine" id="cb325-5" data-line-number="5"> <span class="cf">return</span> <span class="bu">sorted</span>(bar)</a> +<a class="sourceLine" id="cb325-6" data-line-number="6"> <span class="cf">else</span>:</a> +<a class="sourceLine" id="cb325-7" data-line-number="7"> baz <span class="op">=</span> bar[<span class="bu">len</span>(bar) <span class="op">//</span> <span class="dv">2</span>]</a> +<a class="sourceLine" id="cb325-8" data-line-number="8"> <span class="cf">return</span> (</a> +<a class="sourceLine" id="cb325-9" data-line-number="9"> foo([qux <span class="cf">for</span> qux <span class="kw">in</span> bar <span class="cf">if</span> qux <span class="op"><</span> baz]) <span class="op">+</span> [baz] <span class="op">+</span></a> +<a class="sourceLine" id="cb325-10" data-line-number="10"> foo([qux <span class="cf">for</span> qux <span class="kw">in</span> bar <span class="cf">if</span> qux <span class="op">></span> baz])</a> +<a class="sourceLine" id="cb325-11" data-line-number="11"> )</a></code></pre></div> +<p>The following code in Python contained in file <code>./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim</code>:</p> +<div class="sourceCode" id="cb326"><pre class="sourceCode py"><code class="sourceCode python"><a class="sourceLine" id="cb326-1" data-line-number="1"><span class="op">>>></span> foo([<span class="dv">4</span>, <span class="dv">2</span>, <span class="dv">1</span>, <span class="dv">3</span>])</a> +<a class="sourceLine" id="cb326-2" data-line-number="2">[<span class="dv">1</span>, <span class="dv">2</span>, <span class="dv">3</span>, <span class="dv">4</span>]</a></code></pre></div> +</blockquote> +<h4 id="heading-renderers"><span class="header-section-number">2.3.1.16</span> Heading Renderers</h4> +<p>The <code>\markdownRendererHeadingOne</code> macro represents a first level heading. The macro receives a single argument that corresponds to the heading text.</p> +<p>The <code>\markdownRendererHeadingTwo</code> macro represents a second level heading. The macro receives a single argument that corresponds to the heading text.</p> +<p>The <code>\markdownRendererHeadingThree</code> macro represents a third level heading. The macro receives a single argument that corresponds to the heading text.</p> +<p>The <code>\markdownRendererHeadingFour</code> macro represents a fourth level heading. The macro receives a single argument that corresponds to the heading text.</p> +<p>The <code>\markdownRendererHeadingFive</code> macro represents a fifth level heading. The macro receives a single argument that corresponds to the heading text.</p> +<p>The <code>\markdownRendererHeadingSix</code> macro represents a sixth level heading. The macro receives a single argument that corresponds to the heading text.</p> +<h5 id="plain-tex-example-23" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb327"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb327-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb327-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a> +<a class="sourceLine" id="cb327-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne{1}</a> +<a class="sourceLine" id="cb327-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererHeadingTwo{2}</a> +<a class="sourceLine" id="cb327-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererHeadingThree{3}</a> +<a class="sourceLine" id="cb327-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererHeadingFour{4}</a> +<a class="sourceLine" id="cb327-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererHeadingFive{5}</a> +<a class="sourceLine" id="cb327-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererHeadingSix{6}</a> +<a class="sourceLine" id="cb327-9" data-line-number="9"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb327-10" data-line-number="10">######</a> +<a class="sourceLine" id="cb327-11" data-line-number="11">#####</a> +<a class="sourceLine" id="cb327-12" data-line-number="12">#####</a> +<a class="sourceLine" id="cb327-13" data-line-number="13">###</a> +<a class="sourceLine" id="cb327-14" data-line-number="14">######</a> +<a class="sourceLine" id="cb327-15" data-line-number="15"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb327-16" data-line-number="16"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb328"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb328-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>65536</p> +</blockquote> +<h5 id="latex-example-37" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb329"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb329-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb329-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb329-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb329-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb329-5" data-line-number="5"> interblockSeparator = {},</a> +<a class="sourceLine" id="cb329-6" data-line-number="6"> headingOne = 1,</a> +<a class="sourceLine" id="cb329-7" data-line-number="7"> headingTwo = 2,</a> +<a class="sourceLine" id="cb329-8" data-line-number="8"> headingThree = 3,</a> +<a class="sourceLine" id="cb329-9" data-line-number="9"> headingFour = 4,</a> +<a class="sourceLine" id="cb329-10" data-line-number="10"> headingFive = 5,</a> +<a class="sourceLine" id="cb329-11" data-line-number="11"> headingSix = 6,</a> +<a class="sourceLine" id="cb329-12" data-line-number="12"> },</a> +<a class="sourceLine" id="cb329-13" data-line-number="13">}</a> +<a class="sourceLine" id="cb329-14" data-line-number="14"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb329-15" data-line-number="15"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb329-16" data-line-number="16">######</a> +<a class="sourceLine" id="cb329-17" data-line-number="17">#####</a> +<a class="sourceLine" id="cb329-18" data-line-number="18">#####</a> +<a class="sourceLine" id="cb329-19" data-line-number="19">###</a> +<a class="sourceLine" id="cb329-20" data-line-number="20">######</a> +<a class="sourceLine" id="cb329-21" data-line-number="21"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb329-22" data-line-number="22"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb330"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb330-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>65536</p> +</blockquote> +<h5 id="context-example-31" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb331"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb331-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb331-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererInterblockSeparator{}</a> +<a class="sourceLine" id="cb331-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererHeadingOne{1}</a> +<a class="sourceLine" id="cb331-4" data-line-number="4"><span class="fu">\def</span>\markdownRendererHeadingTwo{2}</a> +<a class="sourceLine" id="cb331-5" data-line-number="5"><span class="fu">\def</span>\markdownRendererHeadingThree{3}</a> +<a class="sourceLine" id="cb331-6" data-line-number="6"><span class="fu">\def</span>\markdownRendererHeadingFour{4}</a> +<a class="sourceLine" id="cb331-7" data-line-number="7"><span class="fu">\def</span>\markdownRendererHeadingFive{5}</a> +<a class="sourceLine" id="cb331-8" data-line-number="8"><span class="fu">\def</span>\markdownRendererHeadingSix{6}</a> +<a class="sourceLine" id="cb331-9" data-line-number="9"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb331-10" data-line-number="10"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb331-11" data-line-number="11">######</a> +<a class="sourceLine" id="cb331-12" data-line-number="12">#####</a> +<a class="sourceLine" id="cb331-13" data-line-number="13">#####</a> +<a class="sourceLine" id="cb331-14" data-line-number="14">###</a> +<a class="sourceLine" id="cb331-15" data-line-number="15">######</a> +<a class="sourceLine" id="cb331-16" data-line-number="16"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb331-17" data-line-number="17"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb332"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb332-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>65536</p> +</blockquote> +<h4 id="horizontal-rule-renderer"><span class="header-section-number">2.3.1.17</span> Horizontal Rule Renderer</h4> +<p>The <code>\markdownRendererHorizontalRule</code> macro represents a horizontal rule. The macro receives no arguments.</p> +<h5 id="plain-tex-example-24" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb333"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb333-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb333-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererHorizontalRule{\vfil\break}</a> +<a class="sourceLine" id="cb333-3" data-line-number="3"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb333-4" data-line-number="4">This is the first page.</a> +<a class="sourceLine" id="cb333-5" data-line-number="5"></a> +<a class="sourceLine" id="cb333-6" data-line-number="6">***</a> +<a class="sourceLine" id="cb333-7" data-line-number="7"></a> +<a class="sourceLine" id="cb333-8" data-line-number="8">This is the second page.</a> +<a class="sourceLine" id="cb333-9" data-line-number="9"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb333-10" data-line-number="10"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb334"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb334-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is the first page.</p> +<hr /> +<p>This is the second page.</p> +</blockquote> +<h5 id="latex-example-38" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb335"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb335-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb335-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb335-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb335-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb335-5" data-line-number="5"> horizontalRule = <span class="fu">\newpage</span>,</a> +<a class="sourceLine" id="cb335-6" data-line-number="6"> },</a> +<a class="sourceLine" id="cb335-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb335-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb335-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb335-10" data-line-number="10">This is the first page.</a> +<a class="sourceLine" id="cb335-11" data-line-number="11"></a> +<a class="sourceLine" id="cb335-12" data-line-number="12">***</a> +<a class="sourceLine" id="cb335-13" data-line-number="13"></a> +<a class="sourceLine" id="cb335-14" data-line-number="14">This is the second page.</a> +<a class="sourceLine" id="cb335-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb335-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb336"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb336-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is the first page.</p> +<hr /> +<p>This is the second page.</p> +</blockquote> +<h5 id="context-example-32" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb337"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb337-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb337-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererHorizontalRule{\page[yes]}</a> +<a class="sourceLine" id="cb337-3" data-line-number="3"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb337-4" data-line-number="4"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb337-5" data-line-number="5">This is the first page.</a> +<a class="sourceLine" id="cb337-6" data-line-number="6"></a> +<a class="sourceLine" id="cb337-7" data-line-number="7">***</a> +<a class="sourceLine" id="cb337-8" data-line-number="8"></a> +<a class="sourceLine" id="cb337-9" data-line-number="9">This is the second page.</a> +<a class="sourceLine" id="cb337-10" data-line-number="10"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb337-11" data-line-number="11"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb338"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb338-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is the first page.</p> +<hr /> +<p>This is the second page.</p> +</blockquote> +<h4 id="footnote-renderer"><span class="header-section-number">2.3.1.18</span> Footnote Renderer</h4> +<p>The <code>\markdownRendererFootnote</code> macro represents a footnote. This macro will only be produced, when the <strong><code>footnotes</code></strong> option is <code>true</code>. The macro receives a single argument that corresponds to the footnote text.</p> +<h5 id="plain-tex-example-25" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb339"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb339-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb339-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a> +<a class="sourceLine" id="cb339-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererFootnote#1{ (and \lowercase{#1})}</a> +<a class="sourceLine" id="cb339-4" data-line-number="4"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb339-5" data-line-number="5">This is some text[^1] and this is some other text[^2].</a> +<a class="sourceLine" id="cb339-6" data-line-number="6"></a> +<a class="sourceLine" id="cb339-7" data-line-number="7"> [^1]: this is a footnote</a> +<a class="sourceLine" id="cb339-8" data-line-number="8"></a> +<a class="sourceLine" id="cb339-9" data-line-number="9"> [^2]: this is some other footnote</a> +<a class="sourceLine" id="cb339-10" data-line-number="10"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb339-11" data-line-number="11"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb340"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb340-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is some text (and this is a footnote) and this is some other text (and this is some other footnote).</p> +</blockquote> +<h5 id="latex-example-39" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb341"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb341-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb341-2" data-line-number="2"><span class="bu">\usepackage</span>[footnotes]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb341-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb341-4" data-line-number="4"> renderers = {</a> +<a class="sourceLine" id="cb341-5" data-line-number="5"> footnote = { (and <span class="fu">\MakeLowercase</span>{#1})},</a> +<a class="sourceLine" id="cb341-6" data-line-number="6"> },</a> +<a class="sourceLine" id="cb341-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb341-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb341-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb341-10" data-line-number="10">This is some text[^1] and this is some other text[^2].</a> +<a class="sourceLine" id="cb341-11" data-line-number="11"></a> +<a class="sourceLine" id="cb341-12" data-line-number="12"> [^1]: this is a footnote</a> +<a class="sourceLine" id="cb341-13" data-line-number="13"></a> +<a class="sourceLine" id="cb341-14" data-line-number="14"> [^2]: this is some other footnote</a> +<a class="sourceLine" id="cb341-15" data-line-number="15"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb341-16" data-line-number="16"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb342"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb342-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is some text (and this is a footnote) and this is some other text (and this is some other footnote).</p> +</blockquote> +<h5 id="context-example-33" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb343"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb343-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb343-2" data-line-number="2"><span class="fu">\def</span>\markdownOptionFootnotes{true}</a> +<a class="sourceLine" id="cb343-3" data-line-number="3"><span class="fu">\def</span>\markdownRendererFootnote#1{ (and \lowercase{#1})}</a> +<a class="sourceLine" id="cb343-4" data-line-number="4"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb343-5" data-line-number="5"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb343-6" data-line-number="6">This is some text[^1] and this is some other text[^2].</a> +<a class="sourceLine" id="cb343-7" data-line-number="7"></a> +<a class="sourceLine" id="cb343-8" data-line-number="8"> [^1]: this is a footnote</a> +<a class="sourceLine" id="cb343-9" data-line-number="9"></a> +<a class="sourceLine" id="cb343-10" data-line-number="10"> [^2]: this is some other footnote</a> +<a class="sourceLine" id="cb343-11" data-line-number="11"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb343-12" data-line-number="12"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb344"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb344-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is some text (and this is a footnote) and this is some other text (and this is some other footnote).</p> +</blockquote> +<h4 id="parenthesized-citations-renderer"><span class="header-section-number">2.3.1.19</span> Parenthesized Citations Renderer</h4> +<p>The <code>\markdownRendererCite</code> macro represents a string of one or more parenthetical citations. This macro will only be produced, when the <strong><code>citations</code></strong> option is <code>true</code>. The macro receives the parameter <code>{</code>⟨<em>number of citations</em>⟩<code>}</code> followed by <code>{</code>⟨<em>prenote</em>⟩<code>}{</code>⟨<em>postnote</em>⟩<code>}{</code>⟨<em>name</em>⟩<code>}</code> repeated ⟨<em>number of citations</em>⟩ times. The ⟨<em>suppress author</em>⟩ parameter is either the token <code>-</code>, when the author’s name is to be suppressed, or <code>+</code> otherwise.</p> +<h5 id="latex-example-40" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb345"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb345-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb345-2" data-line-number="2"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb345-3" data-line-number="3"><span class="fu">\newcount\citationsCounter</span></a> +<a class="sourceLine" id="cb345-4" data-line-number="4"><span class="fu">\newcount\citationsTotal</span></a> +<a class="sourceLine" id="cb345-5" data-line-number="5"><span class="fu">\makeatletter</span></a> +<a class="sourceLine" id="cb345-6" data-line-number="6"><span class="fu">\def</span>\citations#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb345-7" data-line-number="7"> a parenthesized citation \emph{#4}</a> +<a class="sourceLine" id="cb345-8" data-line-number="8"> \advance\citationsCounter by 1\relax</a> +<a class="sourceLine" id="cb345-9" data-line-number="9"> \ifx\relax#2\relax</a> +<a class="sourceLine" id="cb345-10" data-line-number="10"> \ifx\relax#3\relax\else</a> +<a class="sourceLine" id="cb345-11" data-line-number="11"> with a postfix \emph{#3}<span class="co">%</span></a> +<a class="sourceLine" id="cb345-12" data-line-number="12"> \fi</a> +<a class="sourceLine" id="cb345-13" data-line-number="13"> \else</a> +<a class="sourceLine" id="cb345-14" data-line-number="14"> with a prefix \emph{#2}<span class="co">%</span></a> +<a class="sourceLine" id="cb345-15" data-line-number="15"> \ifx\relax#3\relax\else</a> +<a class="sourceLine" id="cb345-16" data-line-number="16"> \ and a postfix \emph{#3}<span class="co">%</span></a> +<a class="sourceLine" id="cb345-17" data-line-number="17"> \fi</a> +<a class="sourceLine" id="cb345-18" data-line-number="18"> \fi</a> +<a class="sourceLine" id="cb345-19" data-line-number="19"> \ifnum\citationsCounter>\citationsTotal\relax</a> +<a class="sourceLine" id="cb345-20" data-line-number="20"> .<span class="co">%</span></a> +<a class="sourceLine" id="cb345-21" data-line-number="21"> \expandafter\@gobble</a> +<a class="sourceLine" id="cb345-22" data-line-number="22"> \else</a> +<a class="sourceLine" id="cb345-23" data-line-number="23"> , and</a> +<a class="sourceLine" id="cb345-24" data-line-number="24"> \fi\citations}</a> +<a class="sourceLine" id="cb345-25" data-line-number="25"><span class="fu">\makeatother</span></a> +<a class="sourceLine" id="cb345-26" data-line-number="26"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb345-27" data-line-number="27"> renderers = {</a> +<a class="sourceLine" id="cb345-28" data-line-number="28"> cite = {<span class="co">%</span></a> +<a class="sourceLine" id="cb345-29" data-line-number="29"> <span class="fu">\citationsCounter</span>=1<span class="co">%</span></a> +<a class="sourceLine" id="cb345-30" data-line-number="30"> <span class="fu">\citationsTotal</span>=#1<span class="co">%</span></a> +<a class="sourceLine" id="cb345-31" data-line-number="31"> This is</a> +<a class="sourceLine" id="cb345-32" data-line-number="32"> <span class="fu">\expandafter\citations</span></a> +<a class="sourceLine" id="cb345-33" data-line-number="33"> },</a> +<a class="sourceLine" id="cb345-34" data-line-number="34"> },</a> +<a class="sourceLine" id="cb345-35" data-line-number="35">}</a> +<a class="sourceLine" id="cb345-36" data-line-number="36"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb345-37" data-line-number="37"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb345-38" data-line-number="38">[see @abrahams90, pp. 12; @eijkhout91, pp. 34]</a> +<a class="sourceLine" id="cb345-39" data-line-number="39"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb345-40" data-line-number="40"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb346"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb346-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a parenthesized citation <em>abrahams90</em> with a prefix see and a postfix <em>pp. > 12</em>, and a citation <em>eijkhout91</em> with a postfix <em>pp. 34</em>.</p> +</blockquote> +<h4 id="text-citations-renderer"><span class="header-section-number">2.3.1.20</span> Text Citations Renderer</h4> +<p>The <code>\markdownRendererTextCite</code> macro represents a string of one or more text citations. This macro will only be produced, when the <strong><code>citations</code></strong> option is <code>true</code>. The macro receives parameters in the same format as the <code>\markdownRendererCite</code> macro.</p> +<h5 id="latex-example-41" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb347"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb347-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb347-2" data-line-number="2"><span class="bu">\usepackage</span>[citations]{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb347-3" data-line-number="3"><span class="fu">\newcount\citationsCounter</span></a> +<a class="sourceLine" id="cb347-4" data-line-number="4"><span class="fu">\newcount\citationsTotal</span></a> +<a class="sourceLine" id="cb347-5" data-line-number="5"><span class="fu">\makeatletter</span></a> +<a class="sourceLine" id="cb347-6" data-line-number="6"><span class="fu">\def</span>\citations#1#2#3#4{<span class="co">%</span></a> +<a class="sourceLine" id="cb347-7" data-line-number="7"> a text citation \emph{#4}</a> +<a class="sourceLine" id="cb347-8" data-line-number="8"> \advance\citationsCounter by 1\relax</a> +<a class="sourceLine" id="cb347-9" data-line-number="9"> \ifx\relax#2\relax</a> +<a class="sourceLine" id="cb347-10" data-line-number="10"> \ifx\relax#3\relax\else</a> +<a class="sourceLine" id="cb347-11" data-line-number="11"> with a postfix \emph{#3}<span class="co">%</span></a> +<a class="sourceLine" id="cb347-12" data-line-number="12"> \fi</a> +<a class="sourceLine" id="cb347-13" data-line-number="13"> \else</a> +<a class="sourceLine" id="cb347-14" data-line-number="14"> with a prefix \emph{#2}<span class="co">%</span></a> +<a class="sourceLine" id="cb347-15" data-line-number="15"> \ifx\relax#3\relax\else</a> +<a class="sourceLine" id="cb347-16" data-line-number="16"> \ and a postfix \emph{#3}<span class="co">%</span></a> +<a class="sourceLine" id="cb347-17" data-line-number="17"> \fi</a> +<a class="sourceLine" id="cb347-18" data-line-number="18"> \fi</a> +<a class="sourceLine" id="cb347-19" data-line-number="19"> \ifnum\citationsCounter>\citationsTotal\relax</a> +<a class="sourceLine" id="cb347-20" data-line-number="20"> .<span class="co">%</span></a> +<a class="sourceLine" id="cb347-21" data-line-number="21"> \expandafter\@gobble</a> +<a class="sourceLine" id="cb347-22" data-line-number="22"> \else</a> +<a class="sourceLine" id="cb347-23" data-line-number="23"> , and</a> +<a class="sourceLine" id="cb347-24" data-line-number="24"> \fi\citations}</a> +<a class="sourceLine" id="cb347-25" data-line-number="25"><span class="fu">\makeatother</span></a> +<a class="sourceLine" id="cb347-26" data-line-number="26"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb347-27" data-line-number="27"> renderers = {</a> +<a class="sourceLine" id="cb347-28" data-line-number="28"> textCite = {<span class="co">%</span></a> +<a class="sourceLine" id="cb347-29" data-line-number="29"> <span class="fu">\citationsCounter</span>=1<span class="co">%</span></a> +<a class="sourceLine" id="cb347-30" data-line-number="30"> <span class="fu">\citationsTotal</span>=#1<span class="co">%</span></a> +<a class="sourceLine" id="cb347-31" data-line-number="31"> This is</a> +<a class="sourceLine" id="cb347-32" data-line-number="32"> <span class="fu">\expandafter\citations</span></a> +<a class="sourceLine" id="cb347-33" data-line-number="33"> },</a> +<a class="sourceLine" id="cb347-34" data-line-number="34"> },</a> +<a class="sourceLine" id="cb347-35" data-line-number="35">}</a> +<a class="sourceLine" id="cb347-36" data-line-number="36"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb347-37" data-line-number="37"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb347-38" data-line-number="38">@abrahams90 [pp. 12; also @eijkhout91]</a> +<a class="sourceLine" id="cb347-39" data-line-number="39"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb347-40" data-line-number="40"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb348"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb348-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>This is a text citation <em>abrahams90</em> with a postfix <em>pp. 12</em>, and a citation <em>eijkhout91</em> with a prefix <em>also</em>.</p> +</blockquote> +<h3 id="token-renderer-prototypes"><span class="header-section-number">2.3.2</span> Token Renderer Prototypes</h3> +<p>By default, token renderers point to package-defined <span class="tex">T<sub>e</sub>X</span> macros, further referred to as <em>prototypes</em>, which provide useful default definitions.</p> +<h5 id="plain-tex-example-26" class="unnumbered">Plain <span class="tex">T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb349"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb349-1" data-line-number="1"><span class="fu">\input</span> markdown</a> +<a class="sourceLine" id="cb349-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTildePrototype{<span class="co">%</span></a> +<a class="sourceLine" id="cb349-3" data-line-number="3"> Packages can specify token renderer prototypes.<span class="co">%</span></a> +<a class="sourceLine" id="cb349-4" data-line-number="4">}</a> +<a class="sourceLine" id="cb349-5" data-line-number="5"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb349-6" data-line-number="6">~</a> +<a class="sourceLine" id="cb349-7" data-line-number="7"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb349-8" data-line-number="8"></a> +<a class="sourceLine" id="cb349-9" data-line-number="9"><span class="fu">\def</span>\markdownRendererTilde{<span class="co">%</span></a> +<a class="sourceLine" id="cb349-10" data-line-number="10"> User-defined token renderers take precedence.<span class="co">%</span></a> +<a class="sourceLine" id="cb349-11" data-line-number="11">}</a> +<a class="sourceLine" id="cb349-12" data-line-number="12"><span class="fu">\markdownBegin</span></a> +<a class="sourceLine" id="cb349-13" data-line-number="13">~</a> +<a class="sourceLine" id="cb349-14" data-line-number="14"><span class="fu">\markdownEnd</span></a> +<a class="sourceLine" id="cb349-15" data-line-number="15"><span class="fu">\bye</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb350"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb350-1" data-line-number="1"><span class="ex">luatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Packages can specify token renderer prototypes.</p> +<p>User-defined token renderers take precedence.</p> +</blockquote> +<h5 id="latex-example-42" class="unnumbered"><span class="latex">L<sup>a</sup>T<sub>e</sub>X</span> Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb351"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb351-1" data-line-number="1"><span class="bu">\documentclass</span>{<span class="ex">article</span>}</a> +<a class="sourceLine" id="cb351-2" data-line-number="2"><span class="bu">\usepackage</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb351-3" data-line-number="3"><span class="fu">\markdownSetup</span>{</a> +<a class="sourceLine" id="cb351-4" data-line-number="4"> rendererPrototypes = {</a> +<a class="sourceLine" id="cb351-5" data-line-number="5"> tilde = {Packages can specify token renderer prototypes.},</a> +<a class="sourceLine" id="cb351-6" data-line-number="6"> },</a> +<a class="sourceLine" id="cb351-7" data-line-number="7">}</a> +<a class="sourceLine" id="cb351-8" data-line-number="8"><span class="kw">\begin</span>{<span class="ex">document</span>}</a> +<a class="sourceLine" id="cb351-9" data-line-number="9"><span class="kw">\begin</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb351-10" data-line-number="10">~</a> +<a class="sourceLine" id="cb351-11" data-line-number="11"><span class="kw">\end</span>{<span class="ex">markdown</span>}</a> +<a class="sourceLine" id="cb351-12" data-line-number="12"></a> +<a class="sourceLine" id="cb351-13" data-line-number="13"><span class="kw">\begin</span>{<span class="ex">markdown*</span>}{</a> +<a class="sourceLine" id="cb351-14" data-line-number="14"> renderers = {</a> +<a class="sourceLine" id="cb351-15" data-line-number="15"> tilde = {User-defined token renderers take precedence.},</a> +<a class="sourceLine" id="cb351-16" data-line-number="16"> },</a> +<a class="sourceLine" id="cb351-17" data-line-number="17">}</a> +<a class="sourceLine" id="cb351-18" data-line-number="18">~</a> +<a class="sourceLine" id="cb351-19" data-line-number="19"><span class="kw">\end</span>{<span class="ex">markdown*</span>}</a> +<a class="sourceLine" id="cb351-20" data-line-number="20"><span class="kw">\end</span>{<span class="ex">document</span>}</a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb352"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb352-1" data-line-number="1"><span class="ex">lualatex</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Packages can specify token renderer prototypes.</p> +<p>User-defined token renderers take precedence.</p> +</blockquote> +<h5 id="context-example-34" class="unnumbered">Con<span class="tex">T<sub>e</sub>X</span>t Example</h5> +<p>Using a text editor, create a text document named <code>document.tex</code> with the following content:</p> +<div class="sourceCode" id="cb353"><pre class="sourceCode tex"><code class="sourceCode latex"><a class="sourceLine" id="cb353-1" data-line-number="1"><span class="fu">\usemodule</span>[t][markdown]</a> +<a class="sourceLine" id="cb353-2" data-line-number="2"><span class="fu">\def</span>\markdownRendererTildePrototype{<span class="co">%</span></a> +<a class="sourceLine" id="cb353-3" data-line-number="3"> Packages can specify token renderer prototypes.<span class="co">%</span></a> +<a class="sourceLine" id="cb353-4" data-line-number="4">}</a> +<a class="sourceLine" id="cb353-5" data-line-number="5"><span class="fu">\starttext</span></a> +<a class="sourceLine" id="cb353-6" data-line-number="6"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb353-7" data-line-number="7">~</a> +<a class="sourceLine" id="cb353-8" data-line-number="8"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb353-9" data-line-number="9"></a> +<a class="sourceLine" id="cb353-10" data-line-number="10"><span class="fu">\def</span>\markdownRendererTilde{<span class="co">%</span></a> +<a class="sourceLine" id="cb353-11" data-line-number="11"> User-defined token renderers take precedence.<span class="co">%</span></a> +<a class="sourceLine" id="cb353-12" data-line-number="12">}</a> +<a class="sourceLine" id="cb353-13" data-line-number="13"><span class="fu">\startmarkdown</span></a> +<a class="sourceLine" id="cb353-14" data-line-number="14">~</a> +<a class="sourceLine" id="cb353-15" data-line-number="15"><span class="fu">\stopmarkdown</span></a> +<a class="sourceLine" id="cb353-16" data-line-number="16"><span class="fu">\stoptext</span></a></code></pre></div> +<p>Next, invoke LuaTeX from the terminal:</p> +<div class="sourceCode" id="cb354"><pre class="sourceCode sh"><code class="sourceCode bash"><a class="sourceLine" id="cb354-1" data-line-number="1"><span class="ex">context</span> document.tex</a></code></pre></div> +<p>A PDF document named <code>document.pdf</code> should be produced and contain the following text:</p> +<blockquote> +<p>Packages can specify token renderer prototypes.</p> +<p>User-defined token renderers take precedence.</p> +</blockquote> +<section class="footnotes"> <hr /> <ol> -<li id="fn1"><p>Here is the footnote.<a href="#fnref1">↩</a></p></li> -<li id="fn2"><p>Here's one with multiple blocks.</p> +<li id="fn1"><p>Here is the footnote.<a href="#fnref1" class="footnote-back">↩</a></p></li> +<li id="fn2"><p>Here’s one with multiple blocks.</p> <p>Subsequent paragraphs are indented to show that they belong to the previous footnote.</p> <pre><code>{ some.code }</code></pre> -<p>The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref2">↩</a></p></li> -<li id="fn3"><p>Here is the footnote.<a href="#fnref3">↩</a></p></li> -<li id="fn4"><p>Here's one with multiple blocks.</p> +<p>The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref2" class="footnote-back">↩</a></p></li> +<li id="fn3"><p>Here is the footnote.<a href="#fnref3" class="footnote-back">↩</a></p></li> +<li id="fn4"><p>Here’s one with multiple blocks.</p> <p>Subsequent paragraphs are indented to show that they belong to the previous footnote.</p> <pre><code>{ some.code }</code></pre> -<p>The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref4">↩</a></p></li> -<li id="fn5"><p>Inlines notes are easier to write, since you don't have to pick an identifier and move down to type the note.<a href="#fnref5">↩</a></p></li> -<li id="fn6"><p>Inlines notes are easier to write, since you don't have to pick an identifier and move down to type the note.<a href="#fnref6">↩</a></p></li> +<p>The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.<a href="#fnref4" class="footnote-back">↩</a></p></li> +<li id="fn5"><p>Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note.<a href="#fnref5" class="footnote-back">↩</a></p></li> +<li id="fn6"><p>Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note.<a href="#fnref6" class="footnote-back">↩</a></p></li> </ol> -</div> +</section> </body> </html> diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.md b/Master/texmf-dist/doc/generic/markdown/markdown.md index 7bbfc7fa4f1..ddd8c67dcdb 100644 --- a/Master/texmf-dist/doc/generic/markdown/markdown.md +++ b/Master/texmf-dist/doc/generic/markdown/markdown.md @@ -2,6 +2,7 @@ --- title: Markdown Package User Manual author: Vít Novotný +date: v\markdownVersion{} (\markdownLastModified{}) --- @@ -9,12 +10,12 @@ author: Vít Novotný Introduction ============ -The [Markdown package][pkg] converts [markdown][] markup to TeX commands. The -functionality is provided both as a Lua module, and as plain TeX, LaTeX, and -ConTeXt macro packages that can be used to directly typeset TeX documents +The [Markdown package][pkg] converts [markdown][] markup to \TeX{} commands. The +functionality is provided both as a Lua module and as plain \TeX{}, \LaTeX{}, and +\Hologo{ConTeXt} macro packages that can be used to directly typeset \TeX documents containing markdown markup. Unlike other convertors, the Markdown package makes it easy to redefine how each and every markdown element is rendered. -Creative abuse of the markdown syntax is encouraged. <i class="em em-wink"></i> +Creative abuse of the markdown syntax is encouraged. ;-) [markdown]: https://daringfireball.net/projects/markdown/basics/ (Daring Fireball: Markdown Basics) @@ -23,9 +24,9 @@ Creative abuse of the markdown syntax is encouraged. <i class="em em-wink"></i> This document is a user manual for the [Markdown package][pkg]. It provides -beginner tutorials and code examples. For an in-depth description of the -package requirements, interfaces, and implementation, please refer to the -[technical documentation][techdoc]. +tutorials and code examples. For an in-depth description of the package +requirements, interfaces, and implementation, please refer to the [technical +documentation][techdoc]. [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf (A Markdown Interpreter for TeX) @@ -34,19 +35,19 @@ package requirements, interfaces, and implementation, please refer to the Requirements ------------ -The package requires a working TeX distribution. [TeX Live][] ≥ 2013 is known to -work and so are recent installation of [MikTeX][]. If you are using a minimal -installation of a TeX distribution, please consult the +The package requires a working \TeX{} distribution. [\TeX{} Live][tl] ≥ 2013 is +known to work and so are recent installation of [Mik\TeX{}][mik]. If you are +using a minimal installation of a \TeX{} distribution, please consult the [technical documentation][techdoc] for a detailed list of required packages. - [TeX Live]: https://www.tug.org/texlive/ (TeX Live - TeX Users Group) - [MikTeX]: https://miktex.org/ (Home - MiKTeXorg) + [tl]: https://www.tug.org/texlive/ (TeX Live - TeX Users Group) + [mik]: https://miktex.org/ (Home - MiKTeXorg) Installation ------------ -The package comes pre-installed with [TeX Live][] ≥ 2016 and with recent -installations of [MikTeX][]. Unless you explicitly wish to use the latest +The package comes pre-installed with [\TeX{} Live][tl] ≥ 2016 and with recent +installations of [MikTeX][mik]. Unless you explicitly wish to use the latest version of the package, you are encouraged to skip this step. To install the package, first download the package from the repository @@ -55,7 +56,7 @@ using Git: git clone https://github.com/witiko/markdown `````` Next, enter the directory named `markdown` and interpret the file named -`markdown.ins` file using a Unicode-aware TeX engine, such as XeTeX or +`markdown.ins` file using a Unicode-aware \TeX{} engine, such as XeTeX or LuaTeX: ``` sh cd markdown @@ -63,16 +64,17 @@ luatex markdown.ins `````` This should produce the following files: - * `markdown.lua` – the Lua module, - * `markdown-cli.lua` – the Lua command-line interface, - * `markdown.tex` – the plain TeX macro package, - * `markdown.sty` – the LaTeX package, and - * `t-markdown.tex` – the ConTeXt module. + * `markdown.lua`, the Lua module, + * `markdown-cli.lua`, the Lua command-line interface, + * `markdown.tex`, the plain \TeX{} macro package, + * `markdown.sty`, the \LaTeX{} package, and + * `t-markdown.tex`, the \Hologo{ConTeXt} module. -### Local installation +### Local Installation -To perform a local installation, place the above files into your TeX directory -structure. This is generally where the individual files should be placed: +To perform a local installation, place the above files into your \TeX{} +directory structure. This is generally where the individual files should be +placed: * `<TEXMF>/tex/luatex/markdown/markdown.lua` * `<TEXMF>/scripts/markdown/markdown-cli.lua` @@ -80,23 +82,23 @@ structure. This is generally where the individual files should be placed: * `<TEXMF>/tex/latex/markdown/markdown.sty` * `<TEXMF>/tex/context/third/markdown/t-markdown.tex` -where `<TEXMF>` corresponds to a root of your TeX distribution, such as +where `<TEXMF>` corresponds to a root of your \TeX{} distribution, such as `/usr/share/texmf` and `~/texmf` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\texmf` on Windows systems. When in doubt, -consult the manual of your TeX distribution. +`C:\Users\`\meta{Your username}`\texmf` on Windows systems. When in doubt, +consult the manual of your \TeX{} distribution. -### Portable installation ### +### Portable Installation Alternatively, you can also store the above files in the same folder as your -TeX document and distribute them together. This way your document can be -portably typeset on legacy TeX distributions. +\TeX{} document and distribute them together. This way your document can be +portably typeset on legacy \TeX{} distributions. -First document +First Document -------------- In this section, we will take the necessary steps to typeset our first markdown -document in TeX. This will serve as our first hands-on experience with the +document in \TeX{}. This will serve as our first hands-on experience with the package and also as a reassurance that the package has been correctly installed. ### Using Lua @@ -109,7 +111,7 @@ following content: \bye ``````` -#### Using the Lua module +#### Using the Lua Module Using a text editor, create a text document named `hello.lua` with the following content: @@ -133,7 +135,7 @@ texlua hello.lua > hello.tex pdftex document.tex `````` -#### Using the Lua CLI +#### Using the Lua Command-Line Interface Using a text editor, create a text document named `hello.md` with the following content: @@ -142,12 +144,12 @@ Hello *world*! `````` Next, invoke LuaTeX from the terminal: ``` sh -texlua <CLI␣PATHNAME> -- hello.md hello.tex +texlua ⟨CLI pathname⟩ -- hello.md hello.tex luatex document.tex `````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, +where \meta{CLI pathname} 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\<YOUR␣USERNAME>\texmf\scripts\markdown\markdown-cli.lua` on Windows +`C:\Users\`\meta{Your username}`\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][]. @@ -156,11 +158,11 @@ script file using [Kpathsea][]. A PDF document named `document.pdf` should be produced and contain the text “Hello *world*!” Invoking pdfTeX should have the same effect: ``` sh -texlua <CLI␣PATHNAME> -- hello.md hello.tex +texlua ⟨CLI pathname⟩ -- hello.md hello.tex pdftex document.tex `````` -### Using plain TeX +### Using Plain \TeX{} Using a text editor, create a text document named `document.tex` with the following content: @@ -181,7 +183,7 @@ A PDF document named `document.pdf` should be produced and contain the text pdftex --shell-escape document.tex ``````` -### Using LaTeX +### Using \LaTeX{} Using a text editor, create a text document named `document.tex` with the following content: @@ -221,7 +223,7 @@ lualatex latex.tex `````` to see the effect of your changes. -### Using ConTeXt +### Using \Hologo{ConTeXt} Using a text editor, create a text document named `document.tex` with the following content: @@ -263,3240 +265,14 @@ to see the effect of your changes. Examples ======== -This section will show how to use the package by example. - - -Lua ---- - -The Lua part of the package makes it possible to convert a markdown document -into TeX commands and typeset it later when convenient. Although the typical -user will not find this terribly useful and will instead use the plain TeX, -LaTeX, and ConTeXt macro packages to convert and typeset the markdown documents -in a single step, they will still benefit from learning the options that -control the behavior of the Lua parser. - - -### Interfaces - -The Lua part of the package exposes two interfaces – the `markdown` Lua module, -and the Lua command-line interface (CLI). - -#### The Lua module - -The `markdown` Lua module exposes the `new(options)` method, which creates a -converter function from markdown to TeX. The properties of the converter -function are specified by the Lua table `options`. The parameter is optional; -when unspecified, the behaviour will be the same as if `options` were an empty -table. - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\input lmfonts -\input example -\bye -``````` -Using a text editor, create a text document named `example.lua` with the -following content: -``` lua -#!/usr/bin/env texlua -local kpse = require("kpse") -kpse.set_program_name("luatex") -local markdown = require("markdown") -local convert_safe = markdown.new() -local convert_unsafe = markdown.new({hybrid = true}) -local input = [[$\sqrt{-1}$ *equals* $i$.]] -print(convert_safe(input) .. " " .. convert_unsafe(input)) -``````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua example.lua > example.tex -luatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the text -“\$\\sqrt{-1}\$ *equals* \$i\$. √-̅1̅ *equals* $i$.” Invoking pdfTeX should have -the same effect: -``` sh -texlua example.lua > example.tex -pdftex document.tex -`````` - -*** - -Rather than use the `texlua` interpreter, we can also access the `markdown` Lua -module directly from our document. Using a text editor, create a text document -named `document.tex` with the following content: -``` 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 -``````` -Next, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -``````` -A PDF document named `document.pdf` should be produced and contain the text -“\$\\sqrt {-1}\$ *equals* \$i\$. √-̅1̅ *equals* $i$.” In this case, we cannot -use pdfTeX, because pdfTeX does not define the `\directlua` TeX command. - -#### The Lua CLI - -The Lua command-line interface (CLI) accepts the same options as the `markdown` -Lua module, but now the options are specified as command-line parameters. - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\input lmfonts -\input safe\ \input unsafe -\bye -``````` -Using a text editor, create a text document named `example.md` with the -following content: -``` md -$\sqrt{-1}$ *equals* $i$. -`````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> -- example.md safe.tex -texlua <CLI␣PATHNAME> hybrid=true -- example.md unsafe.tex -luatex document.tex -`````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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 text -“\$\\sqrt{-1}\$ *equals* \$i\$. √-̅1̅ *equals* $i$.” Invoking pdfTeX should have -the same effect: -``` sh -texlua <CLI␣PATHNAME> -- example.md safe.tex -texlua <CLI␣PATHNAME> hybrid=true -- example.md unsafe.tex -pdftex document.tex -`````` - - -### Options - -This section will cover the options recognized by the Lua interface. The -interfaces of the plain TeX, LaTeX, and ConTeXt macro packages recognize these -options as well, in addition to their own options. - - -#### File and Directory Names - - -##### Option `cacheDir` - -`cacheDir` (default value: `"."`) - -: A path to the directory containing auxiliary cache files. If the last - segment of the path does not exist, it will be created by the Lua - command-line and plain TeX implementations. The Lua implementation expects - that the entire path already exists. - - When iteratively writing and typesetting a markdown document, the cache - files are going to accumulate over time. You are advised to clean the - cache directory every now and then, or to set it to a temporary filesystem - (such as `/tmp` on UN*X systems), which gets periodically emptied. - - -###### Lua module example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\directlua{ - local markdown = require("markdown") - local convert = markdown.new({cacheDir = "cache"}) - local input = "Hello *world*!" - tex.sprint(convert(input)) } -\bye -``````` -Create an empty directory named `cache` next to our text document. Then, invoke -LuaTeX from the terminal: -``` sh -luatex document.tex -``````` -A PDF document named `document.pdf` should be produced and contain the text -“Hello *world*!” Several cache files of the Markdown package will also be -produced in the `cache` directory as we requested using the `cacheDir` option. - -###### Lua CLI example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\input hello -\bye -``````` -Using a text editor, create a text document named `hello.md` with the -following content: -``` md -Hello *world*! -`````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> cacheDir=cache -- hello.md hello.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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 text -“Hello *world*!” A directory named `cache` containing several cache files of -the Markdown package will also be produced as we requested using the `cacheDir` -option. - -###### Plain TeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\def\markdownOptionCacheDir{cache} -\markdownBegin -Hello *world*! -\markdownEnd -\bye -``````` -Next, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the text “Hello -*world*!” A directory named `cache` containing several cache files of the -Markdown package will also be produced as we requested using the `cacheDir` -option. - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\documentclass{article} -\usepackage[cacheDir=cache]{markdown} -\begin{document} -\begin{markdown} -Hello *world*! -\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 text “Hello -*world*!” A directory named `cache` containing several cache files of the -Markdown package will also be produced as we requested using the `cacheDir` -option. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\def\markdownOptionCacheDir{cache} -\starttext -\startmarkdown -Hello *world*! -\stopmarkdown -\stoptext -``````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the text “Hello -*world*!” A directory named `cache` containing several cache files of the -Markdown package will also be produced as we requested using the `cacheDir` -option. - - -#### Parser Options - - -##### Option `blankBeforeBlockquote` - -`blankBeforeBlockquote` (default value: `false`) - -: true - - : Require a blank line between a paragraph and the following blockquote. - - false - - : Do not require a blank line between a paragraph and the following - blockquote. - - -###### 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 newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "A paragraph." .. newline .. - "> A quote." .. newline - tex.sprint(convert(input)) - - convert = markdown.new({blankBeforeBlockquote = true}) - input = "A paragraph." .. newline .. - "> Not a quote." .. newline - tex.sprint(convert(input)) } -\bye -``````` -Then, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -``````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> > A quote. -> -> A paragraph > Not a quote. - -###### 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 -A paragraph. -> A quote? -`````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> blankBeforeBlockquote=true -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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: - -> A paragraph. -> -> > A quote? -> -> A paragraph. > A quote? - -###### Plain TeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown - -\markdownBegin -A paragraph. -> A quote. -\markdownEnd - -\def\markdownOptionBlankBeforeBlockquote{true} -\markdownBegin -A paragraph. -> Not a quote. -\markdownEnd - -\bye -``````` -Next, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> > A quote. -> -> A paragraph > Not a quote. - -###### 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} -A paragraph. -> A quote. -\end{markdown} - -\begin{markdown*}{blankBeforeBlockquote} -A paragraph. -> Not a quote. -\end{markdown*} - -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> > A quote. -> -> A paragraph > Not a quote. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\starttext - -\startmarkdown -A paragraph. -> A quote. -\stopmarkdown - -\def\markdownOptionBlankBeforeBlockquote{true} -\startmarkdown -A paragraph. -> Not a quote. -\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: - -> A paragraph. -> -> > A quote. -> -> A paragraph > Not a quote. - - -##### Option `blankBeforeCodeFence` - -`blankBeforeCodeFence` (default value: `false`) - -: true - - : Require a blank line between a paragraph and the following fenced code - block. - - false - - : Do not require a blank line between a paragraph and the following - fenced code block. - - -###### 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 newline = [[^^J^^J]] - local convert, input - - convert = markdown.new({fencedCode = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "A code fence." .. newline .. - "```" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({ - fencedCode = true, blankBeforeCodeFence = true}) - input = "A paragraph." .. newline .. - "```" .. newline .. - "Not a code fence." .. newline .. - "```" .. newline - 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: - -> A paragraph. -> -> ``` -> A code fence. -> ``` -> -> A paragraph. ``` Not a code fence. ``` - -###### 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 -A paragraph. -``` -A code fence? -``` -``````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> fencedCode=true -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> fencedCode=true blankBeforeCodeFence=true -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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: - -> A paragraph. -> -> ``` -> A code fence? -> ``` -> -> A paragraph. ``` A code fence? ``` - -###### Plain TeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -```` tex -\input markdown -\def\markdownOptionFencedCode{true} - -\markdownBegin -A paragraph. -``` -A code fence. -``` -\markdownEnd - -\def\markdownOptionBlankBeforeCodeFence{true} -\markdownBegin -A paragraph. -``` -Not a code fence. -``` -\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: - -> A paragraph. -> -> ``` -> A code fence. -> ``` -> -> A paragraph. ``` Not a code fence. ``` - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -```` tex -\documentclass{article} -\usepackage[fencedCode]{markdown} -\begin{document} - -\begin{markdown} -A paragraph. -``` -A code fence. -``` -\end{markdown} - -\begin{markdown*}{blankBeforeCodeFence} -A paragraph. -``` -Not a code fence. -``` -\end{markdown*} - -\end{document} -```````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> ``` -> A code fence. -> ``` -> -> A paragraph. ``` Not a code fence. ``` - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -```` tex -\usemodule[t][markdown] -\def\markdownOptionFencedCode{true} -\starttext - -\startmarkdown -A paragraph. -``` -A code fence. -``` -\stopmarkdown - -\def\markdownOptionBlankBeforeCodeFence{true} -\startmarkdown -A paragraph. -``` -Not a code fence. -``` -\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: - -> A paragraph. -> -> ``` -> A code fence. -> ``` -> -> A paragraph. ``` Not a code fence. ``` - - -##### Option `blankBeforeHeading` - -`blankBeforeHeading` (default value: `false`) - -: true - - : Require a blank line between a paragraph and the following header. - - false - - : Do not require a blank line between a paragraph and the following - header. - - -###### Lua module example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\input lmfonts -\def\markdownRendererHeadingOne#1{{\bf #1}\par} -\directlua{ - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "A paragraph." .. newline .. - "A heading." .. newline .. - "==========" .. newline - tex.sprint(convert(input)) - - convert = markdown.new({blankBeforeHeading = true}) - input = "A paragraph." .. newline .. - "Not a heading." .. newline .. - "==============" .. newline - tex.sprint(convert(input)) } -\bye -``````` -Then, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -``````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> A heading. -> ========== -> -> A paragraph. Not a heading. ============== - -###### 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 -A paragraph. -A heading? -========== -`````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> blankBeforeHeading=true -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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: - -> A paragraph. -> -> A heading? -> ========== -> -> A paragraph. A heading? ========== - -###### Plain TeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown - -\markdownBegin -A paragraph. -A heading. -========== -\markdownEnd - -\def\markdownOptionBlankBeforeHeading{true} -\markdownBegin -A paragraph. -Not a heading. -============== -\markdownEnd - -\bye -``````` -Next, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> A heading. -> ========== -> -> A paragraph. Not a heading. ============== - -###### 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} -A paragraph. -A heading. -========== -\end{markdown} - -\begin{markdown*}{blankBeforeHeading} -A paragraph. -Not a heading. -============== -\end{markdown*} - -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> A paragraph. -> -> A heading. -> ========== -> -> A paragraph. Not a heading. ============== - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\starttext - -\startmarkdown -A paragraph. -A heading. -========== -\stopmarkdown - -\def\markdownOptionBlankBeforeHeading{true} -\startmarkdown -A paragraph. -Not a heading. -============== -\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: - -> A paragraph. -> -> A heading. -> ========== -> -> A paragraph. Not a heading. ============== - - -##### Option `breakableBlockquotes` - -`breakableBlockquotes` (default value: `false`) - -: true - - : A blank line separates block quotes. - - false - - : Blank lines in the middle of a block quote are ignored. - - -###### Lua module example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown -\input lmfonts -\def\markdownRendererHeadingOne#1{{\bf #1}\par} -\directlua{ - local markdown = require("markdown") - local newline = [[^^J^^J]] - local convert, input - - convert = markdown.new() - input = "> A single" .. newline .. newline .. - "> block quote." .. newline - tex.sprint(convert(input)) - - convert = markdown.new({breakableBlockquotes = true}) - input = "> A block quote." .. newline .. newline .. - "> Another block quote." .. newline - tex.sprint(convert(input)) } -\bye -``````` -Then, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -``````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> > A single block quote. -> -> > A block quote. -> -> > Another block quote. - -###### 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 -> A single block quote - -> or two block quotes? -`````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> breakableBlockquotes=true -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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: - -> > A single block quote or two block quotes? -> -> > A single block quote -> -> > or two block quotes? - -###### Plain TeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown - -\markdownBegin -> A single - -> block quote. -\markdownEnd - -\def\markdownOptionBreakableBlockquotes{true} -\markdownBegin -> A block quote. - -> Another block quote. -\markdownEnd - -\bye -``````` -Next, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> > A single block quote. -> -> > A block quote. -> -> > Another block quote. - -###### 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} -> A single - -> block quote. -\end{markdown} - -\begin{markdown*}{breakableBlockquotes} -> A block quote. - -> Another block quote. -\end{markdown*} - -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> > A single block quote. -> -> > A block quote. -> -> > Another block quote. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\starttext - -\startmarkdown -> A single - -> block quote. -\stopmarkdown - -\def\markdownOptionBreakableBlockquotes{true} -\startmarkdown -> A block quote. - -> Another block quote. -\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: - -> > A single block quote. -> -> > A block quote. -> -> > Another block quote. - - -##### Option `citationNbsps` - -`citationNbsps` (default value: `true`) - -: true - - : Replace regular spaces with non-breakable spaces inside the prenotes - and postnotes of citations produced via the pandoc citation syntax - extension. - - false - - : Do not replace regular spaces with non-breakable spaces inside the - prenotes and postnotes of citations produced via the pandoc citation - syntax extension. - - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `document.bib` with the -following content: -``` bib -@book{knuth:tex, - author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" } -``````` -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\documentclass{article} -\usepackage[citations]{markdown} -\begin{document} - -\begin{markdown} -The TeXbook [@knuth:tex, p. 123 and 130] is good. -\end{markdown} - -\begin{markdown*}{citationNbsps = false} -The TeXbook [@knuth:tex, p. 123 and 130] is good. -\end{markdown*} - -\bibliographystyle{plain} -\bibliography{document.bib} -\end{document} -``````` -Next, invoke LuaTeX and BibTeX from the terminal: -``` sh -lualatex document.tex -bibtex document.aux -lualatex document.tex -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text, where the middot (`·`) denotes a non-breakable space: - -> The TeXbook [1, p.·123·and·130] is good. -> -> The TeXbook [1, p. 123 and 130] is good. -> -> ### References -> [1] Donald·Ervin Knuth. _The TeXbook, volume A of Computers and typesetting._ -> Addison-Wesley, 1984. - - -##### Option `citations` - -`citations` (default value: `false`) - -: true - - : Enable the pandoc citation syntax extension: - - ``` md - Here is a simple parenthetical citation [@doe99] and here - is a string of several [see @doe99, pp. 33-35; also - @smith04, chap. 1]. - - A parenthetical citation can have a [prenote @doe99] and - a [@smith04 postnote]. The name of the author can be - suppressed by inserting a dash before the name of an - author as follows [-@smith04]. - - Here is a simple text citation @doe99 and here is - a string of several @doe99 [pp. 33-35; also @smith04, - chap. 1]. Here is one with the name of the author - suppressed -@doe99. - `````` - -: false - - : Disable the pandoc citation syntax extension. - - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `document.bib` with the -following content: -``` bib -@book{knuth:tex, - author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" } -``````` -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\documentclass{article} -\usepackage[backend=biber]{biblatex} -\addbibresource{document.bib} -\usepackage[citations]{markdown} -\begin{document} - -\begin{markdown} -The TeXbook [@knuth:tex, p. 123 and 130] was written by @knuth:tex. -\end{markdown} - -\printbibliography -\end{document} -``````` -Next, invoke LuaTeX and Biber from the terminal: -``` sh -lualatex document.tex -biber document.bcf -lualatex document.tex -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> The TeXbook [1, p.·123 and 130] was written by Knuth [1]. -> -> ### References -> [1] Donald Ervin Knuth. _The TeXbook, volume A of Computers and typesetting._ -> Addison-Wesley, 1984. - - -##### Option `codeSpans` - -`codeSpans` (default value: `true`) - -: true - - : Enable the code span syntax: - - ~~~ md - Use the `printf()` function. - ``There is a literal backtick (`) here.`` - ~~~ - -: false - - : Disable the code span syntax. This allows you to easily - use the quotation mark ligatures in texts that do not contain code - spans: - - ~~~ - ``This is a quote.'' - ~~~~~~ - - -###### 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 = markdown.new() - local input = - "``This is a code span.'' " .. - "``This is no longer a code span.''" - tex.sprint(convert(input)) } -\par -\directlua{ - local markdown = require("markdown") - local convert = markdown.new({codeSpans = false}) - local input = - "``This is a quote.'' " .. - "``This is another quote.''" - tex.sprint(convert(input)) } -\bye -``````` -Then, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -``````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ``This is a code span.'' ``This is no longer a code span.'' -> -> “This is a quote.” “This is another quote.” - -###### 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 -\par -\input optiontrue -\bye -``````` -Using a text editor, create a text document named `content.md` with the -following content: -``` md -``Is this a code span?'' ``Or a quote?'' -`````` -Next, invoke LuaTeX from the terminal: -``` sh -texlua <CLI␣PATHNAME> codeSpans=false -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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 this a code span?” “Or a quote?” -> -> ``Is this a code span?'' ``Or a quote?'' - -###### Plain TeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\input markdown - -\markdownBegin -``This is a code span.'' -``This is no longer a code span.'' -\markdownEnd - -\def\markdownOptionCodeSpans{false} -\markdownBegin -``This is a quote.'' -``This is another quote.'' -\markdownEnd - -\bye -``````` -Next, invoke LuaTeX from the terminal: -``` sh -luatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ``This is a code span.'' ``This is no longer a code span.'' -> -> “This is a quote.” “This is another quote.” - -###### 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} -``This is a code span.'' -``This is no longer a code span.'' -\end{markdown} - -\begin{markdown*}{codeSpans=false} -``This is a quote.'' -``This is another quote.'' -\end{markdown*} - -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ``This is a code span.'' ``This is no longer a code span.'' -> -> “This is a quote.” “This is another quote.” - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\starttext - -\startmarkdown -``This is a code span.'' -``This is no longer a code span.'' -\stopmarkdown - -\def\markdownOptionCodeSpans{false} -\startmarkdown -``This is a quote.'' -``This is another quote.'' -\stopmarkdown - -\stoptext -```````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ``This is a code span.'' ``This is no longer a code span.'' -> -> “This is a quote.” “This is another quote.” - - -##### Option `contentBlocks` - -`contentBlocks` (default value: `false`) - -: true - - : Enable the - iA Writer content blocks syntax extension: - - ``` md - http://example.com/minard.jpg (Napoleon's - disastrous Russian campaign of 1812) - /Flowchart.png "Engineering Flowchart" - /Savings Account.csv 'Recent Transactions' - /Example.swift - /Lorem Ipsum.txt - `````` - -: false - - : Disable the - iA Writer content blocks syntax extension. - - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `table.csv` with the -following content: -``` csv -Name,Surname,Born -Albert,Einstein,1879 -Marie,Curie,1867 -Thomas,Edison,1847 -``````` -Create also a text document named `markdown-languages.json` with the following -content: -``` js -{ - "tex": "LaTeX" -} -`````` -Create also a text document named `code.tex` with the following content: -``` tex -This is an example code listing in \LaTeX. -``````` -Create also a text document named `part.md` with the following content: -``` md -This is a *transcluded markdown document*. -`````` -Create also a text document named `document.tex` with the following content: -``` tex -\documentclass{article} -\usepackage{minted} -\usepackage[contentBlocks]{markdown} -\begin{document} -\begin{markdown} -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -\end{markdown} -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex --shell-escape document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> | Name | Surname | Born | -> | ------ | ---------| ---- | -> | Albert | Einstein | 1879 | -> | Marie | Curie | 1867 | -> | Thomas | Edison | 1847 | -> -> Table 1: An example table -> -> ``` tex -> This is an example code listing in \LaTeX. -> ``````` -> -> This is a *transcluded markdown document*. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `table.csv` with the -following content: -``` csv -Name,Surname,Born -Albert,Einstein,1879 -Marie,Curie,1867 -Thomas,Edison,1847 -``````` -Create also a text document named `markdown-languages.json` with the following -content: -``` js -{ - "tex": "ConTeXt" -} -`````` -Create also a text document named `code.tex` with the following content: -``` tex -This is an example code listing in \ConTeXt. -``````` -Create also a text document named `part.md` with the following content: -``` md -This is a *transcluded markdown document*. -`````` -Create also a text document named `document.tex` with the following content: -``` tex -\usemodule[t][markdown] -\def\markdownOptionContentBlocks{true} -\definetyping [ConTeXt] -\setuptyping [ConTeXt] [option=TEX] -\starttext -\startmarkdown -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -\stopmarkdown -\stoptext -```````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> | Name | Surname | Born | -> | ------ | ---------| ---- | -> | Albert | Einstein | 1879 | -> | Marie | Curie | 1867 | -> | Thomas | Edison | 1847 | -> -> Table 1: An example table -> -> ``` tex -> This is an example code listing in \ConTeXt. -> ``````` -> -> This is a *transcluded markdown document*. - - -##### Option `contentBlocksLanguageMap` - -`contentBlocksLanguageMap` (default value: `"markdown-languages.json"`) - -: The filename of the JSON file that maps filename extensions to - programming language names in the iA Writer content blocks. - - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `table.csv` with the -following content: -``` csv -Name,Surname,Born -Albert,Einstein,1879 -Marie,Curie,1867 -Thomas,Edison,1847 -``````` -Create also a text document named `language-map.json` with the following -content: -``` js -{ - "tex": "LaTeX" -} -`````` -Create also a text document named `code.tex` with the following content: -``` tex -This is an example code listing in \LaTeX. -``````` -Create also a text document named `part.md` with the following content: -``` md -This is a *transcluded markdown document*. -`````` -Create also a text document named `document.tex` with the following content: -``` tex -\documentclass{article} -\usepackage{minted} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - contentBlocksLanguageMap = {language-map.json}, -} -\begin{document} -\begin{markdown} -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -\end{markdown} -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex --shell-escape document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> | Name | Surname | Born | -> | ------ | ---------| ---- | -> | Albert | Einstein | 1879 | -> | Marie | Curie | 1867 | -> | Thomas | Edison | 1847 | -> -> Table 1: An example table -> -> ``` tex -> This is an example code listing in \LaTeX. -> ``````` -> -> This is a *transcluded markdown document*. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `table.csv` with the -following content: -``` csv -Name,Surname,Born -Albert,Einstein,1879 -Marie,Curie,1867 -Thomas,Edison,1847 -``````` -Create also a text document named `language-map.json` with the following -content: -``` js -{ - "tex": "ConTeXt" -} -`````` -Create also a text document named `code.tex` with the following content: -``` tex -This is an example code listing in \ConTeXt. -``````` -Create also a text document named `part.md` with the following content: -``` md -This is a *transcluded markdown document*. -`````` -Create also a text document named `document.tex` with the following content: -``` tex -\usemodule[t][markdown] -\def\markdownOptionContentBlocks{true} -\def\markdownOptionContentBlocksLanguageMap{language-map.json} -\definetyping [ConTeXt] -\setuptyping [ConTeXt] [option=TEX] -\starttext -\startmarkdown -/table.csv (An example table) -/code.tex (An example code listing) -/part.md (A file transclusion example) -\stopmarkdown -\stoptext -```````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> | Name | Surname | Born | -> | ------ | ---------| ---- | -> | Albert | Einstein | 1879 | -> | Marie | Curie | 1867 | -> | Thomas | Edison | 1847 | -> -> Table 1: An example table -> -> ``` tex -> This is an example code listing in \ConTeXt. -> ``````` -> -> This is a *transcluded markdown document*. - - -##### Option `definitionLists` - -`definitionLists` (default value: `false`) - -: true - - : Enable the pandoc definition list syntax extension: - - ``` md - Term 1 - - : Definition 1 - - Term 2 with *inline markup* - - : Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2. - ````` - -: false - - : Disable the pandoc definition list syntax extension. - - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\documentclass{article} -\usepackage[definitionLists]{markdown} -\begin{document} -\begin{markdown} -Term 1 - -: Definition 1 - -Term 2 with *inline markup* - -: Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2. -\end{markdown} -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> Term 1 -> -> : Definition 1 -> -> Term 2 with *inline markup* -> -> : Definition 2 -> -> { some code, part of Definition 2 } -> -> Third paragraph of definition 2. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\def\markdownOptionDefinitionLists{true} -\starttext -\startmarkdown -Term 1 - -: Definition 1 - -Term 2 with *inline markup* - -: Definition 2 - - { some code, part of Definition 2 } - - Third paragraph of definition 2. -\stopmarkdown -\stoptext -```````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> Term 1 -> -> : Definition 1 -> -> Term 2 with *inline markup* -> -> : Definition 2 -> -> { some code, part of Definition 2 } -> -> Third paragraph of definition 2. - - -##### Option `fencedCode` - -`fencedCode` (default value: `false`) - -: true - - : Enable the commonmark fenced code block extension: - - ~~~~~~~~ md - ~~~ js - if (a > 3) { - moveShip(5 * gravity, DOWN); - } - ~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ``` - ~~~~~~~~~~~ - -: false - - : Disable the commonmark fenced code block extension. - - -###### LaTeX example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\documentclass{article} -\usepackage{minted} -\usepackage[fencedCode]{markdown} -\begin{document} -\begin{markdown} -~~~ js -if (a > 3) { - moveShip(5 * gravity, DOWN); -} -~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ``` -\end{markdown} -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex --shell-escape document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ~~~ js -> if (a > 3) { -> moveShip(5 * gravity, DOWN); -> } -> ~~~~~~ -> -> ``` html -> <pre> -> <code> -> // Some comments -> line 1 of code -> line 2 of code -> line 3 of code -> </code> -> </pre> -> ``` - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\def\markdownOptionFencedCode{true} -\definetyping [js] -\definetyping [html] -\setuptyping [html] [option=XML] -\starttext -\startmarkdown -~~~ js -if (a > 3) { - moveShip(5 * gravity, DOWN); -} -~~~~~~ - - ``` html - <pre> - <code> - // Some comments - line 1 of code - line 2 of code - line 3 of code - </code> - </pre> - ``` -\stopmarkdown -\stoptext -```````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> ~~~ js -> if (a > 3) { -> moveShip(5 * gravity, DOWN); -> } -> ~~~~~~ -> -> ``` html -> <pre> -> <code> -> // Some comments -> line 1 of code -> line 2 of code -> line 3 of code -> </code> -> </pre> -> ``` - - -##### Option `footnotes` - -`footnotes` (default value: `false`) - -: true - - : Enable the pandoc footnote syntax extension: - - ``` md - Here is a footnote reference,[^1] and another.[^longnote] - - [^1]: Here is the footnote. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous footnote. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph footnotes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented. - `````` - -: false - - : Disable the pandoc 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]{markdown} -\begin{document} -\begin{markdown} -Here is a footnote reference,[^1] and another.[^longnote] - -[^1]: Here is the footnote. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they -belong to the previous footnote. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph footnotes - work like multi-paragraph list items. - -This paragraph won't be part of the note, because it -isn't indented. -\end{markdown} -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> Here is a footnote reference,[^1] and another.[^longnote] -> -> [^1]: Here is the footnote. -> -> [^longnote]: Here's one with multiple blocks. -> -> Subsequent paragraphs are indented to show that they -> belong to the previous footnote. -> -> { some.code } -> -> The whole paragraph can be indented, or just the -> first line. In this way, multi-paragraph footnotes -> work like multi-paragraph list items. -> -> This paragraph won't be part of the note, because it -> isn't indented. - -###### 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} -\starttext -\startmarkdown -Here is a footnote reference,[^1] and another.[^longnote] - -[^1]: Here is the footnote. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they -belong to the previous footnote. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph footnotes - work like multi-paragraph list items. - -This paragraph won't be part of the note, because it -isn't indented. -\stopmarkdown -\stoptext -```````` -Next, invoke LuaTeX from the terminal: -``` sh -context document.tex -````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> Here is a footnote reference,[^1] and another.[^longnote] -> -> [^1]: Here is the footnote. -> -> [^longnote]: Here's one with multiple blocks. -> -> Subsequent paragraphs are indented to show that they -> belong to the previous footnote. -> -> { some.code } -> -> The whole paragraph can be indented, or just the -> first line. In this way, multi-paragraph footnotes -> work like multi-paragraph list items. -> -> This paragraph won't be part of the note, because it -> isn't indented. - - -##### Option `hashEnumerators` - -`hashEnumerators` (default value: `false`) - -: true - - : Enable the use of hash symbols (`#`) as ordered item list - markers: - - ``` md - #. Bird - #. McHale - #. Parish - `````` - -: false - - : Disable the use of hash symbols (`#`) as ordered item list - markers. - - -###### 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} -#. Bird -#. McHale -#. Parish -\end{markdown} - -\begin{markdown*}{hashEnumerators} -#. Bird -#. McHale -#. Parish -\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: - -> . Bird -> ======== -> . McHale -> ======== -> . Parish -> ======== -> -> #. Bird -> #. McHale -> #. Parish - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\starttext - -\startmarkdown -#. Bird -#. McHale -#. Parish -\stopmarkdown - -\def\markdownOptionHashEnumerators{true} -\startmarkdown -#. Bird -#. McHale -#. Parish -\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: - -> . Bird -> ======== -> . McHale -> ======== -> . Parish -> ======== -> -> #. Bird -> #. McHale -> #. Parish - - -##### Option `html` - -`html` (default value: `false`) - -: true - - : Enable the recognition of HTML tags, block elements, comments, HTML - instructions, and entities in the input. Tags, block elements (along - with contents), HTML instructions, and comments will be ignored and - HTML entities will be replaced with the corresponding Unicode - codepoints. - -: false - - : Disable the recognition of HTML markup. Any HTML markup in the input - will be rendered as plain text. - - -When the option is enabled, HTML entities are currently incorrectly parsed. -See [the corresponding issue][issue-38] in the package repository. - - [issue-36]: https://github.com/Witiko/markdown/issues/36 - (HTML entities with the `html` Lua option enabled produce a Lua - parser error) - -###### 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 = 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: -``` sh -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. - -###### 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 -\par -\input optiontrue -\bye -``````` -Using a text editor, create a text document named `content.md` with the -following content: -``` html -<div> -*Is there block tag support?* -</div> -*Is there <inline tag="tag"></inline> support?* -_Is there <!-- comment --> support?_ -_Is there <? HTML instruction ?> support?_ -```````` -Next, invoke LuaTeX from the terminal: -``` sh -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 `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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: - -> \<div>Is there block tag support?\</div> -> Is there \<inline tag=”tag”>\</inline> support? -> Is there \<!-- comment --> 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 -<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: -``` sh -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 {.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} -<div> -*There is no block tag support.* -</div> -*There is no <inline tag="tag"></inline> support.* -_There is no <!-- comment --> support._ -_There is no <? HTML instruction ?> support._ -\end{markdown} - -\begin{markdown*}{html} -<div> -*There is block tag support.* -</div> -*There is <inline tag="tag"></inline> support.* -_There is <!-- comment --> support._ -_There is <? HTML instruction ?> support._ -\end{markdown*} - -\end{document} -``````` -Next, invoke LuaTeX from the terminal: -``` sh -lualatex document.tex -`````` -A PDF document named `document.pdf` should be produced and contain the -following text: - -> \<div>There is no block tag support.\</div> -> There is no \<inline tag=”tag”>\</inline> support. -> There is no \<!-- comment --> support. -> There is no <? HTML instruction ?> support. -> -> There is support. There is support. There is support. - -###### ConTeXt example {.unnumbered} - -Using a text editor, create a text document named `document.tex` with the -following content: -``` tex -\usemodule[t][markdown] -\starttext - -\startmarkdown -<div> -*There is no block tag support.* -</div> -*There is no <inline tag="tag"></inline> support.* -_There is no <!-- comment --> support._ -_There is no <? HTML instruction ?> support._ -\stopmarkdown - -\def\markdownOptionHtml{true} -\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: -``` sh -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. - - -##### 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 <CLI␣PATHNAME> -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> hybrid=true -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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 <CLI␣PATHNAME> -- content.md optionfalse.tex -texlua <CLI␣PATHNAME> smartEllipses=true -- content.md optiontrue.tex -luatex document.tex -``````` -where `<CLI␣PATHNAME>` corresponds to the location of the Lua CLI script file, -such as `~/texmf/scripts/markdown/markdown-cli.lua` on UN\*X systems or -`C:\Users\<YOUR␣USERNAME>\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 - -<!-- TODO --> - - -### Options - -<!-- TODO --> - - -### Token renderers - -<!-- TODO --> - - -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. - -<!-- TODO --> - -### Interfaces - -<!-- TODO --> - - -### Options - -<!-- TODO --> - - -### Token renderers - -<!-- TODO --> - - -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 - -<!-- TODO --> - -### Options - -<!-- TODO --> +In this section, I will describe the individual parts of the Markdown package. +Each part will be shown by example, leaving the implementation details to the +[technical documentation][techdoc]. -### Token renderers + [techdoc]: http://mirrors.ctan.org/macros/generic/markdown/markdown.pdf + (A Markdown Interpreter for \TeX{}) -<!-- TODO --> +/markdown-interfaces.md +/markdown-options.md +/markdown-tokens.md diff --git a/Master/texmf-dist/doc/generic/markdown/markdown.pdf b/Master/texmf-dist/doc/generic/markdown/markdown.pdf Binary files differindex 567f99aed14..b445d4cc577 100644 --- a/Master/texmf-dist/doc/generic/markdown/markdown.pdf +++ b/Master/texmf-dist/doc/generic/markdown/markdown.pdf |