vue-highlightjs
Vue.js syntax highlighting made easy, using highlight.js.
Quickstart
Installation
npm install --save vue-highlightjs
Using vue-highlightjs
In your main JavaScript file (eg. main.js
):
import Vue from 'vue'
import VueHighlightJS from 'vue-highlightjs'
Vue.use(VueHighlightJS)
In your template, in order to highlight javascript code:
<pre v-highlightjs="sourcecode"><code class="javascript"></code></pre>
<pre v-highlightjs><code class="javascript">const s = new Date().toString()</code></pre>
Contributing
Any sort of contributions and feedback is much appreciated. Just
leave an issue or pull-request!
This project uses the AirBnB code style.
Please run npm run lint
and npm run test
before you submit a pull request! <3
About
Author: Chris Hager chris@linuxuser.at (https://www.metachris.com)
License: MIT
Contributors:
Changelog
v1.3.3
v1.3.1
- Changed
const
to var
for compatibility with PhantomJS and UglifyJS - Bugfix to allow empty content
v1.2.2
- Fixed displaying and highlighting HTML tags passed as value to the directive (thanks @nguyenvanduocit)