shadcn / next-contentlayer

A template with Next.js 13 app dir, Contentlayer, Tailwind CSS and dark mode.
https://next-contentlayer.vercel.app
678 stars 91 forks source link

Table styles seem broken #6

Open feliche93 opened 1 year ago

feliche93 commented 1 year ago

In this sample post the table style layouts do not seem to be working: https://next-contentlayer.vercel.app/posts/dynamic-routing-static-regeneration

CleanShot 2023-05-12 at 17 12 53@2x
mohammedyh commented 1 year ago

I had a similar problem, I'm not sure what Markdown implementation Contentlayer uses, but I imagine tables aren't supported. I resolved the issue by installing the remark-gfm package and adding it to the contentlayer.config.js file. After that, the tables rendered correctly for me. Code snippet below for reference:

import remarkGfm from 'remark-gfm'

...

export default makeSource({
  contentDirPath: 'posts',
  documentTypes: [Post],
  mdx: {
    remarkPlugins: [remarkGfm],
  },
})

Table rendering correctly after installing remark plugin

TheKonka commented 1 year ago

@mohammedyh Thanks!