vue-highlightjs

Syntax highlighting with highlight.js for Vue.js 2.x
445,320 336
Install
npm install vue-highlightjs
Latest Version:1.3.3
Vue:2
License:MIT
Last Updated:May 24, 2021
Links: GitHub  ·  npm
Maintainer: metachris

vue-highlightjs

This project is superseded by the official Highlight.js Vue plugin:


Vue.js syntax highlighting made easy, using highlight.js.

Build Status

Quickstart

Installation

Simply install the npm package vue-highlightjs:

npm install --save vue-highlightjs

Using vue-highlightjs

In your main JavaScript file (eg. main.js):

// Import Vue and vue-highlgihtjs
import Vue from 'vue'
import VueHighlightJS from 'vue-highlightjs'
import 'highlight.js/styles/default.css' // or other highlight.js theme

// Tell Vue.js to use vue-highlightjs
Vue.use(VueHighlightJS)

In your template, in order to highlight javascript code:

<!-- If your source-code lives in a variable called 'sourcecode' -->
<pre v-highlightjs="sourcecode"><code class="javascript"></code></pre>

<!-- If you want to highlight hardcoded source-code -->
<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

  • Documentation

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)

Related Packages

vue-highlight.js

Highlight.js syntax highlighter component for Vue.

60,107 207
vue-hljs-with-line-number

Syntax highlighting with highlight.js for Vue.js 2.x

811
@lotsa/verdant-lang-vue

Vue language support for verdant-js

366 0
vue-highlight-code

Import the npm package and only one prop to show highlightCode and editor

33,884 25

Version History

Version Released License
1.3.3 MIT
1.3.1 MIT
1.2.3 MIT
1.2.2 MIT
1.2.1 MIT