forked from mermaid-js/mermaid-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: use
mermaid.render()
instead of .run()
Currently, `mermaid-cli` renders mermaid diagrams by: mmd code → HTML `<div>` contexts → mermaid.run() → HTML `<svg>` However, when converting the mmd code to HTML `<div>`, newlines and whitespace formatting may get removed. For the majority of diagrams, this is no issue, but for some diagrams (e.g. classDiagram), whitespace does matter. The mermaid API has a `mermaid.render()` function that we can use instead, which parses in mmd code directly, without having to go through a HTML element first: mmd code → mermaid.render() → SVG → HTML `<svg>` As an aditional benefit, we get better error messages from Mermaid too! Fixes: mermaid-js#532
- Loading branch information
1 parent
dc4c4ca
commit 69c5fc7
Showing
3 changed files
with
12 additions
and
36 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
# This test is for issue https://github.com/mermaid-js/mermaid-cli/issues/532 | ||
title: Empty class diagram v2 structs | ||
--- | ||
classDiagram-v2 | ||
class Pancake { | ||
} | ||
class Waffle { | ||
} |