next-contentlayer icon indicating copy to clipboard operation
next-contentlayer copied to clipboard

Table styles seem broken

Open feliche93 opened this issue 2 years ago • 2 comments

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

feliche93 avatar May 12 '23 15:05 feliche93

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

mohammedyh avatar May 27 '23 11:05 mohammedyh

@mohammedyh Thanks!

TheKonka avatar Jul 05 '23 13:07 TheKonka