zce / velite

Turns Markdown / MDX, YAML, JSON, or others into app's data layer with Zod schema.
http://velite.js.org
MIT License
476 stars 23 forks source link

Syntax highlighting not working #234

Closed carlos-dubon closed 2 weeks ago

carlos-dubon commented 2 weeks ago

You should specify in the docs that for syntax highlighting to work you need to change markdown to mdx for us who use MDX:

// this doesn't work
import rehypePrettyCode from 'rehype-pretty-code'
import { defineConfig } from 'velite'

export default defineConfig({
  markdown: {
    // https://rehype-pretty-code.netlify.app/
    rehypePlugins: [rehypePrettyCode]
  }
})
// this works
import rehypePrettyCode from 'rehype-pretty-code'
import { defineConfig } from 'velite'

export default defineConfig({
  mdx: {
    // https://rehype-pretty-code.netlify.app/
    rehypePlugins: [rehypePrettyCode]
  }
})
zce commented 2 weeks ago

markdown is the global s.markdown() schema options, mdx is the global s.mdx() schema options.

Is there anything wrong with this?

carlos-dubon commented 2 weeks ago

Sorry if I haven't said this before, but what an amazing tool you've created!

It was just confusing, since I was using mdx and when following the docs I got an build error message. But it was becasue I had markdown instead of mdx in the config file.