diff --git a/apps/wiki.json b/apps/wiki.json index 14dc08d6..493364eb 100644 --- a/apps/wiki.json +++ b/apps/wiki.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "📝", - "previous": "&qrcrBeaWg89ikgql9hXdr68krkg+5NZkmwTbpodEW4U=.sha256" + "previous": "&/wl8HE2jZShRXTYEVYRrK3pjHwi41Wbxl9HoSJaQP6Y=.sha256" } \ No newline at end of file diff --git a/apps/wiki/handler.js b/apps/wiki/handler.js index c0fe3b93..244bb336 100644 --- a/apps/wiki/handler.js +++ b/apps/wiki/handler.js @@ -10,7 +10,9 @@ function markdown(md) { while ((event = walker.next())) { let node = event.node; if (event.entering) { - if (node.type === 'link') { + if (node.destination?.startsWith('&')) { + node.destination = '/' + node.destination + '/view?filename=' + node.firstChild?.literal; + } else if (node.type === 'link') { if (node.destination.indexOf(':') == -1 && node.destination.indexOf('/') == -1) { node.destination = `${node.destination}`; @@ -57,7 +59,7 @@ async function main() {

${wiki_name}: ${wiki_doc_name}

${markdown(md)}
`, - content_type: 'text/html', + content_type: 'text/html; charset=utf-8', status_code: 200, }); } else { diff --git a/apps/wiki/tf-wiki-doc.js b/apps/wiki/tf-wiki-doc.js index e6acc075..18158942 100644 --- a/apps/wiki/tf-wiki-doc.js +++ b/apps/wiki/tf-wiki-doc.js @@ -28,15 +28,13 @@ class TfWikiDocElement extends LitElement { while ((event = walker.next())) { let node = event.node; if (event.entering) { - if (node.type === 'link') { + if (node.destination?.startsWith('&')) { + node.destination = '/' + node.destination + '/view?filename=' + node.firstChild?.literal; + } else if (node.type === 'link') { if (node.destination.indexOf(':') == -1 && node.destination.indexOf('/') == -1) { node.destination = `#${this.wiki?.name}/${node.destination}`; } - } else if (node.type == 'image') { - if (node.destination.startsWith('&')) { - node.destination = '/' + node.destination + '/view'; - } } } }