mirror of
https://github.com/c8r/x0.git
synced 2024-08-17 09:20:52 +03:00
15 lines
351 B
JavaScript
15 lines
351 B
JavaScript
// front-matter loader for mdx
|
|
const matter = require('gray-matter')
|
|
const stringifyObject = require('stringify-object')
|
|
|
|
module.exports = async function (src) {
|
|
const callback = this.async()
|
|
const { content, data } = matter(src)
|
|
|
|
const code = `export const frontMatter = ${stringifyObject(data)}
|
|
|
|
${content}
|
|
`
|
|
return callback(null, code)
|
|
}
|