Fix case-insensitive anchor ID collision in markdown help output#10095
Fix case-insensitive anchor ID collision in markdown help output#10095aidanfnv wants to merge 4 commits intoshader-slang:masterfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 📝 WalkthroughWalkthroughStandardizes anchor IDs in the command-line reference to lowercase and updates the Markdown link-name generator to lowercase prefixes so generated anchors align with revised doc IDs, resolving incorrect navigation to duplicated anchors. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
Pull request overview
Fixes anchor collisions in the generated Markdown help output by aligning explicit <a id> generation with GitHub’s case-insensitive heading ID behavior, preventing navigation from jumping to the wrong section.
Changes:
- Lowercase anchor ID prefixes in
_getLinkNameto match GitHub’s case-insensitive deduplication. - Update generated
command-line-slangc-reference.mdanchors and links to the new IDs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| source/core/slang-command-options-writer.cpp | Lowercases anchor ID prefixes during link-name generation to avoid case-only collisions. |
| docs/command-line-slangc-reference.md | Refreshes explicit anchors and in-doc links to match the updated ID generation behavior. |
Comments suppressed due to low confidence (1)
docs/command-line-slangc-reference.md:1
- “inbetween” should be “in between”.
# Slang Command Line Options
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| * [Internal](#Internal) | ||
| * [Deprecated](#Deprecated) | ||
| * [General](#general) | ||
| * [Target](#target) |
There was a problem hiding this comment.
I found it strange that there are two "target" links.
One as line 16 and another at line 36.
There was a problem hiding this comment.
"Target" (uppercase, line 16) refers to the category for the Target-related options, "-target" (with hyphen, not in the quick links) refers to the command-line option for specifying a target (and is listed in the "Target" category too), and "target" (lowercase, line 36) refers to the list of targets accepted as <target> for -target <target>.
It is quite confusing, and since I will need to regenerate this file anyways after other changes are merged, I will consider updating "Target" (the category) to "Target-related", as I think "Target-related Options" is a bit more descriptive than "Target Options".
) Fixes #10083 The markdown help output (`slangc -help-style markdown -h`) generates explicit `<a id>` anchor IDs for headings using case-sensitive deduplication, but GitHub's markdown renderer generates heading IDs case-insensitively. This causes the `## Target` category heading and `## target` value section heading to produce non-colliding explicit anchors (`Target` and `target`), while GitHub assigns them colliding auto-IDs (`target` and `target-1`). The auto-ID `target-1` for `## target` then coincides with the explicit anchor for the `### -target` option, so clicking "target" in GitHub's right-side navigation scrolls to the `-target` option instead of the target value list. This fix lowercases anchor ID prefixes in `_getLinkName` so that deduplication matches GitHub's case-insensitive behavior. The explicit anchors now align with GitHub's auto-generated heading IDs, and the right-side navigation links to the correct sections. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Fixes #10083
The markdown help output (
slangc -help-style markdown -h) generates explicit<a id>anchor IDs for headings using case-sensitive deduplication, but GitHub's markdown renderer generates heading IDs case-insensitively. This causes the## Targetcategory heading and## targetvalue section heading to produce non-colliding explicit anchors (Targetandtarget), while GitHub assigns them colliding auto-IDs (targetandtarget-1). The auto-IDtarget-1for## targetthen coincides with the explicit anchor for the### -targetoption, so clicking "target" in GitHub's right-side navigation scrolls to the-targetoption instead of the target value list.This fix lowercases anchor ID prefixes in
_getLinkNameso that deduplication matches GitHub's case-insensitive behavior. The explicit anchors now align with GitHub's auto-generated heading IDs, and the right-side navigation links to the correct sections.