fix(core/xref-headings): prefix cross-spec section links with §#5342
Merged
Conversation
Cross-spec section references written as [[[SPEC#id]]] now render with a leading "§" section sign (e.g. "§ 4 Fetching") and carry the `sec-ref` class, matching in-document [[[#id]]] links which already do both via core/anchor-expander. Closes #5341
Contributor
There was a problem hiding this comment.
Pull request overview
Updates cross-spec section references ([[[SPEC#id]]]) to render like in-document section references by adding a leading section sign (§\u00A0) and the sec-ref class when a heading is successfully resolved from the headings API/cache.
Changes:
- Prefix resolved cross-spec section link text with
§\u00A0and addsec-refclass viacore/xref-headings. - Extend fixture data to include a “no section number” case and add/adjust tests accordingly.
- Ensure API-failure fallback and author-supplied alias text remain unchanged (no
§, nosec-ref).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/core/xref-headings.js |
Adds §\u00A0 prefix and sec-ref class to successfully resolved cross-spec section references. |
tests/spec/core/inlines-spec.js |
Updates expectations for §\u00A0 output, adds coverage for no-number sections and API-failure behavior. |
tests/data/headings.json |
Adds a fixture entry for a section heading with number: null. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
sidvishnoi
approved these changes
Jun 23, 2026
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.
Closes #5341
Cross-spec section references written as
[[[SPEC#id]]]now render with a leading "§" section sign (for example,[[[fetch#fetching]]]becomes "§ 4 Fetching"), so they match in-document section references written as[[[#id]]], which already render with the "§" viacore/anchor-expander. The cross-spec links also now carry thesec-refclass for the same reason, keeping the two forms consistent in both text content and styling hooks.The section sign is rendered the same way as the in-document path: a "§" followed by a non-breaking space (so the sign never wraps away from the number), then the
secnoand the title. When the referenced section has no number, the link renders as "§ Title". The API-failure fallback (which shows the spec title only) and author-supplied alias text ([[[SPEC#id|text]]]) are intentionally left unchanged — neither is a section reference, so neither gets the "§".