vue-hljs

Highlight.js plugin for Vue.js 2.0

Usage no npm install needed!

<script type="module">
  import vueHljs from 'https://cdn.skypack.dev/vue-hljs';
</script>

README

Build Status Build status Coverage Status GitHub stars MITLicence

NPM

vue-hljs

Install

npm install vue-hljs --save

or

yarn add vue-hljs

Useage

import Vue from "vue";
import vueHljs from "vue-hljs";
import hljs from "highlight.js";
//if you want to use default color, import this css file
import "vue-hljs/dist/style.css";

//use
Vue.use(vueHljs, { hljs })
<div v-highlight>
  <pre>
    <code class="you can specify the language here">...</code>
  </pre>
</div>

Use your own style

This plugin use gruvbox-dark as default style.

You can wirte your own style or see highlight.js demo. And then import your css file in Vue project entry.