vue-highlightjs
Advanced tools
Comparing version 1.2.3 to 1.3.1
@@ -8,3 +8,4 @@ module.exports = { | ||
"strict": [0, "global"], | ||
"no-var": "off" | ||
} | ||
}; |
25
index.js
'use strict'; | ||
const hljs = require('highlight.js'); | ||
var hljs = require('highlight.js'); | ||
const vueHighlightJS = {}; | ||
var vueHighlightJS = {}; | ||
vueHighlightJS.install = function install(Vue) { | ||
@@ -11,7 +11,10 @@ Vue.directive('highlightjs', { | ||
// on first bind, highlight all targets | ||
const targets = el.querySelectorAll('code'); | ||
for (var i = 0; i < targets.length; i += 1) { | ||
const target = targets[i]; | ||
var targets = el.querySelectorAll('code'); | ||
var target; | ||
var i; | ||
if (binding.value) { | ||
for (i = 0; i < targets.length; i += 1) { | ||
target = targets[i]; | ||
if (typeof binding.value === 'string') { | ||
// if a value is directly assigned to the directive, use this | ||
@@ -27,7 +30,9 @@ // instead of the element content. | ||
// after an update, re-fill the content and then highlight | ||
const targets = el.querySelectorAll('code'); | ||
var targets = el.querySelectorAll('code'); | ||
var target; | ||
var i; | ||
for (var i = 0; i < targets.length; i += 1) { | ||
const target = targets[i]; | ||
if (binding.value) { | ||
for (i = 0; i < targets.length; i += 1) { | ||
target = targets[i]; | ||
if (typeof binding.value === 'string') { | ||
target.textContent = binding.value; | ||
@@ -34,0 +39,0 @@ hljs.highlightBlock(target); |
{ | ||
"name": "vue-highlightjs", | ||
"version": "1.2.3", | ||
"version": "1.3.1", | ||
"description": "Syntax highlighting with highlight.js for Vue.js 2.x", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/metachris/vue-highlightjs", |
@@ -55,5 +55,6 @@ [Vue.js](https://vuejs.org/) syntax highlighting made easy, using [highlight.js](https://highlightjs.org/). | ||
* Chris Hager | ||
* [Chris Hager](https://www.metachris.com) | ||
* [mr-krille](https://github.com/mr-krille) | ||
* [Duoc Nguyen](https://github.com/nguyenvanduocit) | ||
* [Shu Ding](https://github.com/shudin) | ||
@@ -63,4 +64,9 @@ | ||
v1.3.1 | ||
* Changed `const` to `var` for compatibility with PhantomJS and UglifyJS | ||
* [Bugfix](https://github.com/metachris/vue-highlightjs/pull/6) to allow empty content | ||
v1.2.2 | ||
* Fixed displaying and highlighting HTML tags passed as value to the directive (thanks @nguyenvanduocit) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4776
59
71