Repository navigation
🐛 FIX: Keep task-list content in its original paragraph - #491
Open
Aschenbath wants to merge 1 commit into
Open
Aschenbath wants to merge 1 commit into
Aschenbath wants to merge 1 commit into
Conversation
bardrop
reviewed
Nov 25, 2026
| and firstBlock[1].type == "inline" | ||
| ): | ||
| state.tokens[itemTokIdx].meta["checked"] = checked | ||
| firstBlock[1].content = firstBlock[1].content[4:] |
There was a problem hiding this comment.
On main the text after the checkbox was stripped again by the paragraph rule. Here only 4 characters are cut, so whitespace after the marker now ends up in the inline tokens:
md = MarkdownIt("gfm-like2", {"linkify": False, "breaks": True})
md.render("- [x] \n foo\n")
# main: ...checked=""> foo</li>
# this PR: ...checked=""> <br />\nfoo</li>
md.parse("- [x] foo\n") # text token: "foo" on main, " foo" hereIn the first case the paragraph now starts with a softbreak token (GitHub does not make a task item of it at all: it renders [x]<br>foo).
Suggested change
| firstBlock[1].content = firstBlock[1].content[4:] | |
| firstBlock[1].content = firstBlock[1].content[3:].lstrip() |
With this both give the same tokens as main again, and tests/test_port + tests/test_cmark_spec pass (1028).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
gfm-like2,- [x] # headingcurrently becomes a heading, and similar checkbox content becomes a blockquote, nested list, or thematic break. The checkbox is removed before the block parser can determine that it belongs to a paragraph.Parse the original list-item content first, then remove the checkbox from the first paragraph's inline token. This also leaves checkbox-shaped text in setext headings and code blocks literal. Add regressions for the five block-like prefixes and a setext heading, and record the change in the changelog.
Validation: all five block-prefix regressions failed on the unchanged baseline;
uvx --with tox-uv tox -e py312passes all 1,196 tests, including CommonMark and packaging checks. Repository pre-commit hooks (including strict mypy) pass for all tracked files and the new test file.AI assistance: implemented and tested with OpenAI Codex. The changes and test results were reviewed in this session.