From 09d2ba41cf42841205752b0f127305202218f985 Mon Sep 17 00:00:00 2001 From: Sheogorath Date: Sat, 28 Oct 2017 16:56:25 +0200 Subject: [PATCH] Use mermaidAPI in mermaid scope Introduced by https://github.com/knsv/mermaid/commit/a5b71455271aef1180eefa1054d751dea1885e3f#diff-67ae90c5144c55348a3cbdb078240454L532 Fixes #600 Parse only throws error: https://github.com/knsv/mermaid/commit/167368d508f1e5b1606b2b45f892cdd60d479448#diff-67ae90c5144c55348a3cbdb078240454 --- public/js/extra.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/public/js/extra.js b/public/js/extra.js index d36592d9..df5e454e 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -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('
' + err + '
')