Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make mermaid.parse throw an error on invalid shapes #6002

Merged

Commits on Oct 28, 2024

  1. Configuration menu
    Copy the full SHA
    7fa8b35 View commit details
    Browse the repository at this point in the history
  2. refactor: fix addVertex type parameter

    I went through
    `packages/mermaid/src/diagrams/flowchart/parser/flow.jison` and found
    every possible value this `type` parameter could be.
    aloisklink committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    17e2f9e View commit details
    Browse the repository at this point in the history
  3. fix: error mermaid.parse on invalid shapes

    Currently, invalid shapes cause an error when rendering, but not when
    parsing. This confuses the Mermaid Live Editor, e.g. by not showing the
    error message.
    
    Instead, I've added an `isValidShape()` that validates if the shape is
    valid at parse time. This only checks shapes using the new extended
    shapes syntax. Currenlty, using `A(-this is an ellipse node-)` is broken
    (see mermaid-js#5976) and also causes an invalid shape error at render time, but
    I've ignored it in this PR, so it will continue pass at parse-time
    (we have unit tests checking ellipse parsing).
    
    See: mermaid-js#5976
    aloisklink committed Oct 28, 2024
    Configuration menu
    Copy the full SHA
    5fabd41 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    848be3d View commit details
    Browse the repository at this point in the history

Commits on Oct 29, 2024

  1. Configuration menu
    Copy the full SHA
    f6c32b6 View commit details
    Browse the repository at this point in the history