Merge pull request #379 from timlrx/refactor/simplify-mdx
remove redundant frontmatter parsing
This commit is contained in:
commit
609623d405
@ -56,13 +56,11 @@ export async function getFileBySlug(type, slug) {
|
||||
|
||||
let toc = []
|
||||
|
||||
// Parsing frontmatter here to pass it in as options to rehype plugin
|
||||
const { data: frontmatter } = matter(source)
|
||||
const { code } = await bundleMDX({
|
||||
const { code, frontmatter } = await bundleMDX({
|
||||
source,
|
||||
// mdx imports can be automatically source from the components directory
|
||||
cwd: path.join(root, 'components'),
|
||||
xdmOptions(options) {
|
||||
xdmOptions(options, frontmatter) {
|
||||
// this is the recommended way to add custom remark/rehype plugins:
|
||||
// The syntax might look weird, but it protects you in case we add/remove
|
||||
// plugins in the future.
|
||||
|
Loading…
x
Reference in New Issue
Block a user