Skip to content

Heading ids: lowercase (GitHub-style) + opt-in ASCII fold - #81

Merged
dereuromark merged 1 commit into
mainfrom
feat/heading-ids-lowercase
Jun 7, 2026
Merged

Heading ids: lowercase (GitHub-style) + opt-in ASCII fold#81
dereuromark merged 1 commit into
mainfrom
feat/heading-ids-lowercase

Conversation

@dereuromark

Copy link
Copy Markdown
Contributor

Implements the carve spec #73 lowercase heading-id decision in carve-js.

What changes

slugify now:

ASCII transliteration is now opt-in (slugify(text, true)), surfaced as the
asciiHeadingIds parse option on parse / resolve / carveToHtml. Previously it
was the baked default.

Why

Lowercase ids make the common </#id> and [Heading][] cross-references
case-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

Gates green locally: test (642 pass), typecheck, build. Part of carve#71.

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
dereuromark merged commit ccfdd6d into main Jun 7, 2026
2 checks passed
@dereuromark
dereuromark deleted the feat/heading-ids-lowercase branch June 7, 2026 12:20
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.
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