Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly produce paragraph separators inside block-level elements #376

Closed
Witiko opened this issue Nov 23, 2023 · 0 comments · Fixed by #403
Closed

Correctly produce paragraph separators inside block-level elements #376

Witiko opened this issue Nov 23, 2023 · 0 comments · Fixed by #403
Assignees
Labels
bug lua Related to the Lua interface and implementation
Milestone

Comments

@Witiko
Copy link
Owner

Witiko commented Nov 23, 2023

In #306, we added support for paragraph separators that are inserted between paragraphs and also between block-level element separated by more than one blank line:

markdown/markdown.dtx

Lines 28533 to 28570 in 859b8da

Blocks = V("InitializeState")
* ( V("ExpectedJekyllData")
* (V("Blank")^0 / writer.interblocksep)
)^-1
* V("Blank")^0
% \end{macrocode}
% \par
% \begin{markdown}
%
% Only create interblock separators between pairs of blocks that are not
% both paragraphs. Between a pair of paragraphs, any number of blank
% lines will always produce a paragraph separator.
%
% \end{markdown}
% \begin{macrocode}
* ( V("Block")
* ( V("Blank")^0 * parsers.eof
+ ( V("Blank")^2 / writer.paragraphsep
+ V("Blank")^0 / writer.interblocksep
)
)
+ ( V("Paragraph") + V("Plain") )
* ( V("Blank")^0 * parsers.eof
+ ( V("Blank")^2 / writer.paragraphsep
+ V("Blank")^0 / writer.interblocksep
)
)
* V("Block")
* ( V("Blank")^0 * parsers.eof
+ ( V("Blank")^2 / writer.paragraphsep
+ V("Blank")^0 / writer.interblocksep
)
)
+ ( V("Paragraph") + V("Plain") )
* ( V("Blank")^0 * parsers.eof
+ V("Blank")^0 / writer.paragraphsep
)
)^0,

Here is an example of two paragraphs that are correctly separated by paragraph separators rather than interblock separators:

$ docker run -i --rm witiko/markdown markdown-cli <<< $'First paragraph\n\nSecond paragraph'
\markdownRendererDocumentBegin
First paragraph\markdownRendererParagraphSeparator
Second paragraph\markdownRendererDocumentEnd

However, paragraph separators are not inserted between paragraphs in blockquotes:

$ docker run -i --rm witiko/markdown markdown-cli <<< $'> First paragraph\n>\n> Second paragraph'
\markdownRendererDocumentBegin
\markdownRendererBlockQuoteBegin
First paragraph\markdownRendererInterblockSeparator
Second paragraph
\markdownRendererBlockQuoteEnd \markdownRendererDocumentEnd

Furthermore, paragraph separators are also not inserted between paragraphs in fenced divs:

$ docker run -i --rm witiko/markdown markdown-cli fencedDivs=true <<< $'::: class\nFirst paragraph\n\nSecond paragraph\n:::'
\markdownRendererDocumentBegin
\markdownRendererFencedDivAttributeContextBegin
\markdownRendererAttributeClassName{class}%
First paragraph\markdownRendererInterblockSeparator
Second paragraph
\markdownRendererFencedDivAttributeContextEnd \markdownRendererDocumentEnd

Lastly, paragraph separators are also not inserted between paragraphs in lists:

$ docker run -i --rm witiko/markdown markdown-cli <<< $'- First paragraph\n\n  Second paragraph'
\markdownRendererDocumentBegin
\markdownRendererUlBegin
\markdownRendererUlItem First paragraph\markdownRendererInterblockSeparator
Second paragraph\markdownRendererUlItemEnd 
\markdownRendererUlEnd \markdownRendererDocumentEnd
$ docker run -i --rm witiko/markdown markdown-cli <<< $'1. First paragraph\n\n   Second paragraph'
\markdownRendererDocumentBegin
\markdownRendererOlBegin
\markdownRendererOlItemWithNumber{1}First paragraph\markdownRendererInterblockSeparator
Second paragraph\markdownRendererOlItemEnd 
\markdownRendererOlEnd \markdownRendererDocumentEnd

All four cases should produce paragraph separators instead.

@Witiko Witiko added bug lua Related to the Lua interface and implementation labels Nov 23, 2023
@Witiko Witiko added this to the 3.3.0 milestone Nov 23, 2023
@Witiko Witiko self-assigned this Nov 23, 2023
Witiko added a commit that referenced this issue Nov 23, 2023
@Witiko Witiko modified the milestones: 3.3.0, 3.2.1 Nov 23, 2023
@Witiko Witiko changed the title Correctly produce paragraph separators in lists Correctly produce paragraph separators inside block-level elements Nov 27, 2023
Witiko added a commit that referenced this issue Nov 27, 2023
@Witiko Witiko modified the milestones: 3.2.1, 3.3.0 Nov 28, 2023
@Witiko Witiko modified the milestones: 3.3.0, 3.4.0 Dec 16, 2023
@Witiko Witiko assigned lostenderman and unassigned Witiko Dec 19, 2023
@Witiko Witiko modified the milestones: 3.4.0, 3.5.0 Jan 31, 2024
lostenderman pushed a commit to lostenderman/markdown that referenced this issue Feb 8, 2024
@Witiko Witiko modified the milestones: 3.5.0, 3.4.1 Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug lua Related to the Lua interface and implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants