| | |
| | | name = "Description" |
| | | opts: Options |
| | | |
| | | constructor(opts?: Options) { |
| | | constructor(opts?: Partial<Options>) { |
| | | super() |
| | | this.opts = { ...defaultOptions, ...opts } |
| | | } |
| | |
| | | () => { |
| | | return async (tree: HTMLRoot, file) => { |
| | | const frontMatterDescription = file.data.frontmatter?.description |
| | | const desc = frontMatterDescription ?? toString(tree) |
| | | const text = toString(tree) |
| | | |
| | | const desc = frontMatterDescription ?? text |
| | | const sentences = desc.replace(/\s+/g, ' ').split('.') |
| | | let finalDesc = "" |
| | | let sentenceIdx = 0 |
| | |
| | | } |
| | | |
| | | file.data.description = finalDesc |
| | | file.data.text = text |
| | | } |
| | | } |
| | | ] |
| | |
| | | declare module 'vfile' { |
| | | interface DataMap { |
| | | description: string |
| | | text: string |
| | | } |
| | | } |
| | | |