From 860380d46a99a53d242e3981b22bce6c9a11fbec Mon Sep 17 00:00:00 2001 From: Hans Fast Date: Wed, 1 Apr 2026 11:02:51 +0200 Subject: [PATCH] addSummary: use opening and closing tags to select page summary. So summary doesn't have to be first thing in file. --- a_pubfile.md | 4 +++- html-manipulations/addSummary.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/a_pubfile.md b/a_pubfile.md index d12a507..7efb3ca 100644 --- a/a_pubfile.md +++ b/a_pubfile.md @@ -3,10 +3,12 @@ title: My Public File cuid: 26e4-a1 --- + + This is a public file with some nice text. It's easy to write in this file. - + I can write more things after the comment if I want. diff --git a/html-manipulations/addSummary.js b/html-manipulations/addSummary.js index 7e312d8..22a1442 100644 --- a/html-manipulations/addSummary.js +++ b/html-manipulations/addSummary.js @@ -1,6 +1,8 @@ //looks for an html comment pattern, and, if found, //adds the text before it to the doc under the key `summary`. -const reg = /^(?.+)?/s +const reg = /.*(?.+)?/s +//use a custom element instead. +// const reg = /(?.+)?<\/doc-summary>/s export default (doc) => { const result = reg.exec(doc._body); if (result) {