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

Add `format` to support MDX and plain markdown #19

Closed wooorm closed 3 years ago

wooorm commented 3 years ago

Add format to support MDX and plain markdown

Closes GH-17.

wooorm commented 3 years ago

@ChristianMurphy Do you see the default being detect as a good idea? I think so

wooorm commented 3 years ago

/cc @remcohaszing @ggoodman WDYT?

ChristianMurphy commented 3 years ago

Do you see the default being detect as a good idea?

I think so. :+1: There is an edge case, that being if people use non-standard md and mdx extensions and still want the type to be inferred there isn't a way to override at the moment. But until that use case pops up, YAGNI

wooorm commented 3 years ago

There is an edge case, that being if people use non-standard md and mdx extensions and still want the type to be inferred there isn't a way to override at the moment.

The way I’ve set it up now is that there’s two lists of extensions: one for markdown, one for mdx. Folks can overwrite those to set their own funky preferences.

It’s indeed a weird case, but with {mdExtensions: ['.mdx', ...], mdxExtensions: [...]} one could load .mdx as markdown, or with {mdExtensions: [...], mdxExtensions: ['.md', ...]} one could set .md as MDX. Again, I think it’s really weird, but it’s possible.

remcohaszing commented 3 years ago

I mostly looked at the docs, because although I’ve looked at the internals, I’m not very familiar with them.

Anyway, looks good to me :+1: