Heading ids: lowercase (GitHub-style) + opt-in ASCII fold - #81
Merged
Conversation
Aligns slugify with carve spec #73: the auto heading-id rule now applies the jgm/djot#393 run-replacement (each maximal run of non-alphanumeric ASCII -> single '-', trimmed) and then lowercases (Unicode-aware), keeping non-ASCII verbatim. Lowercasing makes ids and the common </#id> / [Heading][] cross-references case-insensitive with no special lookup logic. ASCII transliteration is no longer the default: it moves behind an opt-in slugify(text, true), surfaced as the asciiHeadingIds parse option (carveToHtml / resolve). Empty-text and digit-leading slugs use the s / s- fallback. Bumps the spec submodule to the #73 lowercase corpus and updates the slug unit tests accordingly.
dereuromark
added a commit
that referenced
this pull request
Jun 27, 2026
Aligns slugify with carve spec #73: the auto heading-id rule now applies the jgm/djot#393 run-replacement (each maximal run of non-alphanumeric ASCII -> single '-', trimmed) and then lowercases (Unicode-aware), keeping non-ASCII verbatim. Lowercasing makes ids and the common </#id> / [Heading][] cross-references case-insensitive with no special lookup logic. ASCII transliteration is no longer the default: it moves behind an opt-in slugify(text, true), surfaced as the asciiHeadingIds parse option (carveToHtml / resolve). Empty-text and digit-leading slugs use the s / s- fallback. Bumps the spec submodule to the #73 lowercase corpus and updates the slug unit tests accordingly.
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.
Implements the carve spec #73 lowercase heading-id decision in carve-js.
What changes
slugifynow:-, trimmed),s/s-for empty-text and digit-leading slugs.ASCII transliteration is now opt-in (
slugify(text, true)), surfaced as theasciiHeadingIdsparse option onparse/resolve/carveToHtml. Previously itwas the baked default.
Why
Lowercase ids make the common
</#id>and[Heading][]cross-referencescase-insensitive with no special lookup logic - the GitHub/Hugo/Jekyll convention
authors expect. Supersedes the case-preserving approach (carve-js followed djot#393
case+case preservation briefly; spec #73 reversed it for carve).
Scope
src/heading-ids.ts,src/index.ts,src/parse.tsGates green locally:
test(642 pass),typecheck,build. Part of carve#71.