Compare commits

..

2 Commits

3 changed files with 9 additions and 2 deletions

View File

@ -3,10 +3,12 @@ title: My Public File
cuid: 26e4-a1
---
<!--summary-start-->
This is a public file with some nice text.
It's easy to write in this file.
<!--summary-above-->
<!--summary-end-->
I can write more things after the comment if I want.

3
c.ori Normal file
View File

@ -0,0 +1,3 @@
{
gitrepo: "https://git.surfacemarkup.net/hans/ad_pubfiles"
}

View File

@ -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 = /^(?<summary>.+)?<!--summary-above-->/s
const reg = /.*<!--summary-start-->(?<summary>.+)?<!--summary-end-->/s
//use a custom element instead.
// const reg = /<doc-summary>(?<summary>.+)?<\/doc-summary>/s
export default (doc) => {
const result = reg.exec(doc._body);
if (result) {