highlight.js polyfill ·
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.
How to use
Prepare
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.
Example
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>
About module
import hljsThemes from 'highlight.js-polyfill';
It will get an Array of syntax themes.
Build
$ npm run build
Publish
$ npm run release