summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/markdown/markdown.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/markdown/markdown.sty')
-rw-r--r--Master/texmf-dist/tex/latex/markdown/markdown.sty164
1 files changed, 107 insertions, 57 deletions
diff --git a/Master/texmf-dist/tex/latex/markdown/markdown.sty b/Master/texmf-dist/tex/latex/markdown/markdown.sty
index 816c56a2a0d..fa84c468857 100644
--- a/Master/texmf-dist/tex/latex/markdown/markdown.sty
+++ b/Master/texmf-dist/tex/latex/markdown/markdown.sty
@@ -6,7 +6,7 @@
%%
%% markdown.dtx (with options: `latex')
%%
-%% Copyright (C) 2016-2020 Vít Novotný
+%% Copyright (C) 2016-2021 Vít Novotný
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
@@ -45,18 +45,63 @@
%%
%% The names of the source files used are shown above.
%%
-\NeedsTeXFormat{LaTeX2e}%
\RequirePackage{keyval}
-\RequirePackage{url}
-\RequirePackage{graphicx}
-\RequirePackage{ifthen}
-\RequirePackage{fancyvrb}
-\RequirePackage{csvsimple}
-\RequirePackage{gobble}
+\RequirePackage{xstring}
\newenvironment{markdown}\relax\relax
\newenvironment{markdown*}[1]\relax\relax
\newcommand\markdownSetup[1]{%
\setkeys{markdownOptions}{#1}}%
+\newcommand\markdownSetupSnippet[2]{%
+ \@ifundefined
+ {markdownLaTeXSetupSnippet\markdownLaTeXThemeName#1}{%
+ \newtoks\next
+ \next={#2}%
+ \expandafter\let\csname markdownLaTeXSetupSnippet%
+ \markdownLaTeXThemeName#1\endcsname=\next
+ }{%
+ \markdownWarning
+ {Redefined setup snippet \markdownLaTeXThemeName#1}%
+ \csname markdownLaTeXSetupSnippet%
+ \markdownLaTeXThemeName#1\endcsname={#2}%
+ }}%
+\newif\ifmarkdownLaTeXPlain
+ \markdownLaTeXPlainfalse
+\define@key{markdownOptions}{plain}[true]{%
+ \ifmarkdownLaTeXLoaded
+ \markdownWarning
+ {The plain option must be specified when loading the package}%
+ \else
+ \markdownLaTeXPlaintrue
+ \fi}
+\newif\ifmarkdownLaTeXLoaded
+ \markdownLaTeXLoadedfalse
+\AtEndOfPackage{\markdownLaTeXLoadedtrue}%
+\define@key{markdownOptions}{theme}{%
+ \IfSubStr{#1}{/}{}{%
+ \markdownError
+ {Won't load theme with unqualified name #1}%
+ {Theme names must contain at least one forward slash}}%
+ \StrSubstitute{#1}{/}{_}[\markdownLaTeXThemePackageName]%
+ \edef\markdownLaTeXThemePackageName{%
+ markdowntheme\markdownLaTeXThemePackageName}%
+ \expandafter\markdownLaTeXThemeLoad\expandafter{%
+ \markdownLaTeXThemePackageName}{#1/}}%
+\newcommand\markdownLaTeXThemeName{}%
+\newcommand\markdownLaTeXThemeLoad[2]{%
+ \ifmarkdownLaTeXLoaded
+ \def\markdownLaTeXThemeName{#2}%
+ \RequirePackage{#1}%
+ \def\markdownLaTeXThemeName{}%
+ \else
+ \AtEndOfPackage{%
+ \def\markdownLaTeXThemeName{#2}%
+ \RequirePackage{#1}%
+ \def\markdownLaTeXThemeName{}}%
+ \fi}%
+\@onlypreamble\KV@markdownOptions@theme
+\define@key{markdownOptions}{snippet}{%
+ \expandafter\markdownSetup\expandafter{%
+ \the\csname markdownLaTeXSetupSnippet#1\endcsname}}%
\define@key{markdownOptions}{helperScriptFileName}{%
\def\markdownOptionHelperScriptFileName{#1}}%
\define@key{markdownOptions}{inputTempFileName}{%
@@ -115,8 +160,12 @@
\def\markdownOptionSlice{#1}}%
\define@key{markdownOptions}{startNumber}[true]{%
\def\markdownOptionStartNumber{#1}}%
+\define@key{markdownOptions}{stripIndent}[true]{%
+ \def\markdownOptionStripIndent{#1}}%
\define@key{markdownOptions}{tableCaptions}[true]{%
\def\markdownOptionTableCaptions{#1}}%
+\define@key{markdownOptions}{texComments}[true]{%
+ \def\markdownOptionTeXComments{#1}}%
\define@key{markdownOptions}{tightLists}[true]{%
\def\markdownOptionTightLists{#1}}%
\define@key{markdownOptions}{underscores}[true]{%
@@ -249,6 +298,8 @@
\renewcommand\markdownRendererTextCite[1]{#1}}%
\define@key{markdownRenderers}{table}{%
\renewcommand\markdownRendererTable[3]{#1}}%
+\define@key{markdownRenderers}{inlineHtmlComment}{%
+ \renewcommand\markdownRendererInlineHtmlComment[1]{#1}}%
\define@key{markdownRendererPrototypes}{interblockSeparator}{%
\renewcommand\markdownRendererInterblockSeparatorPrototype{#1}}%
\define@key{markdownRendererPrototypes}{lineBreak}{%
@@ -367,13 +418,15 @@
\renewcommand\markdownRendererTextCitePrototype[1]{#1}}%
\define@key{markdownRendererPrototypes}{table}{%
\renewcommand\markdownRendererTablePrototype[3]{#1}}%
-\input markdown
+\define@key{markdownRendererPrototypes}{inlineHtmlComment}{%
+ \renewcommand\markdownRendererInlineHtmlCommentPrototype[1]{#1}}%
+\newcommand\markdownInfo[1]{\PackageInfo{markdown}{#1}}%
+\newcommand\markdownWarning[1]{\PackageWarning{markdown}{#1}}%
+\newcommand\markdownError[2]{\PackageError{markdown}{#1}{#2.}}%
+\input markdown/markdown
\def\markdownVersionSpace{ }%
\ProvidesPackage{markdown}[\markdownLastModified\markdownVersionSpace v%
\markdownVersion\markdownVersionSpace markdown renderer]%
-\renewcommand\markdownInfo[1]{\PackageInfo{markdown}{#1}}%
-\renewcommand\markdownWarning[1]{\PackageWarning{markdown}{#1}}%
-\renewcommand\markdownError[2]{\PackageError{markdown}{#1}{#2.}}%
\let\markdownInputPlainTeX\markdownInput
\renewcommand\markdownInput[2][]{%
\begingroup
@@ -403,13 +456,15 @@
\define@key{markdownOptions}{rendererPrototypes}{%
\setkeys{markdownRendererPrototypes}{#1}%
\def\KV@prefix{KV@markdownOptions@}}%
-\ifx\markdownOptionTightLists\undefined
- \@ifclassloaded{beamer}{}{
- \RequirePackage{paralist}}
-\else
- \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{
- \RequirePackage{paralist}}
-\fi
+\ifmarkdownLaTeXPlain\else
+\RequirePackage{ifthen}
+\@ifundefined{markdownOptionTightLists}{%
+ \@ifclassloaded{beamer}{}{%
+ \RequirePackage{paralist}}%
+}{%
+ \ifthenelse{\equal{\markdownOptionTightLists}{false}}{}{%
+ \RequirePackage{paralist}}%
+}%
\@ifpackageloaded{paralist}{
\markdownSetup{rendererPrototypes={
ulBeginTight = {\begin{compactitem}},
@@ -426,6 +481,9 @@
olEndTight = {\markdownRendererOlEnd},
dlBeginTight = {\markdownRendererDlBegin},
dlEndTight = {\markdownRendererDlEnd}}}}
+\RequirePackage{csvsimple}
+\RequirePackage{fancyvrb}
+\RequirePackage{graphicx}
\markdownSetup{rendererPrototypes={
lineBreak = {\\},
leftBrace = {\textbraceleft},
@@ -459,10 +517,10 @@
\label{fig:#1}%
\end{figure}},
ulBegin = {\begin{itemize}},
- ulItem = {\item},
+ ulItem = {\item{}},
ulEnd = {\end{itemize}},
olBegin = {\begin{enumerate}},
- olItem = {\item},
+ olItem = {\item{}},
olItemWithNumber = {\item[#1.]},
olEnd = {\end{enumerate}},
dlBegin = {\begin{description}},
@@ -476,39 +534,30 @@
\ifx\relax#2\relax
\VerbatimInput{#1}%
\else
- \ifx\minted@code\undefined
- \ifx\lst@version\undefined
+ \@ifundefined{minted@code}{%
+ \@ifundefined{lst@version}{%
\markdownRendererInputFencedCode{#1}{}%
- \else
+ }{%
\lstinputlisting[language=#2]{#1}%
- \fi
- \else
+ }%
+ }{%
\inputminted{#2}{#1}%
- \fi
+ }%
\fi},
horizontalRule = {\noindent\rule[0.5ex]{\linewidth}{1pt}},
footnote = {\footnote{#1}}}}
-\newif\ifmarkdownLATEXStrongEmphasisNested
-\markdownLATEXStrongEmphasisNestedfalse
-\markdownSetup{rendererPrototypes={
- strongEmphasis = {%
- \ifmarkdownLATEXStrongEmphasisNested
- \markdownLATEXStrongEmphasisNestedfalse
- \textmd{#1}%
- \markdownLATEXStrongEmphasisNestedtrue
- \else
- \markdownLATEXStrongEmphasisNestedtrue
- \textbf{#1}%
- \markdownLATEXStrongEmphasisNestedfalse
- \fi}}}
-\ifx\chapter\undefined
+\def\markdownLATEXStrongEmphasis#1{%
+ \IfSubStr\f@series{b}{\textnormal{#1}}{\textbf{#1}}}
+\markdownSetup{rendererPrototypes={strongEmphasis={%
+ \protect\markdownLATEXStrongEmphasis{#1}}}}
+\@ifundefined{chapter}{%
\markdownSetup{rendererPrototypes = {
headingOne = {\section{#1}},
headingTwo = {\subsection{#1}},
headingThree = {\subsubsection{#1}},
headingFour = {\paragraph{#1}\leavevmode},
headingFive = {\subparagraph{#1}\leavevmode}}}
-\else
+}{%
\markdownSetup{rendererPrototypes = {
headingOne = {\chapter{#1}},
headingTwo = {\section{#1}},
@@ -516,9 +565,10 @@
headingFour = {\subsubsection{#1}},
headingFive = {\paragraph{#1}\leavevmode},
headingSix = {\subparagraph{#1}\leavevmode}}}
-\fi
+}%
\newcount\markdownLaTeXCitationsCounter
+\RequirePackage{gobble}
\def\markdownLaTeXBasicCitations#1#2#3#4#5#6{%
\advance\markdownLaTeXCitationsCounter by 1\relax
\ifx\relax#4\relax
@@ -691,47 +741,48 @@
cite = {%
\markdownLaTeXCitationsCounter=1%
\def\markdownLaTeXCitationsTotal{#1}%
- \ifx\autocites\undefined
- \ifx\citep\undefined
+ \@ifundefined{autocites}{%
+ \@ifundefined{citep}{%
\expandafter\expandafter\expandafter
\markdownLaTeXBasicCitations
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter}%
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter}%
- \else
+ }{%
\expandafter\expandafter\expandafter
\markdownLaTeXNatbibCitations
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter}%
- \fi
- \else
+ }%
+ }{%
\expandafter\expandafter\expandafter
\markdownLaTeXBibLaTeXCitations
\expandafter{\expandafter}%
- \fi},
+ }},
textCite = {%
\markdownLaTeXCitationsCounter=1%
\def\markdownLaTeXCitationsTotal{#1}%
- \ifx\autocites\undefined
- \ifx\citep\undefined
+ \@ifundefined{autocites}{%
+ \@ifundefined{citep}{%
\expandafter\expandafter\expandafter
\markdownLaTeXBasicTextCitations
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter}%
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter}%
- \else
+ }{%
\expandafter\expandafter\expandafter
\markdownLaTeXNatbibTextCitations
\expandafter\expandafter\expandafter{%
\expandafter\expandafter\expandafter}%
- \fi
- \else
+ }%
+ }{%
\expandafter\expandafter\expandafter
\markdownLaTeXBibLaTeXTextCitations
\expandafter{\expandafter}%
- \fi}}}
+ }}}}
+\RequirePackage{url}
\def\markdownRendererLinkPrototype{%
\begingroup
\catcode`\#=12
@@ -794,8 +845,6 @@
\fi
\advance\markdownLaTeXRowCounter by 1\relax
\ifnum\markdownLaTeXRowCounter>\markdownLaTeXRowTotal\relax
- \markdownInfo{\the\markdownLaTeXTable}
- \markdownInfo{\the\markdownLaTeXTableEnd}
\the\markdownLaTeXTable
\the\markdownLaTeXTableEnd
\expandafter\@gobble
@@ -818,6 +867,7 @@
\addto@hook\markdownLaTeXTable{#1\\}%
\expandafter\@gobble
\fi\markdownLaTeXRenderTableCell}
+\fi
\newcommand\markdownMakeOther{%
\count0=128\relax
\loop