highlight.js-polyfill

0.2.3 • Public • Published

highlight.js polyfill · Build Status npm version

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

/highlight.js-polyfill/

    Package Sidebar

    Install

    npm i highlight.js-polyfill

    Weekly Downloads

    7

    Version

    0.2.3

    License

    MIT

    Last publish

    Collaborators

    • fateud