fix: stripRichTextMarkup must not corrupt Mermaid node syntax#4
Closed
NeoVand wants to merge 1 commit into
Closed
Conversation
Regression from the bare-ref strip change: Mermaid reuses {{…}} (hexagon) and
[[…]] (subroutine) for node *shapes* — e.g. a story diagram with
`T3{{"Middlebox"}}`. The new fallback turned that into `T3"Middlebox"`, invalid
Mermaid, so the diagram failed to render ("Diagram unavailable").
Fix: only resolve a bare ref when its id is slug-shaped (REF_ID:
lowercase kebab/colon). Non-slug `{{…}}` / `[[…]]` (quotes, spaces, capitals =
Mermaid syntax) pass through untouched. This also fixes the *pre-existing*
silent loss of those labels — the "Middlebox" hexagon now renders correctly.
Added regression tests; verified the Transport category-story diagram renders
again, console clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Superseded by #5, which includes this Mermaid fix plus the new force layout. Closing to consolidate into a single PR. |
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.
Follow-up fix to the quality pass (#3, already merged).
The bare-ref change in #3 regressed Mermaid diagrams: Mermaid reuses
{{…}}(hexagon) and
[[…]](subroutine) for node shapes — e.g. the Transportcategory story has
T3{{"Middlebox"}}.stripRichTextMarkup(which also cleansMermaid node labels) turned that into
T3"Middlebox", invalid Mermaid, so thediagram failed to render ("Diagram unavailable").
Fix: only resolve a bare ref when its id is slug-shaped (lowercase
kebab/colon,
REF_ID). Non-slug{{…}}/[[…]]— quotes, spaces, capitals,i.e. Mermaid syntax — pass through untouched. This also fixes the pre-existing
silent loss of those labels: the "Middlebox" hexagon now renders with its label.
Added regression tests; verified the Transport category-story diagram renders
again with a clean console.
🤖 Generated with Claude Code