Skip to content

Apply the CommonMark rule of 3 which we missed. - #1691

Merged
waylan merged 1 commit into
Python-Markdown:masterfrom
facelessuser:bugfix/rule-of-3
Nov 5, 2026
Merged

waylan merged 1 commit into
Python-Markdown:masterfrom
facelessuser:bugfix/rule-of-3

Conversation

@facelessuser

Copy link
Copy Markdown
Collaborator

Rule of 3: an ambiguous delimiter cannot pair with an open delimiter if the sum of the original lengths is a multiple of 3 (unless both are multiples of 3).

3 existing test were changed. These matched the results of other CommonMark parsers but not the official CommonMark implementation. These other parsers missed a subtle interpretation of the rule of 3 that the official implementation applies.

AI was used to pin down where we deviated and generate the tests to capture where we deviated.
It particualry was particularly useful to identify why some CommonMark parsers don't match the
official one with certain applications of the "rule-of-3".

Fixes #1690

Description

AI Assistance Disclosure

  • No AI tools were used in preparing this PR.

  • AI tools were used and I have disclosed which ones, and have fully reviewed and verified their output.

    AI tools were use to assist with the following:

    • Code
    • Code Comments
    • Documentation
    • Changelog Entry
    • Commit Message
    • The Description Above
    • Other: To pin down where we deviated and generate tests that we should match.

Checklist

Rule of 3: an ambiguous delimiter cannot pair with an open delimiter if
the sum of the original lengths is a multiple of 3 (unless both are
multiples of 3).

3 existing test were changed. These matched the results of other
CommonMark parsers but not the official CommonMark implementation. These
other parsers missed a subtle interpretation of the rule of 3 that the
official implementation applies.

Fixes Python-Markdown#1690
@waylan
waylan merged commit a198bb3 into Python-Markdown:master Nov 5, 2026
14 checks passed
@facelessuser facelessuser mentioned this pull request Nov 8, 2026
8 of 15 tasks
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.

Strong with underscores not rendered when content has a word-initial underscore (regression in 3.11.1)

2 participants