Skip to content

Preserve task markers in indented list code - #451

Merged
chrisjsewell merged 7 commits into
executablebooks:masterfrom
AryanRG:fix/task-marker-indented-code
Nov 9, 2026
Merged

chrisjsewell merged 7 commits into
executablebooks:masterfrom
AryanRG:fix/task-marker-indented-code

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

With task lists enabled, checkbox-like text at the start of an indented code block inside a list item is consumed as a task marker. For example, a list item containing literal [x] code loses those characters in both the code token and rendered HTML, and gains a checkbox. GFM task markers apply when the first block is a paragraph, not an indented code block.

Check whether the item is an indented code block after its indentation state is established and before consuming a task marker. This preserves literal code while leaving ordinary task items unchanged. Add boundary regressions and an Unreleased changelog note.

Validation:

  • The proposed regressions: 12 failed on the pristine base; 19 focused cases passed with the fix.
  • Full local suite: 1,051 passed on Python 3.13.
  • Pinned pre-commit hooks, including Ruff and strict mypy, passed.
  • Independent differential checks covered 161,280 parser/render comparisons. Other Python versions and hosted CI are not yet verified.

AI assistance was used to investigate, implement, test, and review this change.

@chrisjsewell
chrisjsewell merged commit 01d077a into executablebooks:master Nov 9, 2026
15 checks passed
@chrisjsewell

Copy link
Copy Markdown
Member

Merged in 01d077a, thanks @AryanRG! This was a real bug in the task-list support, and the fix was in the right place: its output matches cmark-gfm and the mdit-py-plugins tasklists plugin. Before merging I merged master in, dropped the changelog line (written at release time), added the user-visible cases to tests/test_port/fixtures/tasklists.md (indented code after spaces and tabs, in an ordered list, a blockquote, a nested list and a mixed list, plus the 4-space and tab boundaries that are still tasks), and made the test_misc.py tests turn linkify off when linkify-it-py is not installed.

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

Successfully merging this pull request may close these issues.

2 participants