All Projects → byteboomers → vue-hljs-lite

byteboomers / vue-hljs-lite

Licence: MIT license
Lightweight highlight.js Vue component

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-hljs-lite

kirby-highlight
Themeable server-side syntax highlighting for Kirby
Stars: ✭ 14 (-68.18%)
Mutual labels:  highlight-js

vue-hljs-lite

Lightweight highlight.js Vue component

Installation

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

npm package link

Usage

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.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].