Lightweight highlight.js Vue component
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
dist
src
.babelrc
.gitignore
.npmignore
LICENSE
README.md
package-lock.json
package.json
webpack.config.js

README.md

vue-hljs-lite

Lightweight highlight.js Vue component

Installation

npm install --save highlight.js vue-hljs-lite

npm package link

Setup & example

Inside your main.js:

The default highlight.js import imports all languages, it is therefore likely to be more efficient to import only the library and the languages you need.

import hljs from 'highlight.js/lib/highlight';
import xml from 'highlight.js/lib/languages/xml';
hljs.registerLanguage('xml', xml);

import VueHljsLite from 'vue-hljs-lite';

Vue.use(VueHljsLite, { hljs });

Inside any component:

<vue-hljs-lite :code="code" :language="'xml'"></vue-hljs-lite>

Props

  • code: the code to highlight.
  • language: the language of the code to highlight.

Size:

1.52 KiB

Powered by

  • Babel 7
  • Webpack 4

License

MIT

Twitter

Follow me on Twitter