Compare commits
No commits in common. "598e2c84b9c6dafd8fcba2af2f9c41f5dd40e005" and "be6ea7b34ef07363b293ddfa1f79ce5b8dae6c9b" have entirely different histories.
598e2c84b9
...
be6ea7b34e
|
|
@ -3,12 +3,10 @@ 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-end-->
|
||||
<!--summary-above-->
|
||||
I can write more things after the comment if I want.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
//looks for an html comment pattern, and, if found,
|
||||
//adds the text before it to the doc under the key `summary`.
|
||||
const reg = /.*<!--summary-start-->(?<summary>.+)?<!--summary-end-->/s
|
||||
//use a custom element instead.
|
||||
// const reg = /<doc-summary>(?<summary>.+)?<\/doc-summary>/s
|
||||
const reg = /^(?<summary>.+)?<!--summary-above-->/s
|
||||
export default (doc) => {
|
||||
const result = reg.exec(doc._body);
|
||||
if (result) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue