Skip to content

feat(core/inlines): render inline code in [[[…|alias]]] link text#5344

Merged
marcoscaceres merged 1 commit into
mainfrom
fix-5343-code-in-alias
Jul 3, 2026
Merged

feat(core/inlines): render inline code in [[[…|alias]]] link text#5344
marcoscaceres merged 1 commit into
mainfrom
fix-5343-code-in-alias

Conversation

@marcoscaceres

Copy link
Copy Markdown
Contributor

Closes #5343

Author aliases in the [[[…|alias]]] autolink now support inline code, so backticks in the alias render as a <code> element instead of appearing literally, matching how the [= =] inline-link syntax already does it. A shared setInlineContent helper applies the processed alias at the three sites that emit alias display text (same-document, cross-spec section, and cross-spec spec links).

Author aliases in the [[[…|text]]] autolink now run through the same
inline-code processing as [= =], so `code` in an alias renders as a
<code> element instead of literal backticks. A shared setInlineContent
helper applies the processed alias at the three sites that emit alias
display text (same-document, cross-spec section, and cross-spec links).

Closes #5343

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

This PR makes [[[…|alias]]] autolink alias text render inline code spans (backticks) as <code>…</code>, aligning autolink behavior with existing [= =] inline-link processing. It does so by reusing the existing inline backtick processing logic and applying it consistently where alias display text is materialized.

Changes:

  • Inline [[[#id|alias]]] now runs alias text through inline backtick processing so `code` becomes <code>code</code>.
  • Cross-spec alias display text application (in core/data-cite and core/xref-headings) now uses a shared setInlineContent() helper to render backticks as <code>.
  • Adds test coverage for backticks in alias text across same-document, cross-spec section, and cross-spec spec links (including multi-line alias text).

Reviewed changes

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

File Description
tests/spec/core/inlines-spec.js Adds tests verifying backticks in `[[[…
src/core/xref-headings.js Uses setInlineContent() when applying alias text to cross-spec section links (headings API module).
src/core/inlines.js Processes same-document `[[[#id
src/core/data-cite.js Uses setInlineContent() when applying alias text for non-section data-cite links.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@marcoscaceres
marcoscaceres marked this pull request as ready for review July 3, 2026 03:30
@marcoscaceres
marcoscaceres requested a review from sidvishnoi July 3, 2026 03:30
expect(anchor.textContent).toBe("the fetch method");
});

it("processes backticks in [[[SPEC|`code`]]] alias text", async () => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This one feels not needed (use case).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can see myself using this... like [[fetch|fetch()]]].

@marcoscaceres
marcoscaceres merged commit 3de292d into main Jul 3, 2026
10 checks passed
@marcoscaceres
marcoscaceres deleted the fix-5343-code-in-alias branch July 3, 2026 04:07
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.

Support inline code (backticks) in [[[…|alias]]] link text

3 participants