mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
mermaid: avoid leading whitespace #394
to avoid brittle initialization of mindmap graph
This commit is contained in:
parent
c7f6cbf71b
commit
0d5ee6d1b4
1 changed files with 4 additions and 1 deletions
|
@ -125,11 +125,14 @@ function initMermaid( update, attrs ) {
|
||||||
dir = JSON.parse( '{ "dummy": ' + m[2] ).dummy;
|
dir = JSON.parse( '{ "dummy": ' + m[2] ).dummy;
|
||||||
content = graph.substring( d.lastIndex );
|
content = graph.substring( d.lastIndex );
|
||||||
}
|
}
|
||||||
|
content = content.trim();
|
||||||
return { dir: dir, content: content };
|
return { dir: dir, content: content };
|
||||||
};
|
};
|
||||||
|
|
||||||
var serializeGraph = function( graph ){
|
var serializeGraph = function( graph ){
|
||||||
return '%%{init: ' + JSON.stringify( graph.dir ) + '}%%\n' + graph.content;
|
var s = '%%{init: ' + JSON.stringify( graph.dir ) + '}%%\n';
|
||||||
|
s += graph.content;
|
||||||
|
return s;
|
||||||
};
|
};
|
||||||
|
|
||||||
var init_func = function( attrs ){
|
var init_func = function( attrs ){
|
||||||
|
|
Loading…
Reference in a new issue