1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-03-01 09:20:02 +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(" "); }).join(" ");
// Children // Children
var children = tree.children ? serialize(tree.children) : ""; var children = tree.children ? serialize(tree.children) : "";
var result = "";
// Self-closing tag // Self-closing tag
if(tree.isSelfClosing) { if(tree.isSelfClosing) {
return "<" + tag + (attributes ? " " + attributes : "") + " />"; result += "<" + tag + (attributes ? " " + attributes : "") + " />";
} } else {
// Opening and closing tags // Opening and closing tags
return "<" + tag + (attributes ? " " + attributes : "") + ">" + children + "</" + tag + ">"; result += "<" + tag + (attributes ? " " + attributes : "") + ">" + children + "</" + tag + ">";
}
if(tree.isBlock) {
result += "\n\n";
}
return result;
}; };
})(); })();

View File

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