From ecdd3beb4fb3bcd9ea2f1c6349a68f74a40f1679 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Fri, 28 Apr 2023 03:01:37 +0000 Subject: CTAN sync 202304280301 --- .../contrib/context-collating-marks/LICENSE | 1 + .../contrib/context-collating-marks/README.md | 17 + .../contrib/context-collating-marks/VERSION | 1 + .../doc/context/third/collating-marks/README.md | 46 + .../t-collatingmarks-module-doc.pdf | Bin 0 -> 140294 bytes .../t-collatingmarks-module-doc.tex | 3 + .../third/collating-marks/t-collatingmarks.mkiv | 174 + macros/generic/markdown/CHANGES.md | 55 +- macros/generic/markdown/README.md | 6 +- macros/generic/markdown/VERSION | 2 +- macros/generic/markdown/examples/context-mkii.tex | 70 - macros/generic/markdown/examples/context-mkiv.tex | 2 +- macros/generic/markdown/examples/latex-luatex.tex | 56 + macros/generic/markdown/examples/latex-pdftex.tex | 76 + macros/generic/markdown/examples/latex-xetex.tex | 1 + macros/generic/markdown/examples/latex.tex | 84 - .../markdown/libraries/markdown-tinyyaml.lua | 18 +- macros/generic/markdown/markdown.dtx | 640 +- macros/generic/markdown/markdown.html | 10786 ++++++++++--------- macros/generic/markdown/markdown.pdf | Bin 998227 -> 1011455 bytes macros/latex/contrib/photobook/README.md | 7 + macros/latex/contrib/photobook/photobook.cls | 112 +- macros/latex/contrib/photobook/photobook.pdf | Bin 143821 -> 143897 bytes .../latex/contrib/proflycee/doc/ProfLycee-doc.pdf | Bin 848758 -> 929713 bytes .../latex/contrib/proflycee/doc/ProfLycee-doc.tex | 1446 ++- .../proflycee/doc/graphics/integr_nwks_a.png | Bin 0 -> 4779 bytes .../proflycee/doc/graphics/integr_nwks_b.png | Bin 0 -> 5332 bytes macros/latex/contrib/proflycee/tex/ProfLycee.sty | 3 +- .../proflycee/tex/proflycee-tools-analyse.tex | 148 + .../proflycee/tex/proflycee-tools-graphiques.tex | 4 +- .../proflycee/tex/proflycee-tools-listings.tex | 8 +- .../proflycee/tex/proflycee-tools-minted.tex | 4 +- .../proflycee/tex/proflycee-tools-piton.tex | 4 +- .../proflycee/tex/proflycee-tools-pythontex.tex | 46 +- 34 files changed, 7462 insertions(+), 6358 deletions(-) create mode 100644 macros/context/contrib/context-collating-marks/LICENSE create mode 100644 macros/context/contrib/context-collating-marks/README.md create mode 100644 macros/context/contrib/context-collating-marks/VERSION create mode 100644 macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/README.md create mode 100644 macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf create mode 100644 macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex create mode 100644 macros/context/contrib/context-collating-marks/tex/context/third/collating-marks/t-collatingmarks.mkiv delete mode 100644 macros/generic/markdown/examples/context-mkii.tex create mode 100644 macros/generic/markdown/examples/latex-luatex.tex create mode 100644 macros/generic/markdown/examples/latex-pdftex.tex create mode 120000 macros/generic/markdown/examples/latex-xetex.tex delete mode 100644 macros/generic/markdown/examples/latex.tex create mode 100644 macros/latex/contrib/proflycee/doc/graphics/integr_nwks_a.png create mode 100644 macros/latex/contrib/proflycee/doc/graphics/integr_nwks_b.png (limited to 'macros') diff --git a/macros/context/contrib/context-collating-marks/LICENSE b/macros/context/contrib/context-collating-marks/LICENSE new file mode 100644 index 0000000000..a7a158b93c --- /dev/null +++ b/macros/context/contrib/context-collating-marks/LICENSE @@ -0,0 +1 @@ +Public Domain \ No newline at end of file diff --git a/macros/context/contrib/context-collating-marks/README.md b/macros/context/contrib/context-collating-marks/README.md new file mode 100644 index 0000000000..bbdd0eff82 --- /dev/null +++ b/macros/context/contrib/context-collating-marks/README.md @@ -0,0 +1,17 @@ +# Module: Collating Marks + +## Editorial + +Author = W. Egger +Version = 2023.04.15 +License = Public Domain + +## Introduction + +Collating marks are small black rules placed on the spine of printed sections. On each section the mark is moved by the length of the black rule. When the book is assembled on the spine appears a stair like pattern. Continuity of this pattern insures that the book is ordered in the correct sequence of sections. + +## Description + +The module is used in connection with arranging pages for folding to form sections. + +Depending on the arranging scheme used the module must be set up accordingly in the set of MetaPost variables. \ No newline at end of file diff --git a/macros/context/contrib/context-collating-marks/VERSION b/macros/context/contrib/context-collating-marks/VERSION new file mode 100644 index 0000000000..a327302c23 --- /dev/null +++ b/macros/context/contrib/context-collating-marks/VERSION @@ -0,0 +1 @@ +2023.04.26 diff --git a/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/README.md b/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/README.md new file mode 100644 index 0000000000..b953b7761f --- /dev/null +++ b/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/README.md @@ -0,0 +1,46 @@ +# Module: Collating Marks + +## Editorial + +Author = W. Egger +Version = 2023.04.15 +License = Public Domain + +## Introduction + +Collating marks are small black rules placed on the spine of printed sections. On each section the mark is moved by the length of the black rule. When the book is assembled on the spine appears a stair like pattern. Continuity of this pattern insures that the book is ordered in the correct sequence of sections. + +## Usage + +The module is used in connection with arranging pages for folding to form sections. + +Depending on the arranging scheme used the module must be set up accordingly in the set of MetaPost variables. + +### Example: + +Example setup for the collating marks: + +\usemodule[collatingmarks][Collatingmarks=yes] + +\setupMPvariables + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0.5mm, % used for correction if horizontal page-shifting is used + frenchdoors=false, + wickel=false] + +This setup is used for the arranging scheme \setuparranging[2*4*2] which indicates that it is double-sided printed with 4 pages recto and verso and there are two sheets of paper forming together the sections containing 16 pages. + +The shift parameter is used to adjust the position of the collating mark centered on the spine. This is specially important when a horizontal shift-list is used for arranging! + +Example setup for horizontal page shifting: + +\definepageshift + [hor] + [horizontal] + [1mm,-1mm,.75mm,-.75mm,.5mm,-.5mm,.25mm,0mm, + 0mm,-.25mm,.5mm,-.5mm,.75mm,-.75mm,1mm,-1mm] + +\setuppageshift[paper][hor] %paper= arrange only, horizontal only + +\setuparranging[2*4*2] diff --git a/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf b/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf new file mode 100644 index 0000000000..52bf0eed68 Binary files /dev/null and b/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.pdf differ diff --git a/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex b/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex new file mode 100644 index 0000000000..ab3abb9aa3 --- /dev/null +++ b/macros/context/contrib/context-collating-marks/doc/context/third/collating-marks/t-collatingmarks-module-doc.tex @@ -0,0 +1,3 @@ +The documentation of this module can be created from the source-file by running: + +mtxrun --script modules --process t-collatingmarks.tex \ No newline at end of file diff --git a/macros/context/contrib/context-collating-marks/tex/context/third/collating-marks/t-collatingmarks.mkiv b/macros/context/contrib/context-collating-marks/tex/context/third/collating-marks/t-collatingmarks.mkiv new file mode 100644 index 0000000000..c0f13da3d0 --- /dev/null +++ b/macros/context/contrib/context-collating-marks/tex/context/third/collating-marks/t-collatingmarks.mkiv @@ -0,0 +1,174 @@ +%D \module +%D [ file=t-collatingmarks, +%D version=2023.04.15, +%D title=Collating Marks \CONTEXT\ User Module, +%D subtitle=Environment for collating marks, +%D author={W. Egger}, +%D date=\currentdate, +%D copyright={W. Egger}, +%D email=w.egger@boede.nl, +%D license=Public Domain] +%D +%D The documentation can be generated with: +%D mtxrun --script modules --process t-collatingmarks.tex + +\startmodule[collatingmarks] + +\writestatus{loading}{Context Module for Collating Marks} + +%D\enablemode[demo] + +%D \startsubject[title={Introduction}] +%D +%D This code is based on the work of Thomas A. Schmitz, who created the module for +%D different crop marks. +%D +%D If a book consists of multiple sections, each section should be marked +%D along the spine with a collating mark. This mark moves down along the spine +%D according to the number of the section. After collating the book it becomes +%D easy tho check whether the sequence of the sections is correct. One should +%D see a \quotation{stair case} on the spine of the book. +%D \stopsubject +%D +%D \startsubject[title={Using the module}] +%D +%D If the collating marks should be placed, then the system should be setup with +%D \type{\setupMPvariables[pages=8,sheets=2,shift=0mm,frenchdoors=false,wickel=false]} Note that the +%D collating marks-setup needs to know how many pages are placed on a +%D doublesided printed sheet of paper and how many such sheets result in a +%D section i.e. these values depend on the \type{\setuparranging} command. The +%D shift-option is 0mm if no horizontal page shifting is issued during +%D imposition. If a horizontal page shifting is used, then the shift option is +%D used to position the collating mark precisely on the spine. +%D +%D The two keys \quotation{frenchdoors} and \quotation{wickel} are used for +%D special purposes. These are not intended for general use. +%D For the preparation of a binding called +%D French doors, where there is a left (normal) and a right book, which opens +%D from left to right the MPvariable \quotation{frenchdoors} must be set to true +%D (boolean). +%D For preparing a section with parallelfolding/letterfolding/Wickelfalz the +%D MPvariable \quotation{wickel} must be set to true (boolean). +%D\stopsubject + +%D \startsubject[title={Vocabulary}] +%D +%D EN: Collating mark, DE: Kollationiermarke, NL: collationeerblokje +%D \stopsubject + + +\unprotect + +\setupmodule[Collatingmarks=yes] + +\setupMPvariables + [Collatingmarks] + [pages=16, %pages per sheet doublesided + sheets=1,% number of sheets forming one section + horpageshift=0, + frenchdoors=false, + wickel=false] + +%D We prepare collating marks: + +\processaction[\currentmoduleparameter{Collatingmarks}] + [yes=>\def\Collatingmarks{Collatingmarks}, + no=>\def\Collatingmarks{}, + \v!unknown=>\def\Collatingmarks{}, + \v!default=>\def\Collatingmarks{}] + +%D The newly prepared macros go into the page background: + +\setupbackgrounds[page][state=repeat,background={\Collatingmarks}] + +%D We define an overlay for the collating marks. + +\defineoverlay[Collatingmarks][\useMPgraphic{Collatingmarks}] + +%D We let \METAPOST do the calculations and draw de collating marks. + +\startusableMPgraphic{Collatingmarks} +StartPage; + +numeric offset, sectionno, pages, sheets, factor, correction, offset, pageshift; +path p,q; +boolean frenchdoors,wickel; + +pages := \MPvar{pages}; +sheets := \MPvar{sheets}; +pageshift := \MPvar{horpageshift}; +frenchdoors := \MPvar{frenchdoors}; +wickel := \MPvar{wickel}; + +z5colm = ulcorner Page; +z6colm = (x5colm, y5colm-10mm); + +p := unitsquare xscaled 1mm yscaled 7mm; + +if \realpagenumber mod 2 = 1 : % on uneven pages only + sectionno := \realpagenumber div (sheets*pages)+1; + label.lrt(textext("\switchtobodyfont[5pt]"& decimal sectionno &""),llcorner Page shifted (1mm,-2mm)); + if \realpagenumber mod (sheets*pages) = 1 : % on the first page of a section only + nofmarkings := (y6colm-7mm) div 7mm; + offset := y6colm-sectionno*7mm; + if sectionno > nofmarkings : + correction := sectionno div nofmarkings; + offset := y6colm-(sectionno-correction*nofmarkings)*7mm; + fi; + if frenchdoors or wickel : + p := p shifted ((PaperWidth),offset); + else : + p := p shifted (-1mm-2pageshift,offset); + fi; + fill p withcolor black; + if sectionno < 9 : + label.rt(textext("\switchtobodyfont[3pt] \white "& decimal sectionno &""), center p shifted (-1.3mm,0)); + else : + label.rt(textext("\switchtobodyfont[3pt] \white "& decimal sectionno &""), center p shifted (-1.5mm,0)); + fi; + fi; +fi; +\stopusableMPgraphic + +\protect +\stopmodule + +\doifnotmode{demo}{\endinput} + + + +%D Example: +%D \usemodule[collatingmarks][Collatingmarks=yes] +%D \setuppapersize[A5][A2] +%D \setuplayout[location=middle,marking=on] +%D \setuppagenumbering[alternative=doublesided] +%D \setuparranging[2*4] +%D +%D \setupMPvariables +%D [pages=8, % pages per sheet of paper doublesided +%D sheets=1, % sheets of paper used per section +%D horpageshift=0mm, % used for correction if horizontal page-shifting is used +%D frenchdoors=false, +%D wickel=false] +%D +%D \starttext +%D \dorecurse{10}{\section{Text \recurselevel}\input tufte \par\subject{Ward} \input ward\par} +%D \stoptext + + +\usemodule[collatingmarks][Collatingmarks=yes] +\setuppapersize[A5][A2] +\setuplayout[location=middle,marking=on] +\setuppagenumbering[alternative=doublesided] +\setuparranging[2*4*2] + +\setupMPvariables + [pages=8, % pages per sheet of paper doublesided + sheets=2, % sheets of paper used per section + horpageshift=0mm, % used for correction if horizontal page-shifting is used + frenchdoors=false, + wickel=false] + +\starttext + \dorecurse{10}{\section{Text \recurselevel}\input tufte \par\subject{Ward} \input ward\par} +\stoptext diff --git a/macros/generic/markdown/CHANGES.md b/macros/generic/markdown/CHANGES.md index 3eef881e72..4e1e87e508 100644 --- a/macros/generic/markdown/CHANGES.md +++ b/macros/generic/markdown/CHANGES.md @@ -1,15 +1,62 @@ # Changes -## 2.22.0 (2023-04-03) +## 2.23.0 (2023-04-27) + +Development: + +- Add support of bulk redefinition of token renderers and + token renderer prototypes in the `\markdownSetup` LaTeX + command using wildcards. (#232, #287) + +Fixes: + +- Drop support for ConTeXt Mark II, since the MkII files are + no longer installed in TeX Live 2023, see the article by + [Hans Hagen](https://tug.org/texlive/files/tb136hagen-texlive.pdf). + (#281, #282) +- Remove extra space after inline elements with attributes. + (#288) +- Make our implementation of attributes compatible with jgm/pandoc. + (#279, #297, f7c701b) + +Documentation: + +- Add a link to a preprint from TUGboat 44(1) to `README.md`. + (#234, a4d9fbf) +- Separate example files for pdfLaTeX, XeLaTeX, LuaLaTeX, and + TeX4ht. (daccaa8) + +Docker: + +- Add TeX Live 2022 historical image. (#285, #295) +- Add support for TeX Live 2023. (contributed by @gucci-on-fleek, + #281, #282) + +Refactoring: + +- Use `\prg_new_conditional:Nnn` to define `\@@_if_option:n`. + (#289) + +Libraries: + +- Make tinyyaml a standalone CTAN package. (contributed by + @zepinglee, #218, #294) + +Default Renderer Prototypes: + +- Make the default LaTeX renderer prototypes for tight lists produce + surrounding spaces. (#290, #296) + +## 2.22.0 (2023-04-02) Development: - Add support for TeX math surrounded by backslash-escaped parens and brackets. (contributed by @lostenderman, #61, #235, #236, #270) -- Add support for attributes on links, images, and inline - code spans. (jgm#36, jgm#43, #50, #123, #256, #280) -- Add `import` LaTeX option. (#107, #285) +- Add support for attributes on links, images, fenced code, + and inline code spans. (jgm#36, jgm#43, #50, #123, #256, #280) +- Add `import` LaTeX option. (#107, #286) Documentation: diff --git a/macros/generic/markdown/README.md b/macros/generic/markdown/README.md index 42a62e7383..217cd6710e 100644 --- a/macros/generic/markdown/README.md +++ b/macros/generic/markdown/README.md @@ -185,8 +185,9 @@ For further information, consult one of the following: - [Markdown 2.7.0: Towards lightweight markup in TeX][tb124], - [Making Markdown into a Microwave Meal][tb129], - [Markdown 2.10.0: LaTeX Themes & Snippets, Two Flavors of Comments, and LuaMetaTeX][tb131], - - [Markdown 2.15.0: What's New?][tb133], and - - [Markdown 2.17.1: What's New, What's Next?][tb135]. + - [Markdown 2.15.0: What's New?][tb133], + - [Markdown 2.17.1: What's New, What's Next?][tb135], and + - [Attributes in Markdown][tb136]. 5. Journal articles of me and my students published by [CSTUG Bulletin][csbul] (in Czech and Slovak): - [Rendering Markdown inside TeX Documents][10.5300/2016-1-4/78], - [Markdown 2.8.1: Boldly Unto the Throne of Lightweight Markup in TeX][10.5300/2020-1-2/48], @@ -213,6 +214,7 @@ For further information, consult one of the following: [tb131]: https://www.tug.org/TUGboat/tb42-2/tb131novotny-markdown.pdf "Markdown 2.10.0: LaTeX Themes & Snippets, Two Flavors of Comments, and LuaMetaTeX" [tb133]: https://www.tug.org/TUGboat/tb43-1/tb133novotny-markdown.pdf "Markdown 2.15.0: What's New?" [tb135]: https://www.overleaf.com/read/pgwrhhskmgfm "Markdown 2.17.1: What's New, What's Next?" + [tb136]: https://www.overleaf.com/read/dshtsnnmtshs "Attributes in Markdown" [tb131-slides]: https://tug.org/tug2021/assets/pdf/tug2021-novotny-slides.pdf "Markdown 2.10.0: LaTeX Themes & Snippets, Two Flavors of Comments, and LuaMetaTeX" [tb131-video]: https://youtu.be/THmPkAncMnc "Markdown 2.10.0: LaTeX Themes & Snippets, Two Flavors of Comments, and LuaMetaTeX" diff --git a/macros/generic/markdown/VERSION b/macros/generic/markdown/VERSION index dc259f020e..51e0f67329 100644 --- a/macros/generic/markdown/VERSION +++ b/macros/generic/markdown/VERSION @@ -1 +1 @@ -2.22.0-0-g5a3d0fe (2023-04-02) +2.23.0-0-g0b22f91 (2023-04-27) diff --git a/macros/generic/markdown/examples/context-mkii.tex b/macros/generic/markdown/examples/context-mkii.tex deleted file mode 100644 index e4f953c9a2..0000000000 --- a/macros/generic/markdown/examples/context-mkii.tex +++ /dev/null @@ -1,70 +0,0 @@ -\enableregime[utf] -\usetypescript[modern][ec] -\setupbodyfont[10pt,rm] -\setupexternalfigures[location={local,global,default}] - -% Load the Markdown module. -\usemodule[t][markdown] - -% Set options of the Markdown module. -\setupmarkdown - [ - contentBlocks = yes, - debugExtensions = yes, - definitionLists = yes, - fancy_lists = yes, - fencedCode = yes, - hashEnumerators = yes, - inlineNotes = yes, - lineBlocks = yes, - notes = yes, - pipeTables = yes, - rawAttribute = yes, - smartEllipses = yes, - strikethrough = yes, - subscripts = yes, - superscripts = yes, - tableCaptions = yes, - taskLists = yes, - texMathDollars = yes, - texMathDoubleBackslash = yes, - texMathSingleBackslash = yes, - ] - -% Set renderers of the Markdown module. -\definetyping - [latex] - -\setuptyping - [latex] - [option=TEX] - -\starttext - -% Typeset the document `example.md` by letting the Markdown package handle -% the conversion internally. -\inputmarkdown{./example.md} - -% Typeset the document `example.tex` that we prepared separately using the -% Lua command-line interface and that contains a plain TeX representation -% of the document `example.md`. -\catcode`\%=12\relax -\catcode`\#=12\relax -\doiffileelse{./example.tex}{\input example}{} -\catcode`\%=14\relax -\catcode`\#=6\relax - -% Typeset inline markdown text. -\startmarkdown - -Here are some non-ASCII characters: *ěščřžýáíé* -and ConTeXt special characters: *|*. - -Here is a hard line break that we inserted directly from the TeX source -by typing two spaces at the end of a line. -This is stretching TeX's abilities and is only supported in ConTeXt MkIV -and later. - -\stopmarkdown - -\stoptext diff --git a/macros/generic/markdown/examples/context-mkiv.tex b/macros/generic/markdown/examples/context-mkiv.tex index 9d485820cf..4c05059f3a 100644 --- a/macros/generic/markdown/examples/context-mkiv.tex +++ b/macros/generic/markdown/examples/context-mkiv.tex @@ -70,7 +70,7 @@ kpse.set_program_name("luatex") \catcode`\%=14\relax \catcode`\#=6\relax -% Typeset inline markdown text. +% Typeset some further examples with inline markdown text. \startmarkdown Here are some non-ASCII characters: *ěščřžýáíé* diff --git a/macros/generic/markdown/examples/latex-luatex.tex b/macros/generic/markdown/examples/latex-luatex.tex new file mode 100644 index 0000000000..18b16bf776 --- /dev/null +++ b/macros/generic/markdown/examples/latex-luatex.tex @@ -0,0 +1,56 @@ +\documentclass{book} +\usepackage{polyglossia} +\setmainlanguage{english} +\usepackage{fontspec} +\usepackage{booktabs} +% Load the Markdown package and set its options. +\usepackage[ + contentBlocks, + debugExtensions, + definitionLists, + fancy_lists, + fencedCode, + hashEnumerators, + inlineNotes, + jekyllData, + lineBlocks, + notes, + pipeTables, + rawAttribute, + smartEllipses, + strikeThrough, + subscripts, + superscripts, + tableCaptions, + taskLists, + texMathDollars, + texMathDoubleBackslash, + texMathSingleBackslash, +]{markdown} +% Set the document metadata using a YAML metadata block. +\begin{markdown*}{hybrid} +--- +title: An Example *Markdown* Document +author: Vít Novotný +date: \today +--- +\end{markdown*} +\begin{document} +% Typeset the document `example.md` by letting the Markdown package handle +% the conversion internally. +\markdownInput{./example.md} + +% Typeset the document `example.tex` that we prepared separately using the +% Lua command-line interface of the Markdown package and that contains a +% plain TeX representation of the document `example.md`. +\catcode`\%=12\relax +\catcode`\#=12\relax +\InputIfFileExists{./example.tex}{}{} +\catcode`\%=14\relax +\catcode`\#=6\relax + +% Typeset some further examples with inline markdown text. +\begin{markdown} +Here are some non-ASCII characters: *ěščřžýáíé*. +\end{markdown} +\end{document} diff --git a/macros/generic/markdown/examples/latex-pdftex.tex b/macros/generic/markdown/examples/latex-pdftex.tex new file mode 100644 index 0000000000..db6cbea8c8 --- /dev/null +++ b/macros/generic/markdown/examples/latex-pdftex.tex @@ -0,0 +1,76 @@ +\documentclass{book} +\usepackage[english]{babel} +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage{booktabs} +% Load the Markdown package and set its options. +\usepackage[ + contentBlocks, + debugExtensions, + definitionLists, + fancy_lists, + fencedCode, + hashEnumerators, + inlineNotes, + jekyllData, + lineBlocks, + notes, + pipeTables, + rawAttribute, + smartEllipses, + strikeThrough, + subscripts, + superscripts, + tableCaptions, + taskLists, + texMathDollars, + texMathDoubleBackslash, + texMathSingleBackslash, +]{markdown} +% Set the document metadata using a YAML metadata block. +\begin{markdown*}{hybrid} +--- +title: An Example *Markdown* Document +author: Vít Novotný +date: \today +--- +\end{markdown*} +\begin{document} +% Typeset the document `example.md` by letting the Markdown package handle +% the conversion internally. +\markdownInput{./example.md} + +% Typeset the document `example.tex` that we prepared separately using the +% Lua command-line interface of the Markdown package and that contains a +% plain TeX representation of the document `example.md`. +\catcode`\%=12\relax +\catcode`\#=12\relax +\InputIfFileExists{./example.tex}{}{} +\catcode`\%=14\relax +\catcode`\#=6\relax + +% Typeset some further examples with inline markdown text. +\begin{markdown} +Here are some non-ASCII characters: *ěščřžýáíé*. +\end{markdown} + +\begin{markdown*}{html, hybrid} +Here is some HTML code mixed *with Markdown*. In \TeX, the HTML code +will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed +through to the output: + + + + + + + + + + + + +
EmilTobiasLinus
161410
+\end{markdown*} +\end{document} diff --git a/macros/generic/markdown/examples/latex-xetex.tex b/macros/generic/markdown/examples/latex-xetex.tex new file mode 120000 index 0000000000..d18d544a19 --- /dev/null +++ b/macros/generic/markdown/examples/latex-xetex.tex @@ -0,0 +1 @@ +latex-luatex.tex \ No newline at end of file diff --git a/macros/generic/markdown/examples/latex.tex b/macros/generic/markdown/examples/latex.tex deleted file mode 100644 index 44736c61dc..0000000000 --- a/macros/generic/markdown/examples/latex.tex +++ /dev/null @@ -1,84 +0,0 @@ -\documentclass{book} -\usepackage{ifxetex,ifluatex} -\ifxetex - \usepackage{polyglossia} - \setmainlanguage{english} - \usepackage{fontspec} -\else\ifluatex - \usepackage{polyglossia} - \setmainlanguage{english} - \usepackage{fontspec} -\else - \usepackage[english]{babel} - \usepackage[utf8]{inputenc} - \usepackage[T1]{fontenc} - \usepackage{lmodern} -\fi\fi -\usepackage{booktabs} -\usepackage[ - contentBlocks, - debugExtensions, - definitionLists, - fancy_lists, - fencedCode, - hashEnumerators, - inlineNotes, - jekyllData, - lineBlocks, - notes, - pipeTables, - rawAttribute, - smartEllipses, - strikeThrough, - subscripts, - superscripts, - tableCaptions, - taskLists, - texMathDollars, - texMathDoubleBackslash, - texMathSingleBackslash, -]{markdown} -\begin{markdown*}{hybrid} ---- -title: An Example *Markdown* Document -author: Vít Novotný -date: \today ---- -\end{markdown*} -\begin{document} -% Typeset the document `example.md` by letting the Markdown package handle -% the conversion internally. -\markdownInput{./example.md} - -% Typeset the document `example.tex` that we prepared separately using the -% Lua command-line interface of the Markdown package and that contains a -% plain TeX representation of the document `example.md`. -\catcode`\%=12\relax -\catcode`\#=12\relax -\InputIfFileExists{./example.tex}{}{} -\catcode`\%=14\relax -\catcode`\#=6\relax - -\begin{markdown} -Here are some non-ASCII characters: *ěščřžýáíé*. -\end{markdown} - -\begin{markdown*}{html, hybrid} -Here is some HTML code mixed *with Markdown*. In \TeX, the HTML code -will be silently ignored, whereas in \TeX 4ht, the HTML code will be passed -through to the output: - - - - - - - - - - - - -
EmilTobiasLinus
161410
-\end{markdown*} -\end{document} diff --git a/macros/generic/markdown/libraries/markdown-tinyyaml.lua b/macros/generic/markdown/libraries/markdown-tinyyaml.lua index 7a57ef2422..074ad79446 100644 --- a/macros/generic/markdown/libraries/markdown-tinyyaml.lua +++ b/macros/generic/markdown/libraries/markdown-tinyyaml.lua @@ -38,6 +38,8 @@ local tonumber = tonumber local math = math local getmetatable = getmetatable local error = error +local end_symbol = "..." +local end_break_symbol = "...\n" local UNESCAPES = { ['0'] = "\x00", z = "\x00", N = "\x85", @@ -183,7 +185,14 @@ function Parser:parsestring(line, stopper) if not i then return nil, line end - return ssub(line, 2, i-1), ssub(line, i+1) + -- Unescape repeated single quotes. + while i < #line and ssub(line, i+1, i+1) == "'" do + i = sfind(line, "'", i + 2, true) + if not i then + return nil, line + end + end + return ssub(line, 2, i-1):gsub("''", "'"), ssub(line, i+1) end if q == '"' then local i, buf = 2, '' @@ -702,6 +711,13 @@ function Parser:parsemap(line, lines, indent) while #lines > 0 do -- Check for a new document line = lines[1] + if line == end_symbol or line == end_break_symbol then + for i, _ in ipairs(lines) do + lines[i] = nil + end + return map + end + if startswith(line, '---') then while #lines > 0 and not startswith(lines, '---') do tremove(lines, 1) diff --git a/macros/generic/markdown/markdown.dtx b/macros/generic/markdown/markdown.dtx index ee878acc72..3edb022e15 100644 --- a/macros/generic/markdown/markdown.dtx +++ b/macros/generic/markdown/markdown.dtx @@ -796,16 +796,18 @@ abbr { \ProvidesPackage{markdownthemewitiko_markdown_techdoc}[2022/02/23] \RequirePackage{etoolbox} \markdownSetup{ - rendererPrototypes = { - codeSpan = {\inline{#1}}, - headingFour = {% + renderers = { + head*Four = {% \paragraph{#1}\leavevmode \def\markdownRendererInterblockSeparator{% \let\markdownRendererInterblockSeparator\par }% \noindent }, - jekyllDataEnd = {% + }, + rendererPrototypes = { + codeSpan = {\inline{#1}}, + jek*llDataEnd = {% \AfterEndPreamble{% \printtitlepage \tableofcontents @@ -1045,7 +1047,7 @@ a directory named `markdown` due to [issue #74][issue-74]. % % This section gives an overview of all resources required by the package. % -%### Lua Requirements {#luaprerequisites} +%### Lua Requirements {#lua-prerequisites} % % The Lua part of the package requires that the following Lua modules are % available from within the Lua\TeX{} engine (though not necessarily in the @@ -1201,7 +1203,8 @@ end)() % (subset) parser that is used to read \acro{yaml} metadata when the % \Opt{jekyllData} option is enabled. We carry a copy of the library % in file `markdown-tinyyaml.lua` distributed together with the Markdown -% package. +% package. % % \end{markdown} % \iffalse @@ -1211,11 +1214,11 @@ end)() % \par % \begin{markdown} % -%### Plain \TeX{} Requirements {#texprerequisites} +%### Plain \TeX{} Requirements {#tex-prerequisites} % % The plain \TeX{} part of the package requires that the plain \TeX{} % format (or its superset) is loaded, all the Lua prerequisites (see -% Section <#sec:luaprerequisites>), and the following packages: +% Section <#sec:lua-prerequisites>), and the following packages: % % \pkg{expl3} % @@ -1275,7 +1278,7 @@ end)() % \par % \begin{markdown} % -%### \LaTeX{} Requirements {#latexprerequisites} +%### \LaTeX{} Requirements {#latex-prerequisites} % % The \LaTeX{} part of the package requires that the \Hologo{LaTeX2e} format is % loaded, @@ -1291,12 +1294,12 @@ end)() % \fi % \begin{markdown} % a \TeX{} engine that extends \Hologo{eTeX}, and all the plain \TeX{} -% prerequisites (see Section <#sec:texprerequisites>): +% prerequisites (see Section <#sec:tex-prerequisites>): % % The following packages are soft prerequisites. They are only used to provide % default token renderer prototypes (see sections % <#sec:texrendererprototypes> and -% <#sec:latexdefaultrendererprototypes>) or \LaTeX{} themes (see Section +% <#sec:latex-default-renderer-prototypes>) or \LaTeX{} themes (see Section % <#sec:latexthemes>) and will not be loaded if the `plain` package option % has been enabled (see Section <#sec:latexplain>): % @@ -1369,7 +1372,7 @@ end)() % %: A package that is used to polyfill the general hook management system in % the default renderer prototypes for \acro{yaml} metadata, see Section -% <#sec:latexyamlmetadata>, and also in the default renderer prototype +% <#sec:latex-yaml-metadata>, and also in the default renderer prototype % for identifier attributes. % % \pkg{soulutf8} @@ -1402,7 +1405,7 @@ end)() %### \Hologo{ConTeXt} Prerequisites % The \Hologo{ConTeXt} part of the package requires that either the Mark II or % the Mark IV format is loaded, all the plain \TeX{} prerequisites (see -% Section <#sec:texprerequisites>), and the following \Hologo{ConTeXt} +% Section <#sec:tex-prerequisites>), and the following \Hologo{ConTeXt} % modules: % % \pkg{m-database} @@ -1601,13 +1604,14 @@ the Markdown package: ``` sh git clone https://github.com/witiko/markdown cd markdown/examples -lualatex latex.tex +lualatex latex-luatex.tex `````` -A PDF document named `latex.pdf` should be produced. Open the text documents -`latex.tex` and `example.md` in a text editor to see how the example documents -are structured. Try changing the documents and typesetting them as follows: +A PDF document named `latex-luatex.pdf` should be produced. Open the text +documents `latex-luatex.tex` and `example.md` in a text editor to see how the +example documents are structured. Try changing the documents and typesetting +them as follows: ``` sh -lualatex latex.tex +lualatex latex-luatex.tex `````` to see the effect of your changes. @@ -1628,10 +1632,7 @@ Next, invoke LuaTeX from the terminal: context document.tex `````` A PDF document named `document.pdf` should be produced and contain the text “Hello -*world*!” Invoking pdfTeX should have the same effect: -``` sh -texexec --passon=--shell-escape document.tex -`````` +*world*!” *** @@ -1714,12 +1715,12 @@ local M = {metadata = metadata} % \par % \begin{markdown} % -%### Conversion from Markdown to Plain \TeX{} {#luaconversion} +%### Conversion from Markdown to Plain \TeX{} {#lua-conversion} % % The Lua interface exposes the \luamdef{new}`(options)` function. This % function returns a conversion function from markdown to plain \TeX{} according % to the table `options` that contains options recognized by the Lua interface -% (see Section <#sec:luaoptions>). The `options` parameter is optional; when +% (see Section <#sec:lua-options>). The `options` parameter is optional; when % unspecified, the behaviour will be the same as if `options` were an empty % table. % @@ -1732,7 +1733,7 @@ local M = {metadata = metadata} % print(convert("Hello *world*!")) % ``````` % -%### User-Defined Syntax Extensions {#luauserextensions} +%### User-Defined Syntax Extensions {#lua-user-extensions} % % For the purpose of user-defined syntax extensions, the Lua interface also % exposes the \luamdef{reader} object, which performs the lexical and @@ -1966,7 +1967,7 @@ pdftex document.tex % \fi % \begin{markdown} % -%### Options {#luaoptions} +%### Options {#lua-options} % % The Lua interface recognizes the following options. When unspecified, the % value of a key is taken from the \luamdef{defaultOptions} table. @@ -2081,7 +2082,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. } { \msg_error:nnnV - { @@ } + { markdown } { failed-typecheck-for-boolean-option } { #1 } \l_tmpa_tl @@ -2090,7 +2091,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. } } \msg_new:nnn - { @@ } + { markdown } { failed-typecheck-for-boolean-option } { Option~#1~has~value~#2,~ @@ -2139,7 +2140,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_bool { \msg_error:nnn - { @@ } + { markdown } { undefined-option } { #1 } } @@ -2148,7 +2149,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_tl { \msg_error:nnnV - { @@ } + { markdown } { unknown-option-type } { #1 } \l_tmpa_tl @@ -2158,13 +2159,13 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_tl } \msg_new:nnn - { @@ } + { markdown } { unknown-option-type } { Option~#1~has~unknown~type~#2. } \msg_new:nnn - { @@ } + { markdown } { undefined-option } { Option~#1~is~undefined. @@ -2191,7 +2192,7 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_bool { \msg_error:nnn - { @@ } + { markdown } { undefined-option } { #1 } } @@ -2247,7 +2248,17 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \tl_tail:n { #1 } } } -\seq_new:N \g_@@_cases_seq +% \end{macrocode} +% \par +% \begin{markdown} +% +% To make it easier to support different coding styles in the interface, +% engines, we define the \mdef{\@\@_with_various_cases:nn} function +% that allows us to generate different variants of a string using +% different cases. +% +% \end{markdown} +% \begin{macrocode} \cs_new:Nn \@@_with_various_cases:nn { \seq_clear:N @@ -2268,6 +2279,29 @@ interfaces and all the way up to the \LaTeX{} and \Hologo{ConTeXt} interfaces. \l_tmpa_seq { #2 } } +% \end{macrocode} +% \par +% \begin{markdown} +% +% To interrupt the \mref{\@\@_with_various_cases:nn} function +% prematurely, use the \mdef{\@\@_with_various_cases_break:} function. +% +% \end{markdown} +% \begin{macrocode} +\cs_new:Nn \@@_with_various_cases_break: + { + \seq_map_break: + } +% \end{macrocode} +% \begin{markdown} +% +% By default, camelCase and snake\\\_case are supported. +% Additional cases can be added by adding functions to the +% \mdef{g_\@\@_cases_seq} sequence. +% +% \end{markdown} +% \begin{macrocode} +\seq_new:N \g_@@_cases_seq \cs_new:Nn \@@_camel_case:N { \regex_replace_all:nnN @@ -2641,13 +2675,13 @@ defaultOptions.contentBlocksLanguageMap = "markdown-languages.json" extensible subset of the \acro{peg} grammar of markdown % (see the \luamref{walkable_syntax} hash table) after built-in syntax extensions -% (see Section <#sec:luabuiltinextensions>) +% (see Section <#sec:lua-built-in-extensions>) % \iffalse (see options \Opt{citations}, \Opt{contentBlocks}, \Opt{definitionLists}, etc.) % \fi and user-defined syntax extensions -% (see Section <#sec:luauserextensions>) +% (see Section <#sec:lua-user-extensions>) % \iffalse (see option \Opt{extensions}) % \fi @@ -2881,7 +2915,7 @@ Hi *world*! ``````` Last, invoke pdfTeX without shell access from the terminal: ``` sh -texexec --passon=--no-shell-escape frozen-document.tex +context frozen-document.tex `````` A PDF document named `frozen-document.pdf` should be produced and contain the text “Hello *world*!” Since we used the contents of the frozen cache using @@ -4622,13 +4656,13 @@ defaultOptions.contentBlocks = false extensible subset of the \acro{peg} grammar of markdown % (see the \luamref{walkable_syntax} hash table) after built-in syntax extensions -% (see Section <#sec:luabuiltinextensions>) +% (see Section <#sec:lua-built-in-extensions>) % \iffalse (see options \Opt{citations}, \Opt{contentBlocks}, \Opt{definitionLists}, etc.) % \fi and user-defined syntax extensions -% (see Section <#sec:luauserextensions>) +% (see Section <#sec:lua-user-extensions>) % \iffalse (see option \Opt{extensions}) % \fi @@ -5194,7 +5228,7 @@ metadata.grammar_version = 2 % markdown using the interface of a Lua \luamref{reader} object, such as % the \luamref{reader->insert_pattern} and % \luamref{reader->add_special_character} methods, -% see Section <#luauserextensions>. +% see Section <#lua-user-extensions>. % % \end{markdown} % \iffalse @@ -5857,7 +5891,7 @@ Hi *world*! ``````` Last, invoke pdfTeX without shell access from the terminal: ``` sh -texexec --passon=--no-shell-escape document.tex +context document.tex `````` A new PDF document named `document.pdf` should be produced and contain the same text “Hello *world*!” Since we used the contents of the frozen cache using @@ -10323,7 +10357,7 @@ for i = 1, #arg do % Unless the `-`{}`-` argument has been specified before, an argument % containing the equals sign (`=`) is assumed to be an option specification in % a \meta{key}`=`\meta{value} format. The available options are listed in -% Section <#sec:luaoptions>. +% Section <#sec:lua-options>. % \end{markdown} % \begin{macrocode} elseif arg[i]:match("=") then @@ -10491,7 +10525,7 @@ pdftex --shell-escape document.tex % % The plain \TeX{} interface provides macros for the typesetting of markdown % input from within plain \TeX{}, for setting the Lua interface options (see -% Section <#sec:luaoptions>) used during the conversion from markdown to +% Section <#sec:lua-options>) used during the conversion from markdown to % plain \TeX{} and for changing the way markdown the tokens are rendered. % % \end{markdown} @@ -10510,7 +10544,7 @@ pdftex --shell-escape document.tex % \noindent It is expected that the special plain \TeX{} characters have the % expected category codes, when `\input`ting the file. % -%### Typesetting Markdown {#textypesetting} +%### Typesetting Markdown {#tex-typesetting} % % The interface exposes the \mdef{markdownBegin}, \mdef{markdownEnd}, % \mdef{markdownInput}, and \mdef{markdownEscape} macros. @@ -10607,11 +10641,11 @@ pdftex --shell-escape document.tex % \par % \begin{markdown} % -%### Options {#texoptions} +%### Options {#tex-options} % % The plain \TeX{} options are represented by \TeX{} commands. Some of them map % directly to the options recognized by the Lua interface (see -% Section <#sec:luaoptions>), while some of them are specific to the plain +% Section <#sec:lua-options>), while some of them are specific to the plain % \TeX{} interface. % % To enable the enumeration of plain \TeX{} options, we will maintain the @@ -10880,7 +10914,7 @@ For more information, see the examples for the \Opt{finalizeCache} option. % % Furthemore, we also define macros that map directly to the options recognized % by the Lua interface, such as \mdef{markdownOptionHybrid} for the -% \Opt{hybrid} Lua option (see Section <#sec:luaoptions>), which are not +% \Opt{hybrid} Lua option (see Section <#sec:lua-options>), which are not % processed by the plain \TeX{} implementation, only passed along to Lua. % % For the macros that correspond to the non-boolean options recognized by the @@ -11125,7 +11159,7 @@ In this section, I will describe the individual token renderers. % % The following \TeX{} macros may occur inside the output of the % converter functions exposed by the Lua interface (see Section -% <#sec:luaconversion>) and represent the parsed markdown tokens. These +% <#sec:lua-conversion>) and represent the parsed markdown tokens. These % macros are intended to be redefined by the user who is typesetting a % document. By default, they point to the corresponding prototypes (see Section % <#sec:texrendererprototypes>). @@ -12637,8 +12671,8 @@ list is not tight). The macro receives no arguments. % \begin{markdown} The \mdef{markdownRendererDlBeginTight} macro represents the beginning of a -definition list that contains an item with several paragraphs of text (the -list is not tight). This macro will only be produced, when the +definition list that contains no item with several paragraphs of text (the +list is tight). This macro will only be produced, when the \Opt{tightLists} option is disabled. The macro receives no arguments. % \end{markdown} @@ -18540,7 +18574,7 @@ following text: % \begin{markdown} % The macro is exposed in the interface, so that the user can create their own % markdown environments. Due to the way the arguments are passed to Lua (see -% Section <#sec:directlua>), the first argument may not contain the +% Section <#sec:direct-lua>), the first argument may not contain the % string `]]` (regardless of the category code of the bracket symbol (`]`)). % % The \mdef{markdownMode} macro specifies how the plain \TeX{} implementation @@ -18677,7 +18711,7 @@ pdflatex --shell-escape document.tex % Section <#sec:texinterface>). % % The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see -% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`, +% Section <#sec:tex-interface-logging>) to use the \LaTeX{} `\PackageInfo`, % `\PackageWarning`, and `\PackageError` macros. % % \end{markdown} @@ -18697,10 +18731,10 @@ pdflatex --shell-escape document.tex % \end{Verbatim} % \begin{markdown} % where \meta{options} are the \LaTeX{} interface options (see Section -% <#sec:latexoptions>). Note that \meta{options} inside the `\usepackage` +% <#sec:latex-options>). Note that \meta{options} inside the `\usepackage` % macro may not set the `markdownRenderers` (see Section -% <#sec:latexrenderers>) and `markdownRendererPrototypes` (see Section -% <#sec:latexrendererprototypes>) keys. Furthermore, although the +% <#sec:latex-renderers>) and `markdownRendererPrototypes` (see Section +% <#sec:latex-renderer-prototypes>) keys. Furthermore, although the % base variant of the `import` key that loads a single \LaTeX{} theme % (see Section <#sec:latexthemes>) can be used, the extended variant % that can load multiple themes and import snippets from them (see @@ -18718,7 +18752,7 @@ pdflatex --shell-escape document.tex % The \envmref{markdown} and \envmref{markdown*} \LaTeX{} environments are used to % typeset markdown document fragments. The starred version of the % \envmref{markdown} environment accepts \LaTeX{} interface options (see -% Section <#sec:latexoptions>) as its only argument. These options will +% Section <#sec:latex-options>) as its only argument. These options will % only influence this markdown document fragment. % % \end{markdown} @@ -18755,7 +18789,7 @@ pdflatex --shell-escape document.tex % the filename of a markdown document and expands to the result of the % conversion of the input markdown document to plain \TeX{}. Unlike the % \mref{markdownInput} macro provided by the plain \TeX{} interface, this macro -% also accepts \LaTeX{} interface options (see Section <#sec:latexoptions>) +% also accepts \LaTeX{} interface options (see Section <#sec:latex-options>) % as its optional argument. These options will only influnce this markdown % document. % @@ -18771,7 +18805,7 @@ pdflatex --shell-escape document.tex % \end{document} % ``````` % -%### Options {#latexoptions} +%### Options {#latex-options} % % The \LaTeX{} options are represented by a comma-delimited list of % \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value} @@ -18780,9 +18814,9 @@ pdflatex --shell-escape document.tex % % Except for the `plain` option described in Section <#sec:latexplain>, and % the \LaTeX{} themes described in Section <#sec:latexthemes>, and the -% \LaTeX{} snippets described in Section <#sec:latexsetupsnippets>, +% \LaTeX{} snippets described in Section <#sec:latex-setup-snippets>, % \LaTeX{} options map directly to the options recognized by the plain -% \TeX{} interface (see Section <#sec:texoptions>) and to the markdown token +% \TeX{} interface (see Section <#sec:tex-options>) and to the markdown token % renderers and their prototypes recognized by the plain \TeX{} interface (see % Sections <#sec:texrenderersuser> and <#sec:texrendererprototypes>). % @@ -18807,7 +18841,7 @@ pdflatex --shell-escape document.tex % \end{macrocode} % \begin{markdown} % -%#### \LaTeX{} snippets {#latexsetupsnippets} +%#### \LaTeX{} snippets {#latex-setup-snippets} % % We may also set up \LaTeX{} options as *snippets* using the % \mdef{markdownSetupSnippet} macro and invoke them later. The @@ -18939,9 +18973,9 @@ other packages used in a document. Additionally, if we redefine token renderers and renderer prototypes ourselves, the default definitions will bring no benefit to us. Using the `plain` package option, we can keep the default definitions from the plain \TeX{} implementation -% (see Section <#sec:textokenrendererprototypes>) +% (see Section <#sec:tex-token-renderer-prototypes>) and prevent the soft \LaTeX{} prerequisites -% in Section <#sec:latexprerequisites> +% in Section <#sec:latex-prerequisites> from being loaded: The plain option must be set before or when loading the package. Setting the option after loading the package will have no effect. @@ -19112,7 +19146,7 @@ would use the following code in the preamble of your document: % \begin{markdown} % % The \LaTeX{} themes have a useful synergy with snippets (see Section -% <#sec:latexsetupsnippets>): To make it less likely that different themes +% <#sec:latex-setup-snippets>): To make it less likely that different themes % will set up snippets with the same name, we will prepend \meta{theme % name}`/` before the snippet name and use the result as the snippet name. % For example, if the `witiko/dot` theme sets up the `product` snippet, the @@ -19406,7 +19440,7 @@ following text, where the middot (`·`) denotes a non-breaking space: % \par % \begin{markdown} % -% Please, see Section <#sec:latexthemesimplementation> for implementation +% Please, see Section <#sec:latex-themes-implementation> for implementation % details of the example themes. #### \LaTeX{} snippets {#latexsnippets} @@ -19483,7 +19517,8 @@ The following ordered list will be preceded by roman numerals: ``````` If the `romanNumerals` snippet were defined in the `jdoe/lists` theme, -we can import the theme and use the qualified name of the snippet: +we could import the `jdoe/lists` theme and use the qualified name +`jdoe/lists/romanNumerals` to invoke the snippet: ``` tex \markdownSetup{import=jdoe/lists} @@ -19499,7 +19534,7 @@ The following ordered list will be preceded by roman numerals: Alternatively, we can use the extended variant of the `import` \LaTeX{} option that allows us to import the `romanNumerals` snippet to the -current namespace, so that we can invoke the snippet with less typing: +current namespace for easier access: ``` tex \markdownSetup{ @@ -19518,8 +19553,9 @@ The following ordered list will be preceded by roman numerals: ``````` Furthermore, we can also specify the name of the snippet in the current -namespace, which is different from the name of the snippet in the -`jdoe/lists` theme: +namespace, which can be different from the name of the snippet in the +`jdoe/lists` theme. For example, we can make the snippet +`jdoe/lists/romanNumerals` available under the name `roman`. ``` tex \markdownSetup{ @@ -19538,7 +19574,23 @@ The following ordered list will be preceded by roman numerals: ``````` Several themes and/or snippets can be loaded at once using the extended -variant of the `import` \LaTeX{} option. +variant of the `import` \LaTeX{} option: + +``` tex +\markdownSetup{ + import = { + jdoe/longpackagename/lists = { + arabic as arabic1, + roman, + alphabetic, + }, + jdoe/anotherlongpackagename/lists = { + arabic as arabic2, + }, + jdoe/yetanotherlongpackagename, + }, +} +``````` % \markdownEnd % \iffalse @@ -19752,7 +19804,7 @@ variant of the `import` \LaTeX{} option. { s } { \msg_error:nnn - { @@ } + { markdown } { malformed-name-for-clist-option } { #3 } } @@ -19798,7 +19850,7 @@ variant of the `import` \LaTeX{} option. { en } { F } \msg_new:nnn - { @@ } + { markdown } { malformed-name-for-clist-option } { Clist~option~name~#1~does~not~end~with~-s. @@ -19851,12 +19903,13 @@ variant of the `import` \LaTeX{} option. % } % ``````` % -%#### Plain \TeX{} Markdown Token Renderers {#latexrenderers} +%#### Plain \TeX{} Markdown Token Renderers {#latex-renderers} % % The \LaTeX{} interface recognizes an option with the `renderers` key, -% whose value must be a list of options that map directly to the markdown token -% renderer macros exposed by the plain \TeX{} interface (see Section -% <#sec:texrenderersuser>). +% whose value must be a list of key-values, where the keys correspond +% to the markdown token renderer macros exposed by the plain \TeX{} +% interface (see Section <#sec:texrenderersuser>) and the values are +% new definitions of these token renderers. % % \end{markdown} % \begin{macrocode} @@ -19932,12 +19985,119 @@ variant of the `import` \LaTeX{} option. % } % ``````` % -%#### Plain \TeX{} Markdown Token Renderer Prototypes {#latexrendererprototypes} +% In addition to exact token renderer names, we also support wildcards +% that match multiple token renderer names. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\tl_new:N + \l_@@_renderer_definition_tl +\keys_define:nn + { markdown/latex-options/renderers } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l_@@_renderer_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g_@@_renderers_seq + { + \@@_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \@@_renderer_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g_@@_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l_@@_renderer_definition_tl + \int_incr:N + \l_tmpa_int + \@@_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer } + { + Renderer~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-wildcard } + { + Wildcard~#1~matches~no~renderers. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff +% \end{macrocode} +% \begin{markdown} +% +%#### Plain \TeX{} Markdown Token Renderer Prototypes {#latex-renderer-prototypes} % -% The \LaTeX{} interface recognizes an option with the `rendererPrototypes` -% key, whose value must be a list of options that map directly to the markdown -% token renderer prototype macros exposed by the plain \TeX{} interface (see -% Section <#sec:texrendererprototypes>). +% The \LaTeX{} interface recognizes an option with the +% `rendererPrototypes` key, whose value must be a list of key-values, +% where the keys correspond to the markdown token renderer prototype +% macros exposed by the plain \TeX{} interface (see Section +% <#sec:texrendererprototypes>) and the values are new definitions of +% these token renderer prototypes. % % \end{markdown} % \begin{macrocode} @@ -20000,6 +20160,111 @@ variant of the `import` \LaTeX{} option. % } % ``````` % +% In addition to exact token renderer prototype names, we also support +% wildcards that match multiple token renderer prototype names. +% +% \end{markdown} +% \begin{macrocode} +\ExplSyntaxOn +\tl_new:N + \l_@@_renderer_prototype_definition_tl +\keys_define:nn + { markdown/latex-options/renderer-prototypes } + { + unknown .code:n = { + \regex_match:nVTF + { \* } + \l_keys_key_str + { + \tl_set:Nn + \l_@@_renderer_prototype_definition_tl + { #1 } + \tl_set:NV + \l_tmpa_tl + \l_keys_key_str + \regex_replace_all:nnN + { \* } + { .* } + \l_tmpa_tl + \regex_set:NV + \l_tmpa_regex + \l_tmpa_tl + \int_zero:N + \l_tmpa_int + \seq_map_inline:Nn + \g_@@_renderers_seq + { + \@@_with_various_cases:nn + { ##1 } + { + \regex_match:NnT + \l_tmpa_regex + { ####1 } + { + \@@_renderer_prototype_tl_to_csname:nN + { ##1 } + \l_tmpa_tl + \prop_get:NnN + \g_@@_renderer_arities_prop + { ##1 } + \l_tmpb_tl + \cs_generate_from_arg_count:cNVV + { \l_tmpa_tl } + \cs_set:Npn + \l_tmpb_tl + \l_@@_renderer_prototype_definition_tl + \int_incr:N + \l_tmpa_int + \@@_with_various_cases_break: + } + } + } + \int_compare:nNnT + { \l_tmpa_int } = { 0 } + { + \msg_error:nnV + { markdown } + { nonmatched-renderer-prototype-wildcard } + \l_keys_key_str + } + } + { + \msg_error:nnV + { markdown } + { undefined-renderer-prototype } + \l_keys_key_str + } + }, + } +\msg_new:nnn + { markdown } + { undefined-renderer-prototype } + { + Renderer~prototype~#1~is~undefined. + } +\msg_new:nnn + { markdown } + { nonmatched-renderer-prototype-wildcard } + { + Wildcard~#1~matches~no~renderer~prototypes. + } +\cs_generate_variant:Nn + \regex_set:Nn + { NV } +\cs_generate_variant:Nn + \cs_generate_from_arg_count:NNnn + { cNVV } +\cs_generate_variant:Nn + \msg_error:nnn + { nnV } +\prg_generate_conditional_variant:Nnn + \regex_match:nn + { nV } + { TF } +\ExplSyntaxOff +% \end{macrocode} +% \begin{markdown} +% % \iffalse % %<*context> @@ -20052,11 +20317,6 @@ following text: > *equals* > i. -Invoking pdfTeX should have the same effect: -``` sh -texexec --passon=--shell-escape document.tex -`````` - % %<*context> % \fi @@ -20077,7 +20337,7 @@ texexec --passon=--shell-escape document.tex % \begin{markdown} % % The \Hologo{ConTeXt} implementation redefines the plain \TeX{} logging macros -% (see Section <#sec:texinterfacelogging>) to use the \Hologo{ConTeXt} +% (see Section <#sec:tex-interface-logging>) to use the \Hologo{ConTeXt} % `\writestatus` macro. % % \end{markdown} @@ -20137,7 +20397,7 @@ texexec --passon=--shell-escape document.tex % the conversion of the input markdown document to plain \TeX{}. Unlike the % \mref{markdownInput} macro provided by the plain \TeX{} interface, this macro % also accepts \Hologo{ConTeXt} interface options (see Section -% <#sec:contextoptions>) as its optional argument. These options will only +% <#sec:context-options>) as its optional argument. These options will only % influnce this markdown document. % % The following example \LaTeX{} code showcases the usage of the @@ -20151,7 +20411,7 @@ texexec --passon=--shell-escape document.tex % \stoptext % ``````` % -%### Options {#contextoptions} +%### Options {#context-options} % % The \Hologo{ConTeXt} options are represented by a comma-delimited list of % \meta{key}`=`\meta{value} pairs. For boolean options, the `=`\meta{value} @@ -20160,7 +20420,7 @@ texexec --passon=--shell-escape document.tex % omitted. % % \Hologo{ConTeXt} options map directly to the options recognized by the plain -% \TeX{} interface (see Section <#sec:texoptions>). +% \TeX{} interface (see Section <#sec:tex-options>). % % The \Hologo{ConTeXt} options may be specified when using the % \mref{inputmarkdown} macro (see Section <#sec:contextinterface>), or via the @@ -22764,7 +23024,7 @@ end % \par % \begin{markdown} % -%### Plain \TeX{} Writer {#texwriter} +%### Plain \TeX{} Writer {#tex-writer} % % This section documents the \luamref{writer} object, which implements the % routines for producing the \TeX{} output. The object is an amalgamate of the @@ -22787,7 +23047,7 @@ M.writer = {} % % The \luamdef{writer.new} method creates and returns a new \TeX{} writer % object associated with the Lua interface options (see Section -% <#sec:luaoptions>) `options`. When `options` are unspecified, it is +% <#sec:lua-options>) `options`. When `options` are unspecified, it is % assumed that an empty table was passed to the method. % % The objects produced by the \luamref{writer.new} method expose instance methods @@ -23085,7 +23345,7 @@ function M.writer.new(options) {"\\markdownRendererCodeSpan{", self.escape(s), "}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererCodeSpanAttributeContextEnd ") + "\\markdownRendererCodeSpanAttributeContextEnd{}") end return buf end @@ -23113,7 +23373,7 @@ function M.writer.new(options) "{",self.string(tit or ""),"}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererLinkAttributeContextEnd ") + "\\markdownRendererLinkAttributeContextEnd{}") end return buf end @@ -23141,7 +23401,7 @@ function M.writer.new(options) "{",self.string(tit or ""),"}"}) if attributes ~= nil then table.insert(buf, - "\n\\markdownRendererImageAttributeContextEnd ") + "\\markdownRendererImageAttributeContextEnd{}") end return buf end @@ -23385,30 +23645,53 @@ function M.writer.new(options) % \begin{markdown} % % Define \luamdef{writer->attributes} as a function that will transform -% input attributes `attr` to the output format. +% input attributes `attrs` to the output format. % % \end{markdown} % \begin{macrocode} - function self.attributes(attr) - local buf = {} + function self.attributes(attributes) + local expanded_attributes = {} + local key_value_regex = "([^= ]+)%s*=%s*(.*)" + local key, value + for _, attribute in ipairs(attributes) do + if attribute:sub(1, 1) == "#" or attribute:sub(1, 1) == "." then + table.insert(expanded_attributes, attribute) + else + key, value = attribute:match(key_value_regex) + if key:lower() == "id" then + table.insert(expanded_attributes, "#" .. value) + elseif key:lower() == "class" then + local classes = {} + for class in value:gmatch("%S+") do + table.insert(classes, class) + end + table.sort(classes) + for _, class in ipairs(classes) do + table.insert(expanded_attributes, "." .. class) + end + else + table.insert(expanded_attributes, attribute) + end + end + end + table.sort(expanded_attributes) - table.sort(attr) + local buf = {} local seen = {} - local key, value - for i = 1, #attr do - if seen[attr[i]] ~= nil then + for _, attribute in ipairs(expanded_attributes) do + if seen[attribute] ~= nil then goto continue -- prevent duplicate attributes else - seen[attr[i]] = true + seen[attribute] = true end - if attr[i]:sub(1, 1) == "#" then + if attribute:sub(1, 1) == "#" then table.insert(buf, {"\\markdownRendererAttributeIdentifier{", - attr[i]:sub(2), "}"}) - elseif attr[i]:sub(1, 1) == "." then + attribute:sub(2), "}"}) + elseif attribute:sub(1, 1) == "." then table.insert(buf, {"\\markdownRendererAttributeClassName{", - attr[i]:sub(2), "}"}) + attribute:sub(2), "}"}) else - key, value = attr[i]:match("([^= ]+)%s*=%s*(.*)") + key, value = attribute:match(key_value_regex) table.insert(buf, {"\\markdownRendererAttributeKeyValue{", key, "}{", value, "}"}) end @@ -23866,13 +24149,16 @@ parsers.commented_line = Cg(Cc(""), "backslashes") parsers.chunk = parsers.line * (parsers.optionallyindentedline - parsers.blankline)^0 -parsers.attribute_key_char = parsers.alphanumeric + S("_-") +parsers.attribute_key_char = parsers.alphanumeric + S("-_:.") parsers.attribute_key = (parsers.attribute_key_char - parsers.dash - parsers.digit) * parsers.attribute_key_char^0 parsers.attribute_value = ( (parsers.dquote / "") * (parsers.anyescaped - parsers.dquote)^0 * (parsers.dquote / "")) + + ( (parsers.squote / "") + * (parsers.anyescaped - parsers.squote)^0 + * (parsers.squote / "")) + ( parsers.anyescaped - parsers.dquote - parsers.rbrace - parsers.space)^0 @@ -24247,7 +24533,7 @@ end % \par % \begin{markdown} % -%### Markdown Reader {#markdownreader} +%### Markdown Reader {#markdown-reader} % % This section documents the \luamref{reader} object, which implements the % routines for parsing the markdown input. The object corresponds to the @@ -24256,7 +24542,7 @@ end % % The \luamdef{reader.new} method creates and returns a new \TeX{} reader % object associated with the Lua interface options (see Section -% <#sec:luaoptions>) `options` and with a writer object `writer`. When +% <#sec:lua-options>) `options` and with a writer object `writer`. When % `options` are unspecified, it is assumed that an empty table was passed to % the method. % @@ -25321,7 +25607,7 @@ end % \begin{markdown} % % Although the interface of the \luamref{reader->insert_pattern} method does -% document this (see Section <#sec:luauserextensions>), we allow the +% document this (see Section <#sec:lua-user-extensions>), we allow the % \luamref{reader->insert_pattern} and \luamref{reader->update_rule} % methods to insert not just \acro{peg} patterns, but also rule names that % reference the \acro{peg} grammar of Markdown. @@ -25438,7 +25724,7 @@ end % \begin{markdown} % When determining the name of the cache file, create salt for the hashing % function out of the package version and the passed options recognized by the -% Lua interface (see Section <#sec:luaoptions>). The \Opt{cacheDir} option +% Lua interface (see Section <#sec:lua-options>). The \Opt{cacheDir} option % is disregarded. % \end{markdown} % \begin{macrocode} @@ -25509,7 +25795,7 @@ end % \end{macrocode} % \begin{markdown} % -%### Built-In Syntax Extensions {#luabuiltinextensions} +%### Built-In Syntax Extensions {#lua-built-in-extensions} % % Create \luamref{extensions} hash table that contains built-in syntax % extensions. Syntax extensions are functions that produce objects with two @@ -27611,6 +27897,7 @@ M.extensions.jekyll_data = function(expect_jekyll_data) , function(s, i, text) -- luacheck: ignore s i local data local ran_ok, _ = pcall(function() + -- TODO: Replace with `require("tinyyaml")` in TeX Live 2023 local tinyyaml = require("markdown-tinyyaml") data = tinyyaml.parse(text, {timestamps=false}) end) @@ -27654,7 +27941,7 @@ end % % The \luamref{new} function returns a conversion function that takes a % markdown string and turns it into a plain \TeX{} output. See Section -% <#sec:luaconversion>. +% <#sec:lua-conversion>. % % \end{markdown} % \begin{macrocode} @@ -27883,7 +28170,7 @@ function M.new(options) % % Finally, cast the user-defined syntax extension to the internal format % of user extensions used by the Markdown package (see Section -% <#sec:luabuiltinextensions>.) +% <#sec:lua-built-in-extensions>.) % % \end{markdown} % \begin{macrocode} @@ -28004,7 +28291,7 @@ end % used to implement the macros for the conversion from markdown to plain \TeX{} % exposed by the plain \TeX{} interface (see Section <#sec:texinterface>). % -%### Logging Facilities {#texinterfacelogging} +%### Logging Facilities {#tex-interface-logging} % % \end{markdown} % \begin{macrocode} @@ -28025,7 +28312,7 @@ end % \par % \begin{markdown} % -%### Token Renderer Prototypes {#textokenrendererprototypes} +%### Token Renderer Prototypes {#tex-token-renderer-prototypes} % % The following definitions should be considered placeholder. % @@ -28205,7 +28492,7 @@ end % \par % \begin{markdown} % -%#### YAML Metadata Renderer Prototypes {#expl3yamlmetadataimplementation} +%#### YAML Metadata Renderer Prototypes {#expl3-yaml-metadata-implementation} % % To keep track of the current type of structure we inhabit when we are % traversing a \acro{yaml} document, we will maintain the @@ -28445,8 +28732,8 @@ end %### Lua Snippets % After the \mdef{markdownPrepareLuaOptions} macro has been fully expanded, % the \mdef{markdownLuaOptions} macro will expands to a Lua table that -% contains the plain \TeX{} options (see Section <#sec:texoptions>) in a -% format recognized by Lua (see Section <#sec:luaoptions>). +% contains the plain \TeX{} options (see Section <#sec:tex-options>) in a +% format recognized by Lua (see Section <#sec:lua-options>). % % \end{markdown} % \begin{macrocode} @@ -28573,8 +28860,9 @@ end % \end{markdown} % \begin{macrocode} \ExplSyntaxOn -\cs_new:Nn - \@@_if_option:nTF +\prg_new_conditional:Nnn + \@@_if_option:n + { TF, T, F } { \@@_get_option_type:nN { #1 } @@ -28584,7 +28872,7 @@ end \c_@@_option_type_boolean_tl { \msg_error:nnxx - { @@ } + { markdown } { expected-boolean-option } { #1 } { \l_tmpa_tl } @@ -28595,11 +28883,11 @@ end \str_if_eq:NNTF \l_tmpa_tl \c_@@_option_value_true_tl - { #2 } - { #3 } + { \prg_return_true: } + { \prg_return_false: } } \msg_new:nnn - { @@ } + { markdown } { expected-boolean-option } { Option~#1~has~type~#2,~ @@ -28812,14 +29100,14 @@ end % \end{macrocode} % \begin{markdown} % -%### Lua Shell Escape Bridge {#luabridge} +%### Lua Shell Escape Bridge {#lua-bridge} % % The following \TeX{} code is intended for \TeX{} engines that do not provide % direct access to Lua, but expose the shell of the operating system. This % corresponds to the \mref{markdownMode} values of `0` and `1`. % % The \mref{markdownLuaExecute} macro defined here and in Section -% <#sec:directlua> are meant to be indistinguishable to the remaining code. +% <#sec:direct-lua> are meant to be indistinguishable to the remaining code. % % The package assumes that although the user is not using the Lua\TeX{} engine, % their \TeX{} distribution contains it, and uses shell access to produce and @@ -29001,11 +29289,11 @@ end % \par % \begin{markdown} % -%### Direct Lua Access {#directlua} +%### Direct Lua Access {#direct-lua} % % The following \TeX{} code is intended for \TeX{} engines that provide % direct access to Lua (Lua\TeX{}). The macro \mref{markdownLuaExecute} defined -% here and in Section <#sec:luabridge> are meant to be indistinguishable to +% here and in Section <#sec:lua-bridge> are meant to be indistinguishable to % the remaining code. This corresponds to the \mref{markdownMode} value of `2`. % % \end{markdown} @@ -29021,7 +29309,7 @@ end % The direct Lua access version of the \mref{markdownLuaExecute} macro is defined % in terms of the `\directlua` primitive. The `print` function is set as % an alias to the `tex.print` method in order to mimic the behaviour of the -% \mref{markdownLuaExecute} definition from Section <#sec:luabridge>, +% \mref{markdownLuaExecute} definition from Section <#sec:lua-bridge>, % % \end{markdown} % \begin{macrocode} @@ -29199,7 +29487,7 @@ end % %### Logging Facilities % The \LaTeX{} implementation redefines the plain \TeX{} logging macros (see -% Section <#sec:texinterfacelogging>) to use the \LaTeX{} `\PackageInfo`, +% Section <#sec:tex-interface-logging>) to use the \LaTeX{} `\PackageInfo`, % `\PackageWarning`, and `\PackageError` macros. % % \end{markdown} @@ -29212,7 +29500,7 @@ end % The \mdef{markdownInputPlainTeX} macro is used to store the original plain % \TeX{} implementation of the \mref{markdownInput} macro. The \mref{markdownInput} % is then redefined to accept an optional argument with options recognized by -% the \LaTeX{} interface (see Section <#sec:latexoptions>). +% the \LaTeX{} interface (see Section <#sec:latex-options>). % % \end{markdown} % \begin{macrocode} @@ -29258,7 +29546,7 @@ end % \par % \begin{markdown} % -%#### \LaTeX{} Themes {#latexthemesimplementation} +%#### \LaTeX{} Themes {#latex-themes-implementation} % % This section implements the theme-loading mechanism and the example themes % provided with the Markdown package. @@ -29320,7 +29608,7 @@ end % \begin{markdown} % % We load the \pkg{ifthen} and \pkg{grffile} packages, see also -% Section <#sec:latexprerequisites>: +% Section <#sec:latex-prerequisites>: % % \end{markdown} % \begin{macrocode} @@ -29394,7 +29682,7 @@ end % \begin{markdown} % % We load the \pkg{catchfile} and \pkg{grffile} packages, see also -% Section <#sec:latexprerequisites>: +% Section <#sec:latex-prerequisites>: % % \end{markdown} % \begin{macrocode} @@ -29655,7 +29943,7 @@ end % \par % \begin{markdown} % -%### Token Renderer Prototypes {#latexdefaultrendererprototypes} +%### Token Renderer Prototypes {#latex-default-renderer-prototypes} % % The following configuration should be considered placeholder. If the `plain` % package option has been enabled (see Section <#sec:latexplain>), none of @@ -29742,8 +30030,25 @@ end { #2 } } \markdownSetup{rendererPrototypes={ - ulBeginTight = {\begin{compactitem}}, - ulEndTight = {\end{compactitem}}, +% \end{macrocode} +% \par +% \begin{markdown} +% +% Make tight bullet lists a little less compact by adding extra vertical space +% above and below them. +% +% \end{markdown} +% \begin{macrocode} + ulBeginTight = {% + \group_begin: + \pltopsep=\topsep + \plpartopsep=\partopsep + \begin{compactitem} + }, + ulEndTight = { + \end{compactitem} + \group_end: + }, fancyOlBegin = { \group_begin: \tl_set:Nn @@ -29767,8 +30072,25 @@ end \end{enumerate} \group_end: }, - olBeginTight = {\begin{compactenum}}, - olEndTight = {\end{compactenum}}, +% \end{macrocode} +% \par +% \begin{markdown} +% +% Make tight ordered lists a little less compact by adding extra vertical +% space above and below them. +% +% \end{markdown} +% \begin{macrocode} + olBeginTight = {% + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum} + }, + olEndTight = { + \end{compactenum} + \group_end: + }, fancyOlBeginTight = { \group_begin: \tl_set:Nn @@ -29779,7 +30101,11 @@ end { #2 } \tl_set:Nn \l_tmpa_tl - { \begin{compactenum}[ } + { + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactenum}[ + } \tl_put_right:Nx \l_tmpa_tl { \@@_latex_paralist_style:nn { #1 } { #2 } } @@ -29801,8 +30127,25 @@ end { #1 } ] }, - dlBeginTight = {\begin{compactdesc}}, - dlEndTight = {\end{compactdesc}}}} +% \end{macrocode} +% \par +% \begin{markdown} +% +% Make tight definition lists a little less compact by adding extra +% vertical space above and below them. +% +% \end{markdown} +% \begin{macrocode} + dlBeginTight = { + \group_begin: + \plpartopsep=\partopsep + \pltopsep=\topsep + \begin{compactdesc} + }, + dlEndTight = { + \end{compactdesc} + \group_end: + }}} \cs_generate_variant:Nn \@@_latex_fancy_list_item_label:nnn { VVn } @@ -30595,7 +30938,7 @@ end % \par % \begin{markdown} % -%#### YAML Metadata {#latexyamlmetadata} +%#### YAML Metadata {#latex-yaml-metadata} % % The default setup of \acro{yaml} metadata will invoke the `\title`, % `\author`, and `\date` macros when scalar values for keys that @@ -30701,7 +31044,7 @@ end % \end{markdown} % \begin{macrocode} \ExplSyntaxOn -\@@_if_option:nTF +\@@_if_option:nT { linkAttributes } { \RequirePackage{graphicx} @@ -30725,7 +31068,6 @@ end }, } } - { } \ExplSyntaxOff % \end{macrocode} % \par @@ -30846,7 +31188,7 @@ end %### Typesetting Markdown % The \mref{inputmarkdown} is defined to accept an optional argument with % options recognized by the \Hologo{ConTeXt} interface (see Section -% <#sec:contextoptions>). +% <#sec:context-options>). % % \end{markdown} % \begin{macrocode} diff --git a/macros/generic/markdown/markdown.html b/macros/generic/markdown/markdown.html index b31144bfe9..7318814624 100644 --- a/macros/generic/markdown/markdown.html +++ b/macros/generic/markdown/markdown.html @@ -84,7 +84,7 @@

Markdown Package User Manual

Vít Novotný

-

2.22.0-0-g5a3d0fe 2023-04-02

+

2.23.0-0-g0b22f91 2023-04-27