@highlightjs/vue-plugin
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -1,1 +0,1 @@ | ||
import{defineComponent as e,ref as l,watch as a,computed as t,h as u}from"vue";import n from"highlight.js/lib/core";var r=e({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(e){var u=l(e.language);a((function(){return e.language}),(function(e){u.value=e}));var r=t((function(){return e.autodetect||!u.value})),o=t((function(){return!r.value&&!n.getLanguage(u.value)}));return{className:t((function(){return o.value?"":"hljs "+u.value})),highlightedCode:t((function(){var l;if(o.value)return console.warn('The language "'+u.value+'" you specified could not be found.'),e.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");if(r.value){var a=n.highlightAuto(e.code);return u.value=null!==(l=a.language)&&void 0!==l?l:"",a.value}return(a=n.highlight(e.code,{language:u.value,ignoreIllegals:e.ignoreIllegals})).value}))}},render:function(){return u("pre",{},[u("code",{class:this.className,innerHTML:this.highlightedCode})])}}),o={install:function(e){e.component("highlightjs",r)}};export default o; | ||
import{defineComponent as e,ref as l,watch as a,computed as t,h as n}from"vue";import u from"highlight.js/lib/core";var r=e({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(e){var n=l(e.language);a((function(){return e.language}),(function(e){n.value=e}));var r=t((function(){return e.autodetect||!n.value})),o=t((function(){return!r.value&&!u.getLanguage(n.value)}));return{className:t((function(){return o.value?"":"hljs "+n.value})),highlightedCode:t((function(){var l;if(o.value)return console.warn('The language "'+n.value+'" you specified could not be found.'),e.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");if(r.value){var a=u.highlightAuto(e.code);return n.value=null!==(l=a.language)&&void 0!==l?l:"",a.value}return(a=u.highlight(e.code,{language:n.value,ignoreIllegals:e.ignoreIllegals})).value}))}},render:function(){return n("pre",{},[n("code",{class:this.className,innerHTML:this.highlightedCode})])}}),o={install:function(e){e.component("highlightjs",r)},component:r};export default o; |
@@ -1,1 +0,1 @@ | ||
var hljsVuePlugin=function(e,u){"use strict";var n=e.defineComponent({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(n){var t=e.ref(n.language);e.watch((function(){return n.language}),(function(e){t.value=e}));var a=e.computed((function(){return n.autodetect||!t.value})),l=e.computed((function(){return!a.value&&!u.getLanguage(t.value)}));return{className:e.computed((function(){return l.value?"":"hljs "+t.value})),highlightedCode:e.computed((function(){var e;if(l.value)return console.warn('The language "'+t.value+'" you specified could not be found.'),n.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");if(a.value){var r=u.highlightAuto(n.code);return t.value=null!==(e=r.language)&&void 0!==e?e:"",r.value}return(r=u.highlight(n.code,{language:t.value,ignoreIllegals:n.ignoreIllegals})).value}))}},render:function(){return e.h("pre",{},[e.h("code",{class:this.className,innerHTML:this.highlightedCode})])}});return{install:function(e){e.component("highlightjs",n)}}}(Vue,hljs); | ||
var hljsVuePlugin=function(e,n){"use strict";var u=e.defineComponent({props:{code:{type:String,required:!0},language:{type:String,default:""},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0}},setup:function(u){var t=e.ref(u.language);e.watch((function(){return u.language}),(function(e){t.value=e}));var a=e.computed((function(){return u.autodetect||!t.value})),l=e.computed((function(){return!a.value&&!n.getLanguage(t.value)}));return{className:e.computed((function(){return l.value?"":"hljs "+t.value})),highlightedCode:e.computed((function(){var e;if(l.value)return console.warn('The language "'+t.value+'" you specified could not be found.'),u.code.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");if(a.value){var o=n.highlightAuto(u.code);return t.value=null!==(e=o.language)&&void 0!==e?e:"",o.value}return(o=n.highlight(u.code,{language:t.value,ignoreIllegals:u.ignoreIllegals})).value}))}},render:function(){return e.h("pre",{},[e.h("code",{class:this.className,innerHTML:this.highlightedCode})])}});return{install:function(e){e.component("highlightjs",u)},component:u}}(Vue,hljs); |
export declare function escapeHtml(value: string): string; | ||
//# sourceMappingURL=utils.d.ts.map |
import { Plugin } from 'vue'; | ||
declare const plugin: Plugin; | ||
declare const component: import("vue").DefineComponent<{ | ||
code: { | ||
type: StringConstructor; | ||
required: true; | ||
}; | ||
language: { | ||
type: StringConstructor; | ||
default: string; | ||
}; | ||
autodetect: { | ||
type: BooleanConstructor; | ||
default: boolean; | ||
}; | ||
ignoreIllegals: { | ||
type: BooleanConstructor; | ||
default: boolean; | ||
}; | ||
}, { | ||
className: import("vue").ComputedRef<string>; | ||
highlightedCode: import("vue").ComputedRef<string>; | ||
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<{ | ||
code: string; | ||
language: string; | ||
autodetect: boolean; | ||
ignoreIllegals: boolean; | ||
} & {}>, { | ||
language: string; | ||
autodetect: boolean; | ||
ignoreIllegals: boolean; | ||
}>; | ||
declare const plugin: Plugin & { | ||
component: typeof component; | ||
}; | ||
export default plugin; | ||
//# sourceMappingURL=vue.d.ts.map |
{ | ||
"name": "@highlightjs/vue-plugin", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Highlight.js Vue Plugin", | ||
"main": "dist/highlightjs-vue.min.js", | ||
"module": "dist/highlightjs-vue.esm.min.js", | ||
"types": "dist/highlightjs-vue.d.ts", | ||
"types": "dist/vue.d.ts", | ||
"scripts": { | ||
@@ -24,3 +24,3 @@ "build": "rollup -c", | ||
"dependencies": { | ||
"highlight.js": "^10.7.2", | ||
"highlight.js": "^11.0.1", | ||
"vue": "^3" | ||
@@ -27,0 +27,0 @@ }, |
@@ -70,2 +70,24 @@ # Highlight.js plugin for Vue.js | ||
## Using component locally | ||
```vue | ||
<template> | ||
<highlightjs | ||
language="js" | ||
code="console.log('Hello World');" | ||
/> | ||
</template> | ||
<script> | ||
import hljs from 'highlight.js/lib/common'; | ||
import hljsVuePlugin from "@highlightjs/vue-plugin"; | ||
export default { | ||
components: { | ||
highlightjs: hljsVuePlugin.component | ||
} | ||
} | ||
</script> | ||
``` | ||
## Building the pre-built library from source | ||
@@ -72,0 +94,0 @@ |
@@ -76,8 +76,9 @@ import { ref, h, computed, defineComponent, Plugin, watch } from 'vue' | ||
const plugin: Plugin = { | ||
const plugin: Plugin & { component: typeof component } = { | ||
install(app) { | ||
app.component('highlightjs', component) | ||
}, | ||
component, | ||
} | ||
export default plugin |
Sorry, the diff of this file is not supported yet
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
12199
129
99
+ Addedhighlight.js@11.10.0(transitive)
- Removedhighlight.js@10.7.3(transitive)
Updatedhighlight.js@^11.0.1