Skip to content

🏗️🔧:give headings the anchors links point to - #1916

Merged
openinf-commit-queue[bot] merged 1 commit into
livefrom
claude/project-thread-xj2fx1
Oct 9, 2026
Merged

openinf-commit-queue[bot] merged 1 commit into
livefrom
claude/project-thread-xj2fx1

Conversation

@DerekNonGeneric

@DerekNonGeneric DerekNonGeneric commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

Requested by DerekNonGeneric

Before: markdown-it-anchor kept a heading's punctuation and percent-encoded it, so "logLevel?" got the id loglevel%3F and "fetchContent()" got fetchcontent(). TypeDoc links to those as #loglevel and #fetchcontent. With the SDK 3.0.0 reference imported, three of its links (two on GhFileImporterOptions, one on isContentFile) went to the top of the page instead of the heading, and no optional property or method heading had an anchor anyone could guess. Three handbook headings had the same problem, for example #show-the-command%2C-not-the-ceremony.

After: headings get GitHub's anchors: lowercased, with punctuation other than - and _ dropped and spaces turned into hyphens. A build of the site with the 3.0.0 reference imported has no internal link pointing at a missing page or anchor, and no id holds a percent-encoded character.

Nothing linked to the old encoded ids. A check over the built site found no link that used them.

How: a small headingSlug in build/shared/heading-slug.mts (exported as @openinf/portal/build/heading-slug, with unit tests), passed to markdown-it-anchor as slugify. To verify it, I ran the SDK's version-packages and docs:artifact in a scratch checkout, imported the result with unpack-sdk-api-artifact.mts and compile.importSdkApiDocs, built the site, and checked every href and fragment. That import was only for the check and isn't part of this change.

Summary by CodeRabbit

  • Improvements
    • Heading anchors now use consistent slugs that preserve letters and numbers across writing systems, remove punctuation, and replace spaces with hyphens.

markdown-it-anchor keeps a heading's punctuation and percent-encodes
it, so "logLevel?" became #loglevel%3F and "fetchContent()" became
#fetchcontent(). TypeDoc links to those as #loglevel and #fetchcontent,
which is GitHub's rule as well, so once the SDK reference is imported
three of its links reach the top of the page instead of the heading,
and every optional property or method heading has an anchor nothing
can guess. The handbook had three such headings too.

Headings now take GitHub's anchor: lowercased, with punctuation other
than hyphens and underscores dropped and spaces turned into hyphens.
A build of the site with the 3.0.0 reference imported has no link
left pointing at a missing anchor.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Claude-Code:claude-opus-5
@netlify

netlify Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for gh-pages-openinf ready!

Name Link
🔨 Latest commit 6c11061
🔍 Latest deploy log https://app.netlify.com/projects/gh-pages-openinf/deploys/6ac81824f9d7390007b1e977
😎 Deploy Preview https://deploy-preview-1916--gh-pages-openinf.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: 16c31548-28f4-4abf-bcad-3f0c8d08fd66
📥 Commits

Reviewing files that changed from the base of the PR and between 87c5e8a and 6c11061.

📒 Files selected for processing (4)
  • build/shared/heading-slug.mts
  • build/shared/heading-slug.test.mts
  • eleventy.config.mjs
  • package.json

Included review availability: This review used your included allowance. 1 included review remains after this review. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The change adds an exported headingSlug function, tests its slug output, and configures Markdown heading anchors to use it.

Changes

Heading slug generation

Layer / File(s) Summary
Define and export heading slug generation
build/shared/heading-slug.mts, build/shared/heading-slug.test.mts, package.json
Adds headingSlug to trim and lowercase text, remove disallowed characters, and replace spaces with hyphens. Tests cover TypeDoc-style anchors, punctuation, Unicode letters and digits, and repeated spaces. Exports the function from the package.
Use the shared slug for Markdown anchors
eleventy.config.mjs
Imports headingSlug and configures markdownItAnchor to use it.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 6c110

The shared slug generator is wired into Markdown anchors, with no identified issue requiring resolution before merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title describes the main change: update heading anchors so links resolve to them. The emojis and wording reduce polish, but the title remains specific and relevant.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@DerekNonGeneric DerekNonGeneric self-assigned this Oct 8, 2026
@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 9, 2026 — with Claude
@openinf-commit-queue
openinf-commit-queue Bot merged commit 85f0420 into live Oct 9, 2026
19 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 9, 2026
@openinf-commit-queue
openinf-commit-queue Bot deleted the claude/project-thread-xj2fx1 branch October 9, 2026 00:13
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