Scaffold basic workshop frontend.
This commit is contained in:
10
lib/remark-extract-frontmatter.js
Normal file
10
lib/remark-extract-frontmatter.js
Normal file
@ -0,0 +1,10 @@
|
||||
import { visit } from 'unist-util-visit'
|
||||
import { load } from 'js-yaml'
|
||||
|
||||
export default function extractFrontmatter() {
|
||||
return (tree, file) => {
|
||||
visit(tree, 'yaml', (node, index, parent) => {
|
||||
file.data.frontmatter = load(node.value)
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user