Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tables not parsing with remarkGfm #485

Open
landed1 opened this issue Dec 11, 2024 · 1 comment
Open

Tables not parsing with remarkGfm #485

landed1 opened this issue Dec 11, 2024 · 1 comment

Comments

@landed1
Copy link

landed1 commented Dec 11, 2024

Describe the bug

Summary

I am using MDX files for content for a static site. The files sit in a folder and I am using a utility function along with compileMDX.

  try {
    const source = await fs.promises.readFile(filePath, 'utf8')

    const { frontmatter, content } = await compileMDX<MdxFrontmatter>({
      source,
      options: {
        parseFrontmatter: true,
          remarkPlugins: [remarkGfm],
          format: 'mdx',
      }
    })

    return {
      ...frontmatter,
      slug: path.basename(filePath, '.mdx'),
      content
    }

Trying to use like this

<article className='prose max-w-none'>
<MDXRemote source={content} />
<h2>Raw content below works but TABLE md not parsed</h2>
<div>{content}</div>
</article>

Additional information

I have checked most of the bugs and related things I can see online.
Some things which helped get mdx working
mdx-components.tsx in the root folder not app!
delete .next folder
Adding the correct next config to support MDX
The remarkGFM plugin doesn't work so I see the md table content not the html. because I could use

{content}
as this seems to work ok. I also get my front matter ok and so the issues are just the and table parsing.

Thank you for help my package:

  "dependencies": {
    "@mdx-js/loader": "^3.1.0",
    "@mdx-js/mdx": "2.0.0-rc.2",
    "@mdx-js/react": "2.0.0-rc.2",
    "@next/mdx": "^15.0.4",
    "@nextui-org/react": "^2.6.4",
    "@types/mdx": "^2.0.13",
    "contentlayer": "^0.3.4",
    "date-fns": "^4.1.0",
    "framer-motion": "^11.13.1",
    "gray-matter": "^4.0.3",
    "mdx-bundler": "^10.0.3",
    "next": "15.0.4",
    "next-mdx-remote": "^5.0.0",
    "next-seo": "^6.6.0",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "rehype-stringify": "^10.0.1",
    "remark-gfm": "3.0.1",
    "remark-rehype": "^11.1.1"
  },

Example

No response

Reproduction

sorry

next-mdx-remote version

5.0.0

@talatkuyuk
Copy link

You use all weapons: mdx-bundler, next-mdx-remote, @next/mdx etc.

The issue is not related with "next-mdx-remote", maybe related with wrong app structure. We can’t really help without a minimal reproduction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants