diff --git a/README.md b/README.md
index d76524e..44c1f0d 100644
--- a/README.md
+++ b/README.md
@@ -67,6 +67,28 @@ app.use(hljsVuePlugin)
app.mount('#app')
```
+## Using component locally
+
+```vue
+
+
+
+
+
+```
+
## Building the pre-built library from source
We use rollup to build the `dist` distributable.
diff --git a/dist/highlightjs-vue.esm.min.js b/dist/highlightjs-vue.esm.min.js
index a9a334e..8f2f31f 100644
--- a/dist/highlightjs-vue.esm.min.js
+++ b/dist/highlightjs-vue.esm.min.js
@@ -1 +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,"'");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,"'");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;
diff --git a/dist/highlightjs-vue.min.js b/dist/highlightjs-vue.min.js
index 11f81c8..bb540a1 100644
--- a/dist/highlightjs-vue.min.js
+++ b/dist/highlightjs-vue.min.js
@@ -1 +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,"'");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,"'");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);
diff --git a/dist/vue.d.ts b/dist/vue.d.ts
index 607965b..b73d5fe 100644
--- a/dist/vue.d.ts
+++ b/dist/vue.d.ts
@@ -1,4 +1,36 @@
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;
+ highlightedCode: import("vue").ComputedRef;
+}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record, 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
\ No newline at end of file
diff --git a/dist/vue.d.ts.map b/dist/vue.d.ts.map
index d66a1a0..6ad7905 100644
--- a/dist/vue.d.ts.map
+++ b/dist/vue.d.ts.map
@@ -1 +1 @@
-{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../src/vue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,MAAM,EAAS,MAAM,KAAK,CAAA;AA2EtE,QAAA,MAAM,MAAM,EAAE,MAIb,CAAA;AAED,eAAe,MAAM,CAAA"}
\ No newline at end of file
+{"version":3,"file":"vue.d.ts","sourceRoot":"","sources":["../src/vue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,MAAM,EAAS,MAAM,KAAK,CAAA;AAItE,QAAA,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEb,CAAA;AAEF,QAAA,MAAM,MAAM,EAAE,MAAM,GAAG;IAAE,SAAS,EAAE,OAAO,SAAS,CAAA;CAKnD,CAAA;AAED,eAAe,MAAM,CAAA"}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 1e1359d..dae281a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,15 +1,15 @@
{
"name": "@highlightjs/vue-plugin",
- "version": "1.0.1",
+ "version": "2.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@highlightjs/vue-plugin",
- "version": "1.0.1",
+ "version": "2.0.0",
"license": "BSD-3-Clause",
"dependencies": {
- "highlight.js": "^10.7.2",
+ "highlight.js": "^11.0.1",
"vue": "^3"
},
"devDependencies": {
@@ -304,11 +304,11 @@
}
},
"node_modules/highlight.js": {
- "version": "10.7.2",
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.2.tgz",
- "integrity": "sha512-oFLl873u4usRM9K63j4ME9u3etNF0PLiJhSQ8rdfuL51Wn3zkD6drf9ZW0dOzjnZI22YYG24z30JcmfCZjMgYg==",
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.0.1.tgz",
+ "integrity": "sha512-EqYpWyTF2s8nMfttfBA2yLKPNoZCO33pLS4MnbXQ4hECf1TKujCt1Kq7QAdrio7roL4+CqsfjqwYj4tYgq0pJQ==",
"engines": {
- "node": "*"
+ "node": ">=12.0.0"
}
},
"node_modules/is-core-module": {
@@ -943,9 +943,9 @@
"dev": true
},
"highlight.js": {
- "version": "10.7.2",
- "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.2.tgz",
- "integrity": "sha512-oFLl873u4usRM9K63j4ME9u3etNF0PLiJhSQ8rdfuL51Wn3zkD6drf9ZW0dOzjnZI22YYG24z30JcmfCZjMgYg=="
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-11.0.1.tgz",
+ "integrity": "sha512-EqYpWyTF2s8nMfttfBA2yLKPNoZCO33pLS4MnbXQ4hECf1TKujCt1Kq7QAdrio7roL4+CqsfjqwYj4tYgq0pJQ=="
},
"is-core-module": {
"version": "2.4.0",
diff --git a/package.json b/package.json
index f110bd2..23eee8e 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,7 @@
"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": {
"build": "rollup -c",
"test": "echo \"Error: no test specified\" && exit 1",
@@ -21,7 +21,7 @@
"typescript": "^4.2.4"
},
"dependencies": {
- "highlight.js": "^10.7.2",
+ "highlight.js": "^11.0.1",
"vue": "^3"
},
"files": [
diff --git a/src/vue.ts b/src/vue.ts
index 11f89c4..991d3b9 100644
--- a/src/vue.ts
+++ b/src/vue.ts
@@ -73,10 +73,11 @@ const component = defineComponent({
},
})
-const plugin: Plugin = {
+const plugin: Plugin & { component: typeof component } = {
install(app) {
app.component('highlightjs', component)
},
+ component,
}
export default plugin
diff --git a/tsconfig.json b/tsconfig.json
index b379c19..4b470fa 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -8,10 +8,6 @@
"allowSyntheticDefaultImports": true,
"outDir": "dist",
-
- "paths": {
- "highlight.js/lib/core": ["./node_modules/highlight.js/types/index.d.ts"],
- }
},
"exclude": [
"node_modules",