From 37485ae5d642200a29ffc623bae1150d9e8e7978 Mon Sep 17 00:00:00 2001
From: Norbert Preining 2.20.0-0-gf64ade1 2023-02-01 2.21.0-0-gee15b88 2023-02-28
@@ -13603,8 +13922,8 @@ following text:
> Hello *world*!
>
-> *(A forced linebreak)*
->
+> *(A hard line break)*
+>
> _Foo_ bar!
##### \LaTeX{} Example {.unnumbered}
@@ -13616,9 +13935,9 @@ following content:
\usepackage{markdown}
\markdownSetup{
renderers = {
- lineBreak = {%
+ hardLineBreak = {%
\par
- \emph{(A forced linebreak)}%
+ \emph{(A hard line break)}%
\par
},
},
@@ -13629,8 +13948,8 @@ following content:
```````
Using a text editor, create a text document named `example.md` with the
following content. Note the two spaces at the end of the first line, which
-specify a hard linebreak. Due to the limitations of the \TeX{} input
-processor, hard linebreaks would be ignored if we typed them directly into the
+specify a hard line break. Due to the limitations of the \TeX{} input
+processor, hard line breaks would be ignored if we typed them directly into the
`document.tex` document.
Hello world!
_Foo_ bar!
@@ -13644,54 +13963,51 @@ following text:
> Hello *world*!
>
-> *(A forced linebreak)*
->
-> _Foo_ bar!
-
-##### \Hologo{ConTeXt} Example {.unnumbered}
-
-Using a text editor, create a text document named `document.tex` with the
-following content:
-``` tex
-\usemodule[t][markdown]
-\def\markdownRendererLineBreak{%
- \par
- \emph{(A forced linebreak)}%
- \par
-}
-\starttext
-\markdownInput{example.md}
-\stoptext
-```````
-Using a text editor, create a text document named `example.md` with the
-following content. Note the two spaces at the end of the first line, which
-specify a hard linebreak. Due to the limitations of the \TeX{} input
-processor, hard linebreaks would be ignored if we typed them directly into the
-`document.tex` document.
-
-Hello world!
_Foo_ bar!
-
-Next, invoke LuaTeX from the terminal:
-``` sh
-luatex document.tex
-``````
-A PDF document named `document.pdf` should be produced and contain the
-following text:
-
-> Hello *world*!
->
-> *(A forced linebreak)*
->
+> *(A hard line break)*
+>
> _Foo_ bar!
%
%<*tex>
% \fi
+% \begin{markdown}
+%
+% The \mdef{markdownRendererLineBreak} and
+% \mdef{markdownRendererLineBreakPrototype} macros have been deprecated
+% and will be removed in Markdown 3.0.0.
%
+% \end{markdown}
% \begin{macrocode}
-\def\markdownRendererLineBreak{%
- \markdownRendererLineBreakPrototype}%
\ExplSyntaxOn
+\cs_new:Npn
+ \markdownRendererHardLineBreak
+ {
+ \cs_if_exist:NTF
+ \markdownRendererLineBreak
+ {
+ \markdownWarning
+ {
+ Line~break~renderer~has~been~deprecated,~
+ to~be~removed~in~Markdown~3.0.0
+ }
+ \markdownRendererLineBreak
+ }
+ {
+ \cs_if_exist:NTF
+ \markdownRendererLineBreakPrototype
+ {
+ \markdownWarning
+ {
+ Line~break~renderer~prototype~has~been~deprecated,~
+ to~be~removed~in~Markdown~3.0.0
+ }
+ \markdownRendererLineBreakPrototype
+ }
+ {
+ \markdownRendererHardLineBreakPrototype
+ }
+ }
+ }
\seq_gput_right:Nn
\g_@@_renderers_seq
{ lineBreak }
@@ -13699,6 +14015,13 @@ following text:
\g_@@_renderer_arities_prop
{ lineBreak }
{ 0 }
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { hardLineBreak }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { hardLineBreak }
+ { 0 }
\ExplSyntaxOff
% \end{macrocode}
% \par
@@ -15189,6 +15512,50 @@ following text:
%
% \begin{markdown}
+#### Section Renderers
+The \mdef{markdownRendererSectionBegin} and \mdef{markdownRendererSectionEnd}
+macros represent the beginning and the end of a section based on headings.
+
+% \end{markdown}
+%
+% \iffalse
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererSectionBegin{%
+ \markdownRendererSectionBeginPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { sectionBegin }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { sectionBegin }
+ { 0 }
+\ExplSyntaxOff
+\def\markdownRendererSectionEnd{%
+ \markdownRendererSectionEndPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { sectionEnd }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { sectionEnd }
+ { 0 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
#### Replacement Character Renderers
The \mdef{markdownRendererReplacementCharacter} macro represents the U+0000
and U+FFFD Unicode characters. The macro receives no arguments.
@@ -15909,6 +16276,138 @@ following text:
%
% \begin{markdown}
+#### Tex Math Renderers
+The \mdef{markdownRendererInlineMath} and \mdef{markdownRendererDisplayMath} macros
+represent inline and display \TeX{} math.
+Both macros receive a single argument that corresponds to the tex math content.
+These macros will only be produced, when the \Opt{texMathDollars}
+option is enabled.
+
+% \end{markdown}
+%
+% \iffalse
+
+##### Plain \TeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\input markdown
+\def\markdownOptionTexMathDollars{true}
+\def\markdownRendererInlineMath#1{$#1\dots$}
+\def\markdownRendererDisplayMath#1{$$#1\eqno(1)$$}
+\markdownBegin
+$E=mc^2$
+
+$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
+\markdownEnd
+\bye
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+luatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> $E=mc^2\dots$
+>
+> $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\eqno(1)$$
+
+##### \LaTeX{} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\documentclass{article}
+\usepackage[texMathDollars]{markdown}
+\usepackage{amsmath}
+\def\markdownRendererInlineMath#1{\begin{math}#1\dots\end{math}}
+\def\markdownRendererDisplayMath#1{\begin{equation}#1\end{equation}}
+\begin{document}
+\begin{markdown}
+$E=mc^2$
+
+$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
+\end{markdown}
+\end{document}
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+lualatex document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> $E=mc^2\dots$
+>
+> $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\quad(1)$$
+
+##### \Hologo{ConTeXt} Example {.unnumbered}
+
+Using a text editor, create a text document named `document.tex` with the
+following content:
+``` tex
+\usemodule[t][markdown]
+\setupmarkdown[texMathDollars = yes]
+\def\markdownRendererInlineMath#1{$#1\dots$}%
+\def\markdownRendererDisplayMath#1{\placeformula\startformula#1\stopformula}%
+\starttext
+\startmarkdown
+$E=mc^2$
+
+$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
+\stopmarkdown
+\stoptext
+```````
+Next, invoke LuaTeX from the terminal:
+``` sh
+context document.tex
+``````
+A PDF document named `document.pdf` should be produced and contain the
+following text:
+
+> $E=mc^2\dots$
+>
+> $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx\quad(1)$$
+
+%
+%<*tex>
+% \fi
+%
+% \begin{macrocode}
+\def\markdownRendererInlineMath{%
+ \markdownRendererInlineMathPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { inlineMath }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { inlineMath }
+ { 1 }
+\ExplSyntaxOff
+\def\markdownRendererDisplayMath{%
+ \markdownRendererDisplayMathPrototype}%
+\ExplSyntaxOn
+\seq_gput_right:Nn
+ \g_@@_renderers_seq
+ { displayMath }
+\prop_gput:Nnn
+ \g_@@_renderer_arities_prop
+ { displayMath }
+ { 1 }
+\ExplSyntaxOff
+% \end{macrocode}
+% \par
+%
+% \iffalse
+%
+%<*manual-tokens>
+% \fi
+%
+% \begin{markdown}
+
#### Text Citations Renderer
The \mdef{markdownRendererTextCite} macro represents a string of one or more
text citations. This macro will only be produced, when the
@@ -17222,8 +17721,10 @@ A PDF document named `document.pdf` should be produced and contain the
following text:
> \$\\sqrt{-1}\$ *equals* \$i\$.
->
-> √-̅1̅ *equals* $i$.
+>
+>
+> *equals*
+> .
Invoking pdfTeX should have the same effect:
``` sh
@@ -18405,8 +18906,10 @@ A PDF document named `document.pdf` should be produced and contain the
following text:
> \$\\sqrt{-1}\$ *equals* \$i\$.
->
-> √-̅1̅ *equals* $i$.
+>
+>
+> *equals*
+> .
Invoking pdfTeX should have the same effect:
``` sh
@@ -18681,8 +19184,8 @@ texexec --passon=--shell-escape document.tex
%
% \end{markdown}
% \begin{macrocode}
-local upper, gsub, format, length =
- string.upper, string.gsub, string.format, string.len
+local upper, format, length =
+ string.upper, string.format, string.len
local P, R, S, V, C, Cg, Cb, Cmt, Cc, Ct, B, Cs, any =
lpeg.P, lpeg.R, lpeg.S, lpeg.V, lpeg.C, lpeg.Cg, lpeg.Cb,
lpeg.Cmt, lpeg.Cc, lpeg.Ct, lpeg.B, lpeg.Cs, lpeg.P(1)
@@ -21208,6 +21711,11 @@ function M.writer.new(options)
self.slice_end = "$" .. slice_specifiers[1]
end
+ self.slice_begin_type = self.slice_begin:sub(1, 1)
+ self.slice_begin_identifier = self.slice_begin:sub(2) or ""
+ self.slice_end_type = self.slice_end:sub(1, 1)
+ self.slice_end_identifier = self.slice_end:sub(2) or ""
+
if self.slice_begin == "^" and self.slice_end ~= "^" then
self.is_writing = true
else
@@ -21296,11 +21804,12 @@ function M.writer.new(options)
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->linebreak} as the output format of a forced line break.
+% Define \luamdef{writer->hard_line_break} as the output format of a forced
+% line break.
%
% \end{markdown}
% \begin{macrocode}
- self.linebreak = "\\markdownRendererLineBreak\n{}"
+ self.hard_line_break = "\\markdownRendererHardLineBreak\n{}"
% \end{macrocode}
% \par
% \begin{markdown}
@@ -21387,33 +21896,45 @@ function M.writer.new(options)
%
% Use the \luamref{writer->escaped_chars}, \luamref{writer->escaped_uri_chars},
% and \luamref{writer->escaped_minimal_strings} tables to create the
-% \luamdef{writer->escape}, \luamdef{writer->escape_uri}, and
+% \luamdef{writer->escape_typographic_text},
+% \luamdef{writer->escape_programmatic_text}, and
% \luamdef{writer->escape_minimal} escaper functions.
%
% \end{markdown}
% \begin{macrocode}
- self.escape = util.escaper(self.escaped_chars, self.escaped_strings)
- self.escape_uri = util.escaper(self.escaped_uri_chars, self.escaped_minimal_strings)
- self.escape_minimal = util.escaper({}, self.escaped_minimal_strings)
+ local escape_typographic_text = util.escaper(
+ self.escaped_chars, self.escaped_strings)
+ local escape_programmatic_text = util.escaper(
+ self.escaped_uri_chars, self.escaped_minimal_strings)
+ local escape_minimal = util.escaper(
+ {}, self.escaped_minimal_strings)
% \end{macrocode}
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->string} as a function that will transform an input
-% plain text span `s` to the output format and \luamdef{writer->uri} as a
-% function that will transform an input \acro{uri} `u` to the output format.
-% If the \Opt{hybrid} option is enabled, use the
-% \luamref{writer->escape_minimal}. Otherwise, use the
-% \luamref{writer->escape}, and \luamref{writer->escape_uri} functions.
+% Define the following semantic aliases for the escaper functions:
+%
+% - \luamdef{writer->escape} transforms a text string that should always be
+% made printable.
+% - \luamdef{writer->string} transforms a text string that should be made
+% printable only when the \Opt{hybrid} Lua option is disabled. When \Opt{hybrid}
+% is enabled, the text string should be kept as-is.
+% - \luamdef{writer->math} transforms a math span.
+% - \luamdef{writer->identifier} transforms an input programmatic identifier.
+% - \luamdef{writer->uri} transforms an input \acro{uri}.
%
% \end{markdown}
% \begin{macrocode}
+ self.escape = escape_typographic_text
+ self.math = escape_minimal
if options.hybrid then
- self.string = self.escape_minimal
- self.uri = self.escape_minimal
+ self.identifier = escape_minimal
+ self.string = escape_minimal
+ self.uri = escape_minimal
else
- self.string = self.escape
- self.uri = self.escape_uri
+ self.identifier = escape_programmatic_text
+ self.string = escape_typographic_text
+ self.uri = escape_programmatic_text
end
% \end{macrocode}
% \par
@@ -21685,19 +22206,10 @@ function M.writer.new(options)
% \end{markdown}
% \begin{macrocode}
function self.document(d)
- local active_attributes = self.active_attributes
local buf = {"\\markdownRendererDocumentBegin\n", d}
- -- pop attributes for sections that have ended
- if options.headerAttributes and self.is_writing then
- while #active_attributes > 0 do
- local attributes = active_attributes[#active_attributes]
- if #attributes > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextEnd")
- end
- table.remove(active_attributes, #active_attributes)
- end
- end
+ -- pop all attributes
+ table.insert(buf, self.pop_attributes())
table.insert(buf, "\\markdownRendererDocumentEnd")
@@ -21737,9 +22249,9 @@ function M.writer.new(options)
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->active\_attributes} as a stack of attributes
-% of the headings that are currently active. The
-% \luamdef{writer->active\_headings} member variable is mutable.
+% Define \luamdef{writer->active\_attributes} as a stack of block-level
+% attributes that are currently active. The
+% \luamref{writer->active\_attributes} member variable is mutable.
%
% \end{markdown}
% \begin{macrocode}
@@ -21748,92 +22260,174 @@ function M.writer.new(options)
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->heading} as a function that will transform an
-% input heading `s` at level `level` with attributes `attributes` to the
-% output format.
+% Define \luamdef{writer->push\_attributes} and
+% \luamdef{writer->pop\_attributes} as functions that will add a new set
+% of active block-level attributes or remove the most current attributes
+% from \luamref{writer->active\_attributes}.
%
% \end{markdown}
% \begin{macrocode}
- function self.heading(s, level, attributes)
+ local function apply_attributes()
+ local buf = {}
+ for i = 1, #self.active_attributes do
+ local start_output = self.active_attributes[i][3]
+ if start_output ~= nil then
+ table.insert(buf, start_output)
+ end
+ end
+ return buf
+ end
+
+ local function tear_down_attributes()
+ local buf = {}
+ for i = #self.active_attributes, 1, -1 do
+ local end_output = self.active_attributes[i][4]
+ if end_output ~= nil then
+ table.insert(buf, end_output)
+ end
+ end
+ return buf
+ end
+% \end{macrocode}
+% \begin{markdown}
+%
+% The \luamref{writer->push\_attributes} method adds `attributes`
+% of type `attribute_type` to \luamref{writer->active\_attributes}. The
+% `start_output` string is used to construct a rope that will be returned by
+% this function, together with output produced as a result of slicing (see
+% \Opt{slice}). The `end_output` string is stored together with `attributes`
+% and is used to construct the return value of the
+% \luamref{writer->pop\_attributes}
+% method.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.push_attributes(attribute_type, attributes,
+ start_output, end_output)
+ -- index attributes in a hash table for easy lookup
attributes = attributes or {}
for i = 1, #attributes do
attributes[attributes[i]] = true
end
- local active_attributes = self.active_attributes
- local slice_begin_type = self.slice_begin:sub(1, 1)
- local slice_begin_identifier = self.slice_begin:sub(2) or ""
- local slice_end_type = self.slice_end:sub(1, 1)
- local slice_end_identifier = self.slice_end:sub(2) or ""
-
local buf = {}
-
- -- push empty attributes for implied sections
- while #active_attributes < level-1 do
- table.insert(active_attributes, {})
+ -- handle slicing
+ if attributes["#" .. self.slice_end_identifier] ~= nil and
+ self.slice_end_type == "^" then
+ if self.is_writing then
+ table.insert(buf, tear_down_attributes())
+ end
+ self.is_writing = false
+ end
+ if attributes["#" .. self.slice_begin_identifier] ~= nil and
+ self.slice_begin_type == "^" then
+ self.is_writing = true
+ table.insert(buf, apply_attributes())
+ self.is_writing = true
+ end
+ if self.is_writing and start_output ~= nil then
+ table.insert(buf, start_output)
end
+ table.insert(self.active_attributes,
+ {attribute_type, attributes,
+ start_output, end_output})
+ return buf
+ end
- -- pop attributes for sections that have ended
- while #active_attributes >= level do
- local active_identifiers = active_attributes[#active_attributes]
- -- tear down all active attributes at slice end
- if active_identifiers["#" .. slice_end_identifier] ~= nil
- and slice_end_type == "$" then
- for header_level = #active_attributes, 1, -1 do
- if options.headerAttributes and #active_attributes[header_level] > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextEnd")
- end
+% \end{macrocode}
+% \begin{markdown}
+%
+% The \luamref{writer->pop\_attributes} method removes the most current of
+% active block-level attributes from \luamref{writer->active\_attributes}
+% until attributes of type `attribute_type` have been removed. The method
+% returns a rope constructed from the `end_output` string specified
+% in the calls of \luamref{writer->push\_attributes} that produced the most
+% current attributes, and also from output produced as a result of slicing
+% (see \Opt{slice}).
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.pop_attributes(attribute_type)
+ local buf = {}
+ -- pop attributes until we find attributes of correct type
+ -- or until no attributes remain
+ local current_attribute_type = false
+ while current_attribute_type ~= attribute_type and
+ #self.active_attributes > 0 do
+ local attributes, _, end_output
+ current_attribute_type, attributes, _, end_output = table.unpack(
+ self.active_attributes[#self.active_attributes])
+ if self.is_writing and end_output ~= nil then
+ table.insert(buf, end_output)
+ end
+ table.remove(self.active_attributes, #self.active_attributes)
+ -- handle slicing
+ if attributes["#" .. self.slice_end_identifier] ~= nil
+ and self.slice_end_type == "$" then
+ if self.is_writing then
+ table.insert(buf, tear_down_attributes())
end
self.is_writing = false
end
- table.remove(active_attributes, #active_attributes)
- if self.is_writing and options.headerAttributes and #active_identifiers > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextEnd")
- end
- -- apply all active attributes at slice beginning
- if active_identifiers["#" .. slice_begin_identifier] ~= nil
- and slice_begin_type == "$" then
- for header_level = 1, #active_attributes do
- if options.headerAttributes and #active_attributes[header_level] > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextBegin")
- end
- end
+ if attributes["#" .. self.slice_begin_identifier] ~= nil and
+ self.slice_begin_type == "$" then
self.is_writing = true
+ table.insert(buf, apply_attributes())
end
end
+ return buf
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->heading} as a function that will transform an
+% input heading `s` at level `level` with attributes `attributes` to the
+% output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ local current_heading_level = 0
+ function self.heading(s, level, attributes)
+ local buf = {}
- -- tear down all active attributes at slice end
- if attributes["#" .. slice_end_identifier] ~= nil
- and slice_end_type == "^" then
- for header_level = #active_attributes, 1, -1 do
- if options.headerAttributes and #active_attributes[header_level] > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextEnd")
- end
- end
- self.is_writing = false
+ -- push empty attributes for implied sections
+ while current_heading_level < level - 1 do
+ table.insert(buf,
+ self.push_attributes("heading",
+ nil,
+ "\\markdownRendererSectionBegin\n",
+ "\n\\markdownRendererSectionEnd "))
+ current_heading_level = current_heading_level + 1
end
- -- push attributes for the new section
- table.insert(active_attributes, attributes)
- if self.is_writing and options.headerAttributes and #attributes > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextBegin")
+ -- pop attributes for sections that have ended
+ while current_heading_level >= level do
+ table.insert(buf, self.pop_attributes("heading"))
+ current_heading_level = current_heading_level - 1
end
- -- apply all active attributes at slice beginning
- if attributes["#" .. slice_begin_identifier] ~= nil
- and slice_begin_type == "^" then
- for header_level = 1, #active_attributes do
- if options.headerAttributes and #active_attributes[header_level] > 0 then
- table.insert(buf, "\\markdownRendererHeaderAttributeContextBegin")
- end
- end
- self.is_writing = true
+ -- push attributes for the new section
+ local start_output = {}
+ local end_output = {}
+ table.insert(start_output, "\\markdownRendererSectionBegin\n")
+ if options.headerAttributes and attributes ~= nil and #attributes > 0 then
+ table.insert(start_output,
+ "\\markdownRendererHeaderAttributeContextBegin\n")
+ table.insert(start_output, self.attributes(attributes))
+ table.insert(end_output,
+ "\n\\markdownRendererHeaderAttributeContextEnd ")
end
+ table.insert(end_output, "\n\\markdownRendererSectionEnd ")
- if self.is_writing then
- table.insert(buf, self.attributes(attributes))
- end
+ table.insert(buf, self.push_attributes("heading",
+ attributes,
+ start_output,
+ end_output))
+ current_heading_level = current_heading_level + 1
+ assert(current_heading_level == level)
+ -- produce the renderer
local cmd
level = level + options.shiftHeadings
if level <= 1 then
@@ -21939,6 +22533,7 @@ parsers.plus = P("+")
parsers.underscore = P("_")
parsers.period = P(".")
parsers.hash = P("#")
+parsers.dollar = P("$")
parsers.ampersand = P("&")
parsers.backtick = P("`")
parsers.less = P("<")
@@ -22526,8 +23121,11 @@ function M.reader.new(writer, options)
% \end{markdown}
% \begin{macrocode}
function self.normalize_tag(tag)
- return string.lower(
- gsub(util.rope_to_string(tag), "[ \n\r\t]+", " "))
+ tag = util.rope_to_string(tag)
+ tag = tag:gsub("[ \n\r\t]+", " ")
+ tag = tag:gsub("^ ", ""):gsub(" $", "")
+ tag = uni_case.casefold(tag, true, false)
+ return tag
end
% \end{macrocode}
% \par
@@ -22828,18 +23426,18 @@ function M.reader.new(writer, options)
parsers.Endline = parsers.newline
* -V("EndlineExceptions")
* parsers.spacechar^0
- / (options.hardLineBreaks and writer.linebreak
+ / (options.hardLineBreaks and writer.hard_line_break
or writer.space)
parsers.OptionalIndent
= parsers.spacechar^1 / writer.space
- parsers.Space = parsers.spacechar^2 * parsers.Endline / writer.linebreak
+ parsers.Space = parsers.spacechar^2 * parsers.Endline / writer.hard_line_break
+ parsers.spacechar^1 * parsers.Endline^-1 * parsers.eof / ""
+ parsers.spacechar^1 * parsers.Endline
* parsers.optionalspace
/ (options.hardLineBreaks
- and writer.linebreak
+ and writer.hard_line_break
or writer.space)
+ parsers.spacechar^1 * parsers.optionalspace
/ writer.space
@@ -22848,16 +23446,16 @@ function M.reader.new(writer, options)
= parsers.newline
* -V("EndlineExceptions")
* parsers.spacechar^0
- / (options.hardLineBreaks and writer.linebreak
+ / (options.hardLineBreaks and writer.hard_line_break
or writer.nbsp)
parsers.NonbreakingSpace
- = parsers.spacechar^2 * parsers.Endline / writer.linebreak
+ = parsers.spacechar^2 * parsers.Endline / writer.hard_line_break
+ parsers.spacechar^1 * parsers.Endline^-1 * parsers.eof / ""
+ parsers.spacechar^1 * parsers.Endline
* parsers.optionalspace
/ (options.hardLineBreaks
- and writer.linebreak
+ and writer.hard_line_break
or writer.nbsp)
+ parsers.spacechar^1 * parsers.optionalspace
/ writer.nbsp
@@ -22987,12 +23585,10 @@ function M.reader.new(writer, options)
parsers.Paragraph = parsers.nonindentspace * Ct(parsers.Inline^1)
* ( parsers.newline
- * ( parsers.blankline^1
- + #parsers.hash
- + #(parsers.leader * parsers.more * parsers.space^-1)
- + parsers.eof
+ * ( parsers.blankline^1
+ + #V("EndlineExceptions")
)
- + parsers.eof )
+ + parsers.eof)
/ writer.paragraph
parsers.Plain = parsers.nonindentspace * Ct(parsers.Inline^1)
@@ -23682,55 +24278,9 @@ end
% \end{markdown}
% \begin{macrocode}
M.extensions.citations = function(citation_nbsps)
-% \end{macrocode}
-% \par
-% \begin{markdown}
-%
-% Define table \luamdef{escaped_citation_chars} containing the characters to
-% escape in citations.
-%
-% \end{markdown}
-% \begin{macrocode}
- local escaped_citation_chars = {
- ["{"] = "\\markdownRendererLeftBrace{}",
- ["}"] = "\\markdownRendererRightBrace{}",
- ["%"] = "\\markdownRendererPercentSign{}",
- ["\\"] = "\\markdownRendererBackslash{}",
- ["#"] = "\\markdownRendererHash{}",
- }
return {
name = "built-in citations syntax extension",
extend_writer = function(self)
- local options = self.options
-
-% \end{macrocode}
-% \par
-% \begin{markdown}
-%
-% Use the \luamref{escaped_citation_chars} to create the
-% \luamdef{escape_citation} escaper functions.
-%
-% \end{markdown}
-% \begin{macrocode}
- local escape_citation = util.escaper(
- escaped_citation_chars,
- self.escaped_minimal_strings)
-% \end{macrocode}
-% \par
-% \begin{markdown}
-%
-% Define \luamdef{writer->citation} as a function that will transform an input
-% citation name `c` to the output format. If option \Opt{hybrid} is enabled,
-% use the \luamref{writer->escape_minimal} function. Otherwise, use the
-% \luamref{escape_citation} function.
-%
-% \end{markdown}
-% \begin{macrocode}
- if options.hybrid then
- self.citation = self.escape_minimal
- else
- self.citation = escape_citation
- end
% \end{macrocode}
% \par
% \begin{markdown}
@@ -23839,7 +24389,7 @@ M.extensions.citations = function(citation_nbsps)
cites[#cites+1] = {
prenote = normalize(raw_cites[i]),
suppress_author = raw_cites[i+1] == "-",
- name = writer.citation(raw_cites[i+2]),
+ name = writer.identifier(raw_cites[i+2]),
postnote = normalize(raw_cites[i+3]),
}
end
@@ -24550,16 +25100,29 @@ M.extensions.fenced_divs = function(blank_before_div_fence)
% \par
% \begin{markdown}
%
-% Define \luamdef{writer->div} as a function that will transform an input
-% fenced div with content `c` and with attributes `attr` to the output format.
+% Define \luamdef{writer->div_begin} as a function that will transform the
+% beginning of an input fenced div with with attributes `attributes` to the
+% output format.
%
% \end{markdown}
% \begin{macrocode}
- function self.div(c, attr)
- return {"\\markdownRendererFencedDivAttributeContextBegin",
- self.attributes(attr),
- c,
- "\\markdownRendererFencedDivAttributeContextEnd"}
+ function self.div_begin(attributes)
+ local start_output = {"\\markdownRendererFencedDivAttributeContextBegin\n",
+ self.attributes(attributes)}
+ local end_output = {"\n\\markdownRendererFencedDivAttributeContextEnd "}
+ return self.push_attributes("div", attributes, start_output, end_output)
+ end
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->div_end} as a function that will produce the end of a
+% fenced div in the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.div_end()
+ return self.pop_attributes("div")
end
end, extend_reader = function(self)
local parsers = self.parsers
@@ -24612,7 +25175,16 @@ M.extensions.fenced_divs = function(blank_before_div_fence)
, "div_level")
end
- local FencedDiv = fenced_div_begin * increment_div_level(1)
+ local FencedDiv = fenced_div_begin
+ / function (infostring)
+ local attr = lpeg.match(Ct(parsers.attributes), infostring)
+ if attr == nil then
+ attr = {"." .. infostring}
+ end
+ return attr
+ end
+ / writer.div_begin
+ * increment_div_level(1)
* parsers.skipblanklines
* Ct( (V("Block") - fenced_div_end)^-1
* ( parsers.blanklines
@@ -24622,14 +25194,7 @@ M.extensions.fenced_divs = function(blank_before_div_fence)
* (V("Block") - fenced_div_end))^0)
* parsers.skipblanklines
* fenced_div_end * increment_div_level(-1)
- / function (infostring, div)
- local attr = lpeg.match(Ct(parsers.attributes), infostring)
- if attr == nil then
- attr = {"." .. infostring}
- end
- return div, attr
- end
- / writer.div
+ * (Cc("") / writer.div_end)
self.insert_pattern("Block after Verbatim",
FencedDiv, "FencedDiv")
@@ -24774,7 +25339,7 @@ M.extensions.line_blocks = function()
if not self.is_writing then return "" end
local buffer = {}
for i = 1, #lines - 1 do
- buffer[#buffer + 1] = { lines[i], self.linebreak }
+ buffer[#buffer + 1] = { lines[i], self.hard_line_break }
end
buffer[#buffer + 1] = lines[#lines]
@@ -25228,6 +25793,85 @@ end
% \end{macrocode}
% \begin{markdown}
%
+%#### Tex Math Dollars
+%
+% The \luamdef{extensions.tex_math_dollars} function implements the Pandoc
+% tex_math_dollars syntax extension.
+%
+% \end{markdown}
+% \begin{macrocode}
+M.extensions.tex_math_dollars = function()
+ return {
+ name = "built-in tex_math_dollars syntax extension",
+ extend_writer = function(self)
+% \end{macrocode}
+% \par
+% \begin{markdown}
+%
+% Define \luamdef{writer->display_math} as a function that will transform
+% a math span `s` of input text to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.display_math(s)
+ if not self.is_writing then return "" end
+ return {"\\markdownRendererDisplayMath{",self.math(s),"}"}
+ end
+% \end{macrocode}
+% \begin{markdown}
+%
+% Define \luamdef{writer->inline_math} as a function that will transform
+% a math span `s` of input text to the output format.
+%
+% \end{markdown}
+% \begin{macrocode}
+ function self.inline_math(s)
+ if not self.is_writing then return "" end
+ return {"\\markdownRendererInlineMath{",self.math(s),"}"}
+ end
+ end, extend_reader = function(self)
+ local parsers = self.parsers
+ local writer = self.writer
+
+ local function between(p, starter, ender)
+ return (starter * C(p * (p - ender)^0) * ender)
+ end
+
+ local inlinemathtail = B( parsers.any * parsers.nonspacechar
+ + parsers.backslash * parsers.any)
+ * parsers.dollar
+ * -#(parsers.digit)
+
+ local inlinemath = between(C( parsers.backslash^-1
+ * parsers.any
+ - parsers.blankline^2
+ - parsers.dollar),
+ parsers.dollar * #(parsers.nonspacechar),
+ inlinemathtail)
+
+ local displaymathdelim = parsers.dollar
+ * parsers.dollar
+
+ local displaymath = between(C( parsers.backslash^-1
+ * parsers.any
+ - parsers.blankline^2
+ - parsers.dollar),
+ displaymathdelim,
+ displaymathdelim)
+
+ local TexMathDollars = displaymath / writer.display_math
+ + inlinemath / writer.inline_math
+
+ self.insert_pattern("Inline after Emph",
+ TexMathDollars, "TexMathDollars")
+
+ self.add_special_character("$")
+ end
+ }
+end
+% \end{macrocode}
+% \begin{markdown}
+%
%#### YAML Metadata
%
% The \luamdef{extensions.jekyll_data} function implements the Pandoc
@@ -25271,13 +25915,13 @@ M.extensions.jekyll_data = function(expect_jekyll_data)
if #d > 0 then
table.insert(buf, "\\markdownRendererJekyllDataSequenceBegin{")
- table.insert(buf, self.uri(p or "null"))
+ table.insert(buf, self.identifier(p or "null"))
table.insert(buf, "}{")
table.insert(buf, #keys)
table.insert(buf, "}")
else
table.insert(buf, "\\markdownRendererJekyllDataMappingBegin{")
- table.insert(buf, self.uri(p or "null"))
+ table.insert(buf, self.identifier(p or "null"))
table.insert(buf, "}{")
table.insert(buf, #keys)
table.insert(buf, "}")
@@ -25293,7 +25937,7 @@ M.extensions.jekyll_data = function(expect_jekyll_data)
self.jekyllData(v, t, k)
)
else
- k = self.uri(k)
+ k = self.identifier(k)
v = tostring(v)
if typ == "boolean" then
table.insert(buf, "\\markdownRendererJekyllDataBoolean{")
@@ -25456,6 +26100,11 @@ function M.new(options)
table.insert(extensions, jekyll_data_extension)
end
+ if options.lineBlocks then
+ local line_block_extension = M.extensions.line_blocks()
+ table.insert(extensions, line_block_extension)
+ end
+
if options.pipeTables then
local pipe_tables_extension = M.extensions.pipe_tables(
options.tableCaptions)
@@ -25482,9 +26131,9 @@ function M.new(options)
table.insert(extensions, superscript_extension)
end
- if options.lineBlocks then
- local line_block_extension = M.extensions.line_blocks()
- table.insert(extensions, line_block_extension)
+ if options.texMathDollars then
+ local tex_math_dollars_extension = M.extensions.tex_math_dollars()
+ table.insert(extensions, tex_math_dollars_extension)
end
% \end{macrocode}
@@ -25729,7 +26378,7 @@ end
% \end{markdown}
% \begin{macrocode}
\def\markdownRendererInterblockSeparatorPrototype{\par}%
-\def\markdownRendererLineBreakPrototype{\hfil\break}%
+\def\markdownRendererHardLineBreakPrototype{\hfil\break}%
\let\markdownRendererEllipsisPrototype\dots
\def\markdownRendererNbspPrototype{~}%
\def\markdownRendererLeftBracePrototype{\char`\{}%
@@ -25806,6 +26455,8 @@ end
\def\markdownRendererStrikeThroughPrototype#1{#1}%
\def\markdownRendererSuperscriptPrototype#1{#1}%
\def\markdownRendererSubscriptPrototype#1{#1}%
+\def\markdownRendererDisplayMathPrototype#1{$$#1$$}%
+\def\markdownRendererInlineMathPrototype#1{$#1$}%
\ExplSyntaxOn
\cs_gset:Npn
\markdownRendererHeaderAttributeContextBeginPrototype
@@ -25846,6 +26497,8 @@ end
{ ^^^^fffd }
}
\ExplSyntaxOff
+\def\markdownRendererSectionBeginPrototype{}%
+\def\markdownRendererSectionEndPrototype{}%
% \end{macrocode}
% \par
% \begin{markdown}
@@ -27527,7 +28180,7 @@ end
\RequirePackage{fancyvrb}
\RequirePackage{graphicx}
\markdownSetup{rendererPrototypes={
- lineBreak = {\\},
+ hardLineBreak = {\\},
leftBrace = {\textbraceleft},
rightBrace = {\textbraceright},
dollarSign = {\textdollar},
@@ -27642,6 +28295,8 @@ end
headerAttributeContextEnd = {},
superscript = {\textsuperscript{#1}},
subscript = {\textsubscript{#1}},
+ displayMath = {\begin{displaymath}#1\end{displaymath}},
+ inlineMath = {\begin{math}#1\end{math}},
blockQuoteBegin = {\begin{quotation}},
blockQuoteEnd = {\end{quotation}},
inputVerbatim = {\VerbatimInput{#1}},
@@ -28263,7 +28918,7 @@ end
\markdownSetup{rendererPrototypes={
lineBlockBegin = {%
\begingroup
- \def\markdownRendererLineBreak{\\}%
+ \def\markdownRendererHardLineBreak{\\}%
\begin{verse}%
},
lineBlockEnd = {%
@@ -28541,7 +29196,7 @@ end
%
% \end{markdown}
% \begin{macrocode}
-\def\markdownRendererLineBreakPrototype{\blank}%
+\def\markdownRendererHardLineBreakPrototype{\blank}%
\def\markdownRendererLeftBracePrototype{\textbraceleft}%
\def\markdownRendererRightBracePrototype{\textbraceright}%
\def\markdownRendererDollarSignPrototype{\textdollar}%
@@ -28614,7 +29269,7 @@ end
\def\markdownRendererBlockQuoteEndPrototype{\stopquotation}%
\def\markdownRendererLineBlockBeginPrototype{%
\begingroup
- \def\markdownRendererLineBreak{
+ \def\markdownRendererHardLineBreak{
}%
\startlines
}%
@@ -28694,6 +29349,8 @@ end
\def\markdownRendererStrikeThroughPrototype#1{\overstrikes{#1}}
\def\markdownRendererSuperscriptPrototype#1{\high{#1}}
\def\markdownRendererSubscriptPrototype#1{\low{#1}}
+\def\markdownRendererDisplayMathPrototype#1{\startformula#1\stopformula}%
+\def\markdownRendererInlineMathPrototype#1{$#1$}%
% \end{macrocode}
% \par
% \begin{markdown}
diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html
index e64210e146..98c6a51fe3 100644
--- a/macros/generic/markdown/markdown.html
+++ b/macros/generic/markdown/markdown.html
@@ -84,7 +84,7 @@
Hello world!
_Foo_ bar!Markdown Package User Manual
-
+equals .
Invoking pdfTeX should have the same effect:
i.
+
+equals .
In this case, we cannot use pdfTeX, because pdfTeX does not define
the \directlua
TeX
@@ -576,7 +578,8 @@ title="Kpathsea - TeX Users Group">Kpathsea.
contain the following text:
$\sqrt{-1}$ equals $i$.
-√-̅1̅ equals i.
+
+equals .
Invoking pdfTeX should have the same effect:
i.
+
+equals .
Invoking pdfTeX should have the same effect:
i.
+
+equals .
Invoking pdfTeX should have the same effect:
i.
+
+equals .
Invoking pdfTeX should have the same effect:
+```` tex
+\documentclass{article}
+\usepackage[fencedDivs]{markdown}
+\begin{document}
+\begin{markdown}{slice=special}
+Here is a regular paragraph.
+
+::::: {#special}
+Here is a special paragraph.
+:::::
+
+And here is another regular paragraph.
+\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
luatex document.tex
+class="sourceCode sh">lualatex --shell-escape document.tex
A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced as we requested using the finalizeCache
-option.
-Next, change the content of document.tex
as follows:
+contain the following text:
+
+Here is a special paragraph.
+
+2.2.1.23 Option
+finalizeCache
+
+finalizeCache
(default value: false
)
+-
+
Whether an output file specified with the
+frozenCacheFileName
option (frozen cache)
+that contains a mapping between an enumeration of markdown documents and
+their auxiliary cache files will be created.
+The frozen cache makes it possible to later typeset a plain TeX document that contains markdown
+documents without invoking Lua using the
+frozenCache
plain TeX option. As a result, the plain TeX document becomes more portable, but
+further changes in the order and the content of markdown documents will
+not be reflected.
+
+
+Plain TeX Example
+Using a text editor, create a text document named
+document.tex
with the following content:
\input markdown
-\def\markdownOptionFrozenCache{true}
+\def\markdownOptionFinalizeCache{true}
\markdownBegin
-
+ Hi *world*!
Hello *world*!\markdownEnd
\bye
-Last, invoke pdfTeX without shell access from the terminal:
+Next, invoke LuaTeX from the terminal:
pdftex -no-shell-escape document.tex
+class="sourceCode sh">luatex document.tex
+A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced as we requested using the finalizeCache
+option.
+Next, change the content of document.tex
as follows:
+\input markdown
+\def\markdownOptionFrozenCache{true}
+\markdownBegin
+
+ Hi *world*!\markdownEnd
+\bye
+Last, invoke pdfTeX without shell access from the terminal:
+pdftex -no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3480,33 +3517,33 @@ in the content of the markdown document from “Hello world!” to
class="latex">LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass[finalizecache]{article}
-\usepackage{markdown}
-\begin{document}
-\begin{markdown}
-
- Hello *world*!\end{markdown}
-\end{document}
-Next, invoke LuaTeX from the terminal:
-lualatex document.tex
-A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced as we requested using the finalizecache
-option.
-Next, change the content of document.tex
as follows:
\documentclass[frozencache]{article}
+class="sourceCode tex">\documentclass[finalizecache]{article}
\usepackage{markdown}
\begin{document}
\begin{markdown}
-
+ Hi *world*!
Hello *world*!\end{markdown}
\end{document}
-Last, invoke pdfTeX without shell access from the terminal:
+Next, invoke LuaTeX from the terminal:
pdflatex -no-shell-escape document.tex
+class="sourceCode sh">lualatex document.tex
+A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced as we requested using the finalizecache
+option.
+Next, change the content of document.tex
as follows:
+\documentclass[frozencache]{article}
+\usepackage{markdown}
+\begin{document}
+\begin{markdown}
+
+ Hi *world*!\end{markdown}
+\end{document}
+Last, invoke pdfTeX without shell access from the terminal:
+pdflatex -no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3518,33 +3555,33 @@ in the content of the markdown document from “Hello world!” to
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[finalizeCache = yes]
-\starttext
-\startmarkdown
-
- Hello *world*!\stopmarkdown
-\stoptext
-Next, invoke LuaTeX from the terminal:
-context document.tex
-A PDF document named document.pdf
should be produced and
-contain the text “Hello world!” A frozen cache will also be
-produced in the cache.tex
output file as we requested using
-the finalizeCache
option.
-Next, change the content of document.tex
as follows:
\usemodule[t][markdown]
-\setupmarkdown[frozenCache = yes]
+\setupmarkdown[finalizeCache = yes]
\starttext
\startmarkdown
-
+ Hi *world*!
Hello *world*!\stopmarkdown
\stoptext
-Last, invoke pdfTeX without shell access from the terminal:
+Next, invoke LuaTeX from the terminal:
texexec --passon=--no-shell-escape document.tex
+class="sourceCode sh">context document.tex
+A PDF document named document.pdf
should be produced and
+contain the text “Hello world!” A frozen cache will also be
+produced in the cache.tex
output file as we requested using
+the finalizeCache
option.
+Next, change the content of document.tex
as follows:
+\usemodule[t][markdown]
+\setupmarkdown[frozenCache = yes]
+\starttext
+\startmarkdown
+
+ Hi *world*!\stopmarkdown
+\stoptext
+Last, invoke pdfTeX without shell access from the terminal:
+texexec --passon=--no-shell-escape document.tex
A new PDF document named document.pdf
should be produced
and contain the same text “Hello world!” Since we used the
contents of the frozen cache using the
@@ -3552,8 +3589,8 @@ contents of the frozen cache using the
the document without accessing the shell or invoking Lua, but the change
in the content of the markdown document from “Hello world!” to
“Hi world!” was not reflected.
-2.2.1.23 Option
+2.2.1.24 Option
frozenCacheCounter
frozenCacheCounter
(default value: 0
)
@@ -3572,25 +3609,25 @@ markdown document number ⟨number⟩.
Lua Module Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\directlua{
-
- local markdown = require("markdown")
- local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
- local firstInput = "Hello"
- local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
- local secondInput = "*world*!"
- tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
+\input markdown
+\directlua{
+
+ local markdown = require("markdown")
+ local firstConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 0})
+ local firstInput = "Hello"
+ local secondConvert = markdown.new({finalizeCache = true, frozenCacheCounter = 1})
+ local secondInput = "*world*!"
+ tex.sprint(firstConvert(firstInput) .. [[ ]] .. secondConvert(secondInput)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the text “Hello world!” A frozen cache with two entries
will also be produced as we requested using the
frozenCacheCounter
option.
-2.2.1.24 Option
+2.2.1.25 Option
hardLineBreaks
hardLineBreaks
(default value: false
)
@@ -3616,29 +3653,29 @@ of spaces.
class="latex">LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-
- 'Twas brillig, and the slithy toves
- Did gyre and gimble in the wabe;
- All mimsy were the borogoves,
- And the mome raths outgrabe.\end{markdown}
-
-\begin{markdown*}{hardLineBreaks}
-
- 'Twas brillig, and the slithy toves
- Did gyre and gimble in the wabe;
- All mimsy were the borogoves,
- And the mome raths outgrabe.\end{markdown*}
-
-\end{document}
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+
+ 'Twas brillig, and the slithy toves
+ Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
+ And the mome raths outgrabe.\end{markdown}
+
+\begin{markdown*}{hardLineBreaks}
+
+ 'Twas brillig, and the slithy toves
+ Did gyre and gimble in the wabe;
+ All mimsy were the borogoves,
+ And the mome raths outgrabe.\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3647,8 +3684,8 @@ All mimsy were the borogoves, And the mome raths outgrabe.
’Twas brillig, and the slithy toves Did gyre and gimble in the wabe;
All mimsy were the borogoves, And the mome raths outgrabe.
-2.2.1.25 Option
+2.2.1.26 Option
hashEnumerators
hashEnumerators
(default value:
@@ -3659,10 +3696,10 @@ class="header-section-number">2.2.1.25 Option
-
Enable the use of hash symbols (#
) as ordered item list
markers:
-
- #. Bird
- #. McHale #. Parish
+
+ #. Bird
+ #. McHale #. Parish
@@ -3680,27 +3717,27 @@ markers.
class="latex">LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-
- #. Bird
- #. McHale
- #. Parish\end{markdown}
-
-\begin{markdown*}{hashEnumerators}
-
- #. Bird
- #. McHale
- #. Parish\end{markdown*}
-
-\end{document}
+\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+
+ #. Bird
+ #. McHale
+ #. Parish\end{markdown}
+
+\begin{markdown*}{hashEnumerators}
+
+ #. Bird
+ #. McHale
+ #. Parish\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3717,27 +3754,27 @@ contain the following text:
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-
- #. Bird
- #. McHale
- #. Parish\stopmarkdown
-
-\setupmarkdown[hashEnumerators = yes]
-\startmarkdown
-
- #. Bird
- #. McHale
- #. Parish\stopmarkdown
-
-\stoptext
+\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+
+ #. Bird
+ #. McHale
+ #. Parish\stopmarkdown
+
+\setupmarkdown[hashEnumerators = yes]
+\startmarkdown
+
+ #. Bird
+ #. McHale
+ #. Parish\stopmarkdown
+
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3750,8 +3787,8 @@ contain the following text:
- Parish
-2.2.1.26 Option
+2.2.1.27 Option
headerAttributes
headerAttributes
(default value:
@@ -3761,13 +3798,13 @@ class="header-section-number">2.2.1.26 Option
- true
-
Enable the assignment of HTML attributes to headings:
-# My first heading {#foo}
-
-## My second heading ## {#bar .baz}
-
-
- Yet another heading {key=value}===================
+# My first heading {#foo}
+
+## My second heading ## {#bar .baz}
+
+
+ Yet another heading {key=value}===================
@@ -3780,8 +3817,8 @@ class="sourceCode md">
-2.2.1.27 Option
+2.2.1.28 Option
html
html
(default value: false
)
@@ -3810,33 +3847,33 @@ will be rendered as plain text.
Lua Module Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new()
- local newline = [[^^J^^J]]
- local input =
- "<div>*There is no block tag support.*</div>" .. newline ..
- "*There is no <inline tag="tag"></inline> support.*" .. newline ..
- "_There is no <!-- comment --> support._" .. newline ..
- "_There is no <? HTML instruction ?> support._"
- tex.sprint(convert(input)) }\par
-\directlua{
-
- local markdown = require("markdown")
- local convert = markdown.new({html = true})
- local input =
- "<div>*There is block tag support.*</div>" .. newline ..
- "*There is <inline tag="tag"></inline> support.*" .. newline ..
- "_There is <!-- comment --> support._" .. newline ..
- "_There is <? HTML instruction ?> support._"
- tex.sprint(convert(input)) }\bye
+\input markdown
+\input lmfonts
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new()
+ local newline = [[^^J^^J]]
+ local input =
+ "<div>*There is no block tag support.*</div>" .. newline ..
+ "*There is no <inline tag="tag"></inline> support.*" .. newline ..
+ "_There is no <!-- comment --> support._" .. newline ..
+ "_There is no <? HTML instruction ?> support._"
+ tex.sprint(convert(input)) }\par
+\directlua{
+
+ local markdown = require("markdown")
+ local convert = markdown.new({html = true})
+ local input =
+ "<div>*There is block tag support.*</div>" .. newline ..
+ "*There is <inline tag="tag"></inline> support.*" .. newline ..
+ "_There is <!-- comment --> support._" .. newline ..
+ "_There is <? HTML instruction ?> support._"
+ tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
+luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3849,27 +3886,27 @@ support.
Lua CLI Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-\input optionfalse
-\par
-\input optiontrue
-\bye
+\input markdown
+\input lmfonts
+\input optionfalse
+\par
+\input optiontrue
+\bye
Using a text editor, create a text document named
content.md
with the following content:
-<div>
-
- *Is there block tag support?*</div>
-<inline tag="tag"></inline> support?*
- *Is there <!-- comment --> support?_
- _Is there <? HTML instruction ?> support?_ _Is there
+<div>
+
+ *Is there block tag support?*</div>
+<inline tag="tag"></inline> support?*
+ *Is there <!-- comment --> support?_
+ _Is there <? HTML instruction ?> support?_ _Is there
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex
-luatex document.tex
+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ html=true -- content.md optiontrue.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -3887,77 +3924,37 @@ contain the following text:
–> support? Is there <? HTML instruction ?> support?
Is there support? Is there support? Is there support?
-Plain Plain TeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\input markdown
-\input lmfonts
-
-\markdownBegin
-
- <div>
- *There is no block tag support.*
- </div>
- *There is no <inline tag="tag"></inline> support.*
- _There is no <!-- comment --> support._
- _There is no <? HTML instruction ?> support._\markdownEnd
-
-\def\markdownOptionHtml{true}
-\markdownBegin
-
- <div>
- *There is block tag support.*
- </div>
- *There is <inline tag="tag"></inline> support.*
- _There is <!-- comment --> support._
- _There is <? HTML instruction ?> support._\markdownEnd
-
-\bye
-Next, invoke LuaTeX from the terminal:
-luatex document.tex
-A PDF document named document.pdf
should be produced and
-contain the following text:
-
-<div>There is no block tag support.</div> There is no
-<inline tag=”tag”></inline> support. There is no <!–
-comment –> support. There is no <? HTML instruction ?>
-support.
-There is support. There is support. There is support.
-
-LaTeX Example
-Using a text editor, create a text document named
-document.tex
with the following content:
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-
- <div>
- *There is no block tag support.*
- </div>
- *There is no <inline tag="tag"></inline> support.*
- _There is no <!-- comment --> support._
- _There is no <? HTML instruction ?> support._\end{markdown}
-
-\begin{markdown*}{html}
+class="sourceCode tex">\input markdown
+\input lmfonts
+
+\markdownBegin
+
+ <div>
+ *There is no block tag support.*
+ </div>
+ *There is no <inline tag="tag"></inline> support.*
+ _There is no <!-- comment --> support._
+ _There is no <? HTML instruction ?> support._\markdownEnd
+
+\def\markdownOptionHtml{true}
+\markdownBegin
<div>
*There is block tag support.*
</div>
*There is <inline tag="tag"></inline> support.*
_There is <!-- comment --> support._
- _There is <? HTML instruction ?> support._\end{markdown*}
+\markdownEnd
-\end{document}
+\bye
Next, invoke LuaTeX from the terminal:
lualatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -3967,37 +3964,37 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-
- <div>
- *There is no block tag support.*
- </div>
- *There is no <inline tag="tag"></inline> support.*
- _There is no <!-- comment --> support._
- _There is no <? HTML instruction ?> support._\stopmarkdown
-
-\setupmarkdown[html = yes]
-\startmarkdown
+class="sourceCode tex">\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+
+ <div>
+ *There is no block tag support.*
+ </div>
+ *There is no <inline tag="tag"></inline> support.*
+ _There is no <!-- comment --> support._
+ _There is no <? HTML instruction ?> support._\end{markdown}
+
+\begin{markdown*}{html}
<div>
*There is block tag support.*
</div>
*There is <inline tag="tag"></inline> support.*
_There is <!-- comment --> support._
- _There is <? HTML instruction ?> support._\stopmarkdown
+\end{markdown*}
-\stoptext
Next, invoke LuaTeX from the terminal:
context document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4007,8 +4004,48 @@ comment –> support. There is no <? HTML instruction ?> support.-There is support. There is support. There is support.
Using a text editor, create a text document named
+document.tex
with the following content:
\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+
+ <div>
+ *There is no block tag support.*
+ </div>
+ *There is no <inline tag="tag"></inline> support.*
+ _There is no <!-- comment --> support._
+ _There is no <? HTML instruction ?> support._\stopmarkdown
+
+\setupmarkdown[html = yes]
+\startmarkdown
+
+ <div>
+ *There is block tag support.*
+ </div>
+ *There is <inline tag="tag"></inline> support.*
+ _There is <!-- comment --> support._
+ _There is <? HTML instruction ?> support._\stopmarkdown
+
+\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named document.pdf
should be produced and
+contain the following text:
++<div>There is no block tag support.</div> There is no +<inline tag=”tag”></inline> support. There is no <!– +comment –> support. There is no <? HTML instruction ?> +support.
+There is support. There is support. There is support.
+
hybrid
hybrid
(default value: false
)Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input lmfonts
-\directlua{
-
- local markdown = require("markdown")
- local input, convert_safe, convert_unsafe, paragraph
-$\string\sqrt{-1}$ *equals* $i$.]]
- input = [[
- convert_safe = markdown.new()
- convert_unsafe = markdown.new({hybrid = true})\par]]
- paragraph = [[
-
- tex.sprint(
- convert_safe(input) .. paragraph ..
- convert_unsafe(input)
- )
- }\bye
\input markdown
+\input lmfonts
+\directlua{
+
+ local markdown = require("markdown")
+ local input, convert_safe, convert_unsafe, paragraph
+$\string\sqrt{-1}$ *equals* $i$.]]
+ input = [[
+ convert_safe = markdown.new()
+ convert_unsafe = markdown.new({hybrid = true})\par]]
+ paragraph = [[
+
+ tex.sprint(
+ convert_safe(input) .. paragraph ..
+ convert_unsafe(input)
+ )
+ }\bye
Then, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
$\sqrt {-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input lmfonts
-\input optionfalse
-
-\begingroup
-\catcode`\%=12
-\input optiontrue
-\endgroup
-\bye
\input markdown
+\input lmfonts
+\input optionfalse
+
+\begingroup
+\catcode`\%=12
+\input optiontrue
+\endgroup
+\bye
Using a text editor, create a text document named
content.md
with the following content:
$\sqrt{-1}$ *equals* $i$.
$\sqrt{-1}$ *equals* $i$.
Next, invoke LuaTeX from the terminal:
-texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
-texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex
-luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex
+texlua ⟨CLI pathname⟩ hybrid=true -- content.md optiontrue.tex
+luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua
CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems
@@ -4106,91 +4144,95 @@ title="Kpathsea - TeX Users Group">Kpathsea.
-$\sqrt {-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\input lmfonts
-
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$.
-\markdownEnd
-
-\def\markdownOptionHybrid{true}
-\markdownBegin
-$\sqrt{-1}$ *equals* $i$.
-\markdownEnd
-
-\bye
\input markdown
+\input lmfonts
+
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\def\markdownOptionHybrid{true}
+\markdownBegin
+$\sqrt{-1}$ *equals* $i$.
+\markdownEnd
+
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
$\sqrt {-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
Using a text editor, create a text document named
document.tex
with the following content:
\documentclass{article}
-\usepackage{markdown}
-\begin{document}
-
-\begin{markdown}
-$\sqrt{-1}$ *equals* $i$.
-\end{markdown}
-
-\begin{markdown*}{hybrid}
-$\sqrt{-1}$ *equals* $i$.
-\end{markdown*}
-
-\end{document}
\documentclass{article}
+\usepackage{markdown}
+\begin{document}
+
+\begin{markdown}
+$\sqrt{-1}$ *equals* $i$.
+\end{markdown}
+
+\begin{markdown*}{hybrid}
+$\sqrt{-1}$ *equals* $i$.
+\end{markdown*}
+
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
$\sqrt {-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
Using a text editor, create a text document named
document.tex
with the following content:
\usemodule[t][markdown]
-\starttext
-
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$.
-\stopmarkdown
-
-\setupmarkdown[hybrid = yes]
-\startmarkdown
-$\sqrt{-1}$ *equals* $i$.
-\stopmarkdown
-
-\stoptext
\usemodule[t][markdown]
+\starttext
+
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\setupmarkdown[hybrid = yes]
+\startmarkdown
+$\sqrt{-1}$ *equals* $i$.
+\stopmarkdown
+
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
-$\sqrt {-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
inlineNotes
inlineNotes
(default value: false
)Enable the Pandoc inline note syntax extension:
-
- Here is an inline note.^[Inlines notes are easier to
- write, since you don't have to pick an identifier and move down to type the note.]
+ Here is an inline note.^[Inlines notes are easier to
+ write, since you don't have to pick an identifier and move down to type the note.]
LaTeX Example
Using a text editor, create a text document named
document.tex
with the following content:
-\documentclass{article}
-\usepackage[inlineNotes]{markdown}
-\begin{document}
-\begin{markdown}
-
- Here is an inline note.^[Inlines notes are easier to
- write, since you don't have to pick an identifier and
- move down to type the note.]\end{markdown}
-\end{document}
+\documentclass{article}
+\usepackage[inlineNotes]{markdown}
+\begin{document}
+\begin{markdown}
+
+ Here is an inline note.^[Inlines notes are easier to
+ write, since you don't have to pick an identifier and
+ move down to type the note.]\end{markdown}
+\end{document}
Next, invoke LuaTeX from the terminal:
-lualatex document.tex
+lualatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4242,27 +4284,27 @@ id="fnref1" role="doc-noteref">1
class="tex">TeXt Example
Using a text editor, create a text document named
document.tex
with the following content:
-\usemodule[t][markdown]
-\setupmarkdown[inlineNotes = yes]
-\starttext
-\startmarkdown
-
- Here is an inline note.^[Inlines notes are easier to
- write, since you don't have to pick an identifier and
- move down to type the note.]\stopmarkdown
-\stoptext
+\usemodule[t][markdown]
+\setupmarkdown[inlineNotes = yes]
+\starttext
+\startmarkdown
+
+ Here is an inline note.^[Inlines notes are easier to
+ write, since you don't have to pick an identifier and
+ move down to type the note.]\stopmarkdown
+\stoptext
Next, invoke LuaTeX from the terminal:
-context document.tex
+context document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
Here is an inline note.2
-2.2.1.30 Option
+2.2.1.31 Option
jekyllData
jekyllData
(default value: false
)
@@ -4272,18 +4314,18 @@ class="header-section-number">2.2.1.30 Option
-
Enable the Pandoc yaml_metadata_block
syntax extension
for entering metadata in yaml:
----
-title: 'This is the title: it contains a colon'
-author:
-- Author One
-- Author Two
-keywords: [nothing, nothingness]
-abstract: |
-
- This is the abstract.
-
- It consists of two paragraphs.---
+---
+title: 'This is the title: it contains a colon'
+author:
+- Author One
+- Author Two
+keywords: [nothing, nothingness]
+abstract: |
+
+ This is the abstract.
+
+ It consists of two paragraphs.---
@@ -4297,33 +4339,33 @@ for entering metadata in yaml.
Using a text editor, create a text document named
document.tex
with the following content:
\input markdown
-\def\markdownOptionJekyllData{true}
-\ExplSyntaxOn
-\keys_define:nn
-
- { markdown/jekyllData }
- {\gdef\name{#1} },
- name .code:n = { \gdef\age{#1} },
- age .code:n = {
- }\ExplSyntaxOff
-\def\markdownRendererJekyllDataEnd{%
-\name{} is \age{} years old.}
- \markdownBegin
-
- ---
- name: Jane Doe
- age: 99
- ---\markdownEnd
-\bye
\input markdown
+\def\markdownOptionJekyllData{true}
+\ExplSyntaxOn
+\keys_define:nn
+
+ { markdown/jekyllData }
+ {\gdef\name{#1} },
+ name .code:n = { \gdef\age{#1} },
+ age .code:n = {
+ }\ExplSyntaxOff
+\def\markdownRendererJekyllDataEnd{%
+\name{} is \age{} years old.}
+ \markdownBegin
+
+ ---
+ name: Jane Doe
+ age: 99
+ ---\markdownEnd
+\bye
Next, invoke LuaTeX from the terminal:
-luatex document.tex
luatex document.tex
A PDF document named document.pdf
should be produced and
contain the following text:
@@ -4333,31 +4375,31 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4367,39 +4409,39 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
2.2.1.31 Option +
2.2.1.32 Option
lineBlocks
@@ -4426,23 +4468,23 @@ class="sourceCode md">
- @@ -4408,12 +4450,12 @@ class="header-section-number">2.2.1.31 Option
lineBlocks
(default value:false
)- true
Enable the Pandoc line block syntax extension.
-+- | this is a line block that - | spans multiple - | even - discontinuous | lines
+ | this is a line block that + | spans multiple + | even + discontinuous | lines
-
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionLineBlocks{true} -\markdownBegin - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\markdownEnd -\bye
\input markdown +\def\markdownOptionLineBlocks{true} +\markdownBegin + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4455,20 +4497,20 @@ Tread softly because you tread on my dreams. class="latex">LaTeXExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[lineBlocks]{markdown} -\begin{document} -\begin{markdown} - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4481,20 +4523,20 @@ Tread softly because you tread on my dreams. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[lineBlocks = yes] -\starttext -\startmarkdown - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4503,8 +4545,8 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.2.2.1.32 Option +
2.2.1.33 Option
notes
@@ -4547,33 +4589,33 @@ class="sourceCode md">
- @@ -4513,24 +4555,24 @@ class="header-section-number">2.2.1.32 Option
notes
(default value:false
)- true
Enable the Pandoc note syntax extension:
-+[^1] and another.[^longnote] - Here is a note reference, -[^1]: Here is the note. - -[^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - - belong to the previous note. - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - - This paragraph won't be part of the note, because it isn't indented.
[^1] and another.[^longnote] + Here is a note reference, +[^1]: Here is the note. + +[^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + + belong to the previous note. + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + + This paragraph won't be part of the note, because it isn't indented.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[notes]{markdown} -\begin{document} -\begin{markdown} - - Here is a note reference,[^1] and another.[^longnote] - - [^1]: Here is the note. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous note. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[notes]{markdown} +\begin{document} +\begin{markdown} + + Here is a note reference,[^1] and another.[^longnote] + + [^1]: Here is the note. + + [^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + belong to the previous note. + + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + This paragraph won't be part of the note, because it + isn't indented.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4588,33 +4630,33 @@ indented. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\starttext -\startmarkdown - - Here is a note reference,[^1] and another.[^longnote] - - [^1]: Here is the note. - - [^longnote]: Here's one with multiple blocks. - - Subsequent paragraphs are indented to show that they - belong to the previous note. - - { some.code } - - The whole paragraph can be indented, or just the - first line. In this way, multi-paragraph notes - work like multi-paragraph list items. - - This paragraph won't be part of the note, because it - isn't indented.\stopmarkdown -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\starttext +\startmarkdown + + Here is a note reference,[^1] and another.[^longnote] + + [^1]: Here is the note. + + [^longnote]: Here's one with multiple blocks. + + Subsequent paragraphs are indented to show that they + belong to the previous note. + + { some.code } + + The whole paragraph can be indented, or just the + first line. In this way, multi-paragraph notes + work like multi-paragraph list items. + + This paragraph won't be part of the note, because it + isn't indented.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4625,8 +4667,8 @@ role="doc-noteref">6-This paragraph won’t be part of the note, because it isn’t indented.
2.2.1.33 Option +
2.2.1.34 Option
pipeTables
@@ -4658,21 +4700,21 @@ extension. class="latex">LaTeX Example
- @@ -4635,12 +4677,12 @@ class="header-section-number">2.2.1.33 Option
pipeTables
(default value:false
)- true
Enable the PHP Markdown pipe table syntax extension:
-+- | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
+ | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | | 1 | 1 | 1 | 1 |
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables]{markdown} -\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 |\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables]{markdown} +\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 |\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4711,21 +4753,21 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[pipeTables = yes] -\starttext -\startmarkdown - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 |\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[pipeTables = yes] +\starttext +\startmarkdown + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 |\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4760,8 +4802,8 @@ contain the following text:-2.2.1.34 Option +
2.2.1.35 Option
preserveTabs
-
- @@ -4782,8 +4824,8 @@ class="header-section-number">2.2.1.34 Option
preserveTabs
(default value:false
)2.2.1.35 Option +
2.2.1.36 Option
rawAttribute
@@ -4885,26 +4927,26 @@ class="sourceCode md">
- @@ -4792,20 +4834,20 @@ class="header-section-number">2.2.1.35 Option
rawAttribute
(default value:false
)- true
Enable the Pandoc raw attribute syntax extension:
-+`$H_2 O$`{=tex} is a liquid.
`$H_2 O$`{=tex} is a liquid.
To enable raw blocks, the
-fencedCode
option must also be enabled:+Here is a mathematical formula: -``` {=tex} -\[distance[i] = - \begin{dcases} - a & b \\ - c & d - \end{dcases} -\] -```
Here is a mathematical formula: +``` {=tex} +\[distance[i] = + \begin{dcases} + a & b \\ + c & d + \end{dcases} +\] +```
The
class="latex">LaTeX ExamplerawAttribute
option is a good alternative to thehybrid
option. Unlike thehybrid
option, which affects the @@ -4827,29 +4869,29 @@ allows you to isolate the parts of your documents that use TeX:Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[rawAttribute, fencedCode]{markdown} -\usepackage{expl3} -\begin{document} -\begin{markdown} -$H_2 O$`{=tex} is a liquid. - ` - - ``` {=html} - <p>Here is some HTML content that will be ignored.</p> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[rawAttribute, fencedCode]{markdown} +\usepackage{expl3} +\begin{document} +\begin{markdown} +$H_2 O$`{=tex} is a liquid. + ` + + ``` {=html} + <p>Here is some HTML content that will be ignored.</p> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H2O is a liquid.
2.2.1.36 Option +
2.2.1.37 Option
relativeReferences
relativeReferences
(default value: @@ -4861,14 +4903,14 @@ class="header-section-number">2.2.1.36 OptionEnable relative references in autolinks:
-+- I conclude in Section <#conclusion>. - - Conclusion {#conclusion}========== - - In this paper, we have discovered that most - grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
+ I conclude in Section <#conclusion>. + + Conclusion {#conclusion}========== + + In this paper, we have discovered that most + grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes, relativeReferences]{markdown} -\begin{document} -\begin{markdown} - - - I conclude in Section <#conclusion>. - - Conclusion {#conclusion} - ========== - In this paper, we have discovered that most - grandmas would rather eat dinner with their - grandchildren than get eaten. Begone, wolf! -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes, relativeReferences]{markdown} +\begin{document} +\begin{markdown} + + + I conclude in Section <#conclusion>. + + Conclusion {#conclusion} + ========== + In this paper, we have discovered that most + grandmas would rather eat dinner with their + grandchildren than get eaten. Begone, wolf! +\end{markdown} +\end{document}
Next, invoke LuaTeX twice from the terminal:
-+lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4913,8 +4955,8 @@ contain the following text:-In this paper, we have discovered that most grandmas would rather eat dinner with their grandchildren than get eaten. Begone, wolf!
2.2.1.37 Option +
2.2.1.38 Option
shiftHeadings
-
- @@ -4926,36 +4968,36 @@ when ⟨shift amount⟩ is positive, and to level 1, when ⟨shift amount⟩ is negative.
shiftHeadings
(default value:0
)Plain Plain TeX Example
Using a text editor, create a text document named
-example.md
with the following content:+## A section
## A section
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown - -\font\normal=cmr10\normal -\font\big=cmr10 at 12pt -\def\markdownRendererHeadingTwo#1{{\big #1\par}} -\font\bigger=cmr10 scaled 1440 -\def\markdownRendererHeadingOne#1{{\bigger #1\par}} - -\def\markdownOptionShiftHeadings{-1} -\markdownInput{example.md} - -\def\markdownOptionShiftHeadings{0} -\markdownInput{example.md} - -\def\markdownOptionShiftHeadings{+1} -\markdownInput{example.md} - -\bye
\input markdown + +\font\normal=cmr10\normal +\font\big=cmr10 at 12pt +\def\markdownRendererHeadingTwo#1{{\big #1\par}} +\font\bigger=cmr10 scaled 1440 +\def\markdownRendererHeadingOne#1{{\bigger #1\par}} + +\def\markdownOptionShiftHeadings{-1} +\markdownInput{example.md} + +\def\markdownOptionShiftHeadings{0} +\markdownInput{example.md} + +\def\markdownOptionShiftHeadings{+1} +\markdownInput{example.md} + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4967,20 +5009,20 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{filecontents}[overwrite,nosearch,noheader]{example.md} - - ## A section\end{filecontents} -\begin{document} -\markdownInput[shiftHeadings=-1]{example.md} -\markdownInput{example.md} -\markdownInput[shiftHeadings=+1]{example.md} -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{filecontents}[overwrite,nosearch,noheader]{example.md} + + ## A section\end{filecontents} +\begin{document} +\markdownInput[shiftHeadings=-1]{example.md} +\markdownInput{example.md} +\markdownInput[shiftHeadings=+1]{example.md} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -4992,22 +5034,22 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-example.md
with the following content:+## A section
## A section
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\inputmarkdown[shiftHeadings = -1]{example.md} -\inputmarkdown[shiftHeadings = 0]{example.md} -\inputmarkdown[shiftHeadings = +1]{example.md} - -\stoptext
\usemodule[t][markdown] +\starttext + +\inputmarkdown[shiftHeadings = -1]{example.md} +\inputmarkdown[shiftHeadings = 0]{example.md} +\inputmarkdown[shiftHeadings = +1]{example.md} + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5015,8 +5057,8 @@ contain the following text:-A section
A section
2.2.1.38 Option +
2.2.1.39 Option
slice
- @@ -5028,9 +5070,10 @@ ignored. The following selectors are recognized:
slice
(default value:^ $
)The circumflex ( ^
) selects the beginning of a document.The dollar sign ( -$
) selects the end of a document.+ ^
⟨identifier⟩ selects the beginning of a -section with the HTML -attribute#
⟨identifier⟩.^
⟨identifier⟩ selects the beginning of a section or a fenced +div with the HTML attribute +#
⟨identifier⟩.@@ -5046,47 +5089,47 @@ i.e. the entire section with the HTML attribute $
⟨identifier⟩ selects the end of a section with the HTML attribute#
⟨identifier⟩.#
⟨identifier⟩ will be selected. -Plain Plain TeX Example
Using a text editor, create a text document named
-hamlet.md
with the following content:+# The Tragedy of Hamlet - - Shakespeare's longest play. -## Act III {#act-3} - - Hamlet kills Polonius. -## Act V {#act-5} - - Hamlet dies. -## Act I {#act-1} - Hamlet talks to ghost.
# The Tragedy of Hamlet + + Shakespeare's longest play. +## Act III {#act-3} + + Hamlet kills Polonius. +## Act V {#act-5} + + Hamlet dies. +## Act I {#act-1} + Hamlet talks to ghost.
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionHeaderAttributes{true} - -\font\normal=cmr10\normal -\font\big=cmr10 at 12pt -\def\markdownRendererHeadingTwo#1{{\big #1\par}} -\font\bigger=cmr10 scaled 1440 -\def\markdownRendererHeadingOne#1{{\bigger #1\par}} - -\def\markdownOptionSlice{^ ^act-3} -\markdownInput{hamlet.md} - -\def\markdownOptionSlice{act-1} -\markdownInput{hamlet.md} - -\def\markdownOptionSlice{act-3 act-5} -\markdownInput{hamlet.md} - -\bye
\input markdown +\def\markdownOptionHeaderAttributes{true} + +\font\normal=cmr10\normal +\font\big=cmr10 at 12pt +\def\markdownRendererHeadingTwo#1{{\big #1\par}} +\font\bigger=cmr10 scaled 1440 +\def\markdownRendererHeadingOne#1{{\bigger #1\par}} + +\def\markdownOptionSlice{^ ^act-3} +\markdownInput{hamlet.md} + +\def\markdownOptionSlice{act-1} +\markdownInput{hamlet.md} + +\def\markdownOptionSlice{act-3 act-5} +\markdownInput{hamlet.md} + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5103,30 +5146,30 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes]{markdown} -\begin{filecontents}[overwrite,nosearch,noheader]{hamlet.md} - - # The Tragedy of Hamlet - Shakespeare's longest play. - - ## Act III {#act-3} - Hamlet kills Polonius. - - ## Act V {#act-5} - Hamlet dies. - - ## Act I {#act-1} - Hamlet talks to ghost.\end{filecontents} -\begin{document} -\markdownInput[slice=^ ^act-3]{hamlet.md} -\markdownInput[slice=act-1]{hamlet.md} -\markdownInput[slice=act-3 act-5]{hamlet.md} -\end{document}
\documentclass{article} +\usepackage[headerAttributes]{markdown} +\begin{filecontents}[overwrite,nosearch,noheader]{hamlet.md} + + # The Tragedy of Hamlet + Shakespeare's longest play. + + ## Act III {#act-3} + Hamlet kills Polonius. + + ## Act V {#act-5} + Hamlet dies. + + ## Act I {#act-1} + Hamlet talks to ghost.\end{filecontents} +\begin{document} +\markdownInput[slice=^ ^act-3]{hamlet.md} +\markdownInput[slice=act-1]{hamlet.md} +\markdownInput[slice=act-3 act-5]{hamlet.md} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5143,33 +5186,33 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-hamlet.md
with the following content:+# The Tragedy of Hamlet - - Shakespeare's longest play. -## Act III {#act-3} - - Hamlet kills Polonius. -## Act V {#act-5} - - Hamlet dies. -## Act I {#act-1} - Hamlet talks to ghost.
# The Tragedy of Hamlet + + Shakespeare's longest play. +## Act III {#act-3} + + Hamlet kills Polonius. +## Act V {#act-5} + + Hamlet dies. +## Act I {#act-1} + Hamlet talks to ghost.
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[headerAttributes = yes] -\starttext - -\inputmarkdown[slice = ^ ^act-3]{example.md} -\inputmarkdown[slice = act-1]{example.md} -\inputmarkdown[slice = act-3 act-5]{example.md} - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[headerAttributes = yes] +\starttext + +\inputmarkdown[slice = ^ ^act-3]{example.md} +\inputmarkdown[slice = act-1]{example.md} +\inputmarkdown[slice = act-3 act-5]{example.md} + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5182,8 +5225,8 @@ contain the following text:-Act V
Hamlet dies.
2.2.1.39 Option +
2.2.1.40 Option
smartEllipses
-
- @@ -5210,25 +5253,25 @@ class="tex">TeX macro. Example
smartEllipses
(default value:false
)Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} -\input lmfonts -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new() - local input = "These are just three regular dots ..." - tex.sprint(convert(input)) }\par -\directlua{ - - local markdown = require("markdown") - local convert = markdown.new({smartEllipses = true}) - local input = "... and this is a victorian ellipsis." - tex.sprint(convert(input)) }\bye
\input markdown +\def\markdownRendererEllipsis{. . .} +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new() + local input = "These are just three regular dots ..." + tex.sprint(convert(input)) }\par +\directlua{ + + local markdown = require("markdown") + local convert = markdown.new({smartEllipses = true}) + local input = "... and this is a victorian ellipsis." + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5238,23 +5281,23 @@ contain the following text:-Lua CLI Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} -\input lmfonts -\input optionfalse -\par -\input optiontrue -\bye
\input markdown +\def\markdownRendererEllipsis{. . .} +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named
-content.md
with the following content:+Are these just three regular dots, a victorian ellipsis, or ... ?
Are these just three regular dots, a victorian ellipsis, or ... ?
Next, invoke LuaTeX from the terminal:
-+texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex -texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex -luatex document.tex
texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ smartEllipses=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua CLI script file, such as
~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems @@ -5271,27 +5314,27 @@ contain the following text:Are these just three regular dots, a victorian ellipsis, or . . . ?
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEllipsis{. . .} - -\markdownBegin - - These are just three regular dots ...\markdownEnd - -\def\markdownOptionSmartEllipses{true} -\markdownBegin - - ... and this is a victorian ellipsis.\markdownEnd - -\bye
\input markdown +\def\markdownRendererEllipsis{. . .} + +\markdownBegin + + These are just three regular dots ...\markdownEnd + +\def\markdownOptionSmartEllipses{true} +\markdownBegin + + ... and this is a victorian ellipsis.\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5302,28 +5345,28 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - ellipsis = {. . .} - } - }\begin{document} - -\begin{markdown} - - These are just three regular dots ...\end{markdown} - -\begin{markdown*}{smartEllipses} - - ... and this is a victorian ellipsis.\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + ellipsis = {. . .} + } + }\begin{document} + +\begin{markdown} + + These are just three regular dots ...\end{markdown} + +\begin{markdown*}{smartEllipses} + + ... and this is a victorian ellipsis.\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5334,32 +5377,32 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererEllipsis{. . .} -\starttext - -\startmarkdown - - These are just three regular dots ...\stopmarkdown - -\setupmarkdown[smartEllipses = yes] -\startmarkdown - - ... and this is a victorian ellipsis.\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\def\markdownRendererEllipsis{. . .} +\starttext + +\startmarkdown + + These are just three regular dots ...\stopmarkdown + +\setupmarkdown[smartEllipses = yes] +\startmarkdown + + ... and this is a victorian ellipsis.\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-These are just three regular dots …
. . . and this is a victorian ellipsis.
2.2.1.40 Option +
2.2.1.41 Option
startNumber
-
- @@ -5389,32 +5432,32 @@ class="tex">TeX macro. class="latex">LaTeX Example
startNumber
(default value:true
)Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\end{markdown} - -\begin{markdown*}{startNumber=false} - - The following list does not respect the numbers specified in the - markup: - - 3. third item - 4. fourth item - 5. fifth item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage{markdown} +\begin{document} + +\begin{markdown} + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\end{markdown} + +\begin{markdown*}{startNumber=false} + + The following list does not respect the numbers specified in the + markup: + + 3. third item + 4. fourth item + 5. fifth item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5436,30 +5479,30 @@ markup: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\starttext - -\startmarkdown - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\stopmarkdown - -\setupmarkdown[startNumber = no] -\startmarkdown - - The following list respects the numbers specified in the markup: - - 3. third item - 4. fourth item - 5. fifth item\stopmarkdown -\stoptext
\usemodule[t][markdown] +\starttext + +\startmarkdown + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\stopmarkdown + +\setupmarkdown[startNumber = no] +\startmarkdown + + The following list respects the numbers specified in the markup: + + 3. third item + 4. fourth item + 5. fifth item\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5477,8 +5520,8 @@ markup:-- fifth item
2.2.1.41 Option +
2.2.1.42 Option
strikeThrough
@@ -5501,22 +5544,22 @@ class="sourceCode md">
- @@ -5487,8 +5530,8 @@ class="header-section-number">2.2.1.41 Option
strikeThrough
(default value:false
)- true
Enable the Pandoc strike-through syntax extension:
-+This ~~is deleted text.~~
This ~~is deleted text.~~
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStrikeThrough{true} -\input soulutf8.sty -\def\markdownRendererStrikeThrough#1{\st{#1}} -\markdownBegin - - This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd -\bye
\input markdown +\def\markdownOptionStrikeThrough{true} +\input soulutf8.sty +\def\markdownRendererStrikeThrough#1{\st{#1}} +\markdownBegin + + This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5526,23 +5569,23 @@ contain the following text: class="latex">LaTeX ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5552,25 +5595,25 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[strikeThrough = yes] +\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} +\starttext +\startmarkdown + + This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.2.2.1.42 Option +
2.2.1.43 Option
stripIndent
@@ -5602,58 +5645,58 @@ document.
- @@ -5581,14 +5624,14 @@ class="header-section-number">2.2.1.42 Option
stripIndent
(default value:false
)Strip the minimal indentation of non-blank lines from all lines in a markdown document. Requires that the
-preserveTabs
Lua option is disabled:+\documentclass{article} -\usepackage[stripIndent]{markdown} -\begin{document} -\begin{markdown} - - Hello *world*!\end{markdown} - \end{document}
\documentclass{article} +\usepackage[stripIndent]{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} + \end{document}
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStripIndent{true} -\markdownBegin - - Hello *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionStripIndent{true} +\markdownBegin + + Hello *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[stripIndent]{markdown} -\begin{document} -\begin{markdown} - - Hello *world*!\end{markdown} - \end{document}
\documentclass{article} +\usepackage[stripIndent]{markdown} +\begin{document} +\begin{markdown} + + Hello *world*!\end{markdown} + \end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[stripIndent = yes] -\starttext -\startmarkdown - - Hello *world*!\stopmarkdown - \stoptext
\usemodule[t][markdown] +\setupmarkdown[stripIndent = yes] +\starttext +\startmarkdown + + Hello *world*!\stopmarkdown + \stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
-document.pdf
should be produced and contain the text “Hello world!”2.2.1.43 Option +
occurance of ASCII ellipses in the input text. This macro will only be produced, when the2.2.1.44 Option
subscripts
@@ -5680,17 +5723,17 @@ class="sourceCode md">
- @@ -5662,8 +5705,8 @@ class="header-section-number">2.2.1.43 Option
subscripts
(default value:false
)- true
Enable the Pandoc subscript syntax extension:
-+H~2~O is a liquid.
H~2~O is a liquid.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[subscripts]{markdown} -\begin{document} -\begin{markdown} - - H~2~O is a liquid.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[subscripts]{markdown} +\begin{document} +\begin{markdown} + + H~2~O is a liquid.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5700,24 +5743,24 @@ contain the following text: class="tex">TeXt Example-Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[subscripts = yes] -\starttext -\startmarkdown - - H~2~O is a liquid.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[subscripts = yes] +\starttext +\startmarkdown + + H~2~O is a liquid.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H2O is a liquid.
2.2.1.44 Option +
2.2.1.45 Option
superscripts
@@ -5744,17 +5787,17 @@ class="sourceCode md">
- @@ -5726,8 +5769,8 @@ class="header-section-number">2.2.1.44 Option
superscripts
(default value:false
)- true
Enable the Pandoc superscript syntax extension:
-+2^10^ is 1024.
2^10^ is 1024.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[superscripts]{markdown} -\begin{document} -\begin{markdown} - - 2^10^ is 1024.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[superscripts]{markdown} +\begin{document} +\begin{markdown} + + 2^10^ is 1024.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5764,24 +5807,24 @@ contain the following text: class="tex">TeXt Example-Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[superscripts = yes] -\starttext -\startmarkdown - - 2^10^ is 1024.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[superscripts = yes] +\starttext +\startmarkdown + + 2^10^ is 1024.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-210 is 1024.
2.2.1.45 Option +
the beginning of a block quote. The macro receives no arguments.2.2.1.46 Option
tableCaptions
@@ -5815,23 +5858,23 @@ class="sourceCode md">
- @@ -5791,14 +5834,14 @@ class="header-section-number">2.2.1.45 Option
tableCaptions
(default value:false
)Enable the Pandoc
-table_captions
syntax extension for pipe tables.+- | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - : Demonstration of pipe table syntax.
+ | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + : Demonstration of pipe table syntax.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables, tableCaptions]{markdown} -\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables, tableCaptions]{markdown} +\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + + : Demonstration of pipe table syntax.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5871,27 +5914,27 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - pipeTables = yes, - tableCaptions = yes, - ]\starttext -\startmarkdown - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + pipeTables = yes, + tableCaptions = yes, + ]\starttext +\startmarkdown + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + + : Demonstration of pipe table syntax.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5927,8 +5970,8 @@ contain the following text:-2.2.1.46 Option +
2.2.1.47 Option
taskLists
@@ -5957,26 +6000,26 @@ class="sourceCode md">
- @@ -5937,10 +5980,10 @@ class="header-section-number">2.2.1.46 Option
taskLists
(default value:false
)- true
Enable the Pandoc
-task_lists
syntax extension.+- [ ] an unticked task list item -- [/] a half-checked task list item -- [X] a ticked task list item
- [ ] an unticked task list item +- [/] a half-checked task list item +- [X] a ticked task list item
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[taskLists]{markdown} -\markdownSetup{ - - renderers = { - untickedBox = No, - halfTickedBox = Maybe, - tickedBox = Yes, - }, - }\begin{document} -\begin{markdown} - - - [ ] you can't. - - [/] I can? - - [X] I can!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[taskLists]{markdown} +\markdownSetup{ + + renderers = { + untickedBox = No, + halfTickedBox = Maybe, + tickedBox = Yes, + }, + }\begin{document} +\begin{markdown} + + - [ ] you can't. + - [/] I can? + - [X] I can!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -5990,22 +6033,22 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[taskLists = yes] -\def\markdownRendererUntickedBox{No} -\def\markdownRendererHalftickedBox{Maybe} -\def\markdownRendererTickedBox{Yes} -\starttext -\startmarkdown - - - [ ] you can't. - - [/] I can? - - [X] I can!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[taskLists = yes] +\def\markdownRendererUntickedBox{No} +\def\markdownRendererHalftickedBox{Maybe} +\def\markdownRendererTickedBox{Yes} +\starttext +\startmarkdown + + - [ ] you can't. + - [/] I can? + - [X] I can!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6015,8 +6058,8 @@ contain the following text:-Yes I can! 2.2.1.47 Option +
2.2.1.48 Option
texComments
-
- @@ -6025,15 +6068,15 @@ class="header-section-number">2.2.1.47 Option
texComments
(default value:false
)- true
- @@ -6049,61 +6092,235 @@ comments.
Strip TeX-style comments.
-+\documentclass{article} -\usepackage[texComments]{markdown} -\begin{document} -\begin{markdown} -% this is a comment - Hel - lo *world*!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[texComments]{markdown} +\begin{document} +\begin{markdown} +% this is a comment + Hel + lo *world*!\end{markdown} +\end{document}
Always enabled when
hybrid
is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTexComments{true} -\markdownBegin -% this is a comment - Hel - lo *world*!\markdownEnd -\bye
\input markdown +\def\markdownOptionTexComments{true} +\markdownBegin +% this is a comment + Hel + lo *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[texComments]{markdown} -\begin{document} -\begin{markdown} -% this is a comment - Hel - lo *world*!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[texComments]{markdown} +\begin{document} +\begin{markdown} +% this is a comment + Hel + lo *world*!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”ConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[texComments = yes] -\starttext -\startmarkdown -% this is a comment - Hel - lo *world*!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[texComments = yes] +\starttext +\startmarkdown +% this is a comment + Hel + lo *world*!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
-document.pdf
should be produced and contain the text “Hello world!”2.2.1.48 Option +
2.2.1.49 Option +
+texMathDollars
+
+- +
texMathDollars
(default value:false
)- +
++
+- true
+- +
+Enable the Pandoc
+tex_math_dollars
syntax extension.+inline math: $E=mc^2$ + +display math: $$E=mc^2$$
- +
++
+- false
+- +
+Disable the Pandoc
+tex_math_dollars
syntax +extension.Lua Module +Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown +\input lmfonts +\directlua{ + + local markdown = require("markdown") + local newline = [[^^J^^J]] + local convert = markdown.new({texMathDollars = true}) + local input =$E=mc^2$]] .. newline .. newline .. + [[$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$]] + [[ + tex.sprint(convert(input)) }\bye
Then, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+Lua CLI Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown +\input lmfonts +\input optionfalse +\par +\input optiontrue +\bye
Using a text editor, create a text document named +
+content.md
with the following content:++ $E=mc^2$ + $$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$
Next, invoke LuaTeX from the terminal:
++texlua ⟨CLI pathname⟩ -- content.md optionfalse.tex +texlua ⟨CLI pathname⟩ texMathDollars=true -- content.md optiontrue.tex +luatex document.tex
where ⟨CLI pathname⟩ corresponds to the location of the Lua +CLI script file, such as +
+~/texmf/scripts/markdown/markdown-cli.lua
on UN*X systems +orC:\Users\
⟨Your +username⟩\texmf\scripts\markdown\markdown-cli.lua
on +Windows systems. Use the command +kpsewhich -a markdown-cli.lua
to locate the Lua CLI script +file using Kpathsea.A PDF document named
+document.pdf
should be produced and +contain the following text:++$E=mc^2$
+$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x +\right ) e^{-i2\pi \xi x} dx$$
+E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+Plain TeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown + +\def\markdownOptionTexMathDollars{true} +\markdownBegin +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage[texMathDollars]{markdown} +\begin{document} + +\begin{markdown} +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
++lualatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+ConTeXt Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\usemodule[t][markdown] +\setupmarkdown[texMathDollars = yes] +\starttext + +\startmarkdown +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx
+2.2.1.50 Option
tightLists
@@ -6139,43 +6356,43 @@ multiple paragraphs. -
- @@ -6115,16 +6332,16 @@ class="header-section-number">2.2.1.48 Option paragraphs will be considered tight. Tight lists will produce tight renderers that may produce different output than lists that are not tight: -
tightLists
(default value:true
)+- This is -- a tight -- unordered list. - -- This is - - - not a tight -- unordered list.
- This is +- a tight +- unordered list. + +- This is + + + not a tight +- unordered list.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\begin{document} - -\begin{markdown} - - The following list is tight: - - - first item - - second item - - third item - - The following list is loose: - - - first item - - second item that spans - - multiple paragraphs - - third item\end{markdown} - -\begin{markdown*}{tightLists=false} - - The following list is now also loose: - - - first item - - second item - - third item\end{markdown*} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.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:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6199,8 +6416,8 @@ contain the following text:-third item
2.2.1.49 Option +
2.2.1.51 Option
underscores
@@ -6230,27 +6447,27 @@ constantly escape subscripts. -
- @@ -6210,11 +6427,11 @@ class="header-section-number">2.2.1.49 Option
underscores
(default value:true
)Both underscores and asterisks can be used to denote emphasis and strong emphasis:
-+- *single asterisks* - _single underscores_ - **double asterisks** __double underscores__
+ *single asterisks* + _single underscores_ + **double asterisks** __double underscores__
Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionHybrid{true} - -\markdownBegin -$m\_n$. - This is _emphasized text_ and this is a math subscript: \markdownEnd - -\def\markdownOptionUnderscores{false} -\markdownBegin -$m_n$. - This is *emphasized text* and this is a math subscript: \markdownEnd - -\bye
\input markdown +\def\markdownOptionHybrid{true} + +\markdownBegin +$m\_n$. + This is _emphasized text_ and this is a math subscript: \markdownEnd + +\def\markdownOptionUnderscores{false} +\markdownBegin +$m_n$. + This is *emphasized text* and this is a math subscript: \markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6259,27 +6476,27 @@ contain the following text:-This is emphasized text and this is a math subscript: mₙ.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[hybrid]{markdown} -\begin{document} - -\begin{markdown} -$m\_n$. - This is _emphasized text_ and this is a math subscript: \end{markdown} - -\begin{markdown*}{underscores=false} -$m_n$. - This is *emphasized text* and this is a math subscript: \end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[hybrid]{markdown} +\begin{document} + +\begin{markdown} +$m\_n$. + This is _emphasized text_ and this is a math subscript: \end{markdown} + +\begin{markdown*}{underscores=false} +$m_n$. + This is *emphasized text* and this is a math subscript: \end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6288,28 +6505,28 @@ contain the following text:-This is emphasized text and this is a math subscript: mₙ.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[hybrid = yes] -\starttext - -\startmarkdown -$m\_n$. - This is _emphasized text_ and this is a math subscript: \stopmarkdown - -\setupmarkdown[underscores = yes] -\startmarkdown -$m_n$. - This is *emphasized text* and this is a math subscript: \stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[hybrid = yes] +\starttext + +\startmarkdown +$m\_n$. + This is _emphasized text_ and this is a math subscript: \stopmarkdown + +\setupmarkdown[underscores = yes] +\startmarkdown +$m_n$. + This is *emphasized text* and this is a math subscript: \stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6336,8 +6553,8 @@ plain TeXtaskLists
Lua option totrue
, you would include the following code in your plain TeX document: -+\def\markdownOptionTaskLists{true}
\def\markdownOptionTaskLists{true}
2.2.2.2 Finalizing and Freezing the Cache
@@ -6387,24 +6604,24 @@ options.Using a text editor, create a folder named
-output-directory
and a text document nameddocument.tex
with the following content:+\input lmfonts -\input markdown -\def\markdownOptionHelperScriptFileName{helper-script.lua} -\def\markdownOptionInputTempFileName{temporary-input.md} -\def\markdownOptionOutputTempFileName{temporary-output.tex} -\def\markdownOptionErrorTempFileName{error-output.txt} -\def\markdownOptionOutputDir{output-directory} -\def\markdownOptionCacheDir{output-directory/cache-directory} -\markdownOptionFinalizeCachetrue -\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex} -\markdownBegin - - Hello *world*!\markdownEnd -\bye
\input lmfonts +\input markdown +\def\markdownOptionHelperScriptFileName{helper-script.lua} +\def\markdownOptionInputTempFileName{temporary-input.md} +\def\markdownOptionOutputTempFileName{temporary-output.tex} +\def\markdownOptionErrorTempFileName{error-output.txt} +\def\markdownOptionOutputDir{output-directory} +\def\markdownOptionCacheDir{output-directory/cache-directory} +\markdownOptionFinalizeCachetrue +\def\markdownOptionFrozenCacheFileName{output-directory/cache-directory/frozen-cache.tex} +\markdownBegin + + Hello *world*!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex --output-directory output-directory document.tex
luatex --output-directory output-directory document.tex
A text document named
@@ -6417,8 +6634,8 @@ document. LuaTeX does not need other temporary files to perform the conversion from markdown to TeX. To produce the remaining temporary files, invoke pdfTeX from the terminal: -temporary-input.md
should be produced in the folder namedoutput-directory
and contain the following text:+pdftex --output-directory output-directory --shell-escape document.tex
pdftex --output-directory output-directory --shell-escape document.tex
Text documents named
helper-script.lua
, andtemporary-output.md
should be produced in the folder namedoutput-directory
. The document named @@ -6447,21 +6664,21 @@ Mittelbach. The recognized values of the macro aretrue
false
.Using a text editor, create a text document named
-document.dtx
with the following content:+% \iffalse -\documentclass{ltxdoc} -\usepackage[stripPercentSigns]{markdown} -\begin{document} -\DocInput{document.dtx} -\end{document} -% \fi -% -% \begin{markdown} -% Hello *world*! -% \end{markdown}
% \iffalse +\documentclass{ltxdoc} +\usepackage[stripPercentSigns]{markdown} +\begin{document} +\DocInput{document.dtx} +\end{document} +% \fi +% +% \begin{markdown} +% Hello *world*! +% \end{markdown}
Next, invoke LuaTeX from the terminal:
-+lualatex document.dtx
lualatex document.dtx
A PDF document named
document.pdf
should be produced and contain the text “Hello world!”LaTeX. For example, to set the
taskLists
Lua option totrue
, we would include the following code in our LaTeX document: -+\markdownSetup{ - - taskLists = true, }
\markdownSetup{ + + taskLists = true, }
We can also set all plain TeX options directly from LaTeX. For example, to set @@ -6492,10 +6709,10 @@ the
-\markdownOptionHelperScriptFileName
plain TeX option tohelper-script.lua
, we would inclde the following code in our LaTeX document:+\markdownSetup{ - - helperScriptFileName = helper-script.lua, }
\markdownSetup{ + + helperScriptFileName = helper-script.lua, }
2.2.3.2 No default token renderer prototypes
@@ -6510,8 +6727,8 @@ class="tex">TeX implementation and prevent the soft from being loaded: The plain option must be set before or when loading the package. Setting the option after loading the package will have no effect. -+\usepackage[plain]{markdown}
\usepackage[plain]{markdown}
2.2.3.3 LaTeX themes
@@ -6524,11 +6741,11 @@ without low-level programming.For example, to load themes named
-witiko/beamer/MU
andwitiko/dot
, you would use the following code in the preamble of your document:+\usepackage[ - - theme = witiko/beamer/MU, - theme = witiko/dot,markdown} ]{
\usepackage[ + + theme = witiko/beamer/MU, + theme = witiko/dot,markdown} ]{
Due to limitations of LaTeX, themes may not be loaded after the beginning of a TeX option is enabled.
-LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[theme=witiko/dot]{markdown} -\setkeys{Gin}{ -\columnwidth, - width=\paperheight, - height=0.65 - keepaspectratio}\begin{document} -\begin{markdown} - - ``` dot Various formats of mathemathical formulae - digraph tree { - margin = 0; - rankdir = "LR"; - - latex -> pmml; - latex -> cmml; - pmml -> slt; - cmml -> opt; - cmml -> prefix; - cmml -> infix; - pmml -> mterms [style=dashed]; - cmml -> mterms; - - latex [label = "LaTeX"]; - pmml [label = "Presentation MathML"]; - cmml [label = "Content MathML"]; - slt [label = "Symbol Layout Tree"]; - opt [label = "Operator Tree"]; - prefix [label = "Prefix"]; - infix [label = "Infix"]; - mterms [label = "M-Terms"]; - } - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[theme=witiko/dot]{markdown} +\setkeys{Gin}{ +\columnwidth, + width=\paperheight, + height=0.65 + keepaspectratio}\begin{document} +\begin{markdown} + + ``` dot Various formats of mathemathical formulae + digraph tree { + margin = 0; + rankdir = "LR"; + + latex -> pmml; + latex -> cmml; + pmml -> slt; + cmml -> opt; + cmml -> prefix; + cmml -> infix; + pmml -> mterms [style=dashed]; + cmml -> mterms; + + latex [label = "LaTeX"]; + pmml [label = "Presentation MathML"]; + cmml [label = "Content MathML"]; + slt [label = "Symbol Layout Tree"]; + opt [label = "Operator Tree"]; + prefix [label = "Prefix"]; + infix [label = "Infix"]; + mterms [label = "M-Terms"]; + } + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
@@ -6613,22 +6830,22 @@ Wget or cURL installed. The theme also requires shell access unless the class="tex">TeX option is enabled. -document.pdf
should be produced and contain a drawing of a directed graph similar to Figure 1 from the following conference article:LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[theme=witiko/graphicx/http]{markdown} -\begin{document} -\begin{markdown} - - ![img](https://github.com/witiko/markdown/raw/main/markdown.png - "The banner of the Markdown package")\end{markdown} -\end{document}
\documentclass{article} +\usepackage[theme=witiko/graphicx/http]{markdown} +\begin{document} +\begin{markdown} + + ![img](https://github.com/witiko/markdown/raw/main/markdown.png + "The banner of the Markdown package")\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following image:@@ -6647,21 +6864,21 @@ non-breaking space even when thehybrid
Lua option is disabled. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[theme=witiko/tilde]{markdown} -\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage[theme=witiko/tilde]{markdown} +\begin{document} +\begin{markdown} + + Bartel~Leendert van~der~Waerden\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
@@ -6678,30 +6895,30 @@ class="latex">LaTeX setup snippets provide syntactic sugar for defining and invoking various options locally.document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:Here is how we can use setup snippets to store options and invoke them later:
-+\markdownSetupSnippet{romanNumerals}{ - - renderers = {% - olItemWithNumber = {\item[\romannumeral#1\relax.]% - - }, - }, - }\begin{markdown} - - - The following ordered list will be preceded by arabic numerals: - - 1. wahid - 2. aithnayn -\end{markdown} -\begin{markdown*}{snippet=romanNumerals} - - - The following ordered list will be preceded by roman numerals: - - 3. tres - 4. quattuor -\end{markdown*}
\markdownSetupSnippet{romanNumerals}{ + + renderers = {% + olItemWithNumber = {\item[\romannumeral#1\relax.]% + + }, + }, + }\begin{markdown} + + + The following ordered list will be preceded by arabic numerals: + + 1. wahid + 2. aithnayn +\end{markdown} +\begin{markdown*}{snippet=romanNumerals} + + + The following ordered list will be preceded by roman numerals: + + 3. tres + 4. quattuor +\end{markdown*}
2.3 Markdown Tokens
A key feature of the Markdown package is the support for manipulating @@ -6731,52 +6948,53 @@ macro receives a single attribute that corresponds to the (
+macro receives a single attribute that corresponds to the \meta{class +name}.class="
⟨class name⟩ …"
in HTML and.
⟨class name⟩ in Markdown’sheaderAttributes
syntax extension). The -macro receives a single attribute that corresponds to the .-
\markdownRendererAttributeKeyValue
represents a HTML attribute in the form ⟨key⟩=
⟨value⟩ that is neither an identifier nor a class name. The macro receives two attributes that correspond to the ⟨key⟩ and the ⟨value⟩, respectively.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes, underscores=false]{markdown} -\markdownSetup{ - - renderers = {% - attributeIdentifier = {\par - \emph{(Identifier: #1)} - \par - - },% - attributeClassName = {\par - \emph{(Class name: #1)} - \par - - },% - attributeKeyValue = {\par - \emph{(Key: #1, Value: #2)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - # First top-level heading {jane=doe} - - ## A subheading {#identifier} - - # Second top-level heading {.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes, underscores=false]{markdown} +\markdownSetup{ + + renderers = {% + attributeIdentifier = {\par + \emph{(Identifier: #1)} + \par + + },% + attributeClassName = {\par + \emph{(Class name: #1)} + \par + + },% + attributeKeyValue = {\par + \emph{(Key: #1, Value: #2)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + + # First top-level heading {jane=doe} + + ## A subheading {#identifier} + + # Second top-level heading {.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6793,35 +7011,35 @@ class="header-section-number">2.3.1.2 Block Quote RenderersThe
-\markdownRendererBlockQuoteEnd
macro represents the end of a block quote. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererBlockQuoteBegin{% -\begingroup - \vskip\parindent - \leftskip=2\parindent - \parindent=0pt - - }\def\markdownRendererBlockQuoteEnd{% -\par - \vskip\parindent - \endgroup - - }\markdownBegin - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\markdownEnd -\bye
\input markdown +\def\markdownRendererBlockQuoteBegin{% +\begingroup + \vskip\parindent + \leftskip=2\parindent + \parindent=0pt + + }\def\markdownRendererBlockQuoteEnd{% +\par + \vskip\parindent + \endgroup + + }\markdownBegin + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6832,32 +7050,32 @@ fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\begin{quote}}, - blockQuoteBegin = {\end{quote}}, - blockQuoteEnd = { - }, - }\begin{document} -\begin{markdown} - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\begin{quote}}, + blockQuoteBegin = {\end{quote}}, + blockQuoteEnd = { + }, + }\begin{document} +\begin{markdown} + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6868,27 +7086,27 @@ fortune—often the surfeit of our own behavior—we make guilty of our disasters the sun, the moon, and the stars […]ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererBlockQuoteBegin{\startquotation} -\def\markdownRendererBlockQuoteEnd{\stopquotation} -\starttext -\startmarkdown - - A quote from William Shakespeare's King Lear: - - > This is the excellent foppery of the world that when we are - > sick in fortune---often the surfeit of our own behavior---we - > make guilty of our disasters the sun, the moon, and the - > stars [...]\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererBlockQuoteBegin{\startquotation} +\def\markdownRendererBlockQuoteEnd{\stopquotation} +\starttext +\startmarkdown + + A quote from William Shakespeare's King Lear: + + > This is the excellent foppery of the world that when we are + > sick in fortune---often the surfeit of our own behavior---we + > make guilty of our disasters the sun, the moon, and the + > stars [...]\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6910,29 +7128,29 @@ and\markdownRendererBracketedSpanAttributeContextEnd
macros represent the beginning and the end of an inline bracketed span in which the attributes of the span apply. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[bracketedSpans]{markdown} -\markdownSetup{ - - renderers = { - bracketedSpanAttributeContextBegin = {(}, - bracketedSpanAttributeContextEnd = {)}, - }, - }\begin{document} -\begin{markdown} - - - [foo [bar]{#identifier}]{key=value} [baz]{.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[bracketedSpans]{markdown} +\markdownSetup{ + + renderers = { + bracketedSpanAttributeContextBegin = {(}, + bracketedSpanAttributeContextEnd = {)}, + }, + }\begin{document} +\begin{markdown} + + + [foo [bar]{#identifier}]{key=value} [baz]{.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -6961,56 +7179,56 @@ of a bulleted list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when thetightLists
option is disabled. The macro receives no arguments. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTightLists{true} - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererUlBeginTight{ (} -\def\markdownRendererUlItem{% -\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }\def\markdownRendererUlItemEnd{} -\def\markdownRendererUlEndTight{).} - -\markdownBegin - - This is a tight list - - - the first item - - the second item - - the third item\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererUlBegin{} -\def\markdownRendererUlItem{--\kern 0.5em} -\def\markdownRendererUlItemEnd{.\par} -\def\markdownRendererUlEnd{} - -\markdownBegin - - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\markdownEnd - -\bye
\input markdown +\def\markdownOptionTightLists{true} + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererUlBeginTight{ (} +\def\markdownRendererUlItem{% +\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }\def\markdownRendererUlItemEnd{} +\def\markdownRendererUlEndTight{).} + +\markdownBegin + + This is a tight list + + - the first item + - the second item + - the third item\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererUlBegin{} +\def\markdownRendererUlItem{--\kern 0.5em} +\def\markdownRendererUlItemEnd{.\par} +\def\markdownRendererUlEnd{} + +\markdownBegin + + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7023,61 +7241,61 @@ item).-This is the third item.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[tightLists]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = { - interblockSeparator = {}, - ulBeginTight = { (},% - ulItem = {\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }, - ulItemEnd = {}, - ulEndTight = {).}, - }, - } - This is a tight list - - - the first item - - the second item - - the third item\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\par - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{itemize}}, - ulBeginTight = {\item}, - ulItem = { - ulItemEnd = {.},\end{itemize}}, - ulEnd = { - }, - } - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + ulBeginTight = { (},% + ulItem = {\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }, + ulItemEnd = {}, + ulEndTight = {).}, + }, + } + This is a tight list + + - the first item + - the second item + - the third item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{itemize}}, + ulBeginTight = {\item}, + ulItem = { + ulItemEnd = {.},\end{itemize}}, + ulEnd = { + }, + } + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7090,57 +7308,57 @@ item).-This is the third item.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[tightLists = yes] -\starttext - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererUlBeginTight{ (} -\def\markdownRendererUlItem{% -\def\markdownRendererUlItem{% - - ,\def\markdownRendererUlItem{, and }% - % - } - }\def\markdownRendererUlItemEnd{} -\def\markdownRendererUlEndTight{).} - -\startmarkdown - - This is a tight list - - - the first item - - the second item - - the third item\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererUlBegin{\startitemize} -\def\markdownRendererUlItem{\item} -\def\markdownRendererUlItemEnd{.} -\def\markdownRendererUlEnd{\stopitemize} - -\startmarkdown - - This is a loose list - - - This is the first item - - - This is the second item - - - This is the third item\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[tightLists = yes] +\starttext + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererUlBeginTight{ (} +\def\markdownRendererUlItem{% +\def\markdownRendererUlItem{% + + ,\def\markdownRendererUlItem{, and }% + % + } + }\def\markdownRendererUlItemEnd{} +\def\markdownRendererUlEndTight{).} + +\startmarkdown + + This is a tight list + + - the first item + - the second item + - the third item\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererUlBegin{\startitemize} +\def\markdownRendererUlItem{\item} +\def\markdownRendererUlItemEnd{.} +\def\markdownRendererUlEnd{\stopitemize} + +\startmarkdown + + This is a loose list + + - This is the first item + + - This is the second item + + - This is the third item\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7163,186 +7381,189 @@ fenced code block. This macro will only be produced, when thefencedCode
option is enabled. The macro receives two arguments that correspond to the filename of a file contaning the code block contents and to the code fence infostring. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{verbatim} -\usepackage[hyphens]{url} -\usepackage[fencedCode]{markdown} -\markdownSetup{ - - renderers = { - interblockSeparator = {\def\markdownRendererInterblockSeparator{% - \par - \def\markdownRendererInterblockSeparator{% - \def\markdownRendererInterblockSeparator{% - \par - % - }% - }% - } - }, - inputVerbatim = {\url{#1}:% - is contained in file \verbatiminput{#1}% - - }, - inputFencedCode = {\markdownRendererInputVerbatim{#1}% - in #2 - }, - }, - }\begin{document} -\begin{markdown} - - The following code - - def foo(bar): - if len(bar) <= 1: - return bar[0] - elif len(bar) == 2: - return sorted(bar) - else: - baz = len(bar) // 2 - return foo(bar[baz:], bar[:baz]) - - The following code - - ~~~ Python - >>> foo([4, 2, 1, 3]) - [1, 2, 3, 4] - ~~~~~~~~~~\end{markdown} -\end{document}
\documentclass{article} +\usepackage{verbatim} +\usepackage[hyphens]{url} +\usepackage[fencedCode]{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {\def\markdownRendererInterblockSeparator{% + \par + \def\markdownRendererInterblockSeparator{% + \def\markdownRendererInterblockSeparator{% + \par + % + }% + }% + } + }, + inputVerbatim = {\url{#1}:% + is contained in file \verbatiminput{#1}% + + }, + inputFencedCode = {\markdownRendererInputVerbatim{#1}% + in #2 + }, + }, + }\begin{document} +\begin{markdown} + + The following code + + def foo(bar): + if len(bar) <= 1: + return bar[0] + elif len(bar) == 2: + return sorted(bar) + else: + baz = len(bar) // 2 + return foo(bar[baz:], bar[:baz]) + + The following code + + ~~~ Python + >>> foo([4, 2, 1, 3]) + [1, 2, 3, 4] + ~~~~~~~~~~\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text except for the filename, which may differ:The following code is contained in file
-./_markdown_document/882453149edcf288976647f6fe147ada.verbatim
:+def foo(bar): -if len(bar) <= 1: - return bar[:1] - elif len(bar) == 2: - return sorted(bar) - else: - = bar[len(bar) // 2] - baz return ( - for qux in bar if qux < baz]) + [baz] + - foo([qux for qux in bar if qux > baz]) - foo([qux )
def foo(bar): +if len(bar) <= 1: + return bar[:1] + elif len(bar) == 2: + return sorted(bar) + else: + = bar[len(bar) // 2] + baz return ( + for qux in bar if qux < baz]) + [baz] + + foo([qux for qux in bar if qux > baz]) + foo([qux )
The following code in Python contained in file
-./_markdown_document/cf2a96e2120cef5b1fae5fea36fcc27b.verbatim
:+>>> foo([4, 2, 1, 3]) -1, 2, 3, 4] [
>>> foo([4, 2, 1, 3]) +1, 2, 3, 4] [
2.3.1.6 Code Span Renderer
The
-\markdownRendererCodeSpan
macro represents inline code span in the input text. It receives a single argument that corresponds to the inline code span.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\input lmfonts - -\def\markdownRendererCodeSpan#1{#1} - -\markdownBegin -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\markdownEnd - -\def\markdownOptionHybrid{true} -\markdownBegin -$\sqrt{-1}$ *equals* $i$ -\markdownEnd - -\bye
\input markdown +\input lmfonts + +\def\markdownRendererCodeSpan#1{#1} + +\markdownBegin +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\markdownEnd + +\def\markdownOptionHybrid{true} +\markdownBegin +$\sqrt{-1}$ *equals* $i$ +\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-$\sqrt{-1}$ *equals* $i$.
$\sqrt{-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[smartEllipses]{markdown} -\markdownSetup{ - - renderers = { - codeSpan = {#1}, - }, - }\begin{document} - -\begin{markdown} -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\end{markdown} - -\begin{markdown*}{hybrid} -$\sqrt{-1}$ *equals* $i$ -\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[smartEllipses]{markdown} +\markdownSetup{ + + renderers = { + codeSpan = {#1}, + }, + }\begin{document} + +\begin{markdown} +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\end{markdown} + +\begin{markdown*}{hybrid} +$\sqrt{-1}$ *equals* $i$ +\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-$\sqrt{-1}$ *equals* $i$.
$\sqrt{-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererCodeSpan#1{#1} -\starttext - -\startmarkdown -$\sqrt{-1}$ *equals* $i$` - ` -$\sqrt{-1}$ *equals* $i$ -\stopmarkdown - -\setupmarkdown[hybrid = yes] -\startmarkdown -$\sqrt{-1}$ *equals* $i$ -\stopmarkdown - -\bye
\usemodule[t][markdown] +\def\markdownRendererCodeSpan#1{#1} +\starttext + +\startmarkdown +$\sqrt{-1}$ *equals* $i$` + ` +$\sqrt{-1}$ *equals* $i$ +\stopmarkdown + +\setupmarkdown[hybrid = yes] +\startmarkdown +$\sqrt{-1}$ *equals* $i$ +\stopmarkdown + +\bye
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:$\sqrt{-1}$ *equals* $i$.
$\sqrt{-1}$ equals $i$.
-√-̅1̅ equals i.
++equals .
2.3.1.7 Content Block @@ -7385,38 +7606,38 @@ highlighting. The
Languages.json
file provided by Anton Sotkov is a good starting point. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionContentBlocks{true} -\def\markdownRendererContentBlock#1#2#3#4{% -\tt #2}, #4. - This is { - }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% -\tt #2}, #4. - This is the image { - }\def\markdownRendererContentBlockCode#1#2#3#4#5{% -\uppercase{#1}) document {\tt #3}, #5. - This is the #2 ( - }\markdownBegin - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\markdownEnd -\bye
\input markdown +\def\markdownOptionContentBlocks{true} +\def\markdownRendererContentBlock#1#2#3#4{% +\tt #2}, #4. + This is { + }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% +\tt #2}, #4. + This is the image { + }\def\markdownRendererContentBlockCode#1#2#3#4#5{% +\uppercase{#1}) document {\tt #3}, #5. + This is the #2 ( + }\markdownBegin + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\markdownEnd +\bye
Create also a text document named
-markdown-languages.json
with the following content:+- {"json": "JavaScript Object Notation", - }
+ {"json": "JavaScript Object Notation", + }
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7428,38 +7649,38 @@ extensions and programming language names.-This is the image
https://tug.org/tugboat/noword.jpg
, the logotype of TUGboat.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json} - - { - "json": "JavaScript Object Notation", - }\end{filecontents} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {\texttt{#2}, #4.}, - contentBlock = {This is \texttt{#2}, #4.}, - contentBlockOnlineImage = {This is the image % - contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5. - This is the #2 ( - }, - }, - }\begin{document} -\begin{markdown} - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\end{markdown} -\end{document}
\documentclass{article} +\begin{filecontents}[overwrite,nosearch,noheader]{markdown-languages.json} + + { + "json": "JavaScript Object Notation", + }\end{filecontents} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {\texttt{#2}, #4.}, + contentBlock = {This is \texttt{#2}, #4.}, + contentBlockOnlineImage = {This is the image % + contentBlockCode = {\MakeUppercase{#1}) document \texttt{#3}, #5. + This is the #2 ( + }, + }, + }\begin{document} +\begin{markdown} + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7471,39 +7692,39 @@ extensions and programming language names.-This is the image
https://tug.org/tugboat/noword.jpg
, the logotype of TUGboat.ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[contentBlocks = yes] -\def\markdownRendererContentBlock#1#2#3#4{% -\tt #2}, #4. - This is { - }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% -\tt #2}, #4. - This is the image { - }\def\markdownRendererContentBlockCode#1#2#3#4#5{% -\uppercase{#1}) document {\tt #3}, #5. - This is the #2 ( - }\starttext -\startmarkdown - - /document.tex (the document that we are currently typesetting) - /markdown-languages.json (the mapping between filename extensions - and programming language names) - https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[contentBlocks = yes] +\def\markdownRendererContentBlock#1#2#3#4{% +\tt #2}, #4. + This is { + }\def\markdownRendererContentBlockOnlineImage#1#2#3#4{% +\tt #2}, #4. + This is the image { + }\def\markdownRendererContentBlockCode#1#2#3#4#5{% +\uppercase{#1}) document {\tt #3}, #5. + This is the #2 ( + }\starttext +\startmarkdown + + /document.tex (the document that we are currently typesetting) + /markdown-languages.json (the mapping between filename extensions + and programming language names) + https://tug.org/tugboat/noword.jpg (the logotype of TUGboat)\stopmarkdown +\stoptext
Create also a text document named
-markdown-languages.json
with the following content:+- {"json": "JavaScript Object Notation", - }
+ {"json": "JavaScript Object Notation", + }
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7548,92 +7769,92 @@ of a definition list that contains no item with several paragraphs of text (the list is tight). This macro will only be produced, when thetightLists
option is disabled. The macro receives no arguments. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionDefinitionLists{true} -\def\markdownOptionTightLists{true} - -\def\markdownRendererInterblockSeparator{% -% - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBeginTight{% -\begingroup - \parindent=0pt - - }\def\markdownRendererDlItem#1{% -\par{\bf#1}% - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em} -\def\markdownRendererDlEndTight{\endgroup} - -\markdownBegin - - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBegin{} -\def\markdownRendererDlItem#1{% - - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionEnd{} -\def\markdownRendererDlEnd{.} - -\markdownBegin - - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\markdownEnd - -\bye
\input markdown +\def\markdownOptionDefinitionLists{true} +\def\markdownOptionTightLists{true} + +\def\markdownRendererInterblockSeparator{% +% + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBeginTight{% +\begingroup + \parindent=0pt + + }\def\markdownRendererDlItem#1{% +\par{\bf#1}% + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionBegin{\par--\kern 0.5em} +\def\markdownRendererDlEndTight{\endgroup} + +\markdownBegin + + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBegin{} +\def\markdownRendererDlItem#1{% + + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionEnd{} +\def\markdownRendererDlEnd{.} + +\markdownBegin + + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7655,94 +7876,94 @@ prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.-LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[definitionLists, tightLists]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {% - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{description}}, - dlBeginTight = {% - dlItem = {\item[#1] - \begin{itemize} - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - },\end{itemize}}, - dlItemEnd = {\item, - dlDefinitionBegin = \end{description}}, - dlEndTight = { - }, - } - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\def\markdownRendererInterblockSeparator{\par}% - - }, - dlBegin = {},% - dlItem = { - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }, - dlItemEnd = {}, - dlDefinitionEnd = {}, - dlEnd = {.}, - }, - } - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[definitionLists, tightLists]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {% + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{description}}, + dlBeginTight = {% + dlItem = {\item[#1] + \begin{itemize} + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + },\end{itemize}}, + dlItemEnd = {\item, + dlDefinitionBegin = \end{description}}, + dlEndTight = { + }, + } + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\def\markdownRendererInterblockSeparator{\par}% + + }, + dlBegin = {},% + dlItem = { + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }, + dlItemEnd = {}, + dlDefinitionEnd = {}, + dlEnd = {.}, + }, + } + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7764,94 +7985,94 @@ prepared from roasted coffee beans, and one of the most traded agricultural commodities in the world. Milk is a white cold drink, nutrient-rich, and produced on an industrial scale.-ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown - - [ - definitionLists = yes, - tightLists = yes, - ]\starttext - -\def\markdownRendererInterblockSeparator{% -% - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBeginTight{} -\def\markdownRendererDlItem#1{% -\par{\bf#1}% - \startitemize - \def\markdownRendererDlDefinitionEnd{% - - ,\def\markdownRendererDlDefinitionEnd{% - - , and\def\markdownRendererDlDefinitionEnd{.}% - % - }% - } - }\def\markdownRendererDlItemEnd{\stopitemize} -\def\markdownRendererDlDefinitionBegin{\item} -\def\markdownRendererDlEndTight{} - -\startmarkdown - - This is a tight definition list - - Coffee - : black hot drink - : prepared from roasted coffee beans - : one of the most traded agricultural commodities in the world - - Milk - : white cold drink - : nutrient-rich - : produced on an industrial scale\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererDlBegin{} -\def\markdownRendererDlItem#1{% - - . #1 is a\def\markdownRendererDlDefinitionBegin{% - \def\markdownRendererDlDefinitionBegin{% - - ,\def\markdownRendererDlDefinitionBegin{, and }% - % - }% - } - }\def\markdownRendererDlItemEnd{} -\def\markdownRendererDlDefinitionEnd{} -\def\markdownRendererDlEnd{.} - -\startmarkdown - - This is a loose definition list - - Coffee - - : black hot drink - - : prepared from roasted coffee beans - - : one of the most traded agricultural commodities in the world - - Milk - - : white cold drink - - : nutrient-rich - - : produced on an industrial scale\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown + + [ + definitionLists = yes, + tightLists = yes, + ]\starttext + +\def\markdownRendererInterblockSeparator{% +% + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBeginTight{} +\def\markdownRendererDlItem#1{% +\par{\bf#1}% + \startitemize + \def\markdownRendererDlDefinitionEnd{% + + ,\def\markdownRendererDlDefinitionEnd{% + + , and\def\markdownRendererDlDefinitionEnd{.}% + % + }% + } + }\def\markdownRendererDlItemEnd{\stopitemize} +\def\markdownRendererDlDefinitionBegin{\item} +\def\markdownRendererDlEndTight{} + +\startmarkdown + + This is a tight definition list + + Coffee + : black hot drink + : prepared from roasted coffee beans + : one of the most traded agricultural commodities in the world + + Milk + : white cold drink + : nutrient-rich + : produced on an industrial scale\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererDlBegin{} +\def\markdownRendererDlItem#1{% + + . #1 is a\def\markdownRendererDlDefinitionBegin{% + \def\markdownRendererDlDefinitionBegin{% + + ,\def\markdownRendererDlDefinitionBegin{, and }% + % + }% + } + }\def\markdownRendererDlItemEnd{} +\def\markdownRendererDlDefinitionEnd{} +\def\markdownRendererDlEnd{.} + +\startmarkdown + + This is a loose definition list + + Coffee + + : black hot drink + + : prepared from roasted coffee beans + + : one of the most traded agricultural commodities in the world + + Milk + + : white cold drink + + : nutrient-rich + + : produced on an industrial scale\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7879,67 +8100,67 @@ class="header-section-number">2.3.1.9 Ellipsis RenderersmartEllipses
option is enabled. The macro receives no arguments. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSmartEllipses{true} -\def\markdownRendererEllipsis{{\it SHAZAM}!} -\markdownBegin - - The secret word is ...\markdownEnd -\bye
\input markdown +\def\markdownOptionSmartEllipses{true} +\def\markdownRendererEllipsis{{\it SHAZAM}!} +\markdownBegin + + The secret word is ...\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-The secret word is SHAZAM!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[smartEllipses]{markdown} -\markdownSetup{ - - renderers = {\emph{SHAZAM}!, - ellipsis = - }, - }\begin{document} -\begin{markdown} - - The secret word is ...\end{markdown} -\end{document}
\documentclass{article} +\usepackage[smartEllipses]{markdown} +\markdownSetup{ + + renderers = {\emph{SHAZAM}!, + ellipsis = + }, + }\begin{document} +\begin{markdown} + + The secret word is ...\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-The secret word is SHAZAM!
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[smartEllipses = yes] -\def\markdownRendererEllipsis{\emph{SHAZAM}!} -\starttext -\startmarkdown - - The secret word is ...\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[smartEllipses = yes] +\def\markdownRendererEllipsis{\emph{SHAZAM}!} +\starttext +\startmarkdown + + The secret word is ...\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -7952,76 +8173,76 @@ class="header-section-number">2.3.1.10 Emphasis RenderersThe
-\markdownRendererEmphasis
macro represents an emphasized span of text. The macro receives a single argument that corresponds to the emphasized span of text.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererEmphasis#1{{\it#1}} -\def\markdownRendererStrongEmphasis#1{{\bf#1}} -\markdownBegin - - This is *emphasis*. - - This is **strong emphasis**.\markdownEnd -\bye
\input markdown +\def\markdownRendererEmphasis#1{{\it#1}} +\def\markdownRendererStrongEmphasis#1{{\bf#1}} +\markdownBegin + + This is *emphasis*. + + This is **strong emphasis**.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is emphasis.
This is strong emphasis.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\emph{#1}}, - emphasis = {\textbf{#1}}, - strongEmphasis = { - }, - }\begin{document} -\begin{markdown} - - This is *emphasis*. - - This is **strong emphasis**.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\emph{#1}}, + emphasis = {\textbf{#1}}, + strongEmphasis = { + }, + }\begin{document} +\begin{markdown} + + This is *emphasis*. + + This is **strong emphasis**.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is emphasis.
This is strong emphasis.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererEmphasis#1{\emph{#1}} -\def\markdownRendererStrongEmphasis#1{\bold{#1}} -\starttext -\startmarkdown - - This is *emphasis*. - - This is **strong emphasis**.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererEmphasis#1{\emph{#1}} +\def\markdownRendererStrongEmphasis#1{\bold{#1}} +\starttext +\startmarkdown + + This is *emphasis*. + + This is **strong emphasis**.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8041,38 +8262,38 @@ Context Renderers\markdownRendererFencedCodeAttributeContextEnd
macros represent the beginning and the end of a context in which the attributes of a fenced code apply. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[fencedCode, -markdown} - fencedCodeAttributes]{\usepackage{minted} -\markdownSetup{ - - renderers = {% - fencedCodeAttributeContextBegin = {\begingroup - \markdownSetup{ - - renderers = {% - attributeKeyValue = {\setminted{{#1} = {#2}}% - - }, - },% - } - },% - fencedCodeAttributeContextEnd = {\endgroup - - }, - }, - }\begin{document} -\begin{markdown} - - ``` js {linenos=true} - if (a > 3) { - moveShip(5 * gravity, DOWN); }
\documentclass{article} +\usepackage[fencedCode, +markdown} + fencedCodeAttributes]{\usepackage{minted} +\markdownSetup{ + + renderers = {% + fencedCodeAttributeContextBegin = {\begingroup + \markdownSetup{ + + renderers = {% + attributeKeyValue = {\setminted{{#1} = {#2}}% + + }, + },% + } + },% + fencedCodeAttributeContextEnd = {\endgroup + + }, + }, + }\begin{document} +\begin{markdown} + + ``` js {linenos=true} + if (a > 3) { + moveShip(5 * gravity, DOWN); }
\end{markdown} \end{document}
Next, invoke LuaTeX from the terminal: ``` sh @@ -8143,8 +8364,8 @@ baz \end{markdown} \end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8167,41 +8388,41 @@ Renderers\markdownRendererHeaderAttributeContextEnd
macros represent the beginning and the end of a section in which the attributes of a heading apply. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[headerAttributes]{markdown} -\markdownSetup{ - - renderers = {% - headerAttributeContextBegin = {\par - \emph{(The beginning of a header attribute context)} - \par - - },% - headerAttributeContextEnd = {\par - \emph{(The end of a header attribute context)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - - # First top-level heading - - ## A subheading {#identifier} - - # Second top-level heading {.class_name} -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[headerAttributes]{markdown} +\markdownSetup{ + + renderers = {% + headerAttributeContextBegin = {\par + \emph{(The beginning of a header attribute context)} + \par + + },% + headerAttributeContextEnd = {\par + \emph{(The end of a header attribute context)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + + # First top-level heading + + ## A subheading {#identifier} + + # Second top-level heading {.class_name} +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8233,95 +8454,95 @@ corresponds to the heading text.The
-\markdownRendererHeadingSix
macro represents a sixth level heading. The macro receives a single argument that corresponds to the heading text.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\markdownBegin - - ###### - ##### - ##### - ### - ######\markdownEnd -\bye
\input markdown +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\markdownBegin + + ###### + ##### + ##### + ### + ######\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-65536
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - interblockSeparator = {}, - headingOne = 1, - headingTwo = 2, - headingThree = 3, - headingFour = 4, - headingFive = 5, - headingSix = 6, - }, - }\begin{document} -\begin{markdown} - - ###### - ##### - ##### - ### - ######\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + interblockSeparator = {}, + headingOne = 1, + headingTwo = 2, + headingThree = 3, + headingFour = 4, + headingFive = 5, + headingSix = 6, + }, + }\begin{document} +\begin{markdown} + + ###### + ##### + ##### + ### + ######\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-65536
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererHeadingOne{1} -\def\markdownRendererHeadingTwo{2} -\def\markdownRendererHeadingThree{3} -\def\markdownRendererHeadingFour{4} -\def\markdownRendererHeadingFive{5} -\def\markdownRendererHeadingSix{6} -\starttext -\startmarkdown - - ###### - ##### - ##### - ### - ######\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererHeadingOne{1} +\def\markdownRendererHeadingTwo{2} +\def\markdownRendererHeadingThree{3} +\def\markdownRendererHeadingFour{4} +\def\markdownRendererHeadingFive{5} +\def\markdownRendererHeadingSix{6} +\starttext +\startmarkdown + + ###### + ##### + ##### + ### + ######\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8339,40 +8560,40 @@ contents of the HTML comment.\markdownRendererBlockHtmlCommentEnd
macros represent the beginning and the end of a block HTML comment. The macros receive no arguments. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\markdownSetup{ - - renderers = {\marginnote{#1}}, - inlineHtmlComment = {\begin{quote}}, - blockHtmlCommentBegin = {\end{quote}}, - blockHtmlCommentEnd = { - }, - }\begin{document} -\begin{markdown} - - A useful use of inline HTML comments are side notes. - <!-- Side notes are displayed in the horizontal margins next to the relevant - passages, which makes them *easier for the reader to find* than notes. --> - - We can render block HTML comments as blockquotes: - - <!-- - Here is a block HTML comment with a code example that a programmer might understand: - - foo = bar + baz - 42 - -->\end{markdown} -\end{document}
\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\markdownSetup{ + + renderers = {\marginnote{#1}}, + inlineHtmlComment = {\begin{quote}}, + blockHtmlCommentBegin = {\end{quote}}, + blockHtmlCommentEnd = { + }, + }\begin{document} +\begin{markdown} + + A useful use of inline HTML comments are side notes. + <!-- Side notes are displayed in the horizontal margins next to the relevant + passages, which makes them *easier for the reader to find* than notes. --> + + We can render block HTML comments as blockquotes: + + <!-- + Here is a block HTML comment with a code example that a programmer might understand: + + foo = bar + baz - 42 + -->\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex -lualatex document.tex
lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -8403,32 +8624,32 @@ represents a block HTML element. This macro will only be produced, when thehtml
option is enabled. The macro receives a single argument that filename of a file containing the contents of the HTML element. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[html]{markdown} -\usepackage{marginnote} -\usepackage{verbatim} -\markdownSetup{ - - renderers = {\textbf{#1}}, - inlineHtmlTag = {\verbatiminput{#1}}, - inputBlockHtmlElement = { - }, - }\begin{document} -\begin{markdown} - - <b>_Hello,_ world!</b><br/> - - <div>_Hello,_ world!</div>\end{markdown} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex -lualatex document.tex
+\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\usepackage{verbatim} +\markdownSetup{ + + renderers = {\textbf{#1}}, + inlineHtmlTag = {\verbatiminput{#1}}, + inputBlockHtmlElement = { + }, + }\begin{document} +\begin{markdown} + + <b>_Hello,_ world!</b><br/> + + <div>_Hello,_ world!</div>\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following body text:@@ -8441,48 +8662,48 @@ class="header-section-number">2.3.1.16 Image Renderer receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\begingroup -\catcode`\@=11 -\catcode`\%=12 -\catcode`\^^A=14 -\global\def\markdownRendererImage#1#2#3#4{^^A -\immediate\write18{^^A
-if printf '%s' "#3" | grep -q ^http; then - OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A - $(printf '%s' "#3" | sed 's/.*[.]//')"; -if ! [ -e "$OUTPUT" ]; then - wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; - convert "$OUTPUT" png:"$OUTPUT"; - fi; - printf '%s%%' "$OUTPUT" > \jobname.fetched; - else - printf '%s%%' "#3" > \jobname.fetched; - fi^^A
+- }^^A - {^^A\everyeof={\noexpand}^^A - \edef\filename{\__markdowninput"\jobname.fetched" }^^A - \includegraphics[width=\textwidth]{\filename}^^A - - }^^A - }\endgroup -\begin{document} -\begin{markdown} - - ![TUGboat](https://tug.org/tugboat/noword.jpg)\end{markdown} -\end{document}
+\documentclass{article} +\usepackage{markdown} +\begingroup +\catcode`\@=11 +\catcode`\%=12 +\catcode`\^^A=14 +\global\def\markdownRendererImage#1#2#3#4{^^A +\immediate\write18{^^A
+if printf '%s' "#3" | grep -q ^http; then + OUTPUT="$(printf '%s' "#3" | md5sum | cut -d' ' -f1).^^A + $(printf '%s' "#3" | sed 's/.*[.]//')"; +if ! [ -e "$OUTPUT" ]; then + wget -O "$OUTPUT" '#3' || rm "$OUTPUT"; + convert "$OUTPUT" png:"$OUTPUT"; + fi; + printf '%s%%' "$OUTPUT" > \jobname.fetched; + else + printf '%s%%' "#3" > \jobname.fetched; + fi^^A
+ }^^A + {^^A\everyeof={\noexpand}^^A + \edef\filename{\__markdowninput"\jobname.fetched" }^^A + \includegraphics[width=\textwidth]{\filename}^^A + + }^^A + }\endgroup +\begin{document} +\begin{markdown} + + ![TUGboat](https://tug.org/tugboat/noword.jpg)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex --shell-escape document.tex
lualatex --shell-escape document.tex
A PDF document named
document.pdf
should be produced and contain the following content. This assumes that you use a Unix-like operating system with Bourne or Bourne again shell as the default shell @@ -8503,26 +8724,26 @@ RendererThe
-\markdownRendererInterblockSeparator
macro represents a separator between two markdown block elements. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererInterblockSeparator{% -\par - \it(The end of a block)}% - {\par - - }\markdownBegin - - Hello *world*! - - _Foo_ bar!\markdownEnd -\bye
\input markdown +\def\markdownRendererInterblockSeparator{% +\par + \it(The end of a block)}% + {\par + + }\markdownBegin + + Hello *world*! + + _Foo_ bar!\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8530,32 +8751,32 @@ contain the following text:-(The end of a block)
Foo bar!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - interblockSeparator = {\par - \emph{(The end of a block)}% - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - _Foo_ bar!\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + interblockSeparator = {\par + \emph{(The end of a block)}% + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + _Foo_ bar!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8563,27 +8784,27 @@ contain the following text:-(The end of a block)
Foo bar!
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererInterblockSeparator{% -\par - \emph{(The end of a block)}% - \par - - }\starttext -\startmarkdown - - Hello *world*! - - _Foo_ bar!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererInterblockSeparator{% +\par + \emph{(The end of a block)}% + \par + + }\starttext +\startmarkdown + + Hello *world*! + + _Foo_ bar!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8599,23 +8820,23 @@ class="header-section-number">2.3.1.18 Line Block Renderer\markdownRendererLineBlockEnd
macros represent the beginning and the end of a line block. The macros receive no arguments. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionLineBlocks{true} -\markdownBegin - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\markdownEnd -\bye
\input markdown +\def\markdownOptionLineBlocks{true} +\markdownBegin + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8624,24 +8845,24 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[lineBlocks]{markdown} -\begin{document} -\begin{markdown} - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[lineBlocks]{markdown} +\begin{document} +\begin{markdown} + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8650,24 +8871,24 @@ But I, being poor, have only my dreams;-
I have spread my dreams under your feet;
Tread softly because you tread on my dreams.ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[lineBlocks = yes] -\starttext -\startmarkdown - - | I would spread the cloths under your feet: - | But I, being poor, have only my dreams; - | I have spread my dreams under your feet; - | Tread softly because you tread on my dreams.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[lineBlocks = yes] +\starttext +\startmarkdown + + | I would spread the cloths under your feet: + | But I, being poor, have only my dreams; + | I have spread my dreams under your feet; + | Tread softly because you tread on my dreams.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8678,103 +8899,72 @@ Tread softly because you tread on my dreams.2.3.1.19 Line Break Renderer
-The
-\markdownRendererLineBreak
macro represents a forced -line break. The macro receives no arguments.Plain The
\markdownRendererHardLineBreak
macro represents a +hard line break. The macro receives no arguments. +Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererLineBreak{% -\par - \it(A forced linebreak)}% - {\par - - }\markdownInput{example.md} -\bye
\input markdown +\def\markdownRendererHardLineBreak{% +\par + \it(A hard line break)}% + {\par + + }\markdownInput{example.md} +\bye
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces -at the end of the first line, which specify a hard linebreak. Due to the -limitations of the TeX input -processor, hard linebreaks would be ignored if we typed them directly +at the end of the first line, which specify a hard line break. Due to +the limitations of the TeX input +processor, hard line breaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Hello world!
-(A forced linebreak)
+(A hard line break)
Foo bar!
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - lineBreak = {\par - \emph{(A forced linebreak)}% - \par - - }, - }, - }\begin{document} -\markdownInput{example.md} -\end{document}
Using a text editor, create a text document named -
-example.md
with the following content. Note the two spaces -at the end of the first line, which specify a hard linebreak. Due to the -limitations of the TeX input -processor, hard linebreaks would be ignored if we typed them directly -into thedocument.tex
document.-Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
--lualatex document.tex
A PDF document named
-document.pdf
should be produced and -contain the following text:--Hello world!
-(A forced linebreak)
-Foo bar!
-ConTeXt Example
-Using a text editor, create a text document named -
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererLineBreak{% -\par - \emph{(A forced linebreak)}% - \par - - }\starttext -\markdownInput{example.md} -\stoptext
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + hardLineBreak = {\par + \emph{(A hard line break)}% + \par + + }, + }, + }\begin{document} +\markdownInput{example.md} +\end{document}
Using a text editor, create a text document named
example.md
with the following content. Note the two spaces -at the end of the first line, which specify a hard linebreak. Due to the -limitations of the TeX input -processor, hard linebreaks would be ignored if we typed them directly +at the end of the first line, which specify a hard line break. Due to +the limitations of the TeX input +processor, hard line breaks would be ignored if we typed them directly into thedocument.tex
document.Hello world!
_Foo_ bar!Next, invoke LuaTeX from the terminal:
-+luatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:Hello world!
-(A forced linebreak)
+(A hard line break)
Foo bar!
2.3.1.20 Link Renderer
It receives four arguments: the label, the fully escaped uri that can be directly typeset, the raw uri that can be used outside typesetting, and the title of the link. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled {\it#4}% - #1 { - }\markdownBegin - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\markdownEnd -\bye
\input markdown +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled {\it#4}% + #1 { + }\markdownBegin + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8809,31 +8999,31 @@ contain the following text: class="uri">https://ctan.org/ titled the Comprehensive TeX Archive Network.-LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {% - link = {\texttt{#2} titled \emph{#4}% - #1 - }, - }, - }\begin{document} -\begin{markdown} - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {% + link = {\texttt{#2} titled \emph{#4}% + #1 + }, + }, + }\begin{document} +\begin{markdown} + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8845,22 +9035,22 @@ Archive Network. class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererLink#1#2#3#4{% -\tt#2} titled \emph{#4}% - #1 { - }\starttext -\startmarkdown - - Please visit [the link][ctan]. - - [ctan]: https://ctan.org/ - (the Comprehensive TeX Archive Network)\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererLink#1#2#3#4{% +\tt#2} titled \emph{#4}% + #1 { + }\starttext +\startmarkdown + + Please visit [the link][ctan]. + + [ctan]: https://ctan.org/ + (the Comprehensive TeX Archive Network)\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8880,81 +9070,81 @@ number of markdown documents. Additionally, markdown documents may appear not only in a sequence, but several markdown documents may also be nested. Redefinitions of the macros should take this into account. -LaTeX Example
Using a text editor, create a text document named
-nested.md
with the following content:+This is a *nested* markdown document.
This is a *nested* markdown document.
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[contentBlocks]{markdown} -\markdownSetup{ - - renderers = {% - contentBlock = {\markdownInput{#3}% - - },% - documentBegin = {\par - \emph{(The beginning of a document)} - \par - \begingroup - \markdownSetup{snippet=first-nesting-level}% - - },% - documentEnd = {\endgroup - \par - \emph{(The end of a document)} - \par - - }, - }, - }\markdownSetupSnippet{first-nesting-level}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - \markdownSetup{snippet=second-nesting-level-and-below} - - }, - }, - }\markdownSetupSnippet{second-nesting-level-and-below}{ - - renderers = { - documentBegin = {\par - \emph{(The beginning of a nested document)} - \par - \begingroup - - }, - documentEnd = {\endgroup - \par - \emph{(The end of a nested document)} - \par - - }, - }, - }\begin{document} -\begin{markdown} - - Hello *world*! - - /nested.md - - _Foo_ bar!\end{markdown} -\begin{markdown} - - - Bar baz! -\end{markdown} -\end{document}
\documentclass{article} +\usepackage[contentBlocks]{markdown} +\markdownSetup{ + + renderers = {% + contentBlock = {\markdownInput{#3}% + + },% + documentBegin = {\par + \emph{(The beginning of a document)} + \par + \begingroup + \markdownSetup{snippet=first-nesting-level}% + + },% + documentEnd = {\endgroup + \par + \emph{(The end of a document)} + \par + + }, + }, + }\markdownSetupSnippet{first-nesting-level}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + \markdownSetup{snippet=second-nesting-level-and-below} + + }, + }, + }\markdownSetupSnippet{second-nesting-level-and-below}{ + + renderers = { + documentBegin = {\par + \emph{(The beginning of a nested document)} + \par + \begingroup + + }, + documentEnd = {\endgroup + \par + \emph{(The end of a nested document)} + \par + + }, + }, + }\begin{document} +\begin{markdown} + + Hello *world*! + + /nested.md + + _Foo_ bar!\end{markdown} +\begin{markdown} + + + Bar baz! +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -8974,46 +9164,46 @@ class="header-section-number">2.3.1.22 Non-Breaking Space RendererThe
-\markdownRendererNbsp
macro represents a non-breaking space.LaTeX Example
Using a text editor, create a text document named
-document.bib
with the following content:+@book{knuth:tex, -author = "Knuth, Donald Ervin", - title = "The \TeX book, volume A of Computers and typesetting", - publisher = "Addison-Wesley", - year = "1984" - }
@book{knuth:tex, +author = "Knuth, Donald Ervin", + title = "The \TeX book, volume A of Computers and typesetting", + publisher = "Addison-Wesley", + year = "1984" + }
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[ - - citations, - citationNbsps,markdown} - ]{\markdownSetup{ - - renderers = {$\cdot$}, - nbsp = { - }, - }\begin{document} - -\begin{markdown} - - The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} - -\bibliographystyle{plain} -\bibliography{document.bib} - -\end{document}
\documentclass{article} +\usepackage[ + + citations, + citationNbsps,markdown} + ]{\markdownSetup{ + + renderers = {$\cdot$}, + nbsp = { + }, + }\begin{document} + +\begin{markdown} + + The TeXbook [@knuth:tex, p. 123 and 130] is good.\end{markdown} + +\bibliographystyle{plain} +\bibliography{document.bib} + +\end{document}
Next, invoke LuaTeX and BibTeX from the terminal:
-+lualatex document.tex -bibtex document.aux -lualatex document.tex -lualatex document.tex
lualatex document.tex +bibtex document.aux +lualatex document.tex +lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9030,55 +9220,55 @@ class="header-section-number">2.3.1.23 Note Renderer macro will only be produced, when thenotes
option is enabled. The macro receives a single argument that corresponds to the note text. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionNotes{true} -\def\markdownRendererNote#1{ (and \lowercase{#1})} -\markdownBegin - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\markdownEnd -\bye
\input markdown +\def\markdownOptionNotes{true} +\def\markdownRendererNote#1{ (and \lowercase{#1})} +\markdownBegin + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is some text (and this is a note) and this is some other text (and this is some other note).
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[notes]{markdown} -\markdownSetup{ - - renderers = {\MakeLowercase{#1})}, - note = { (and - }, - }\begin{document} -\begin{markdown} - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\end{markdown} -\end{document}
\documentclass{article} +\usepackage[notes]{markdown} +\markdownSetup{ + + renderers = {\MakeLowercase{#1})}, + note = { (and + }, + }\begin{document} +\begin{markdown} + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9089,22 +9279,22 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[notes = yes] -\def\markdownRendererNote#1{ (and \lowercase{#1})} -\starttext -\startmarkdown - - This is some text[^1] and this is some other text[^2]. - - [^1]: this is a note - - [^2]: this is some other note\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[notes = yes] +\def\markdownRendererNote#1{ (and \lowercase{#1})} +\starttext +\startmarkdown + + This is some text[^1] and this is some other text[^2]. + + [^1]: this is a note + + [^2]: this is some other note\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9196,74 +9386,74 @@ paragraphs of text (the list is tight). This macro will only be produced, when thefancyLists
andtightLists
options are enabled. The macro receives no arguments. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionTightLists{true} -\def\markdownOptionStartNumber{true} - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererOlBeginTight{ (} -\def\markdownRendererOlItemWithNumber#1{% -\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }\def\markdownRendererOlItemEnd{} -\def\markdownRendererOlEndTight{).} - -\markdownBegin - - This is a tight list - - 1. item - 2. item - 3. item\markdownEnd - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererOlBegin{} -\def\markdownRendererOlItemWithNumber#1{% -\kern 0.5em% - #1. - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{} - -\markdownBegin - - This is a loose list - - 1. item - - 2. item - - 3. item\markdownEnd - -\bye
\input markdown +\def\markdownOptionTightLists{true} +\def\markdownOptionStartNumber{true} + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\markdownBegin + + This is a tight list + + 1. item + 2. item + 3. item\markdownEnd + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{} +\def\markdownRendererOlItemWithNumber#1{% +\kern 0.5em% + #1. + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{} + +\markdownBegin + + This is a loose list + + 1. item + + 2. item + + 3. item\markdownEnd + +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9276,77 +9466,77 @@ item).-This is the third item.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[tightLists, startNumber]{markdown} -\begin{document} - -\begin{markdown*}{ - - renderers = { - interblockSeparator = {}, - olBeginTight = { (},% - olItemWithNumber = {\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }, - olItemEnd = {}, - olEndTight = {).}, - }, - } - This is a tight list - - 1. item - 2. item - 3. item\end{markdown*} - -\begin{markdown*}{ - - renderers = {% - interblockSeparator = {\par - :\def\markdownRendererInterblockSeparator{\par}% - - },\begin{enumerate}}, - olBeginTight = {% - olItemWithNumber = {\item This is the - \ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }, - olItemEnd = {.},\end{enumerate}}, - olEnd = { - }, - } - This is a loose list - - 1. item - - 2. item - - 3. item\end{markdown*} - -\end{document}
\documentclass{article} +\usepackage[tightLists, startNumber]{markdown} +\begin{document} + +\begin{markdown*}{ + + renderers = { + interblockSeparator = {}, + olBeginTight = { (},% + olItemWithNumber = {\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }, + olItemEnd = {}, + olEndTight = {).}, + }, + } + This is a tight list + + 1. item + 2. item + 3. item\end{markdown*} + +\begin{markdown*}{ + + renderers = {% + interblockSeparator = {\par + :\def\markdownRendererInterblockSeparator{\par}% + + },\begin{enumerate}}, + olBeginTight = {% + olItemWithNumber = {\item This is the + \ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }, + olItemEnd = {.},\end{enumerate}}, + olEnd = { + }, + } + This is a loose list + + 1. item + + 2. item + + 3. item\end{markdown*} + +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9363,74 +9553,74 @@ item). class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown - - [ - tightLists = yes, - startNumber = yes, - ]\starttext - -\def\markdownRendererInterblockSeparator{} -\def\markdownRendererOlBeginTight{ (} -\def\markdownRendererOlItemWithNumber#1{% -\ifnum #1=1\relax - - the first\else - \ifnum #1=2\relax - - , the second\else - - , and the third\fi - \fi - - }\def\markdownRendererOlItemEnd{} -\def\markdownRendererOlEndTight{).} - -\startmarkdown - - This is a tight list - - 1. item - 2. item - 3. item\stopmarkdown - -\def\markdownRendererInterblockSeparator{% -\par - :\def\markdownRendererInterblockSeparator{\par}% - - }\def\markdownRendererOlBegin{\startitemize} -\def\markdownRendererOlItemWithNumber#1{% -\sym{#1.} - - This is the\ifnum #1=1\relax - - first\else - \ifnum #1=2\relax - - second\else - - third\fi - \fi - - }\def\markdownRendererOlItemEnd{.\par} -\def\markdownRendererOlEnd{\stopitemize} - -\startmarkdown - - This is a loose list - - 1. item - - 2. item - - 3. item\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown + + [ + tightLists = yes, + startNumber = yes, + ]\starttext + +\def\markdownRendererInterblockSeparator{} +\def\markdownRendererOlBeginTight{ (} +\def\markdownRendererOlItemWithNumber#1{% +\ifnum #1=1\relax + + the first\else + \ifnum #1=2\relax + + , the second\else + + , and the third\fi + \fi + + }\def\markdownRendererOlItemEnd{} +\def\markdownRendererOlEndTight{).} + +\startmarkdown + + This is a tight list + + 1. item + 2. item + 3. item\stopmarkdown + +\def\markdownRendererInterblockSeparator{% +\par + :\def\markdownRendererInterblockSeparator{\par}% + + }\def\markdownRendererOlBegin{\startitemize} +\def\markdownRendererOlItemWithNumber#1{% +\sym{#1.} + + This is the\ifnum #1=1\relax + + first\else + \ifnum #1=2\relax + + second\else + + third\fi + \fi + + }\def\markdownRendererOlItemEnd{.\par} +\def\markdownRendererOlEnd{\stopitemize} + +\startmarkdown + + This is a loose list + + 1. item + + 2. item + + 3. item\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9455,54 +9645,54 @@ citations⟩}
followed by ⟨suppress author⟩ repeated ⟨number of citations⟩ times. The ⟨suppress author⟩ parameter is either the token-
, when the author’s name is to be suppressed, or+
otherwise. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a parenthesized citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \ifx\relax#3\relax\else - \ and a postfix \emph{#3}% - \fi - \fi - \ifnum\citationsCounter>\citationsTotal\relax - % - .\expandafter\@gobble - \else - - , and\fi\citations} - \makeatother -\markdownSetup{ - - renderers = {% - cite = {\citationsCounter=1% - \citationsTotal=#1% - - This is\expandafter\citations - - }, - }, - }\begin{document} -\begin{markdown} - - [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a parenthesized citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \ifx\relax#3\relax\else + \ and a postfix \emph{#3}% + \fi + \fi + \ifnum\citationsCounter>\citationsTotal\relax + % + .\expandafter\@gobble + \else + + , and\fi\citations} + \makeatother +\markdownSetup{ + + renderers = {% + cite = {\citationsCounter=1% + \citationsTotal=#1% + + This is\expandafter\citations + + }, + }, + }\begin{document} +\begin{markdown} + + [see @abrahams90, pp. 12; @eijkhout91, pp. 34]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9524,58 +9714,63 @@ contaning the raw block and the raw attribute that designates the format of the raw block. This macro will only be produced, when therawAttribute
andfencedCode
options are enabled. -LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[rawAttribute, fencedCode]{markdown} -\usepackage{expl3} -\ExplSyntaxOn -\cs_new:Nn -\display_raw_content:nn - - {% If the raw attribute is TeX, execute the content as a TeX document. - \str_if_eq:nnTF - - { #2 } - { tex }\markdownEscape { #1 } } - { % Otherwise, ignore the content. - - { } - }\markdownSetup{ - - renderers = {\display_raw_content:nn { #1 } { #2 } }, - rawInline = { \display_raw_content:nn { #1 } { #2 } } - rawBlock = { - }, - }\ExplSyntaxOff -\begin{document} -\begin{markdown} -$H_2 O$`{=tex} is a liquid. - ` - - ``` {=html} - <p>Here is some HTML content that will be ignored.</p> - ```\end{markdown} -\end{document}
\documentclass{article} +\usepackage[rawAttribute, fencedCode]{markdown} +\usepackage{expl3} +\ExplSyntaxOn +\cs_new:Nn +\display_raw_content:nn + + {% If the raw attribute is TeX, execute the content as a TeX document. + \str_if_eq:nnTF + + { #2 } + { tex }\markdownEscape { #1 } } + { % Otherwise, ignore the content. + + { } + }\markdownSetup{ + + renderers = {\display_raw_content:nn { #1 } { #2 } }, + rawInline = { \display_raw_content:nn { #1 } { #2 } } + rawBlock = { + }, + }\ExplSyntaxOff +\begin{document} +\begin{markdown} +$H_2 O$`{=tex} is a liquid. + ` + + ``` {=html} + <p>Here is some HTML content that will be ignored.</p> + ```\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H2O is a liquid.
2.3.1.27 Replacement Character +
2.3.1.27 Section Renderers
+The
+\markdownRendererSectionBegin
and +\markdownRendererSectionEnd
macros represent the beginning +and the end of a section based on headings.2.3.1.28 Replacement Character Renderers
The
-\markdownRendererReplacementCharacter
macro represents the U+0000 and U+FFFD Unicode characters. The macro receives no arguments.2.3.1.28 Special Character +
2.3.1.29 Special Character Renderers
The following macros replace any special plain TeX characters, including the active pipe @@ -9605,52 +9800,52 @@ class="tex">TeXt, in the input text:
- \markdownRendererUnderscore
replaces the underscore (_
).Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\input markdown -\def\markdownRendererTilde{~} -\markdownBegin - - Bartel~Leendert van~der~Waerden\markdownEnd -\bye
\input markdown +\def\markdownRendererTilde{~} +\markdownBegin + + Bartel~Leendert van~der~Waerden\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content. We will make the tilde behave as if it were written in TeX, where it represents a non-breaking space.+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = { - tilde = ~, - }, - }\begin{document} -\begin{markdown} - - Bartel~Leendert van~der~Waerden\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = { + tilde = ~, + }, + }\begin{document} +\begin{markdown} + + Bartel~Leendert van~der~Waerden\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
@@ -9664,73 +9859,73 @@ class="tex">TeXt Example tilde behave as if it were written in TeX, where it represents a non-breaking space. -document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:+\usemodule[t][markdown] -\def\markdownRendererTilde{~} -\starttext -\startmarkdown - - Bartel~Leendert van~der~Waerden\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTilde{~} +\starttext +\startmarkdown + + Bartel~Leendert van~der~Waerden\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text, where the middot (·
) denotes a non-breaking space:-Bartel·Leendert van·der·Waerden
2.3.1.29 Strike-Through +
2.3.1.30 Strike-Through Renderer
The
-\markdownRendererStrikeThrough
macro represents a strike-through span of text. The macro receives a single argument that corresponds to the striked-out span of text. This macro will only be produced, when thestrikeThrough
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionStrikeThrough{true} -\input soulutf8.sty -\def\markdownRendererStrikeThrough#1{\st{#1}} -\markdownBegin - - This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd -\bye
\input markdown +\def\markdownOptionStrikeThrough{true} +\input soulutf8.sty +\def\markdownRendererStrikeThrough#1{\st{#1}} +\markdownBegin + + This is ~~a lunar roving vehicle~~ strike-through text.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[strikeThrough]{markdown} -\usepackage{soulutf8} -\markdownSetup{ - - renderers = {\st{#1}}, - strikeThrough = { - }, - }\begin{document} -\begin{markdown} - - This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[strikeThrough]{markdown} +\usepackage{soulutf8} +\markdownSetup{ + + renderers = {\st{#1}}, + strikeThrough = { + }, + }\begin{document} +\begin{markdown} + + This is ~~a lunar roving vehicle~~ strike-through text.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9740,70 +9935,70 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[strikeThrough = yes] -\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} -\starttext -\startmarkdown - - This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[strikeThrough = yes] +\def\markdownRendererStrikeThrough#1{\overstrikes{#1}} +\starttext +\startmarkdown + + This is ~~a lunar roving vehicle~~ strike-through text.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-This is
a lunar roving vehiclestrike-through text.2.3.1.30 Subscript Renderer
+2.3.1.31 Subscript Renderer
The
-\markdownRendererSubscript
macro represents a subscript span of text. The macro receives a single argument that corresponds to the subscript span of text. This macro will only be produced, when thesubscripts
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSubscripts{true} -\def\markdownRendererSubscript#1{ (#1 moles) and } -\markdownBegin - - H~2~O is a liquid.\markdownEnd -\bye
\input markdown +\def\markdownOptionSubscripts{true} +\def\markdownRendererSubscript#1{ (#1 moles) and } +\markdownBegin + + H~2~O is a liquid.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H (2 moles) and O is a liquid.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[subscripts]{markdown} -\markdownSetup{ - - renderers = { - subscript = { (#1 moles) and }, - }, - }\begin{document} -\begin{markdown} - - H~2~O is a liquid.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[subscripts]{markdown} +\markdownSetup{ + + renderers = { + subscript = { (#1 moles) and }, + }, + }\begin{document} +\begin{markdown} + + H~2~O is a liquid.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9813,70 +10008,70 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[subscripts = yes] -\def\markdownRendererSubscript#1{ (#1 moles) and } -\starttext -\startmarkdown - - H~2~O is a liquid.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[subscripts = yes] +\def\markdownRendererSubscript#1{ (#1 moles) and } +\starttext +\startmarkdown + + H~2~O is a liquid.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-H (2 moles) and O is a liquid.
2.3.1.31 Superscript Renderer
+2.3.1.32 Superscript Renderer
The
-\markdownRendererSuperscript
macro represents a superscript span of text. The macro receives a single argument that corresponds to the superscript span of text. This macro will only be produced, when thesuperscripts
option is enabled.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionSuperscripts{true} -\def\markdownRendererSuperscript#1{ taken to the power of #1} -\markdownBegin - - 2^10^ is 1024.\markdownEnd -\bye
\input markdown +\def\markdownOptionSuperscripts{true} +\def\markdownRendererSuperscript#1{ taken to the power of #1} +\markdownBegin + + 2^10^ is 1024.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-2 taken to the power of 10 is 1024.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[superscripts]{markdown} -\markdownSetup{ - - renderers = { - superscript = { taken to the power of #1}, - }, - }\begin{document} -\begin{markdown} - - 2^10^ is 1024.\end{markdown} -\end{document}
\documentclass{article} +\usepackage[superscripts]{markdown} +\markdownSetup{ + + renderers = { + superscript = { taken to the power of #1}, + }, + }\begin{document} +\begin{markdown} + + 2^10^ is 1024.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -9886,25 +10081,25 @@ contain the following text: class="tex">TeXt ExampleUsing a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[superscripts = yes] -\def\markdownRendererSuperscript#1{ taken to the power of #1} -\starttext -\startmarkdown - - 2^10^ is 1024.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[superscripts = yes] +\def\markdownRendererSuperscript#1{ taken to the power of #1} +\starttext +\startmarkdown + + 2^10^ is 1024.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-2 taken to the power of 10 is 1024.
2.3.1.32 Table Renderer
+2.3.1.33 Table Renderer
The
\markdownRendererTable
macro represents a table. This macro will only be produced, when thepipeTables
option is enabled. The macro @@ -9925,71 +10120,71 @@ one of the following:c
– The corresponding column is centered.- r
– The corresponding column is right-aligned.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[pipeTables, tableCaptions]{markdown} -\newcount\rowCounter -\newcount\columnCounter -\makeatletter -\def\processRow#1{% -\columnCounter=1% - \ifnum\rowCounter=0\relax - - As for the alignment,\else - \the\rowCounter, - In row \fi - \processColumn#1 - \advance\rowCounter by 1\relax - \ifnum\rowCounter>\rowTotal\relax - \expandafter\@gobble - \fi\processRow}% - \def\processColumn#1{% -\the\columnCounter{} - column number \ifnum\rowCounter=0\relax - \if#1d{}has default alignment\fi - \if#1l{}is left-aligned\fi - \if#1c{}is centered\fi - \if#1r{}is right-aligned\fi - \else - \emph{#1}% - says \fi - \advance\columnCounter by 1\relax - \ifnum\columnCounter<\columnTotal\relax, \fi - \ifnum\columnCounter=\columnTotal\relax, and \fi - \ifnum\columnCounter>\columnTotal\relax - \expandafter\@gobble - .\fi\processColumn}% - \makeatother -\markdownSetup{ - - renderers = {% - table = {\emph{#1} that is #3 colums wide - This is a table with caption - and #2 rows long.\rowCounter=0% - \def\rowTotal{#2}% - \def\columnTotal{#3}% - \processRow - - }, - }, - }\begin{document} -\begin{markdown} - - | Right | Left | Default | Center | - |------:|:-----|---------|:------:| - | 12 | 12 | 12 | 12 | - | 123 | 123 | 123 | 123 | - | 1 | 1 | 1 | 1 | - - : Demonstration of pipe table syntax\end{markdown} -\end{document}
\documentclass{article} +\usepackage[pipeTables, tableCaptions]{markdown} +\newcount\rowCounter +\newcount\columnCounter +\makeatletter +\def\processRow#1{% +\columnCounter=1% + \ifnum\rowCounter=0\relax + + As for the alignment,\else + \the\rowCounter, + In row \fi + \processColumn#1 + \advance\rowCounter by 1\relax + \ifnum\rowCounter>\rowTotal\relax + \expandafter\@gobble + \fi\processRow}% + \def\processColumn#1{% +\the\columnCounter{} + column number \ifnum\rowCounter=0\relax + \if#1d{}has default alignment\fi + \if#1l{}is left-aligned\fi + \if#1c{}is centered\fi + \if#1r{}is right-aligned\fi + \else + \emph{#1}% + says \fi + \advance\columnCounter by 1\relax + \ifnum\columnCounter<\columnTotal\relax, \fi + \ifnum\columnCounter=\columnTotal\relax, and \fi + \ifnum\columnCounter>\columnTotal\relax + \expandafter\@gobble + .\fi\processColumn}% + \makeatother +\markdownSetup{ + + renderers = {% + table = {\emph{#1} that is #3 colums wide + This is a table with caption + and #2 rows long.\rowCounter=0% + \def\rowTotal{#2}% + \def\columnTotal{#3}% + \processRow + + }, + }, + }\begin{document} +\begin{markdown} + + | Right | Left | Default | Center | + |------:|:-----|---------|:------:| + | 12 | 12 | 12 | 12 | + | 123 | 123 | 123 | 123 | + | 1 | 1 | 1 | 1 | + + : Demonstration of pipe table syntax\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10007,62 +10202,152 @@ column number 4 says 12. In row 3, column number 1 says number 1 says 1, column number 2 says 1, column number 3 says 1, and column number 4 says 1.-2.3.1.33 Text Citations +
2.3.1.34 Tex Math Renderers
+The
+\markdownRendererInlineMath
and +\markdownRendererDisplayMath
macros represent inline and +display TeX math. Both macros +receive a single argument that corresponds to the tex math content. +These macros will only be produced, when the +texMathDollars
option is enabled.Plain TeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\input markdown +\def\markdownOptionTexMathDollars{true} +\def\markdownRendererInlineMath#1{$#1\dots$} +\def\markdownRendererDisplayMath#1{$$#1\eqno(1)$$} +\markdownBegin +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
++luatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2…
+$$\hat{f} \left ( \xi \right )= +\int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} +dx\eqno(1)$$
+LaTeX Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\documentclass{article} +\usepackage[texMathDollars]{markdown} +\usepackage{amsmath} +\def\markdownRendererInlineMath#1{\begin{math}#1\dots\end{math}} +\def\markdownRendererDisplayMath#1{\begin{equation}#1\end{equation}} +\begin{document} +\begin{markdown} +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
++lualatex document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2…
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx (1)
+ConTeXt Example
+Using a text editor, create a text document named +
+document.tex
with the following content:+\usemodule[t][markdown] +\setupmarkdown[texMathDollars = yes] +\def\markdownRendererInlineMath#1{$#1\dots$}% +\def\markdownRendererDisplayMath#1{\placeformula\startformula#1\stopformula}% +\starttext +\startmarkdown +$E=mc^2$ + +$$\hat{f} \left ( \xi \right )= \int_{-\infty}^{\infty} f\left ( x \right ) e^{-i2\pi \xi x} dx$$ +\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
++context document.tex
A PDF document named
+document.pdf
should be produced and +contain the following text:++E = mc2…
+f̂(ξ) = ∫−∞∞f(x)e−i2πξxdx (1)
+2.3.1.35 Text Citations Renderer
The
-\markdownRendererTextCite
macro represents a string of one or more text citations. This macro will only be produced, when thecitations
option is enabled. The macro receives parameters in the same format as the\markdownRendererCite
macro.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[citations]{markdown} -\newcount\citationsCounter -\newcount\citationsTotal -\makeatletter -\def\citations#1#2#3#4{% -\emph{#4} - a text citation \advance\citationsCounter by 1\relax - \ifx\relax#2\relax - \ifx\relax#3\relax\else - \emph{#3}% - with a postfix \fi - \else - \emph{#2}% - with a prefix \ifx\relax#3\relax\else - \ and a postfix \emph{#3}% - \fi - \fi - \ifnum\citationsCounter>\citationsTotal\relax - % - .\expandafter\@gobble - \else - - , and\fi\citations} - \makeatother -\markdownSetup{ - - renderers = {% - textCite = {\citationsCounter=1% - \citationsTotal=#1% - - This is\expandafter\citations - - }, - }, - }\begin{document} -\begin{markdown} - - @abrahams90 [pp. 12; also @eijkhout91]\end{markdown} -\end{document}
\documentclass{article} +\usepackage[citations]{markdown} +\newcount\citationsCounter +\newcount\citationsTotal +\makeatletter +\def\citations#1#2#3#4{% +\emph{#4} + a text citation \advance\citationsCounter by 1\relax + \ifx\relax#2\relax + \ifx\relax#3\relax\else + \emph{#3}% + with a postfix \fi + \else + \emph{#2}% + with a prefix \ifx\relax#3\relax\else + \ and a postfix \emph{#3}% + \fi + \fi + \ifnum\citationsCounter>\citationsTotal\relax + % + .\expandafter\@gobble + \else + + , and\fi\citations} + \makeatother +\markdownSetup{ + + renderers = {% + textCite = {\citationsCounter=1% + \citationsTotal=#1% + + This is\expandafter\citations + + }, + }, + }\begin{document} +\begin{markdown} + + @abrahams90 [pp. 12; also @eijkhout91]\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10070,29 +10355,29 @@ contain the following text: pp. 12, and a citation eijkhout91 with a prefix also.-2.3.1.34 Thematic Break +
2.3.1.36 Thematic Break Renderer
The
-\markdownRendererThematicBreak
macro represents a thematic break. The macro receives no arguments.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererThematicBreak{\vfil\break} -\markdownBegin - - This is the first page. - - *** - - This is the second page.\markdownEnd -\bye
\input markdown +\def\markdownRendererThematicBreak{\vfil\break} +\markdownBegin + + This is the first page. + + *** + + This is the second page.\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10100,30 +10385,30 @@ contain the following text:-
This is the second page.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - renderers = {\newpage, - thematicBreak = - }, - }\begin{document} -\begin{markdown} - - This is the first page. - - *** - - This is the second page.\end{markdown} -\end{document}
\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + renderers = {\newpage, + thematicBreak = + }, + }\begin{document} +\begin{markdown} + + This is the first page. + + *** + + This is the second page.\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10131,25 +10416,25 @@ contain the following text:-
This is the second page.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererThematicBreak{\page[yes]} -\starttext -\startmarkdown - - This is the first page. - - *** - - This is the second page.\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererThematicBreak{\page[yes]} +\starttext +\startmarkdown + + This is the first page. + + *** + + This is the second page.\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10157,8 +10442,8 @@ contain the following text:-
This is the second page.
2.3.1.35 Tickbox Renderers
+2.3.1.37 Tickbox Renderers
The macros named
-\markdownRendererTickedBox
,\markdownRendererHalfTickedBox
, and\markdownRendererUntickedBox
represent ticked and unticked @@ -10167,28 +10452,28 @@ boxes, respectively. These macros will either be produced, when the Ballot Box with X (☒, U+2612), Hourglass (⌛, U+231B) or Ballot Box (☐, U+2610) Unicode characters are encountered in the markdown input, respectively.LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\documentclass{article} -\usepackage[taskLists]{markdown} -\markdownSetup{ - - renderers = { - untickedBox = No, - tickedBox = Yes, - }, - }\begin{document} -\begin{markdown} - - - [ ] you can't. - - [x] I can!\end{markdown} -\end{document}
\documentclass{article} +\usepackage[taskLists]{markdown} +\markdownSetup{ + + renderers = { + untickedBox = No, + tickedBox = Yes, + }, + }\begin{document} +\begin{markdown} + + - [ ] you can't. + - [x] I can!\end{markdown} +\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10197,24 +10482,24 @@ contain the following text:-Yes I can! ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[taskLists = yes] -\def\markdownRendererUntickedBox{No} -\def\markdownRendererTickedBox{Yes} -\starttext -\startmarkdown - - - [ ] you can't. - - [x] I can!\stopmarkdown -\stoptext
\usemodule[t][markdown] +\setupmarkdown[taskLists = yes] +\def\markdownRendererUntickedBox{No} +\def\markdownRendererTickedBox{Yes} +\starttext +\startmarkdown + + - [ ] you can't. + - [x] I can!\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10223,8 +10508,8 @@ contain the following text:-Yes I can! 2.3.1.36 YAML Metadata +
2.3.1.38 YAML Metadata Renderers
The
-\markdownRendererJekyllDataBegin
macro represents the beginning of a yaml document. This macro will only be @@ -10282,88 +10567,88 @@ be produced when thejekyllData
option is enabled. The macro receives one argument: the scalar key in the parent structure, cast to a string following yaml serialization rules.Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownOptionJekyllData{true} -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
\input markdown +\def\markdownOptionJekyllData{true} +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - renderers = {\gdef\name{#2}}, - jekyllDataString = {\gdef\age{#2}}, - jekyllDataNumber = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + renderers = {\gdef\name{#2}}, + jekyllDataString = {\gdef\age{#2}}, + jekyllDataNumber = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} -\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\def\markdownRendererJekyllDataString#1#2{\gdef\name{#2}} +\def\markdownRendererJekyllDataNumber#1#2{\gdef\age{#2}} +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10375,93 +10660,93 @@ PrototypesBy default, token renderers point to package-defined TeX macros, further referred to as prototypes, which provide useful default definitions.
-Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:+\input markdown -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\markdownBegin - - ~\markdownEnd - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\markdownBegin - - ~\markdownEnd -\bye
\input markdown +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\markdownBegin + + ~\markdownEnd + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\markdownBegin + + ~\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Packages can specify token renderer prototypes.
User-defined token renderers take precedence.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage{markdown} -\markdownSetup{ - - rendererPrototypes = { - tilde = {Packages can specify token renderer prototypes.}, - }, - }\begin{document} -\begin{markdown} - - ~\end{markdown} - -\begin{markdown*}{ - - renderers = { - tilde = {User-defined token renderers take precedence.}, - }, - } - ~\end{markdown*} -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage{markdown} +\markdownSetup{ + + rendererPrototypes = { + tilde = {Packages can specify token renderer prototypes.}, + }, + }\begin{document} +\begin{markdown} + + ~\end{markdown} + +\begin{markdown*}{ + + renderers = { + tilde = {User-defined token renderers take precedence.}, + }, + } + ~\end{markdown*} +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Packages can specify token renderer prototypes.
User-defined token renderers take precedence.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:+\usemodule[t][markdown] -\def\markdownRendererTildePrototype{% -% - Packages can specify token renderer prototypes. - }\starttext -\startmarkdown - - ~\stopmarkdown - -\def\markdownRendererTilde{% -% - User-defined token renderers take precedence. - }\startmarkdown - - ~\stopmarkdown -\stoptext
\usemodule[t][markdown] +\def\markdownRendererTildePrototype{% +% + Packages can specify token renderer prototypes. + }\starttext +\startmarkdown + + ~\stopmarkdown + +\def\markdownRendererTilde{% +% + User-defined token renderers take precedence. + }\startmarkdown + + ~\stopmarkdown +\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:@@ -10475,102 +10760,102 @@ Prototypes high-level interface that can be programmed using themarkdown/jekyllData
key–values from the l3keys module of the LaTeX3 kernel. -Plain Plain TeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\input markdown -\def\markdownOptionJekyllData{true} -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \markdownBegin - - --- - name: Jane Doe - age: 99 - ---\markdownEnd -\bye
Next, invoke LuaTeX from the terminal:
-+luatex document.tex
+\input markdown +\def\markdownOptionJekyllData{true} +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \markdownBegin + + --- + name: Jane Doe + age: 99 + ---\markdownEnd +\bye
Next, invoke LuaTeX from the terminal:
+luatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
LaTeX Example
Using a text editor, create a text document named
-document.tex
with the following content:-\documentclass{article} -\usepackage[jekyllData]{markdown} -\markdownSetup{ - - jekyllDataRenderers = {\gdef\name{#1}}, - name = {\gdef\age{#1}}, - code = { - }, - renderers = {\name{} is \age{} years old.}, - jekyllDataEnd = { - } - }\begin{document} - -\begin{markdown} - - --- - name: Jane Doe - age: 99 - ---\end{markdown} - -\end{document}
Next, invoke LuaTeX from the terminal:
-+lualatex document.tex
+\documentclass{article} +\usepackage[jekyllData]{markdown} +\markdownSetup{ + + jekyllDataRenderers = {\gdef\name{#1}}, + name = {\gdef\age{#1}}, + code = { + }, + renderers = {\name{} is \age{} years old.}, + jekyllDataEnd = { + } + }\begin{document} + +\begin{markdown} + + --- + name: Jane Doe + age: 99 + ---\end{markdown} + +\end{document}
Next, invoke LuaTeX from the terminal:
+lualatex document.tex
A PDF document named
document.pdf
should be produced and contain the following text:-Jane Doe is 99 years old.
ConConTeXt Example
Using a text editor, create a text document named
-document.tex
with the following content:-\usemodule[t][markdown] -\setupmarkdown[jekyllData = yes] -\ExplSyntaxOn -\keys_define:nn - - { markdown/jekyllData } - {\gdef\name{#1} }, - name .code:n = { \gdef\age{#1} }, - age .code:n = { - }\ExplSyntaxOff -\def\markdownRendererJekyllDataEnd{% -\name{} is \age{} years old.} - \starttext - -\startmarkdown - - --- - name: Jane Doe - age: 99 - ---\stopmarkdown - -\stoptext
Next, invoke LuaTeX from the terminal:
-+context document.tex
+\usemodule[t][markdown] +\setupmarkdown[jekyllData = yes] +\ExplSyntaxOn +\keys_define:nn + + { markdown/jekyllData } + {\gdef\name{#1} }, + name .code:n = { \gdef\age{#1} }, + age .code:n = { + }\ExplSyntaxOff +\def\markdownRendererJekyllDataEnd{% +\name{} is \age{} years old.} + \starttext + +\startmarkdown + + --- + name: Jane Doe + age: 99 + ---\stopmarkdown + +\stoptext
Next, invoke LuaTeX from the terminal:
+context document.tex
A PDF document named
document.pdf
should be produced and contain the following text:diff --git a/macros/generic/markdown/markdown.pdf b/macros/generic/markdown/markdown.pdf index f2bf87e528..1b7b16cb5c 100644 Binary files a/macros/generic/markdown/markdown.pdf and b/macros/generic/markdown/markdown.pdf differ -- cgit v1.2.3