Witiko / markdown

:notebook_with_decorative_cover: A package for converting and rendering markdown documents in TeX
http://ctan.org/pkg/markdown
LaTeX Project Public License v1.3c
332 stars 31 forks source link

Ignore hard line breaks at the end of fancy list items #508

Closed Witiko closed 3 weeks ago

Witiko commented 1 month ago

On the first glance, hard line breaks are ignored at the end of unordered and ordered list items, as expected:

$ docker run --pull=always --rm -i witiko/markdown markdown-cli <<< $'- foo  \n- bar\n  bar  \n- baz  '
\markdownRendererDocumentBegin
\markdownRendererUlBegin
\markdownRendererUlItem foo\markdownRendererUlItemEnd 
\markdownRendererUlItem bar\markdownRendererSoftLineBreak
{}bar\markdownRendererUlItemEnd 
\markdownRendererUlItem baz\markdownRendererUlItemEnd 
\markdownRendererUlEnd \markdownRendererDocumentEnd
$ docker run --pull=always --rm -i witiko/markdown markdown-cli <<< $'1. foo  \n2. bar\n  bar  \n3. baz  '
\markdownRendererDocumentBegin
\markdownRendererOlBegin
\markdownRendererOlItemWithNumber{1}foo\markdownRendererOlItemEnd 
\markdownRendererOlItemWithNumber{2}bar\markdownRendererSoftLineBreak
{}bar\markdownRendererOlItemEnd 
\markdownRendererOlItemWithNumber{3}baz\markdownRendererOlItemEnd 
\markdownRendererOlEnd \markdownRendererDocumentEnd

However, they are not entirely ignored, since they change \markdownRendererOlBeginTight to \markdownRendererOlBegin. Therefore, even if they do not produce a \markdownRendererHardLineBreak, they are recognized at some level rather than ignored.

Furthermore, hard line breaks are not ignored in fancy lists when the option fancyLists is enabled:

$ docker run --pull=always --rm -i witiko/markdown markdown-cli fancyLists=true <<< $'a. foo  \nb. bar\n  bar  \nc. baz  '
\markdownRendererDocumentBegin
\markdownRendererFancyOlBeginTight{LowerAlpha}{Period}\markdownRendererFancyOlItemWithNumber{1}foo\markdownRendererHardLineBreak
{}b. bar\markdownRendererSoftLineBreak
{}bar\markdownRendererHardLineBreak
{}c. baz\markdownRendererFancyOlItemEnd 
\markdownRendererFancyOlEndTight \markdownRendererDocumentEnd