Repository navigation
fix(mermaid): accept a hyphen in a flowchart node id - #53
Merged
Merged
Conversation
- user-service --> api-gateway is idiomatic Mermaid and raised: the id stopped at the hyphen and the rest was read as a broken link. Almost certainly the first thing a real diagram would have hit - A hyphen continues an id only when a word character follows it, so a link written without spaces is still a link. The lookahead is word characters and not the id set, because a dot is an id character and x-.->y is a dotted link, not an id called x-. - A -- "a--b" --> B works too. Unquoted it produced a phantom node — three nodes out of two — which is the one failure this package says it will not commit: a drawing that lies instead of an error - Three fixtures in regressions, including the link forms the fix could have broken
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.
You asked whether every open point was fixed. Auditing that turned up two defects in the published package, and this fixes both.
user-service --> api-gatewayraisedHyphenated ids are everywhere in real Mermaid —
api-gateway,load-balancer,user-service. The id scan stopped at the hyphen and-service --> api-gatewaywas read as a broken link:I had this on the open list as "node ids exclude
-", framed as a documented subset limit. It is not a limit, it is a bug: probably the first thing a real diagram would have hit.A hyphen now continues an id when a word character follows it. Two things make that narrow enough to be safe, and both are fixtures:
A-->Banda-b-->c-dare still links;x-.->ywould parse as an id calledx-.and then fail on the remainder.A -- a--b --> Bproduced a phantom nodeThree nodes out of two:
A,b,B. The--inside the label closed the link, and the remainder became a node. That is the one failure this package explicitly says it will not commit — a drawing that lies instead of an error — and the readme's advice ("cannot use the inline-label form") did not point anywhere that worked.A -- "a--b" --> Bworks now: the scanner steps over a quoted span, which makes quoting a real escape hatch, and it is Mermaid's own convention for a label with special characters.A -->|a--b| Balready worked. Unquoted is still read as a link, and the readme now says exactly that instead of implying it fails.Still open, and deliberately
sequenceDiagram,classDiagram,stateDiagram,erDiagram— a hand-written parser each;fallbackcovers them meanwhilearchitecture-betaedge labels — blocked upstream, recorded last pull requestVerification
628 tests (3 new),
lint,fmt:check,typecheck,build,typecheck:packaged,build:docs. Ten spellings checked by hand before writing the tests, including every link form that the change could have broken.