remove redundant frontmatter parsing

This commit is contained in:
Timothy Lin 2022-02-06 21:09:57 +08:00
parent 6aefdd0d39
commit d78b8bd902

View File

@ -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.