Merge pull request #608 from SISheogorath/fix/mermaid
Use mermaidAPI in mermaid scope
This commit is contained in:
commit
b3c66d4a10
1 changed files with 4 additions and 12 deletions
|
@ -373,18 +373,10 @@ export function finishView (view) {
|
|||
var $value = $(value)
|
||||
const $ele = $(value).closest('pre')
|
||||
|
||||
let mermaidError = null
|
||||
window.mermaid.parseError = (err, hash) => {
|
||||
mermaidError = err
|
||||
}
|
||||
|
||||
if (window.mermaidAPI.parse($value.text())) {
|
||||
window.mermaid.mermaidAPI.parse($value.text())
|
||||
$ele.addClass('mermaid')
|
||||
$ele.html($value.text())
|
||||
window.mermaid.init(undefined, $ele)
|
||||
} else {
|
||||
throw new Error(mermaidError)
|
||||
}
|
||||
} catch (err) {
|
||||
$value.unwrap()
|
||||
$value.parent().append('<div class="alert alert-warning">' + err + '</div>')
|
||||
|
|
Loading…
Reference in a new issue