Skip to content

Commit

Permalink
add lib/common to the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Apr 5, 2021
1 parent 71e9e6b commit ea763f7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,16 @@ const hljs = require('./highlight.js');
const highlightedCode = hljs.highlightAuto('<span>Hello World!</span>').value
```

For a smaller footprint, load only the languages you need.
For a smaller footprint, load our common subset of languages (the same set used for our default web build).

```js
const hljs = require('highlight.js/lib/core'); // require only the core library
// separately require languages
const hljs = require('highlight.js/lib/common');
```

For the smallest footprint, load only the languages you need:

```js
const hljs = require('highlight.js/lib/core');
hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml'));

const highlightedCode = hljs.highlight('<span>Hello World!</span>', {language: 'xml'}).value
Expand Down

0 comments on commit ea763f7

Please sign in to comment.