initial commit
This commit is contained in:
commit
d799808203
126 changed files with 16265 additions and 0 deletions
13
lib/remark-extract-frontmatter.ts
Normal file
13
lib/remark-extract-frontmatter.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { Parent } from 'unist'
|
||||
import { VFile } from 'vfile'
|
||||
import { visit } from 'unist-util-visit'
|
||||
import { load } from 'js-yaml'
|
||||
|
||||
export default function extractFrontmatter() {
|
||||
return (tree: Parent, file: VFile) => {
|
||||
visit(tree, 'yaml', (node: Parent) => {
|
||||
//@ts-ignore
|
||||
file.data.frontmatter = load(node.value)
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue