fix: strip MyST roles in headingmap CLI - #54
Merged
Conversation
The headingmap CLI's cleanHeading() only removed ## markers but did
not strip MyST inline roles like {index}`Mutable <single: Mutable>`.
This caused raw role syntax to appear in heading-map keys and values.
Apply MystParser.stripMystRoles() in cleanHeading() to match the
behavior of the sync pipeline's updateHeadingMap().
Adds 1 test (966 → 967 total).
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns the headingmap CLI’s heading normalization with the main sync pipeline by stripping MyST inline role syntax, preventing raw role markup from polluting generated heading-map keys/values.
Changes:
- Update
cleanHeading()in theheadingmapCLI to callMystParser.stripMystRoles(). - Add a unit test verifying role stripping for both heading-map keys and values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/cli/commands/headingmap.ts | Strips MyST inline roles when cleaning headings for heading-map generation. |
| src/cli/tests/headingmap.test.ts | Adds coverage ensuring role syntax is removed from generated heading-map keys/values. |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
headingmapCLI'scleanHeading()only removed##markers but did not strip MyST inline roles like{index}`Mutable <single: Mutable>`. This caused raw role syntax to appear in heading-map keys and values when runningnpx translate headingmap.Root cause: The CLI had its own
cleanHeading()that didn't callMystParser.stripMystRoles(), unlike the sync pipeline'supdateHeadingMap()inheading-map.ts(fixed in v0.12.5).Fix: Apply
MystParser.stripMystRoles()in the CLI'scleanHeading().Before:
After:
Adds 1 test (966 → 967 total). Once merged + released, the zh-cn and fa migration PRs should be re-run.