wooorm / xdm

Just a *really* good MDX compiler. No runtime. With esbuild, Rollup, and webpack plugins
http://wooorm.com/xdm/
MIT License
595 stars 18 forks source link

Support for codeblock meta string? #31

Closed MaximeHeckel closed 3 years ago

MaximeHeckel commented 3 years ago

Hi 👋

I started testing out xdm on my MDX based blog and so far I love it. I come from mdx-js and I found out that xdm does not parse code blocks pre the same way as mdx-js does.

For example I'd often define arbitrary key/values after specifying the language for my codeblock

```js title=foo

// Code block

or even some arbitrary syntax to highlight specific lines

```js {1-2}
// Code block

and I was always able to get back those values as props on the React side of things.

(Another example from the mdx-js docs: https://mdxjs.com/guides/live-code passing live=true to render an alternative codeblock component)

However, I don't seem to be able to get the same behavior with xdm. Do you have any tips or workaround for this? Or is this simply not supported?

Thank you in advance!

wooorm commented 3 years ago

Did you see the guide in the readme? https://github.com/wooorm/xdm#syntax-highlighting

MaximeHeckel commented 3 years ago

I guess I skipped the highlighting part figuring out it was simply about "color highlighting" 😄 Thank you and sorry for the noise!

wooorm commented 3 years ago

fwiw, if you’d want to package that code up as rehype-mdx-meta or so, I’ll swap that section with a link (+ link from https://github.com/wooorm/xdm#plugins)