I'd like to add PrismJS.
https://prismjs.com/index.html
So I have run
yarn add prismjs
Then updated application.js with:
import Prism from 'prismjs';
and application.scss:
@import '~prismjs/themes/prism';
And now it highlights JS and CSS like this:
<pre><code class="language-css">p { color: red }</code></pre>
But, I can't add any more languages. Eg Liquid.
I've tried to follow the instructions to use https://github.com/mAAdhaTTah/babel-plugin-prismjs. So in babel.config.js:
plugins: [
["prismjs", {
"languages": [ "css", "liquid"]
}],
But no highlighting markup is added to the page for liquid.
I get an error in the webpack-dev-server:
ERROR in ./app/javascript/packs/application.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In ..node_modules/prismjs/prism.js
So, How should I properly add the prism-js babel plugin to babel.config.js ?