1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 02:19:55 +00:00

Merge pull request #1984 from senevoldsen90/master

Local relative urls in Markdown map to WikiLinks
This commit is contained in:
Jeremy Ruston 2015-10-26 19:51:16 +00:00
commit 52e0524fbf

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};