fix(core/structure): propagate custom heading ID to section element - #5281
fix(core/structure): propagate custom heading ID to section element#5281marcoscaceres wants to merge 3 commits into
Conversation
When a heading has a custom ID (e.g., from {#custom-id} markdown
syntax), move it to the wrapping section element instead of generating
a separate auto-ID from the heading text. This ensures section and
heading share one canonical ID for fragment navigation and tools
like webref that expect section-level IDs.
Closes #4947
|
@copilot can you fix whatever is causing CI to fail? |
Fixed in 9bfe25f. I investigated the failing Node CI run and updated the affected core specs to match the new heading-id-to-section-id behavior, which resolves the reported failing tests. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
The change this PR makes (moving the author's heading id onto the section, and generating a fresh section-number-based id for the heading) does not reduce the number of ids emitted; it swaps which element holds the author's one, and changes the ids in every ReSpec document. The reason it was worth doing, that webref omitted the custom id, no longer applies: w3c/reffy#1824 landed and webref now exposes it as |
|
Reopening: I closed this too early. The close reasoning was that the reported breakage is gone, since w3c/reffy#1824 landed and webref now exposes the author's id as Where this PR differs from his suggestion is the heading's generated id. This PR leaves it to be generated from the numbered heading text, which is the So the open question is whether to adopt that reserved prefix here. Worth noting either way: this changes the ids emitted by every ReSpec document, and @tabatkins' original question was why a second id is generated at all. |
Closes #4947
When a heading has an explicit id and its section has none, move
the id from the heading to the section.
Written with AI: this change was generated by Claude. Per AI_POLICY.md.