Skip to content

feat: expose canonical heading ID generator for tree transforms - #509

Closed
tubarao312 wants to merge 1 commit into
comarkdown:mainfrom
tubarao312:feat/heading-id-generator
Closed

tubarao312 wants to merge 1 commit into
comarkdown:mainfrom
tubarao312:feat/heading-id-generator

Conversation

@tubarao312

@tubarao312 tubarao312 commented Oct 21, 2026 •

Copy link
Copy Markdown

Expose a per-document heading ID generator from comark/utils, sharing the parser's existing tracker, slug, nesting, authored-ID reservation, and collision rules. Consumers that select or remove AST branches can parse with headingIds:false and allocate IDs only for retained headings without reimplementing CoMark's algorithm.

The helper does not traverse trees or change parser/plugin ordering. Callers control heading provenance and skip raw HTML or literal code. Tests compare results to parser allocation in flat, nested, and disabled modes, including Unicode, authored IDs, collisions, and document isolation.

Validation: 39 focused heading tests, package build, and changed-source lint pass. Combined preview with #508 passes 1,054 core tests and 4 skips, excluding two existing Windows-incompatible suites. Independent thermo-nuclear review approved the helper and downstream traversal, including raw HTML/code provenance, after rerunning the original failing conditional-anchor cases.

Downstream integration: https://github.com/tooling-test/docs/pull/614. It remains gated on an official registry release; the commit-pinned review artifact is https://github.com/tubarao312/comark/releases/tag/brief-reviewed-87bc46e1d9e6. This proposal is independent of the source-range API in #508.

@coderabbitai

coderabbitai Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Documentation previews

Previews are disabled for pull requests from forks.
A maintainer can add the preview:enabled label to enable them.

@vercel

vercel Bot commented Oct 21, 2026

Copy link
Copy Markdown

@tubarao312 is attempting to deploy a commit to the NuxtLabs Team on Vercel.

A member of the Team first needs to authorize it.

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