Skip to content

fix(error-messages): improve hints in xref and link-to-dfn#5170

Open
marcoscaceres wants to merge 3 commits intomainfrom
fix/error-message-hints-v2
Open

fix(error-messages): improve hints in xref and link-to-dfn#5170
marcoscaceres wants to merge 3 commits intomainfrom
fix/error-message-hints-v2

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

Summary

  • xref.js: invalid xref config value had no hint. Now explains the four valid forms (boolean, profile name, array, object) and links to docs via docLink.
  • link-to-dfn.js: linkless <a> warning had no hint. Now suggests adding a <dfn>, using data-cite, or enabling xref. Also detects when the link is inside a data-link-for section and warns about scoping.

Split from #5135; MDN hint improvement is in #5137.

Test plan

  • pnpm start --browser ChromeHeadless --grep="link-to-dfn" — existing tests pass
  • pnpm start --browser ChromeHeadless --grep="xref" — existing tests pass

xref.js: invalid xref config value had no hint. Now explains the four
valid forms and links to docs.

link-to-dfn.js: linkless <a> warning had no hint. Now suggests adding
a <dfn>, using data-cite, or enabling xref. Also detects when the link
is inside a data-link-for section and warns about scoping.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves ReSpec’s author-facing diagnostics by adding actionable hint text (with documentation links) to previously under-explained xref and definition-linking warnings/errors.

Changes:

  • Add a docLink-based hint for invalid respecConfig.xref values in core/xref.
  • Add a detailed hint for linkless <a> elements with no matching <dfn> in core/link-to-dfn, including guidance around data-link-for scoping.
  • Import and use docLink in link-to-dfn to make hint references clickable.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/core/xref.js Adds a new linked hint explaining valid xref config shapes when the value is invalid.
src/core/link-to-dfn.js Adds a new warning hint (with doc links) and a data-link-for scoping note for linkless anchors.

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

marcoscaceres and others added 2 commits April 13, 2026 05:21
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.

3 participants