Repository navigation
Keep Markdown labels apart under case-insensitive matching - #11
Merged
Merged
Conversation
CommonMark and GFM compare link and footnote labels after Unicode case folding, so two CND labels that differ only by case (Fn and fn, ß and SS) could resolve to one definition. markdown_label now keeps a letter, digit or safe punctuation only when case folding leaves it unchanged and percent-encodes everything else, so the mapping stays injective under folding. Goldens are unchanged. Closes CND-38 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
…s comparison markdown-it compares labels with lower() then upper(), not Unicode case folding, so dotless i and i still met after the previous commit. A label character is now kept only when case folding, lowering, and an upper-then-lower round trip all leave it unchanged. Tests sweep the whole Basic Multilingual Plane under both comparisons. Part of CND-38 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS
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.
Markdown compares link and footnote labels without regard to case. CommonMark and GFM do it with Unicode case folding; markdown-it and other JavaScript readers do it by lowercasing then uppercasing. Two CND labels that differ only by case, such as
Fnandfn, orßandSS, could therefore resolve to one definition.markdown_labelnow keeps a letter, digit or-._:only when case folding, lowercasing, and an upper-then-lower round trip all leave it unchanged. Every other character is percent-encoded, as before. Two distinct labels therefore never meet under either comparison. This also covers the dotlessı, which a JavaScript-based reader matches withi.Testing
ß, ligatures, andı.Visible change
A label with capitals is now percent-encoded in Markdown output. For example,
FIG-1becomes%46%49%47-1. Lower-case labels are unchanged.Closes CND-38
🤖 Generated with Claude Code
https://claude.ai/code/session_01XxXUiDn2QyzNTYnZpeVFVS