Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Commit

Permalink
mermaidjs#68 Class diagram parser breaks depending on length of conte…
Browse files Browse the repository at this point in the history
…nt between brackets
  • Loading branch information
Ashish Jain committed Nov 7, 2019
1 parent d425a42 commit 2c885a6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/Preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ class Preview extends React.Component {
} = this.props
try {
mermaid.parse(code)
// Replacing special characters '<' and '>' with encoded '&lt;' and '&gt;'
let _code= code;
_code = _code.replace(/</g,'&lt;');
_code = _code.replace(/>/g,'&gt;');

// Overriding the innerHTML with the updated code string
this.container.innerHTML = _code;
mermaid.init(undefined, this.container)
} catch (e) {
// {str, hash}
Expand Down

0 comments on commit 2c885a6

Please sign in to comment.