Skip to content

fix(core/xref-headings): prefix cross-spec section links with §#5342

Merged
marcoscaceres merged 1 commit into
mainfrom
fix/cross-spec-section-sign
Jun 24, 2026
Merged

fix(core/xref-headings): prefix cross-spec section links with §#5342
marcoscaceres merged 1 commit into
mainfrom
fix/cross-spec-section-sign

Conversation

@marcoscaceres

Copy link
Copy Markdown
Contributor

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 "§" via core/anchor-expander. The cross-spec links also now carry the sec-ref class 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 secno and 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 "§".

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 §\u00A0 and add sec-ref class via core/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 §, no sec-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.

@marcoscaceres marcoscaceres requested a review from Copilot June 23, 2026 22:17
@marcoscaceres marcoscaceres marked this pull request as ready for review June 23, 2026 22:18
@marcoscaceres marcoscaceres requested a review from sidvishnoi June 23, 2026 22:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@marcoscaceres marcoscaceres merged commit c74de30 into main Jun 24, 2026
11 checks passed
@marcoscaceres marcoscaceres deleted the fix/cross-spec-section-sign branch June 24, 2026 00:58
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.

Cross-spec section links [[[SPEC#id]]] omit the “§” section sign

3 participants