Conversation
|
🤖 Here's your preview: https://keluh-vqaaa-aaaam-ai7wa-cai.icp0.io |
There was a problem hiding this comment.
🟡 Changes recommended
The regex handling still diverges from CommonMark for nested underscores and multi-backtick code spans.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Updates anchor validation to better match Starlight-generated heading IDs, especially for identifiers containing underscores.
Changes:
- Separates asterisk and underscore emphasis handling.
- Protects inline code and unwraps links before slug generation.
- Updates shared anchor logic used by validation and static-site synchronization.
Verified: Reviewed the changed helper, its callers, and the configured Markdown pipeline.
File summaries
| File | Description |
|---|---|
scripts/lib/anchors.mjs |
Revised rendered-heading text and slug extraction logic. |
Review details
Suppressed comments (1)
scripts/lib/anchors.mjs:31
- This split recognizes only code spans delimited by exactly one backtick. CommonMark permits matching runs of multiple backticks, so a heading with a two-backtick code span around
_literal_keeps those underscores literal in the rendered heading, while this code exposes them toUNDERSCORE_EMPHASISand computes a different anchor. Use a delimiter-run-aware code-span scanner or the Markdown AST before applying the emphasis rules.
.split(/(`[^`]*`)/g)
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
e7c1656 to
15e833f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The parser does not enable the site's GFM extensions, so some supported headings can receive different anchor IDs.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 1
- Review effort level: Lite
15e833f to
8faa33d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Script-only mdast packages should follow the existing convention and be moved to devDependencies.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 2/3 changed files
- Comments generated: 1
- Review effort level: Lite
Identifier headings with two or more underscores were mis-slugged, which failed validate on a correct link.
8faa33d to
d0ce553
Compare
Summary
npm run validatefails onmainfor a correct link: the slug library mis-slugged any identifier heading with two or more underscores (flexible_http_requestbecameflexiblehttprequest,canister_inspect_messagelikewise).renderedTextparses the heading withmdast-util-from-markdownandmdast-util-to-string, replacing the regexes that approximated inline markdown#markers included, so1. Create a target canisterkeeps its numberdevDependencies; the lockfile root is hand-edited rather than regeneratedVerified against a built site: every heading id in
dist/matches the library across all 200 pages, both directions. A footnote reference in a heading stays out of reach, noted in the code.