From dcd4b33437ee2d76762844fd5b757285a0495900 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 2 Feb 2023 21:15:03 +0000 Subject: markdown (2feb23) git-svn-id: svn://tug.org/texlive/trunk@65715 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/tex/latex/markdown/markdown.sty | 115 +++++++++++++++++----- 1 file changed, 88 insertions(+), 27 deletions(-) (limited to 'Master/texmf-dist/tex/latex/markdown/markdown.sty') diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty index 47bdd40a0df..0dede25d9cc 100644 --- a/Master/texmf-dist/tex/latex/markdown/markdown.sty +++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty @@ -521,9 +521,10 @@ { NnV } \ExplSyntaxOff \markdownIfOption{plain}{\iffalse}{\iftrue} -\markdownIfOption{tightLists}{ - \@ifclassloaded{beamer}{}{\RequirePackage{paralist}}% -}{} +\@ifclassloaded{beamer}{}{% + \markdownIfOption{tightLists}{\RequirePackage{paralist}}{}% + \markdownIfOption{fancyLists}{\RequirePackage{paralist}}{}% +} \ExplSyntaxOn \@ifpackageloaded{paralist}{ \tl_new:N @@ -735,7 +736,7 @@ emphasis = {\emph{#1}}, tickedBox = {$\boxtimes$}, halfTickedBox = {$\boxdot$}, - headerAttributeContextBegin = { + headerAttributeContextBegin = {% \markdownSetup{ rendererPrototypes = { attributeIdentifier = {% @@ -757,29 +758,49 @@ }, }% }, + headerAttributeContextEnd = {}, superscript = {\textsuperscript{#1}}, subscript = {\textsubscript{#1}}, blockQuoteBegin = {\begin{quotation}}, blockQuoteEnd = {\end{quotation}}, inputVerbatim = {\VerbatimInput{#1}}, - inputFencedCode = {% - \ifx\relax#2\relax - \VerbatimInput{#1}% - \else - \@ifundefined{minted@code}{% - \@ifundefined{lst@version}{% - \markdownRendererInputFencedCode{#1}{}% - }{% - \lstinputlisting[language=#2]{#1}% - }% - }{% - \catcode`\#=6\relax - \inputminted{#2}{#1}% - \catcode`\#=12\relax - }% - \fi}, thematicBreak = {\noindent\rule[0.5ex]{\linewidth}{1pt}}, note = {\footnote{#1}}}} +\RequirePackage{ltxcmds} +\ExplSyntaxOn +\cs_gset:Npn + \markdownRendererInputFencedCodePrototype#1#2 + { + \tl_if_empty:nTF + { #2 } + { \markdownRendererInputVerbatim{#1} } + { + \regex_extract_once:nnN + { \w* } + { #2 } + \l_tmpa_seq + \seq_pop_left:NN + \l_tmpa_seq + \l_tmpa_tl + \ltx@ifpackageloaded + { minted } + { + \catcode`\#=6\relax + \exp_args:NV + \inputminted + \l_tmpa_tl + { #1 } + \catcode`\#=12\relax + } + { + \ltx@ifpackageloaded + { listings } + { \lstinputlisting[language=\l_tmpa_tl]{#1} } + { \markdownRendererInputFencedCode{#1}{} } + } + } + } +\ExplSyntaxOff \ExplSyntaxOn \def\markdownLATEXStrongEmphasis#1{% \str_if_in:NnTF @@ -1215,6 +1236,22 @@ \addto@hook\markdownLaTeXTable{#1\\}% \expandafter\@gobble \fi\markdownLaTeXRenderTableCell} + +\markdownIfOption{lineBlocks}{% + \RequirePackage{verse} + \markdownSetup{rendererPrototypes={ + lineBlockBegin = {% + \begingroup + \def\markdownRendererLineBreak{\\}% + \begin{verse}% + }, + lineBlockEnd = {% + \end{verse}% + \endgroup + }, + }} +}{} + \ExplSyntaxOn \keys_define:nn { markdown/jekyllData } @@ -1258,17 +1295,41 @@ \cs_gset:Npn \markdownRendererInputRawInlinePrototype#1#2 { - \str_case:nn + \str_case:nnF + { #2 } + { + { latex } + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \__markdown_plain_tex_default_input_raw_inline_renderer_prototype:nn + { #1 } + { #2 } + } + } +\cs_gset:Npn + \markdownRendererInputRawBlockPrototype#1#2 + { + \str_case:nnF { #2 } { - { tex } { \markdownEscape{#1} } - { latex } { \markdownEscape{#1} } - { md } { \markdownInput{#1} } + { latex } + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { tex } + } + } + { + \__markdown_plain_tex_default_input_raw_block_renderer_prototype:nn + { #1 } + { #2 } } } -\cs_gset_eq:NN - \markdownRendererInputRawBlockPrototype - \markdownRendererInputRawInlinePrototype \ExplSyntaxOff \fi % Closes `\markdownIfOption{Plain}{\iffalse}{iftrue}` \newcommand\markdownMakeOther{% -- cgit v1.2.3