Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About included languages ? #85

Closed
soykje opened this issue Jun 11, 2020 · 5 comments
Closed

About included languages ? #85

soykje opened this issue Jun 11, 2020 · 5 comments

Comments

@soykje
Copy link

soykje commented Jun 11, 2020

Hello,

First, thank you for this great work! 👏

I'm getting started on a SSG NextJS project, and I was wondering what was the purpose of the limitation of included languages? I guess this is about bundle size and performances, but what about just using something like the babel-plugin-prismjs, instead of the method described here?

I'll be happy to discuss that!

Thx again

@soykje soykje changed the title About included languages ❓ About included languages ? Jun 11, 2020
@jeffzh4ng
Copy link

Hi there, I'm trying to include syntax highlighting for Rust in my markdown files but Rust is not part of the included languages. Any idea of how I can add syntax highlighting for Rust?

@soykje
Copy link
Author

soykje commented Aug 24, 2020

@jeffzh4ng Hi, Rust language is included in PrismJS, but the bundled version of prism-react-renderer does not include all of them. You can follow the guidelines from FAQ to add support, or install the babel-plugin-prismjs package (like I did) and then declare your specific languages directly in the Babel config file (see here for more details). Btw do not forget that using this method you'll have to use the 'classic' Prism bundle, not the one from prism-react-renderer... The babel plugin will take care of build size according to your specific configuration.

@jeffzh4ng
Copy link

jeffzh4ng commented Aug 24, 2020

@soykje Thanks for the response. I'm not experienced with Gatsby or Prism at all. Where would I place the code snippet that the FAQ is telling me to do?

@kitten
Copy link
Contributor

kitten commented Aug 24, 2020

@jeffzh4ng you'll have to pass Prism (the default export from prismjs) to the Prism prop of this library.

Then either you make a file that just reexports Prism to add Prism manually to the highlighter and import all the highlighters you need or you can use the linked Babel plugin instead and won't need your own file.

@jeffzh4ng
Copy link

Got it, thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants