mermaidApiParse function

  1. @JS("mermaidAPI.parse")
bool mermaidApiParse(
  1. String text
)

Used to test diagram code before calling render(). Returns true if the diagram syntax is valid. If mermaidSetParseErrorHandler has been used to set a parseError() handler then this method will return false if the diagram syntax is invalid. (If no parseError() handler has been set then parse() will throw an exception in javascript as render() would with invalid syntax). NOTE: Note as of mermaid version 9.0.1 the behavior of parse() method has a BUG

  • it is doced to return true if valid and false if invalid, but instead it returns the parser() object itself ??!!! I have submitted a PR to fix the behavior to match the docs and the user here - so at some point this should work as intended.

Implementation

@JS("mermaidAPI.parse")
external bool mermaidApiParse(String text);