mirror of
https://github.com/McShelby/hugo-theme-relearn
synced 2025-05-01 02:35:50 +08:00
mermaid: avoid leading whitespace #394
to avoid brittle initialization of mindmap graph
This commit is contained in:
parent
c7f6cbf71b
commit
0d5ee6d1b4
@ -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…
x
Reference in New Issue
Block a user