Skip to content

Commit 609623d

Browse files
authored
Merge pull request #379 from timlrx/refactor/simplify-mdx
remove redundant frontmatter parsing
2 parents cf04e25 + d78b8bd commit 609623d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/mdx.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,11 @@ export async function getFileBySlug(type, slug) {
5656

5757
let toc = []
5858

59-
// Parsing frontmatter here to pass it in as options to rehype plugin
60-
const { data: frontmatter } = matter(source)
61-
const { code } = await bundleMDX({
59+
const { code, frontmatter } = await bundleMDX({
6260
source,
6361
// mdx imports can be automatically source from the components directory
6462
cwd: path.join(root, 'components'),
65-
xdmOptions(options) {
63+
xdmOptions(options, frontmatter) {
6664
// this is the recommended way to add custom remark/rehype plugins:
6765
// The syntax might look weird, but it protects you in case we add/remove
6866
// plugins in the future.

0 commit comments

Comments
 (0)