1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-30 05:19:57 +00:00

feat: add \n\n based on isBlock, if could also be inline

This commit is contained in:
lin onetwo 2024-10-14 00:47:13 +08:00
parent 0f385675c2
commit f220dacdd8
2 changed files with 14 additions and 4 deletions

View File

@ -202,12 +202,18 @@ exports.serialize = function(tree,serialize) {
}).join(" ");
// Children
var children = tree.children ? serialize(tree.children) : "";
var result = "";
// Self-closing tag
if(tree.isSelfClosing) {
return "<" + tag + (attributes ? " " + attributes : "") + " />";
result += "<" + tag + (attributes ? " " + attributes : "") + " />";
} else {
// Opening and closing tags
result += "<" + tag + (attributes ? " " + attributes : "") + ">" + children + "</" + tag + ">";
}
// Opening and closing tags
return "<" + tag + (attributes ? " " + attributes : "") + ">" + children + "</" + tag + ">";
if(tree.isBlock) {
result += "\n\n";
}
return result;
};
})();

View File

@ -8,4 +8,8 @@ This is an HTML5 aside element
<$slider target="MyTiddler">
This is a widget invocation
</$slider>
</$slider>
<$list filter="[tag[ExampleTag]sort[title]]" />
Plain text in next paragraph.