You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
failed to get the fontmatter via the code here below with the latest version : [email protected] and also set the parseFrontmatter: true
import{compileMDX}from'next-mdx-remote/rsc'constBlogDetailPage=async()=>{constsource=` --- title: Bertram's Blogs author: Bertram --- # Welcome to my MDX page! This is some **bold** and _italics_ text. This is a list in markdown: - One - Two - Three `const{frontmatter,content }=awaitcompileMDX<{title: string,author:string}>({source:source,options: {parseFrontmatter: true},})console.log('frontmatter',frontmatter)// the frontmatter result is {}return(<div>{content}</div>)}exportdefaultBlogDetailPage
but when I put the source in to a mdx files and then I read from the mdx files with the same codes like below here, I can get the frontmatter correctly
import{compileMDX}from'next-mdx-remote/rsc'importfsfrom'fs'importpathfrom'path'constBlogDetailPage=async()=>{constdata=fs.readFileSync(path.join(process.cwd(),'mdxfiles/test.mdx'))// test.mdx has the same code of the `souce` above const{frontmatter,content }=awaitcompileMDX<{title: string,author:string}>({source:source,options: {parseFrontmatter: true},})console.log('frontmatter',frontmatter)// the frontmatter result is : frontmatter: { title: "Bertram's Blogs", author: 'Bertram' })return(<div>{content}</div>)}exportdefaultBlogDetailPage
Reproduction
you can try on you self side
next-mdx-remote version
v 5.0.0 and also I have tried with the version next-mdx-remote@canary the result is the same
The text was updated successfully, but these errors were encountered:
You are doing wrong in indentations. Remove all indentations from the string of source.
constBlogDetailPage=async()=>{constsource=`---title: Bertram's Blogsauthor: Bertram---# Welcome to my MDX page!This is some **bold** and _italics_ text.This is a list in markdown:- One- Two- Three`// ...}
Describe the bug
failed to get the fontmatter via the code here below with the latest version :
[email protected]
and also set theparseFrontmatter: true
but when I put the source in to a
mdx
files and then I read from themdx
files with the same codes like below here, I can get thefrontmatter
correctlyReproduction
you can try on you self side
next-mdx-remote version
v 5.0.0 and also I have tried with the version
next-mdx-remote@canary
the result is the sameThe text was updated successfully, but these errors were encountered: