markdown
markdown copied to clipboard
Design a feature: the direct mapping of elements
The Markdown package has always relied on TeX's expansion processor: For example, the Lua parser converts the markdown text # What's on the Menu?
, into the TeX code \markdownRendererHeadingOne{What's on the Menu?}
, which TeX expands to \chapter{What's on the Menu?}
and typesets.
However, we can't always rely on TeX's expansion processor: For example, the \begin{frame}
command of the Beamer LaTeX package will read input until it has found a matching \end{frame}
command. If \end{frame}
is hidden behind expansion, it will not be found. Enabling the mapping of elements to arbitrary text in Lua instead of relying on TeX's expansion processor would make it possible to e.g. typeset presentation slides with the Beamer package without having to drop out of Markdown between frames:
\markdownSetup {
directMapping = {
headingOne = {
\begin{frame}
\frametitle{#1}
},
horizontalRule = {
\end{frame}
},
}
}
The above configuration in LaTeX would cause the following Markdown input to produce a presentation slide with the title What's on the Menu? and a horrifying conclusion: Grandma
# What's on the Menu?
Grandma
***
Issues to hammer out include:
- How to best implement attribute substitution (
\frametitle{#1}
) in Lua? - How to pass arbitrary direct mapping definitions from TeX to Lua with as little lossage as possible?