-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/862
- Loading branch information
Showing
13 changed files
with
497 additions
and
65 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,28 @@ | ||
import mermaidAPI from 'mermaid' | ||
|
||
function getRandomInt (min, max) { | ||
return Math.floor(Math.random() * (max - min)) + min | ||
} | ||
|
||
function getId () { | ||
var pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | ||
var id = 'm-' | ||
for (var i = 0; i < 7; i++) { | ||
id += pool[getRandomInt(0, 16)] | ||
} | ||
return id | ||
} | ||
|
||
function render (element, content) { | ||
try { | ||
mermaidAPI.render(getId(), content, (svgGraph) => { | ||
element.innerHTML = svgGraph | ||
}) | ||
} catch (e) { | ||
console.error(e) | ||
element.className = 'mermaid-error' | ||
element.innerHTML = 'mermaid diagram parse error: ' + e.message | ||
} | ||
} | ||
|
||
export default render |
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
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
Oops, something went wrong.