mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
fix: only render yaml/directive block when it is not empty
This commit is contained in:
parent
eec16d3abe
commit
cbd8fa2006
1 changed files with 8 additions and 3 deletions
|
@ -179,10 +179,15 @@ function initMermaid( update, attrs ) {
|
||||||
};
|
};
|
||||||
|
|
||||||
var serializeGraph = function( graph ){
|
var serializeGraph = function( graph ){
|
||||||
if (JSON.stringify(graph.dir) === '{}') {
|
yamlPart = '';
|
||||||
return '---\n' + jsyaml.dump(graph.yaml) + '---\n' + graph.content;
|
dirPart = '';
|
||||||
|
if (JSON.stringify(graph.dir) !== '{}') {
|
||||||
|
dirPart = '%%{init: ' + JSON.stringify(graph.dir) + '}%%\n';
|
||||||
}
|
}
|
||||||
return '---\n' + jsyaml.dump(graph.yaml) + '---\n' + '%%{init: ' + JSON.stringify(graph.dir) + '}%%\n' + graph.content;
|
if (JSON.stringify(graph.yaml) !== '{}') {
|
||||||
|
yamlPart = '---\n' + jsyaml.dump(graph.yaml) + '---\n';
|
||||||
|
}
|
||||||
|
return yamlPart + dirPart + graph.content;
|
||||||
};
|
};
|
||||||
|
|
||||||
var init_func = function( attrs ){
|
var init_func = function( attrs ){
|
||||||
|
|
Loading…
Reference in a new issue