Use mermaidAPI in mermaid scope

Introduced by a5b7145527 (diff-67ae90c5144c55348a3cbdb078240454L532)

Fixes #600

Parse only throws error: 167368d508 (diff-67ae90c5144c55348a3cbdb078240454)
This commit is contained in:
Sheogorath 2017-10-28 16:56:25 +02:00
parent f1475535a2
commit 09d2ba41cf
No known key found for this signature in database
GPG Key ID: 1F05CC3635CDDFFD
1 changed files with 4 additions and 12 deletions

View File

@ -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())) {
$ele.addClass('mermaid')
$ele.html($value.text())
window.mermaid.init(undefined, $ele)
} else {
throw new Error(mermaidError)
}
window.mermaid.mermaidAPI.parse($value.text())
$ele.addClass('mermaid')
$ele.html($value.text())
window.mermaid.init(undefined, $ele)
} catch (err) {
$value.unwrap()
$value.parent().append('<div class="alert alert-warning">' + err + '</div>')