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

Paragraph continuation broken in lists #70

Open
turbo opened this issue Nov 19, 2023 · 1 comment
Open

Paragraph continuation broken in lists #70

turbo opened this issue Nov 19, 2023 · 1 comment

Comments

@turbo
Copy link

turbo commented Nov 19, 2023

Paragraph rules (no new paragraph until repeated horizontal or vertical whitespace) are not processed correctly in lists.

An example:

import markdown

let md = """
Normal paragraph

* bullet item one

* bullet starts here
 and continues here
and this is also the bullet, not a new paragraph

This is a new paragraph though
"""

echo markdown(md, config = initGfmConfig())

Produces:

<p>Normal paragraph</p>
<ul>
<li>
<p>bullet item one</p>
</li>
<li>
<p>bullet starts here
and continues here</p>
</li>
</ul>
<p>and this is also the bullet, not a new paragraph</p>
<p>This is a new paragraph though</p>

Where the second to last paragraph lives outside the list. However, this is what GFM renders:


Normal paragraph

  • bullet item one

  • bullet starts here
    and continues here
    and this is also the bullet, not a new paragraph

This is a new paragraph though

@turbo
Copy link
Author

turbo commented Nov 19, 2023

There's an off-by-one error here:

size = firstLineSize

Adding a +1 seems to superficially fix the bug (all test pass) but that's hacky. I can't quite trace where the offset is coming from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant