diff --git a/apps/wiki.json b/apps/wiki.json index 7386955d..bfabb2ea 100644 --- a/apps/wiki.json +++ b/apps/wiki.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "📝", - "previous": "&4lapemQFDuH+5ZeI831O8Qk+nK+47xLdHvKU6x53j2A=.sha256" + "previous": "&mxGlepLtpWc3IOzgZAKI5gz52tGb+r20LA+aI1qZL1g=.sha256" } \ No newline at end of file diff --git a/apps/wiki/tf-wiki-doc.js b/apps/wiki/tf-wiki-doc.js index bcff39c6..e69e7172 100644 --- a/apps/wiki/tf-wiki-doc.js +++ b/apps/wiki/tf-wiki-doc.js @@ -43,6 +43,16 @@ class TfWikiDocElement extends LitElement { return writer.render(parsed); } + title(md) { + let lines = (md || '').split('\n'); + for (let line of lines) { + let m = line.match(/#+ (.*)/); + if (m) { + return m[1]; + } + } + } + summary(md) { let lines = (md || '').split('\n'); let result = []; @@ -54,7 +64,9 @@ class TfWikiDocElement extends LitElement { if (!line.startsWith('#') && line.trim().length) { have_content = true; } - result.push(line); + if (!line.startsWith('#')) { + result.push(line); + } } return result.join('\n'); } @@ -124,6 +136,7 @@ class TfWikiDocElement extends LitElement { type: 'blog', key: this.value.id, parent: this.value.parent, + title: this.title(blob), summary: this.summary(blob), thumbnail: this.thumbnail(blob), blog: id, @@ -231,6 +244,7 @@ class TfWikiDocElement extends LitElement {
+

${unsafeHTML(this.markdown(this.title(this.blob)))}

${unsafeHTML(this.markdown(this.summary(this.blob)))}
${unsafeHTML(this.markdown(this.blob))}