Skip to content

Match link labels with Unicode case folding - #153

Merged
bobzhang merged 1 commit into
mainfrom
conformance/link-label-casefold
Oct 2, 2026
Merged

bobzhang merged 1 commit into
mainfrom
conformance/link-label-casefold

Conversation

@bobzhang

@bobzhang bobzhang commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Split out of #152.

Bug: link labels were only lowercased for ASCII. The spec matches labels after Unicode case folding.

Repro:

[ΑΓΩ]: /φου

[αγω]

gave <p>[αγω]</p> instead of a link. Same for [ẞ] vs [SS]: /url.

Fix: link_label case-folds the normalized label with @casefold.casefold (full Unicode case folding; moonbit-community/casefold is already a module dependency, now imported by cmark_base).

Spec examples fixed: 206, 540.

Tests: src/cmark_html/link_label_casefold_test.mbt.

Depends on: nothing, independent of the other PRs.

Link labels were only lowercased for ASCII. The spec matches labels
after Unicode case folding, so [ΑΓΩ] must match [αγω] and [ẞ] must
match [SS] (spec examples 206 and 540).
@bobzhang

bobzhang commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Automated review: Codex CLI (codex exec, model reasoning effort high, read-only sandbox), 1 round, on git diff against the base branch.

Verdict: signed off, no changes requested.

I sign off. No concrete correctness or regression issues found in origin/main...HEAD.

The shared parser applies full Unicode folding consistently to definitions, reference links, and images, matching CommonMark 0.31.2. Folding preserves source positions and does not affect the existing length counter. Tests cover Greek and expanding folds (ẞ, ß).

Codex could not run moon test in its read-only sandbox. The tests were run separately on native, js and wasm-gc and pass.

@bobzhang
bobzhang merged commit d0b8ad7 into main Oct 2, 2026
9 checks passed
@bobzhang
bobzhang deleted the conformance/link-label-casefold branch October 2, 2026 01:35
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.

1 participant