In my previous post I moved syntax highlighting to build-time on my Toast powered site. This was great as it removed the runtime dependencies of prismjs, prism-react-renderer, etc. One problem was that I started writing Haskell and Rust posts and neither of these languages are included by default, so I had to include them. In this case I chose to include all of the languages prism offers (except
meta which fails for unknown reasons).
After loading the languages, you need to pass the custom Prism instance into
Highlight as a prop when you render, and you have access to all of the languages. Remember this is done at build time, so we don't have to worry about file sizes.