diff options
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/context/third/markdown/t-markdown.tex | 46 | ||||
-rw-r--r-- | Master/texmf-dist/tex/generic/markdown/markdown.tex | 593 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/markdown/markdown.sty | 198 | ||||
-rw-r--r-- | Master/texmf-dist/tex/luatex/markdown/markdown.lua | 343 |
4 files changed, 742 insertions, 438 deletions
diff --git a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex index 2585f0c2f69..79ba3273a63 100644 --- a/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex +++ b/Master/texmf-dist/tex/context/third/markdown/t-markdown.tex @@ -76,13 +76,29 @@ \seq_map_inline:cn { g__markdown_ ##1 _options_seq } { - \__markdown_context_define_option_keyval:nn - { ##1 } + \__markdown_with_various_cases:nn { ####1 } + { + \__markdown_context_define_option_keyval:nnn + { ##1 } + { ####1 } + { ########1 } + } } } } -\cs_new:Nn \__markdown_context_define_option_keyval:nn +\cs_new:Nn \__markdown_caseless:N + { + \regex_replace_all:nnN + { ([a-z])([A-Z]) } + { \1 \c { str_lowercase:n } \cB\{ \2 \cE\} } + #1 + \tl_set:Nx + #1 + { #1 } + } +\seq_gput_right:Nn \g__markdown_cases_seq { __markdown_caseless:N } +\cs_new:Nn \__markdown_context_define_option_keyval:nnn { \prop_get:cnN { g__markdown_ #1 _option_types_prop } @@ -91,7 +107,7 @@ \keys_define:nn { markdown/context-options } { - #2 .code:n = { + #3 .code:n = { \tl_set:Nx \l_tmpa_tl { @@ -115,7 +131,7 @@ \keys_define:nn { markdown/context-options } { - #2 .default:n = { true }, + #3 .default:n = { true }, } } } @@ -258,9 +274,9 @@ \def\markdownRendererHeadingFourPrototype#1{\subsubsection{#1}}% \def\markdownRendererHeadingFivePrototype#1{\subsubsubsection{#1}}% \def\markdownRendererHeadingSixPrototype#1{\subsubsubsubsection{#1}}% -\def\markdownRendererHorizontalRulePrototype{% +\def\markdownRendererThematicBreakPrototype{% \blackrule[height=1pt, width=\hsize]}% -\def\markdownRendererFootnotePrototype#1{\footnote{#1}}% +\def\markdownRendererNotePrototype#1{\footnote{#1}}% \def\markdownRendererTickedBoxPrototype{$\boxtimes$} \def\markdownRendererHalfTickedBoxPrototype{$\boxdot$} \def\markdownRendererUntickedBoxPrototype{$\square$} @@ -332,6 +348,22 @@ \ifnum\markdownConTeXtColumnCounter<\markdownConTeXtColumnTotal\relax\else \expandafter\gobbleoneargument \fi\markdownConTeXtRenderTableCell} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputRawInlinePrototype#1#2 + { + \str_case:nn + { #2 } + { + { tex } { \markdownEscape{#1} } + { context } { \markdownEscape{#1} } + { md } { \markdownInput{#1} } + } + } +\cs_gset_eq:NN + \markdownRendererInputRawBlockPrototype + \markdownRendererInputRawInlinePrototype +\ExplSyntaxOff \stopmodule\protect \endinput %% diff --git a/Master/texmf-dist/tex/generic/markdown/markdown.tex b/Master/texmf-dist/tex/generic/markdown/markdown.tex index 4b8f0081009..885c7598b09 100644 --- a/Master/texmf-dist/tex/generic/markdown/markdown.tex +++ b/Master/texmf-dist/tex/generic/markdown/markdown.tex @@ -51,7 +51,7 @@ \prop_new:N \g__markdown_default_lua_options_prop \seq_new:N \g__markdown_option_layers_seq \tl_const:Nn \c__markdown_option_layer_lua_tl { lua } -\seq_put_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_lua_tl +\seq_gput_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_lua_tl \cs_new:Nn \__markdown_add_lua_option:nnn { @@ -64,14 +64,14 @@ \cs_new:Nn \__markdown_add_option:nnnn { - \seq_put_right:cn + \seq_gput_right:cn { g__markdown_ #1 _options_seq } { #2 } - \prop_put:cnn + \prop_gput:cnn { g__markdown_ #1 _option_types_prop } { #2 } { #3 } - \prop_put:cnn + \prop_gput:cnn { g__markdown_default_ #1 _options_prop } { #2 } { #4 } @@ -130,19 +130,19 @@ { nnnV } \seq_new:N \g__markdown_option_types_seq \tl_const:Nn \c__markdown_option_type_clist_tl { clist } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_clist_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_clist_tl \tl_const:Nn \c__markdown_option_type_counter_tl { counter } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_counter_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_counter_tl \tl_const:Nn \c__markdown_option_type_boolean_tl { boolean } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_boolean_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_boolean_tl \tl_const:Nn \c__markdown_option_type_number_tl { number } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_number_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_number_tl \tl_const:Nn \c__markdown_option_type_path_tl { path } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_path_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_path_tl \tl_const:Nn \c__markdown_option_type_slice_tl { slice } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_slice_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_slice_tl \tl_const:Nn \c__markdown_option_type_string_tl { string } -\seq_put_right:NV \g__markdown_option_types_seq \c__markdown_option_type_string_tl +\seq_gput_right:NV \g__markdown_option_types_seq \c__markdown_option_type_string_tl \cs_new:Nn \__markdown_get_option_type:nN { @@ -273,6 +273,49 @@ \tl_tail:n { #1 } } } +\seq_new:N \g__markdown_cases_seq +\cs_new:Nn \__markdown_with_various_cases:nn + { + \seq_clear:N + \l_tmpa_seq + \seq_map_inline:Nn + \g__markdown_cases_seq + { + \tl_set:Nn + \l_tmpa_tl + { #1 } + \use:c { ##1 } + \l_tmpa_tl + \seq_put_right:NV + \l_tmpa_seq + \l_tmpa_tl + } + \seq_map_inline:Nn + \l_tmpa_seq + { #2 } + } +\cs_new:Nn \__markdown_camel_case:N + { + \regex_replace_all:nnN + { _ ([a-z]) } + { \c { str_uppercase:n } \cB\{ \1 \cE\} } + #1 + \tl_set:Nx + #1 + { #1 } + } +\seq_gput_right:Nn \g__markdown_cases_seq { __markdown_camel_case:N } +\cs_new:Nn \__markdown_snake_case:N + { + \regex_replace_all:nnN + { ([a-z])([A-Z]) } + { \1 _ \c { str_lowercase:n } \cB\{ \2 \cE\} } + #1 + \tl_set:Nx + #1 + { #1 } + } +\seq_gput_right:Nn \g__markdown_cases_seq { __markdown_snake_case:N } \__markdown_add_lua_option:nnn { cacheDir } { path } @@ -361,6 +404,10 @@ { boolean } { false } \__markdown_add_lua_option:nnn + { notes } + { boolean } + { false } +\__markdown_add_lua_option:nnn { frozenCacheCounter } { counter } { 0 } @@ -389,6 +436,10 @@ { boolean } { false } \__markdown_add_lua_option:nnn + { inlineNotes } + { boolean } + { false } +\__markdown_add_lua_option:nnn { jekyllData } { boolean } { false } @@ -401,6 +452,10 @@ { boolean } { false } \__markdown_add_lua_option:nnn + { rawAttribute } + { boolean } + { false } +\__markdown_add_lua_option:nnn { relativeReferences } { boolean } { false } @@ -457,17 +512,18 @@ { boolean } { true } \ExplSyntaxOff -\def\markdownLastModified{2022-10-03}% -\def\markdownVersion{2.17.1-0-g8ca83f5}% +\def\markdownLastModified{2022-10-30}% +\def\markdownVersion{2.18.0-0-gd8ae860}% \let\markdownBegin\relax \let\markdownEnd\relax \let\markdownInput\relax +\let\markdownEscape\relax \ExplSyntaxOn \seq_new:N \g__markdown_plain_tex_options_seq \prop_new:N \g__markdown_plain_tex_option_types_prop \prop_new:N \g__markdown_default_plain_tex_options_prop \tl_const:Nn \c__markdown_option_layer_plain_tex_tl { plain_tex } -\seq_put_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_plain_tex_tl +\seq_gput_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_plain_tex_tl \cs_new:Nn \__markdown_add_plain_tex_option:nnn { @@ -594,14 +650,14 @@ } } \__markdown_plain_tex_define_option_commands: -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_plain_tex_options_seq { stripPercentSigns } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_plain_tex_option_types_prop { stripPercentSigns } { boolean } -\prop_put:Nnx +\prop_gput:Nnx \g__markdown_default_plain_tex_options_prop { stripPercentSigns } { false } @@ -613,10 +669,10 @@ \def\markdownRendererTickedBox{% \markdownRendererTickedBoxPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { tickedBox } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { tickedBox } { 0 } @@ -624,10 +680,10 @@ \def\markdownRendererHalfTickedBox{% \markdownRendererHalfTickedBoxPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { halfTickedBox } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { halfTickedBox } { 0 } @@ -635,10 +691,10 @@ \def\markdownRendererUntickedBox{% \markdownRendererUntickedBoxPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { untickedBox } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { untickedBox } { 0 } @@ -646,10 +702,10 @@ \def\markdownRendererDocumentBegin{% \markdownRendererDocumentBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { documentBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { documentBegin } { 0 } @@ -657,10 +713,10 @@ \def\markdownRendererDocumentEnd{% \markdownRendererDocumentEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { documentEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { documentEnd } { 0 } @@ -668,10 +724,10 @@ \def\markdownRendererInterblockSeparator{% \markdownRendererInterblockSeparatorPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { interblockSeparator } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { interblockSeparator } { 0 } @@ -679,10 +735,10 @@ \def\markdownRendererLineBreak{% \markdownRendererLineBreakPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { lineBreak } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { lineBreak } { 0 } @@ -690,10 +746,10 @@ \def\markdownRendererEllipsis{% \markdownRendererEllipsisPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ellipsis } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ellipsis } { 0 } @@ -701,10 +757,10 @@ \def\markdownRendererNbsp{% \markdownRendererNbspPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { nbsp } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { nbsp } { 0 } @@ -712,10 +768,10 @@ \def\markdownRendererLeftBrace{% \markdownRendererLeftBracePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { leftBrace } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { leftBrace } { 0 } @@ -723,10 +779,10 @@ \def\markdownRendererRightBrace{% \markdownRendererRightBracePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { rightBrace } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { rightBrace } { 0 } @@ -734,10 +790,10 @@ \def\markdownRendererDollarSign{% \markdownRendererDollarSignPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dollarSign } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dollarSign } { 0 } @@ -745,10 +801,10 @@ \def\markdownRendererPercentSign{% \markdownRendererPercentSignPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { percentSign } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { percentSign } { 0 } @@ -756,10 +812,10 @@ \def\markdownRendererAmpersand{% \markdownRendererAmpersandPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ampersand } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ampersand } { 0 } @@ -767,10 +823,10 @@ \def\markdownRendererUnderscore{% \markdownRendererUnderscorePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { underscore } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { underscore } { 0 } @@ -778,10 +834,10 @@ \def\markdownRendererHash{% \markdownRendererHashPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { hash } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { hash } { 0 } @@ -789,10 +845,10 @@ \def\markdownRendererCircumflex{% \markdownRendererCircumflexPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { circumflex } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { circumflex } { 0 } @@ -800,10 +856,10 @@ \def\markdownRendererBackslash{% \markdownRendererBackslashPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { backslash } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { backslash } { 0 } @@ -811,10 +867,10 @@ \def\markdownRendererTilde{% \markdownRendererTildePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { tilde } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { tilde } { 0 } @@ -822,10 +878,10 @@ \def\markdownRendererPipe{% \markdownRendererPipePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { pipe } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { pipe } { 0 } @@ -833,10 +889,10 @@ \def\markdownRendererCodeSpan{% \markdownRendererCodeSpanPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { codeSpan } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { codeSpan } { 1 } @@ -844,10 +900,10 @@ \def\markdownRendererLink{% \markdownRendererLinkPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { link } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { link } { 4 } @@ -855,10 +911,10 @@ \def\markdownRendererImage{% \markdownRendererImagePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { image } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { image } { 4 } @@ -866,10 +922,10 @@ \def\markdownRendererContentBlock{% \markdownRendererContentBlockPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { contentBlock } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { contentBlock } { 4 } @@ -877,10 +933,10 @@ \def\markdownRendererContentBlockOnlineImage{% \markdownRendererContentBlockOnlineImagePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { contentBlockOnlineImage } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { contentBlockOnlineImage } { 4 } @@ -888,10 +944,10 @@ \def\markdownRendererContentBlockCode{% \markdownRendererContentBlockCodePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { contentBlockCode } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { contentBlockCode } { 5 } @@ -899,10 +955,10 @@ \def\markdownRendererUlBegin{% \markdownRendererUlBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ulBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ulBegin } { 0 } @@ -910,10 +966,10 @@ \def\markdownRendererUlBeginTight{% \markdownRendererUlBeginTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ulBeginTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ulBeginTight } { 0 } @@ -921,10 +977,10 @@ \def\markdownRendererUlItem{% \markdownRendererUlItemPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ulItem } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ulItem } { 0 } @@ -932,10 +988,10 @@ \def\markdownRendererUlItemEnd{% \markdownRendererUlItemEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ulItemEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ulItemEnd } { 0 } @@ -943,10 +999,10 @@ \def\markdownRendererUlEnd{% \markdownRendererUlEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ulEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ulEnd } { 0 } @@ -954,10 +1010,10 @@ \def\markdownRendererUlEndTight{% \markdownRendererUlEndTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { ulEndTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { ulEndTight } { 0 } @@ -965,10 +1021,10 @@ \def\markdownRendererOlBegin{% \markdownRendererOlBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olBegin } { 0 } @@ -976,10 +1032,10 @@ \def\markdownRendererOlBeginTight{% \markdownRendererOlBeginTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olBeginTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olBeginTight } { 0 } @@ -987,10 +1043,10 @@ \def\markdownRendererFancyOlBegin{% \markdownRendererFancyOlBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlBegin } { 2 } @@ -998,10 +1054,10 @@ \def\markdownRendererFancyOlBeginTight{% \markdownRendererFancyOlBeginTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlBeginTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlBeginTight } { 2 } @@ -1009,10 +1065,10 @@ \def\markdownRendererOlItem{% \markdownRendererOlItemPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olItem } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olItem } { 0 } @@ -1020,10 +1076,10 @@ \def\markdownRendererOlItemEnd{% \markdownRendererOlItemEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olItemEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olItemEnd } { 0 } @@ -1031,10 +1087,10 @@ \def\markdownRendererOlItemWithNumber{% \markdownRendererOlItemWithNumberPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olItemWithNumber } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olItemWithNumber } { 1 } @@ -1042,10 +1098,10 @@ \def\markdownRendererFancyOlItem{% \markdownRendererFancyOlItemPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlItem } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlItem } { 0 } @@ -1053,10 +1109,10 @@ \def\markdownRendererFancyOlItemEnd{% \markdownRendererFancyOlItemEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlItemEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlItemEnd } { 0 } @@ -1064,10 +1120,10 @@ \def\markdownRendererFancyOlItemWithNumber{% \markdownRendererFancyOlItemWithNumberPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlItemWithNumber } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlItemWithNumber } { 1 } @@ -1075,10 +1131,10 @@ \def\markdownRendererOlEnd{% \markdownRendererOlEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olEnd } { 0 } @@ -1086,10 +1142,10 @@ \def\markdownRendererOlEndTight{% \markdownRendererOlEndTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { olEndTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { olEndTight } { 0 } @@ -1097,10 +1153,10 @@ \def\markdownRendererFancyOlEnd{% \markdownRendererFancyOlEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlEnd } { 0 } @@ -1108,10 +1164,10 @@ \def\markdownRendererFancyOlEndTight{% \markdownRendererFancyOlEndTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { fancyOlEndTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { fancyOlEndTight } { 0 } @@ -1119,10 +1175,10 @@ \def\markdownRendererDlBegin{% \markdownRendererDlBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlBegin } { 0 } @@ -1130,10 +1186,10 @@ \def\markdownRendererDlBeginTight{% \markdownRendererDlBeginTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlBeginTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlBeginTight } { 0 } @@ -1141,10 +1197,10 @@ \def\markdownRendererDlItem{% \markdownRendererDlItemPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlItem } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlItem } { 1 } @@ -1152,10 +1208,10 @@ \def\markdownRendererDlItemEnd{% \markdownRendererDlItemEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlItemEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlItemEnd } { 0 } @@ -1163,10 +1219,10 @@ \def\markdownRendererDlDefinitionBegin{% \markdownRendererDlDefinitionBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlDefinitionBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlDefinitionBegin } { 0 } @@ -1174,10 +1230,10 @@ \def\markdownRendererDlDefinitionEnd{% \markdownRendererDlDefinitionEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlDefinitionEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlDefinitionEnd } { 0 } @@ -1185,10 +1241,10 @@ \def\markdownRendererDlEnd{% \markdownRendererDlEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlEnd } { 0 } @@ -1196,10 +1252,10 @@ \def\markdownRendererDlEndTight{% \markdownRendererDlEndTightPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { dlEndTight } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { dlEndTight } { 0 } @@ -1207,10 +1263,10 @@ \def\markdownRendererEmphasis{% \markdownRendererEmphasisPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { emphasis } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { emphasis } { 1 } @@ -1218,10 +1274,10 @@ \def\markdownRendererStrongEmphasis{% \markdownRendererStrongEmphasisPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { strongEmphasis } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { strongEmphasis } { 1 } @@ -1229,10 +1285,10 @@ \def\markdownRendererBlockQuoteBegin{% \markdownRendererBlockQuoteBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { blockQuoteBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { blockQuoteBegin } { 0 } @@ -1240,10 +1296,10 @@ \def\markdownRendererBlockQuoteEnd{% \markdownRendererBlockQuoteEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { blockQuoteEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { blockQuoteEnd } { 0 } @@ -1251,10 +1307,10 @@ \def\markdownRendererInputVerbatim{% \markdownRendererInputVerbatimPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { inputVerbatim } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { inputVerbatim } { 1 } @@ -1262,10 +1318,10 @@ \def\markdownRendererInputFencedCode{% \markdownRendererInputFencedCodePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { inputFencedCode } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { inputFencedCode } { 2 } @@ -1273,10 +1329,10 @@ \def\markdownRendererJekyllDataBegin{% \markdownRendererJekyllDataBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataBegin } { 0 } @@ -1284,10 +1340,10 @@ \def\markdownRendererJekyllDataEnd{% \markdownRendererJekyllDataEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataEnd } { 0 } @@ -1295,10 +1351,10 @@ \def\markdownRendererJekyllDataMappingBegin{% \markdownRendererJekyllDataMappingBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataMappingBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataMappingBegin } { 2 } @@ -1306,10 +1362,10 @@ \def\markdownRendererJekyllDataMappingEnd{% \markdownRendererJekyllDataMappingEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataMappingEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataMappingEnd } { 0 } @@ -1317,10 +1373,10 @@ \def\markdownRendererJekyllDataSequenceBegin{% \markdownRendererJekyllDataSequenceBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataSequenceBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataSequenceBegin } { 2 } @@ -1328,10 +1384,10 @@ \def\markdownRendererJekyllDataSequenceEnd{% \markdownRendererJekyllDataSequenceEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataSequenceEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataSequenceEnd } { 0 } @@ -1339,10 +1395,10 @@ \def\markdownRendererJekyllDataBoolean{% \markdownRendererJekyllDataBooleanPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataBoolean } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataBoolean } { 2 } @@ -1350,10 +1406,10 @@ \def\markdownRendererJekyllDataNumber{% \markdownRendererJekyllDataNumberPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataNumber } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataNumber } { 2 } @@ -1361,10 +1417,10 @@ \def\markdownRendererJekyllDataString{% \markdownRendererJekyllDataStringPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataString } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataString } { 2 } @@ -1372,10 +1428,10 @@ \def\markdownRendererJekyllDataEmpty{% \markdownRendererJekyllDataEmptyPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { jekyllDataEmpty } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { jekyllDataEmpty } { 1 } @@ -1383,10 +1439,10 @@ \def\markdownRendererHeadingOne{% \markdownRendererHeadingOnePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headingOne } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headingOne } { 1 } @@ -1394,10 +1450,10 @@ \def\markdownRendererHeadingTwo{% \markdownRendererHeadingTwoPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headingTwo } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headingTwo } { 1 } @@ -1405,10 +1461,10 @@ \def\markdownRendererHeadingThree{% \markdownRendererHeadingThreePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headingThree } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headingThree } { 1 } @@ -1416,10 +1472,10 @@ \def\markdownRendererHeadingFour{% \markdownRendererHeadingFourPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headingFour } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headingFour } { 1 } @@ -1427,10 +1483,10 @@ \def\markdownRendererHeadingFive{% \markdownRendererHeadingFivePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headingFive } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headingFive } { 1 } @@ -1438,43 +1494,111 @@ \def\markdownRendererHeadingSix{% \markdownRendererHeadingSixPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headingSix } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headingSix } { 1 } \ExplSyntaxOff -\def\markdownRendererHorizontalRule{% - \markdownRendererHorizontalRulePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\cs_new:Npn + \markdownRendererThematicBreak + { + \cs_if_exist:NTF + \markdownRendererHorizontalRule + { + \markdownWarning + { + Horizontal~rule~renderer~has~been~deprecated,~ + to~be~removed~in~Markdown~3.0.0 + } + \markdownRendererHorizontalRule + } + { + \cs_if_exist:NTF + \markdownRendererHorizontalRulePrototype + { + \markdownWarning + { + Horizontal~rule~renderer~prototype~has~been~deprecated,~ + to~be~removed~in~Markdown~3.0.0 + } + \markdownRendererHorizontalRulePrototype + } + { + \markdownRendererThematicBreakPrototype + } + } + } +\seq_gput_right:Nn \g__markdown_renderers_seq { horizontalRule } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { horizontalRule } { 0 } +\seq_gput_right:Nn + \g__markdown_renderers_seq + { thematicBreak } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { thematicBreak } + { 0 } \ExplSyntaxOff -\def\markdownRendererFootnote{% - \markdownRendererFootnotePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\cs_new:Npn + \markdownRendererNote + { + \cs_if_exist:NTF + \markdownRendererFootnote + { + \markdownWarning + { + Footnote~renderer~has~been~deprecated,~ + to~be~removed~in~Markdown~3.0.0 + } + \markdownRendererFootnote + } + { + \cs_if_exist:NTF + \markdownRendererFootnotePrototype + { + \markdownWarning + { + Footnote~renderer~prototype~has~been~deprecated,~ + to~be~removed~in~Markdown~3.0.0 + } + \markdownRendererFootnotePrototype + } + { + \markdownRendererNotePrototype + } + } + } +\seq_gput_right:Nn \g__markdown_renderers_seq { footnote } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { footnote } { 1 } +\seq_gput_right:Nn + \g__markdown_renderers_seq + { note } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { note } + { 1 } \ExplSyntaxOff \def\markdownRendererCite{% \markdownRendererCitePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { cite } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { cite } { 1 } @@ -1482,10 +1606,10 @@ \def\markdownRendererTextCite{% \markdownRendererTextCitePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { textCite } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { textCite } { 1 } @@ -1493,10 +1617,10 @@ \def\markdownRendererTable{% \markdownRendererTablePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { table } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { table } { 3 } @@ -1504,10 +1628,10 @@ \def\markdownRendererInlineHtmlComment{% \markdownRendererInlineHtmlCommentPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { inlineHtmlComment } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { inlineHtmlComment } { 1 } @@ -1515,10 +1639,10 @@ \def\markdownRendererBlockHtmlCommentBegin{% \markdownRendererBlockHtmlCommentBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { blockHtmlCommentBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { blockHtmlCommentBegin } { 0 } @@ -1526,10 +1650,10 @@ \def\markdownRendererBlockHtmlCommentEnd{% \markdownRendererBlockHtmlCommentEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { blockHtmlCommentEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { blockHtmlCommentEnd } { 0 } @@ -1537,10 +1661,10 @@ \def\markdownRendererInlineHtmlTag{% \markdownRendererInlineHtmlTagPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { inlineHtmlTag } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { inlineHtmlTag } { 1 } @@ -1548,10 +1672,10 @@ \def\markdownRendererInputBlockHtmlElement{% \markdownRendererInputBlockHtmlElementPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { inputBlockHtmlElement } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { inputBlockHtmlElement } { 1 } @@ -1559,10 +1683,10 @@ \def\markdownRendererAttributeIdentifier{% \markdownRendererAttributeIdentifierPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { attributeIdentifier } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { attributeIdentifier } { 1 } @@ -1570,10 +1694,10 @@ \def\markdownRendererAttributeClassName{% \markdownRendererAttributeClassNamePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { attributeClassName } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { attributeClassName } { 1 } @@ -1581,10 +1705,10 @@ \def\markdownRendererAttributeKeyValue{% \markdownRendererAttributeKeyValuePrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { attributeKeyValue } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { attributeKeyValue } { 2 } @@ -1592,10 +1716,10 @@ \def\markdownRendererHeaderAttributeContextBegin{% \markdownRendererHeaderAttributeContextBeginPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headerAttributeContextBegin } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headerAttributeContextBegin } { 0 } @@ -1603,10 +1727,10 @@ \def\markdownRendererHeaderAttributeContextEnd{% \markdownRendererHeaderAttributeContextEndPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { headerAttributeContextEnd } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { headerAttributeContextEnd } { 0 } @@ -1614,10 +1738,10 @@ \def\markdownRendererStrikeThrough{% \markdownRendererStrikeThroughPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { strikeThrough } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { strikeThrough } { 1 } @@ -1625,10 +1749,10 @@ \def\markdownRendererSuperscript{% \markdownRendererSuperscriptPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { superscript } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { superscript } { 1 } @@ -1636,13 +1760,34 @@ \def\markdownRendererSubscript{% \markdownRendererSubscriptPrototype}% \ExplSyntaxOn -\seq_put_right:Nn +\seq_gput_right:Nn \g__markdown_renderers_seq { subscript } -\prop_put:Nnn +\prop_gput:Nnn \g__markdown_renderer_arities_prop { subscript } { 1 } +\def\markdownRendererInputRawInline{% + \markdownRendererInputRawInlinePrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { inputRawInline } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { inputRawInline } + { 2 } +\ExplSyntaxOff +\def\markdownRendererInputRawBlock{% + \markdownRendererInputRawBlockPrototype}% +\ExplSyntaxOn +\seq_gput_right:Nn + \g__markdown_renderers_seq + { inputRawBlock } +\prop_gput:Nnn + \g__markdown_renderer_arities_prop + { inputRawBlock } + { 2 } \ExplSyntaxOff \ExplSyntaxOn \keys_define:nn @@ -1659,6 +1804,10 @@ \let\markdownRendererBlockHtmlCommentBegin=\iffalse \let\markdownRendererBlockHtmlCommentEndPrototype=\fi \let\markdownRendererBlockHtmlCommentEnd=\fi + \cs_undefine:N \markdownRendererFootnote + \cs_undefine:N \markdownRendererFootnotePrototype + \cs_undefine:N \markdownRendererHorizontalRule + \cs_undefine:N \markdownRendererHorizontalRulePrototype } \cs_new:Nn \__markdown_plaintex_define_renderer_prototype:n { @@ -1815,8 +1964,8 @@ \def\markdownRendererHeadingFourPrototype#1{#1}% \def\markdownRendererHeadingFivePrototype#1{#1}% \def\markdownRendererHeadingSixPrototype#1{#1}% -\def\markdownRendererHorizontalRulePrototype{}% -\def\markdownRendererFootnotePrototype#1{#1}% +\def\markdownRendererThematicBreakPrototype{}% +\def\markdownRendererNotePrototype#1{#1}% \def\markdownRendererCitePrototype#1{}% \def\markdownRendererTextCitePrototype#1{}% \def\markdownRendererTickedBoxPrototype{[X]}% @@ -1826,6 +1975,21 @@ \def\markdownRendererSuperscriptPrototype#1{#1}% \def\markdownRendererSubscriptPrototype#1{#1}% \ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputRawInlinePrototype#1#2 + { + \str_case:nn + { #2 } + { + { tex } { \markdownEscape{#1} } + { md } { \markdownInput{#1} } + } + } +\cs_gset_eq:NN + \markdownRendererInputRawBlockPrototype + \markdownRendererInputRawInlinePrototype +\ExplSyntaxOff +\ExplSyntaxOn \seq_new:N \g__markdown_jekyll_data_datatypes_seq \tl_const:Nn \c__markdown_jekyll_data_sequence_tl { sequence } \tl_const:Nn \c__markdown_jekyll_data_mapping_tl { mapping } @@ -2275,6 +2439,13 @@ |endgroup }% |endgroup +\gdef\markdownEscape#1{% + \catcode`\%=14\relax + \catcode`\#=6\relax + \input #1\relax + \catcode`\%=12\relax + \catcode`\#=12\relax +}% \endinput %% %% End of file `markdown.tex'. diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 1a2a989fe82..47bdd40a0df 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -81,7 +81,7 @@ \prop_new:N \g__markdown_latex_option_types_prop \prop_new:N \g__markdown_default_latex_options_prop \tl_const:Nn \c__markdown_option_layer_latex_tl { latex } -\seq_put_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_latex_tl +\seq_gput_right:NV \g__markdown_option_layers_seq \c__markdown_option_layer_latex_tl \cs_new:Nn \__markdown_add_latex_option:nnn { @@ -173,13 +173,18 @@ \seq_map_inline:cn { g__markdown_ ##1 _options_seq } { - \__markdown_latex_define_option_keyval:nn - { ##1 } + \__markdown_with_various_cases:nn { ####1 } + { + \__markdown_latex_define_option_keyval:nnn + { ##1 } + { ####1 } + { ########1 } + } } } } -\cs_new:Nn \__markdown_latex_define_option_keyval:nn +\cs_new:Nn \__markdown_latex_define_option_keyval:nnn { \prop_get:cnN { g__markdown_ #1 _option_types_prop } @@ -188,7 +193,7 @@ \keys_define:nn { markdown/latex-options } { - #2 .code:n = { + #3 .code:n = { \__markdown_set_option_value:nn { #2 } { ##1 } @@ -201,7 +206,7 @@ \keys_define:nn { markdown/latex-options } { - #2 .default:n = { true }, + #3 .default:n = { true }, } } \str_if_eq:VVT @@ -210,7 +215,7 @@ { \tl_set:Nn \l_tmpa_tl - { #2 } + { #3 } \tl_reverse:N \l_tmpa_tl \str_if_eq:enF @@ -223,7 +228,7 @@ \msg_error:nnn { __markdown } { malformed-name-for-clist-option } - { #2 } + { #3 } } \tl_set:Nx \l_tmpa_tl @@ -312,16 +317,20 @@ } \cs_new:Nn \__markdown_latex_define_renderer:nNn { - \keys_define:nn - { markdown/latex-options/renderers } + \__markdown_with_various_cases:nn + { #1 } { - #1 .code:n = { - \cs_generate_from_arg_count:NNnn - #2 - \cs_set:Npn - { #3 } - { ##1 } - }, + \keys_define:nn + { markdown/latex-options/renderers } + { + ##1 .code:n = { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ####1 } + }, + } } } \cs_generate_variant:Nn @@ -351,16 +360,20 @@ } \cs_new:Nn \__markdown_latex_define_renderer_prototype:nNn { - \keys_define:nn - { markdown/latex-options/renderer-prototypes } + \__markdown_with_various_cases:nn + { #1 } { - #1 .code:n = { - \cs_generate_from_arg_count:NNnn - #2 - \cs_set:Npn - { #3 } - { ##1 } - }, + \keys_define:nn + { markdown/latex-options/renderer-prototypes } + { + ##1 .code:n = { + \cs_generate_from_arg_count:NNnn + #2 + \cs_set:Npn + { #3 } + { ####1 } + }, + } } } \cs_generate_variant:Nn @@ -397,13 +410,13 @@ \ExplSyntaxOn \newcommand\markdownLaTeXThemeName{} \seq_new:N \g__markdown_latex_themes_seq -\seq_put_right:NV +\seq_gput_right:NV \g__markdown_latex_themes_seq \markdownLaTeXThemeName \newcommand\markdownLaTeXThemeLoad[2]{ \def\@tempa{% \def\markdownLaTeXThemeName{#2} - \seq_put_right:NV + \seq_gput_right:NV \g__markdown_latex_themes_seq \markdownLaTeXThemeName \RequirePackage{#1} @@ -437,17 +450,44 @@ { markdown/latex-options/renderers } { #1 } }, - rendererPrototypes .code:n = { - \keys_set:nn - { markdown/latex-options/renderer-prototypes } - { #1 } - }, + } +\__markdown_with_various_cases:nn + { rendererPrototypes } + { + \keys_define:nn + { markdown/latex-options } + { + #1 .code:n = { + \keys_set:nn + { markdown/latex-options/renderer-prototypes } + { ##1 } + }, + } + } +\keys_define:nn + { markdown/latex-options } + { code .code:n = { #1 }, - jekyllDataRenderers .code:n = { - \keys_set:nn - { markdown/latex-options/jekyll-data-renderers } - { #1 } - }, + } +\__markdown_with_various_cases:nn + { jekyllDataRenderers } + { + \keys_define:nn + { markdown/latex-options } + { + #1 .code:n = { + \tl_set:Nn + \l_tmpa_tl + { ##1 } + \tl_replace_all:NnV + \l_tmpa_tl + { / } + \c_backslash_str + \keys_set:nV + { markdown/latex-options/jekyll-data-renderers } + \l_tmpa_tl + }, + } } \keys_define:nn { markdown/latex-options/jekyll-data-renderers } @@ -456,6 +496,10 @@ \tl_set_eq:NN \l_tmpa_tl \l_keys_key_str + \tl_replace_all:NVn + \l_tmpa_tl + \c_backslash_str + { / } \tl_put_right:Nn \l_tmpa_tl { @@ -469,6 +513,12 @@ \cs_generate_variant:Nn \keys_define:nn { nV } +\cs_generate_variant:Nn + \tl_replace_all:Nnn + { NVn } +\cs_generate_variant:Nn + \tl_replace_all:Nnn + { NnV } \ExplSyntaxOff \markdownIfOption{plain}{\iffalse}{\iftrue} \markdownIfOption{tightLists}{ @@ -607,7 +657,7 @@ dlEndTight = {\markdownRendererDlEnd}}} } \ExplSyntaxOff -\RequirePackage{amsmath,ifthen} +\RequirePackage{amsmath} \@ifpackageloaded{unicode-math}{ \markdownSetup{rendererPrototypes={ untickedBox = {$\mdlgwhtsquare$}, @@ -637,29 +687,33 @@ \else \texttt{#1}% \fi + }}} +\ExplSyntaxOn +\markdownSetup{ + rendererPrototypes = { + contentBlock = { + \str_case:nnF + { #1 } + { + { csv } + { + \begin{table} + \begin{center} + \csvautotabular{#3} + \end{center} + \tl_if_empty:nF + { #4 } + { \caption{#4} } + \end{table} + } + { tex } { \markdownEscape{#3} } + } + { \markdownInput{#3} } + }, }, - contentBlock = {% - \ifthenelse{\equal{#1}{csv}}{% - \begin{table}% - \begin{center}% - \csvautotabular{#3}% - \end{center} - \ifx\empty#4\empty\else - \caption{#4}% - \fi - \end{table}% - }{% - \ifthenelse{\equal{#1}{tex}}{% - \catcode`\%=14\relax - \catcode`\#=6\relax - \input #3\relax - \catcode`\%=12\relax - \catcode`\#=12\relax - }{% - \markdownInput{#3}% - }% - }% - }, +} +\ExplSyntaxOff +\markdownSetup{rendererPrototypes={ image = {% \begin{figure}% \begin{center}% @@ -724,8 +778,8 @@ \catcode`\#=12\relax }% \fi}, - horizontalRule = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, - footnote = {\footnote{#1}}}} + thematicBreak = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, + note = {\footnote{#1}}}} \ExplSyntaxOn \def\markdownLATEXStrongEmphasis#1{% \str_if_in:NnTF @@ -1161,7 +1215,6 @@ \addto@hook\markdownLaTeXTable{#1\\}% \expandafter\@gobble \fi\markdownLaTeXRenderTableCell} -\fi \ExplSyntaxOn \keys_define:nn { markdown/jekyllData } @@ -1201,6 +1254,23 @@ } } }{} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputRawInlinePrototype#1#2 + { + \str_case:nn + { #2 } + { + { tex } { \markdownEscape{#1} } + { latex } { \markdownEscape{#1} } + { md } { \markdownInput{#1} } + } + } +\cs_gset_eq:NN + \markdownRendererInputRawBlockPrototype + \markdownRendererInputRawInlinePrototype +\ExplSyntaxOff +\fi % Closes `\markdownIfOption{Plain}{\iffalse}{iftrue}` \newcommand\markdownMakeOther{% \count0=128\relax \loop diff --git a/Master/texmf-dist/tex/luatex/markdown/markdown.lua b/Master/texmf-dist/tex/luatex/markdown/markdown.lua index 9ad26df6dbe..3afe0a924d4 100644 --- a/Master/texmf-dist/tex/luatex/markdown/markdown.lua +++ b/Master/texmf-dist/tex/luatex/markdown/markdown.lua @@ -58,7 +58,7 @@ -- those in the standard .ins files. -- local metadata = { - version = "2.17.1-0-g8ca83f5", + version = "2.18.0-0-gd8ae860", comment = "A module for the conversion from markdown to plain TeX", author = "John MacFarlane, Hans Hagen, Vít Novotný", copyright = {"2009-2016 John MacFarlane, Hans Hagen", @@ -83,7 +83,7 @@ local walkable_syntax = { Block = { "Blockquote", "Verbatim", - "HorizontalRule", + "ThematicBreak", "BulletList", "OrderedList", "Heading", @@ -128,13 +128,14 @@ defaultOptions.debugExtensions = false defaultOptions.definitionLists = false defaultOptions.eagerCache = true metadata.user_extension_api_version = 2 -metadata.grammar_version = 1 +metadata.grammar_version = 2 defaultOptions.extensions = {} defaultOptions.expectJekyllData = false defaultOptions.fancyLists = false defaultOptions.fencedCode = false defaultOptions.finalizeCache = false defaultOptions.footnotes = false +defaultOptions.notes = false defaultOptions.frozenCacheCounter = 0 defaultOptions.hardLineBreaks = false defaultOptions.hashEnumerators = false @@ -142,9 +143,11 @@ defaultOptions.headerAttributes = false defaultOptions.html = false defaultOptions.hybrid = false defaultOptions.inlineFootnotes = false +defaultOptions.inlineNotes = false defaultOptions.jekyllData = false defaultOptions.pipeTables = false defaultOptions.preserveTabs = false +defaultOptions.rawAttribute = true defaultOptions.relativeReferences = false defaultOptions.shiftHeadings = 0 defaultOptions.slice = "^ $" @@ -185,6 +188,11 @@ function util.cache(dir, string, salt, transform, suffix) end return name end +function util.cache_verbatim(dir, string) + string = string:gsub('[\r\n%s]*$', '') + local name = util.cache(dir, string, nil, nil, ".verbatim") + return name +end function util.table_copy(t) local u = { } for k, v in pairs(t) do u[k] = v end @@ -2408,9 +2416,9 @@ function M.writer.new(options) end self.linebreak = "\\markdownRendererLineBreak\n{}" self.ellipsis = "\\markdownRendererEllipsis{}" - function self.hrule() + function self.thematic_break() if not self.is_writing then return "" end - return "\\markdownRendererHorizontalRule{}" + return "\\markdownRendererThematicBreak{}" end self.escaped_uri_chars = { ["{"] = "\\markdownRendererLeftBrace{}", @@ -2547,8 +2555,7 @@ function M.writer.new(options) end function self.verbatim(s) if not self.is_writing then return "" end - s = string.gsub(s, '[\r\n%s]*$', '') - local name = util.cache(options.cacheDir, s, nil, nil, ".verbatim") + local name = util.cache_verbatim(options.cacheDir, s) return {"\\markdownRendererInputVerbatim{",name,"}"} end function self.document(d) @@ -2851,6 +2858,20 @@ parsers.attribute_value = ( (parsers.dquote / "") + ( parsers.anyescaped - parsers.dquote - parsers.rbrace - parsers.space)^0 +parsers.attribute = (parsers.dash * Cc(".unnumbered")) + + C((parsers.hash + parsers.period) + * parsers.attribute_key) + + Cs( parsers.attribute_key + * parsers.optionalspace * parsers.equal * parsers.optionalspace + * parsers.attribute_value) +parsers.attributes = parsers.lbrace + * parsers.optionalspace + * parsers.attribute + * (parsers.spacechar^1 + * parsers.attribute)^0 + * parsers.optionalspace + * parsers.rbrace + -- block followed by 0 or more optionally -- indented blocks with first line indented. parsers.indented_blocks = function(bl) @@ -2901,8 +2922,8 @@ local function captures_geq_length(_,i,a,b) return #a >= #b and i end -parsers.infostring = (parsers.linechar - (parsers.backtick - + parsers.space^1 * (parsers.newline + parsers.eof)))^0 +parsers.infostring = (parsers.linechar - (parsers.backtick + + parsers.space^1 * (parsers.newline + parsers.eof)))^0 local fenceindent parsers.fencehead = function(char) @@ -3123,31 +3144,27 @@ parsers.between = function(p, starter, ender) end parsers.urlchar = parsers.anyescaped - parsers.newline - parsers.more +parsers.TildeFencedCode + = parsers.fencehead(parsers.tilde) + * Cs(parsers.fencedline(parsers.tilde)^0) + * parsers.fencetail(parsers.tilde) + +parsers.BacktickFencedCode + = parsers.fencehead(parsers.backtick) + * Cs(parsers.fencedline(parsers.backtick)^0) + * parsers.fencetail(parsers.backtick) + parsers.lineof = function(c) return (parsers.leader * (P(c) * parsers.optionalspace)^3 * (parsers.newline * parsers.blankline^1 + parsers.newline^-1 * parsers.eof)) end -parsers.heading_attribute = (parsers.dash * Cc(".unnumbered")) - + C((parsers.hash + parsers.period) - * parsers.attribute_key) - + Cs( parsers.attribute_key - * parsers.optionalspace * parsers.equal * parsers.optionalspace - * parsers.attribute_value) -parsers.HeadingAttributes = parsers.lbrace - * parsers.optionalspace - * parsers.heading_attribute - * (parsers.spacechar^1 - * parsers.heading_attribute)^0 - * parsers.optionalspace - * parsers.rbrace - -- parse Atx heading start and return level -parsers.HeadingStart = #parsers.hash * C(parsers.hash^-6) - * -parsers.hash / length +parsers.heading_start = #parsers.hash * C(parsers.hash^-6) + * -parsers.hash / length -- parse setext header ending and return level -parsers.HeadingLevel = parsers.equal^1 * Cc(1) + parsers.dash^1 * Cc(2) +parsers.heading_level = parsers.equal^1 * Cc(1) + parsers.dash^1 * Cc(2) local function strip_atx_end(s) return s:gsub("[#%s]*\n$","") @@ -3207,8 +3224,8 @@ function M.reader.new(writer, options) str = str:gsub('^' .. min_prefix, '') end if toplevel and (options.texComments or options.hybrid) then - str = lpeg.match(Ct(parsers.commented_line^1), str) - str = util.rope_to_string(str) + str = lpeg.match(Ct(parsers.commented_line^1), str) + str = util.rope_to_string(str) end local res = lpeg.match(grammar(), str) if res == nil then @@ -3521,10 +3538,10 @@ function M.reader.new(writer, options) / self.parser_functions.parse_blocks_nested / writer.blockquote - parsers.HorizontalRule = ( parsers.lineof(parsers.asterisk) - + parsers.lineof(parsers.dash) - + parsers.lineof(parsers.underscore) - ) / writer.hrule + parsers.ThematicBreak = ( parsers.lineof(parsers.asterisk) + + parsers.lineof(parsers.dash) + + parsers.lineof(parsers.underscore) + ) / writer.thematic_break parsers.Reference = parsers.define_reference_parser / register_link @@ -3567,14 +3584,14 @@ function M.reader.new(writer, options) * parsers.ListBlock parsers.TightListItem = function(starter) - return -parsers.HorizontalRule + return -parsers.ThematicBreak * (Cs(starter / "" * parsers.tickbox^-1 * parsers.ListBlock * parsers.NestedList^-1) / self.parser_functions.parse_blocks_nested) * -(parsers.blanklines * parsers.indent) end parsers.LooseListItem = function(starter) - return -parsers.HorizontalRule + return -parsers.ThematicBreak * Cs( starter / "" * parsers.tickbox^-1 * parsers.ListBlock * Cc("\n") * (parsers.NestedList + parsers.ListContinuationBlock^0) * (parsers.blanklines / "\n\n") @@ -3611,7 +3628,7 @@ function M.reader.new(writer, options) + parsers.Reference + (parsers.tightblocksep / "\n") -- parse atx header - parsers.AtxHeading = Cg(parsers.HeadingStart,"level") + parsers.AtxHeading = Cg(parsers.heading_start, "level") * parsers.optionalspace * (C(parsers.line) / strip_atx_end @@ -3623,7 +3640,7 @@ function M.reader.new(writer, options) * Ct(parsers.linechar^1 / self.parser_functions.parse_inlines) * parsers.newline - * parsers.HeadingLevel + * parsers.heading_level * parsers.optionalspace * parsers.newline / writer.heading @@ -3696,7 +3713,7 @@ function M.reader.new(writer, options) Blockquote = parsers.Blockquote, Verbatim = parsers.Verbatim, - HorizontalRule = parsers.HorizontalRule, + ThematicBreak = parsers.ThematicBreak, BulletList = parsers.BulletList, OrderedList = parsers.OrderedList, Heading = parsers.Heading, @@ -4285,74 +4302,22 @@ M.extensions.fenced_code = function(blank_before_code_fence) extend_writer = function(self) local options = self.options - function self.fencedCode(i, s) + function self.fencedCode(s, i) if not self.is_writing then return "" end - s = string.gsub(s, '[\r\n%s]*$', '') - local name = util.cache(options.cacheDir, s, nil, nil, ".verbatim") - return {"\\markdownRendererInputFencedCode{",name,"}{",i,"}"} + local name = util.cache_verbatim(options.cacheDir, s) + return {"\\markdownRendererInputFencedCode{", + name,"}{",self.string(i),"}"} end end, extend_reader = function(self) local parsers = self.parsers local writer = self.writer - local function captures_geq_length(_,i,a,b) - return #a >= #b and i - end - - local infostring = (parsers.linechar - (parsers.backtick - + parsers.space^1 * (parsers.newline + parsers.eof)))^0 - - local fenceindent - local fencehead = function(char) - return C(parsers.nonindentspace) / function(s) fenceindent = #s end - * Cg(char^3, "fencelength") - * parsers.optionalspace * C(infostring) - * parsers.optionalspace * (parsers.newline + parsers.eof) - end - - local fencetail = function(char) - return parsers.nonindentspace - * Cmt(C(char^3) * Cb("fencelength"), captures_geq_length) - * parsers.optionalspace * (parsers.newline + parsers.eof) - + parsers.eof - end - - local fencedline = function(char) - return C(parsers.line - fencetail(char)) - / function(s) - local i = 1 - local remaining = fenceindent - while true do - local c = s:sub(i, i) - if c == " " and remaining > 0 then - remaining = remaining - 1 - i = i + 1 - elseif c == "\t" and remaining > 3 then - remaining = remaining - 4 - i = i + 1 - else - break - end - end - return s:sub(i) - end - end - - local TildeFencedCode - = fencehead(parsers.tilde) - * Cs(fencedline(parsers.tilde)^0) - * fencetail(parsers.tilde) - - local BacktickFencedCode - = fencehead(parsers.backtick) - * Cs(fencedline(parsers.backtick)^0) - * fencetail(parsers.backtick) - - local FencedCode = (TildeFencedCode - + BacktickFencedCode) + local FencedCode = (parsers.TildeFencedCode + + parsers.BacktickFencedCode) / function(infostring, code) - return writer.fencedCode(writer.string(infostring), - self.expandtabs(code)) + local expanded_code = self.expandtabs(code) + return writer.fencedCode(expanded_code, + infostring) end self.insert_pattern("Block after Verbatim", @@ -4362,8 +4327,8 @@ M.extensions.fenced_code = function(blank_before_code_fence) if blank_before_code_fence then fencestart = parsers.fail else - fencestart = fencehead(parsers.backtick) - + fencehead(parsers.tilde) + fencestart = parsers.fencehead(parsers.backtick) + + parsers.fencehead(parsers.tilde) end local EndlineExceptions = parsers.EndlineExceptions + fencestart @@ -4373,19 +4338,19 @@ M.extensions.fenced_code = function(blank_before_code_fence) end } end -M.extensions.footnotes = function(footnotes, inline_footnotes) - assert(footnotes or inline_footnotes) +M.extensions.notes = function(notes, inline_notes) + assert(notes or inline_notes) return { - name = "built-in footnotes syntax extension", + name = "built-in notes syntax extension", extend_writer = function(self) function self.note(s) - return {"\\markdownRendererFootnote{",s,"}"} + return {"\\markdownRendererNote{",s,"}"} end end, extend_reader = function(self) local parsers = self.parsers local writer = self.writer - if inline_footnotes then + if inline_notes then local InlineNote = parsers.circumflex * (parsers.tag / self.parser_functions.parse_inlines_no_inline_note) @@ -4394,7 +4359,7 @@ M.extensions.footnotes = function(footnotes, inline_footnotes) self.insert_pattern("Inline after Emph", InlineNote, "InlineNote") end - if footnotes then + if notes then local function strip_first_char(s) return s:sub(2) end @@ -4450,49 +4415,49 @@ M.extensions.header_attributes = function() local parsers = self.parsers local writer = self.writer - parsers.AtxHeading = Cg(parsers.HeadingStart,"level") - * parsers.optionalspace - * (C(((parsers.linechar - - ((parsers.hash^1 - * parsers.optionalspace - * parsers.HeadingAttributes^-1 - + parsers.HeadingAttributes) - * parsers.optionalspace - * parsers.newline)) - * (parsers.linechar - - parsers.hash - - parsers.lbrace)^0)^1) - / self.parser_functions.parse_inlines) - * Cg(Ct(parsers.newline - + (parsers.hash^1 - * parsers.optionalspace - * parsers.HeadingAttributes^-1 - + parsers.HeadingAttributes) + local AtxHeading = Cg(parsers.heading_start, "level") + * parsers.optionalspace + * (C(((parsers.linechar + - ((parsers.hash^1 * parsers.optionalspace - * parsers.newline), "attributes") - * Cb("level") - * Cb("attributes") - / writer.heading - - parsers.SetextHeading = #(parsers.line * S("=-")) - * (C(((parsers.linechar - - (parsers.HeadingAttributes - * parsers.optionalspace - * parsers.newline)) - * (parsers.linechar - - parsers.lbrace)^0)^1) - / self.parser_functions.parse_inlines) - * Cg(Ct(parsers.newline - + (parsers.HeadingAttributes - * parsers.optionalspace - * parsers.newline)), "attributes") - * parsers.HeadingLevel - * Cb("attributes") - * parsers.optionalspace - * parsers.newline - / writer.heading - - local Heading = parsers.AtxHeading + parsers.SetextHeading + * parsers.attributes^-1 + + parsers.attributes) + * parsers.optionalspace + * parsers.newline)) + * (parsers.linechar + - parsers.hash + - parsers.lbrace)^0)^1) + / self.parser_functions.parse_inlines) + * Cg(Ct(parsers.newline + + (parsers.hash^1 + * parsers.optionalspace + * parsers.attributes^-1 + + parsers.attributes) + * parsers.optionalspace + * parsers.newline), "attributes") + * Cb("level") + * Cb("attributes") + / writer.heading + + local SetextHeading = #(parsers.line * S("=-")) + * (C(((parsers.linechar + - (parsers.attributes + * parsers.optionalspace + * parsers.newline)) + * (parsers.linechar + - parsers.lbrace)^0)^1) + / self.parser_functions.parse_inlines) + * Cg(Ct(parsers.newline + + (parsers.attributes + * parsers.optionalspace + * parsers.newline)), "attributes") + * parsers.heading_level + * Cb("attributes") + * parsers.optionalspace + * parsers.newline + / writer.heading + + local Heading = AtxHeading + SetextHeading self.update_rule("Heading", Heading) end } @@ -4608,14 +4573,14 @@ M.extensions.jekyll_data = function(expect_jekyll_data) local UnexpectedJekyllData = P("---") * parsers.blankline / 0 - * #(-parsers.blankline) -- if followed by blank, it's an hrule + * #(-parsers.blankline) -- if followed by blank, it's thematic break * JekyllData * (P("---") + P("...")) local ExpectedJekyllData = ( P("---") * parsers.blankline / 0 - * #(-parsers.blankline) -- if followed by blank, it's an hrule + * #(-parsers.blankline) -- if followed by blank, it's thematic break )^-1 * JekyllData * (P("---") + P("..."))^-1 @@ -4769,6 +4734,65 @@ M.extensions.pipe_tables = function(table_captions) end } end +M.extensions.raw_attribute = function() + return { + name = "built-in raw_attribute syntax extension", + extend_writer = function(self) + local options = self.options + + function self.rawInline(s, attr) + if not self.is_writing then return "" end + local name = util.cache_verbatim(options.cacheDir, s) + return {"\\markdownRendererInputRawInline{", + name,"}{", self.string(attr),"}"} + end + + if options.fencedCode then + function self.rawBlock(s, attr) + if not self.is_writing then return "" end + local name = util.cache_verbatim(options.cacheDir, s) + return {"\\markdownRendererInputRawBlock{", + name,"}{", self.string(attr),"}"} + end + end + end, extend_reader = function(self) + local options = self.options + local writer = self.writer + + local raw_attribute = parsers.lbrace + * parsers.optionalspace + * parsers.equal + * C(parsers.attribute_key) + * parsers.optionalspace + * parsers.rbrace + + local RawInline = parsers.inticks + * raw_attribute + / writer.rawInline + + self.insert_pattern("Inline before Code", + RawInline, "RawInline") + + if options.fencedCode then + local RawBlock = (parsers.TildeFencedCode + + parsers.BacktickFencedCode) + / function(infostring, code) + local expanded_code = self.expandtabs(code) + local attr = lpeg.match(raw_attribute, infostring) + if attr then + return writer.rawBlock(expanded_code, attr) + else + return writer.fencedCode(expanded_code, + infostring) + end + end + + self.insert_pattern("Block after Verbatim", + RawBlock, "RawBlock") + end + end + } +end M.extensions.strike_through = function() return { name = "built-in strike_through syntax extension", @@ -4906,14 +4930,14 @@ M.extensions.fancy_lists = function() * ListBlock local TightListItem = function(starter) - return -parsers.HorizontalRule + return -parsers.ThematicBreak * (Cs(starter / "" * parsers.tickbox^-1 * ListBlock * NestedList^-1) / self.parser_functions.parse_blocks_nested) * -(parsers.blanklines * parsers.indent) end local LooseListItem = function(starter) - return -parsers.HorizontalRule + return -parsers.ThematicBreak * Cs( starter / "" * parsers.tickbox^-1 * ListBlock * Cc("\n") * (NestedList + ListContinuationBlock^0) * (parsers.blanklines / "\n\n") @@ -5034,6 +5058,11 @@ function M.new(options) table.insert(extensions, pipe_tables_extension) end + if options.rawAttribute then + local raw_attribute_extension = M.extensions.raw_attribute() + table.insert(extensions, raw_attribute_extension) + end + if options.strikeThrough then local strike_through_extension = M.extensions.strike_through() table.insert(extensions, strike_through_extension) @@ -5049,10 +5078,12 @@ function M.new(options) table.insert(extensions, superscript_extension) end - if options.footnotes or options.inlineFootnotes then - local footnotes_extension = M.extensions.footnotes( - options.footnotes, options.inlineFootnotes) - table.insert(extensions, footnotes_extension) + if options.footnotes or options.inlineFootnotes or + options.notes or options.inlineNotes then + local notes_extension = M.extensions.notes( + options.footnotes or options.notes, + options.inlineFootnotes or options.inlineNotes) + table.insert(extensions, notes_extension) end if options.citations then |