diff --git a/markdown.dtx b/markdown.dtx index e8f4e1058..e07358498 100644 --- a/markdown.dtx +++ b/markdown.dtx @@ -11926,6 +11926,62 @@ The horizontal margins should contain the following text: % % \begin{markdown} +#### Inline HTML Tag Renderer +The \mdef{markdownRendererInlineHtmlTag} macro represents the contents of an +opening, closing, or empty inline \acro{HTML} tag. This macro will only be +produced, when the \Opt{html} option is enabled. The macro receives a single +argument that corresponds to the contents of the \acro{HTML} tag. + +% \end{markdown} +% +% \iffalse + +##### \LaTeX{} Example {.unnumbered} + +Using a text editor, create a text document named `document.tex` with the +following content: +``` tex +\documentclass{article} +\usepackage[html]{markdown} +\usepackage{marginnote} +\markdownSetup{ + renderers = { + inlineHtmlTag = {\textbf{#1}}, + }, +} +\begin{document} +\begin{markdown} +Hello, world!
+\end{markdown} +\end{document} +``````` +Next, invoke LuaTeX from the terminal: +``` sh +lualatex document.tex +lualatex document.tex +`````` +A PDF document named `document.pdf` should be produced and contain the +following body text: + +> ****Hello, world!**
** + +% +%<*tex> +% \fi +% +% \begin{macrocode} +\def\markdownRendererInlineHtmlTag{% + \markdownRendererInlineHtmlTagPrototype}% +% \end{macrocode} +% \par +% +% \iffalse +% +%<*manual-tokens> +% \fi +% +% \begin{markdown} + ### Token Renderer Prototypes % \label{sec:texrendererprototypes} @@ -12129,6 +12185,7 @@ following text: \def\markdownRendererTextCitePrototype#1{}% \def\markdownRendererTablePrototype#1#2#3{}% \def\markdownRendererInlineHtmlCommentPrototype#1{}% +\def\markdownRendererInlineHtmlTagPrototype#1{}% \def\markdownRendererTickedBoxPrototype{}% \def\markdownRendererHalfTickedBoxPrototype{}% \def\markdownRendererUntickedBoxPrototype{}% @@ -13258,6 +13315,8 @@ The following ordered list will be preceded by roman numerals: \renewcommand\markdownRendererTable[3]{#1}}% \define@key{markdownRenderers}{inlineHtmlComment}{% \renewcommand\markdownRendererInlineHtmlComment[1]{#1}}% +\define@key{markdownRenderers}{inlineHtmlTag}{% + \renewcommand\markdownRendererInlineHtmlTag[1]{#1}}% \define@key{markdownRenderers}{tickedBox}{% \renewcommand\markdownRendererTickedBox{#1}}% \define@key{markdownRenderers}{halfTickedBox}{% @@ -13433,6 +13492,8 @@ The following ordered list will be preceded by roman numerals: \renewcommand\markdownRendererTablePrototype[3]{#1}}% \define@key{markdownRendererPrototypes}{inlineHtmlComment}{% \renewcommand\markdownRendererInlineHtmlCommentPrototype[1]{#1}}% +\define@key{markdownRendererPrototypes}{inlineHtmlTag}{% + \renewcommand\markdownRendererInlineHtmlCommentTag[1]{#1}}% \define@key{markdownRendererPrototypes}{tickedBox}{% \renewcommand\markdownRendererTickedBoxPrototype{#1}}% \define@key{markdownRendererPrototypes}{halfTickedBox}{% @@ -16542,6 +16603,20 @@ function M.writer.new(options) % \par % \begin{markdown} % +% Define \luamdef{writer->inline_html_tag} as a function that will +% transform the contents of an opening, closing, or empty inline \acro{HTML} +% tag to the output format, where `contents` are the contents of the +% \acro{HTML} tag. +% +% \end{markdown} +% \begin{macrocode} + function self.inline_html_tag(contents) + return {"\\markdownRendererInlineHtmlTag{",self.string(contents),"}"} + end +% \end{macrocode} +% \par +% \begin{markdown} +% % Define \luamdef{writer->definitionlist} as a function that will transform an % input definition list to the output format, where `items` is an array of % tables, each of the form `{ term = t, definitions = defs }`, where `t` @@ -18413,12 +18488,12 @@ larsers.PipeTable = Ct(larsers.table_row * parsers.newline larsers.EscapedChar = parsers.backslash * C(parsers.escapable) / writer.string - larsers.InlineHtml = parsers.emptyelt_any + larsers.InlineHtml = parsers.emptyelt_any / writer.inline_html_tag + (parsers.htmlcomment / parse_inlines_no_html) / writer.inline_html_comment + parsers.htmlinstruction - + parsers.openelt_any - + parsers.closeelt_any + + parsers.openelt_any / writer.inline_html_tag + + parsers.closeelt_any / writer.inline_html_tag larsers.HtmlEntity = parsers.hexentity / entities.hex_entity / writer.string + parsers.decentity / entities.dec_entity / writer.string diff --git a/tests/support/markdownthemewitiko_markdown_test.sty b/tests/support/markdownthemewitiko_markdown_test.sty index a7426895b..8d5cd00e2 100644 --- a/tests/support/markdownthemewitiko_markdown_test.sty +++ b/tests/support/markdownthemewitiko_markdown_test.sty @@ -166,6 +166,8 @@ \TABLE{#1}{#2}{#3}}, inlineHtmlComment = {% \TYPE{inlineHtmlComment: #1}}, + inlineHtmlTag = {% + \TYPE{inlineHtmlTag: #1}}, tickedBox = {% \TYPE{tickedBox}% \GOBBLE}, diff --git a/tests/support/plain-setup.tex b/tests/support/plain-setup.tex index 1746e3de0..6ff66d09a 100644 --- a/tests/support/plain-setup.tex +++ b/tests/support/plain-setup.tex @@ -146,6 +146,8 @@ \TABLE{#1}{#2}{#3}}% \def\markdownRendererInlineHtmlComment#1{% \TYPE{inlineHtmlComment: #1}}% +\def\markdownRendererInlineHtmlTag#1{% + \TYPE{inlineHtmlTag: #1}}% \def\markdownRendererTickedBox#1{% \TYPE{tickedBox}}% \def\markdownRendererHalfTickedBox#1{% diff --git a/tests/testfiles/lunamark-markdown/html.test b/tests/testfiles/lunamark-markdown/html.test index 1c4ff423e..e15631395 100644 --- a/tests/testfiles/lunamark-markdown/html.test +++ b/tests/testfiles/lunamark-markdown/html.test @@ -6,7 +6,7 @@ the plain TeX interface.
*There is block tag support.*
-*There is support.* +*There is support.
* _There is support._ _There is support._ @@ -25,7 +25,7 @@ documentBegin codeSpan: html interblockSeparator interblockSeparator -emphasis: There is support. +emphasis: There is (inlineHtmlTag: )(inlineHtmlTag: ) support.(inlineHtmlTag:
) emphasis: There is (inlineHtmlComment: (emphasis: comment)) support. emphasis: There is support. interblockSeparator diff --git a/tests/testfiles/lunamark-markdown/no-html.test b/tests/testfiles/lunamark-markdown/no-html.test index 947c60f40..298d8774b 100644 --- a/tests/testfiles/lunamark-markdown/no-html.test +++ b/tests/testfiles/lunamark-markdown/no-html.test @@ -4,7 +4,7 @@ This test ensures that the Lua `html` option is disabled by default.
*There is no block tag support.*
-*There is no support.* +*There is support.
* _There is no support._ _There is no support._ @@ -23,7 +23,7 @@ documentBegin codeSpan: html interblockSeparator emphasis: There is no block tag support. -emphasis: There is no support. +emphasis: There is support.
emphasis: There is no support. emphasis: There is no support. interblockSeparator