Fix markdown rendering for links with markup

pull/674/head
Zef Hemel 2024-01-28 16:14:05 +01:00
parent 58ea651668
commit e2aa869660
1 changed files with 2 additions and 3 deletions

View File

@ -201,7 +201,7 @@ function render(
body: "",
};
case "Link": {
const linkText = t.children![1].text!;
const linkTextChildren = t.children!.slice(1, -4);
const urlNode = findNodeOfType(t, "URL");
if (!urlNode) {
return renderToText(t);
@ -215,7 +215,7 @@ function render(
attrs: {
href: url,
},
body: linkText,
body: cleanTags(mapRender(linkTextChildren)),
};
}
case "Image": {
@ -240,7 +240,6 @@ function render(
// Custom stuff
case "WikiLink": {
// console.log("WikiLink", JSON.stringify(t, null, 2));
const ref = findNodeOfType(t, "WikiLinkPage")!.children![0].text!;
let linkText = ref.split("/").pop()!;
const aliasNode = findNodeOfType(t, "WikiLinkAlias");