fix(markdown): recognize ~~~ fenced code blocks, not just backticks#2022
Open
kimdzhekhon wants to merge 1 commit into
Open
fix(markdown): recognize ~~~ fenced code blocks, not just backticks#2022kimdzhekhon wants to merge 1 commit into
kimdzhekhon wants to merge 1 commit into
Conversation
The fence-toggle check only matched lines starting with ``` , so a ~~~-fenced block (CommonMark's other valid fence syntax) was parsed as regular prose: any "# ..." line inside it became a spurious heading node, and any markdown link inside it became a spurious document reference edge. Extend the same simple toggle (no fence-length/char tracking, matching the existing implementation's level of rigor) to also match ~~~. Found via codex-assisted code review, verified against the actual code before delegating the fix.
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.
Summary
Found via code review, not tied to an existing issue.
```, so a~~~-fenced block (CommonMark's other valid fence syntax) fell through as regular prose.# ...-shaped line inside a~~~block became a spurious heading node, and any markdown link inside it became a spurious document-reference edge.~~~.Test plan
test_markdown_tilde_fenced_heading_not_parsedandtest_markdown_tilde_fenced_link_not_parsedintests/test_languages.py, mirroring the existing backtick-fence regression testsuv run pytest tests/test_languages.py -q -k markdown— 12 passeduv run pytest tests/ -q— full suite: 3414 passed (4 pre-existing failures unrelated to this change, missing optionalopenaidependency in this environment)