1
0

Fix alias page link markdown rendering

This commit is contained in:
Zef Hemel 2022-11-27 11:20:43 +01:00
parent 45b84ab05b
commit b43c028e51

View File

@ -246,12 +246,17 @@ function render(
case "WikiLink": { case "WikiLink": {
// console.log("WikiLink", JSON.stringify(t, null, 2)); // console.log("WikiLink", JSON.stringify(t, null, 2));
const ref = findNodeOfType(t, "WikiLinkPage")!.children![0].text!; const ref = findNodeOfType(t, "WikiLinkPage")!.children![0].text!;
let linkText = ref;
const aliasNode = findNodeOfType(t, "WikiLinkAlias");
if (aliasNode) {
linkText = aliasNode.children![0].text!;
}
return { return {
name: "a", name: "a",
attrs: { attrs: {
href: `/${ref.replaceAll(" ", "_").replace("@", "#")}`, href: `/${ref.replaceAll(" ", "_").replace("@", "#")}`,
}, },
body: ref, body: linkText,
}; };
} }
case "NakedURL": { case "NakedURL": {