Skip to content

A polyfill for highlight.js to isolate various syntax themes because of global style pollution.

License

Notifications You must be signed in to change notification settings

ChouUn/highlight.js-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A polyfill for highlight.js to isolate various syntax themes because of global style pollution.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published