1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-24 00:50:28 +00:00

Local relative urls in Markdown map to WikiLinks

This commit is contained in:
senevoldsen90 2015-10-09 15:11:24 +02:00
parent c0c0b6653c
commit e5cef9a5a6

View File

@ -48,6 +48,18 @@ function transformNode(node) {
delete widget.attributes.src;
}
}
// Convert internal links to proper wikilinks
if (widget.tag === "a" && widget.attributes.href.value[0] === "#") {
widget.type = "link";
widget.attributes.to = widget.attributes.href;
if (widget.attributes.to.type === "string") {
//Remove '#' before conversion to wikilink
widget.attributes.to.value = widget.attributes.to.value.substr(1);
}
//Children is fine
delete widget.tag;
delete widget.attributes.href;
}
return widget;
} else {
return {type: "text", text: node};