mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 18:17:20 +00:00
Local relative urls in Markdown map to WikiLinks
This commit is contained in:
parent
c0c0b6653c
commit
e5cef9a5a6
@ -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};
|
||||
|
Loading…
Reference in New Issue
Block a user