diff --git a/apps/wiki.json b/apps/wiki.json index 62aea7cc..a3efc534 100644 --- a/apps/wiki.json +++ b/apps/wiki.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "📝", - "previous": "&HpEPHrCdoej769DCZmJYH0ma9OfzdhPKMTEmvcNz8Wg=.sha256" + "previous": "&FINPRELEEbBO4wVoRYZyd5/VIMERFMyk4NjC8wxjelE=.sha256" } \ No newline at end of file diff --git a/apps/wiki/tf-wiki-app.js b/apps/wiki/tf-wiki-app.js index c0e03d89..c339a239 100644 --- a/apps/wiki/tf-wiki-app.js +++ b/apps/wiki/tf-wiki-app.js @@ -39,7 +39,7 @@ class TfCollectionsAppElement extends LitElement { this.owner_ids = await tfrpc.rpc.getOwnerIdentities(); this.whoami = await tfrpc.rpc.localStorageGet('collections_whoami'); let ids = [...new Set([...this.owner_ids, this.whoami])].sort(); - this.following = Object.keys(await tfrpc.rpc.following(ids, 2)).sort(); + this.following = Object.keys(await tfrpc.rpc.following(ids, 1)).sort(); await this.read_wikis(); await this.read_Wiki_docs(); @@ -281,6 +281,7 @@ class TfCollectionsAppElement extends LitElement { ${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html` ` : undefined} `; diff --git a/apps/wiki/tf-wiki-doc.js b/apps/wiki/tf-wiki-doc.js index 7e8e6564..4335a409 100644 --- a/apps/wiki/tf-wiki-doc.js +++ b/apps/wiki/tf-wiki-doc.js @@ -5,6 +5,7 @@ class TfWikiDocElement extends LitElement { static get properties() { return { whoami: {type: String}, + wiki: {type: String}, value: {type: Object}, blob: {type: String}, blob_original: {type: String}, @@ -21,6 +22,19 @@ class TfWikiDocElement extends LitElement { var reader = new commonmark.Parser({safe: true}); var writer = new commonmark.HtmlRenderer(); var parsed = reader.parse(md || ''); + let walker = parsed.walker(); + let event; + while ((event = walker.next())) { + let node = event.node; + if (event.entering) { + if (node.type === 'link') { + if (node.destination.indexOf(':') == -1 && + node.destination.indexOf('/') == -1) { + node.destination = `#${this.wiki?.name}/${node.destination}`; + } + } + } + } return writer.render(parsed); }