mapbox / rehype-prism

rehype plugin to highlight code blocks in HTML with Prism (via refractor)
MIT License
178 stars 24 forks source link

Try to remove parse5 dependency for smaller browser bundles #1

Closed davidtheclark closed 6 years ago

davidtheclark commented 7 years ago

@wooorm: In https://twitter.com/wooorm/status/880164835316596736 and https://twitter.com/wooorm/status/877970932970778624 you suggest it's be better avoid the parse5 dependency for browser envs: https://github.com/mapbox/rehype-prism/blob/a87a08502d9c7c7adecfb50aee9cfb9db310327f/index.js#L33-L35. However, isn't this already part of rehype (https://github.com/wooorm/rehype/blob/e5ff28c9a01eb09e69302739fd3b84f0d732b586/packages/rehype-parse/package.json#L29) ... so if someone's using rehype in the browser, they've already included parse5?

wooorm commented 7 years ago

Oh, yeah I get that my comment is confusing.

A good reason not to include parse5, is the rehype ecosystem may be used (with unified) without rehype-parse (which does include parse5), but for example with remark-parse!

Does that make more sense?

davidtheclark commented 7 years ago

Oh, I understand. I'm doing my syntax highlighting at build time, instead of in the browser, so I'm fine with keeping it in, but open to PRs changing that. I'll edit the title of this issue to reflect.