highlight.js - Syntax highlighting for the Web.
A polyfill for highlight.js to isolate various syntax themes because of global style pollution.
This package doesn't require modifying the source file.
import 'highlight.js-polyfill/styles/index.css';
OR
import 'highlight.js-polyfill/styles/index.scss';
The latter need node-sass and sass-loader in Webpack.
const theme = 'atom-one-dark';
return `
<pre class=${theme}>
<code class="hljs">
${hljs.highlight(lang, code, true).value}
</code>
</pre>
`;
It will render to :
<pre class="atom-one-dark">
<code class="hljs">
...
</code>
</pre>
import hljsThemes from 'highlight.js-polyfill';
It will get an Array of syntax themes.
$ npm run build
$ npm run release