From abd235cf53a13f0ced7731c353cb7938e62a5759 Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Tue, 22 Jun 2021 18:39:17 -0400 Subject: [PATCH 01/11] update changelog --- CHANGELOG.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1c36e..154bf83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.0.1 + +- Export `component` also +- Fix name of types file + ## 2.0.0 - Vue 3.x support @@ -15,4 +20,4 @@ ## 0.9.0 - Original release -- Code split out from the original Highlight.js package \ No newline at end of file +- Code split out from the original Highlight.js package From d373ece07df9b805f337fbec4be11d5edc0cd2d6 Mon Sep 17 00:00:00 2001 From: Stephen Li Date: Sun, 19 Sep 2021 04:06:31 -0400 Subject: [PATCH 02/11] Change highlight.js/vue to peerDependencies to enforce versions (#17) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6b44c89..99d639d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "tslib": "^2.2.0", "typescript": "^4.2.4" }, - "dependencies": { + "peerDependencies": { "highlight.js": "^11.0.1", "vue": "^3" }, From 365d6167ad70bb35efed8257fe7204fbbd43bfdb Mon Sep 17 00:00:00 2001 From: Josh Goebel Date: Sun, 19 Sep 2021 04:10:18 -0400 Subject: [PATCH 03/11] (chore) release 2.1.0 --- CHANGELOG.md | 5 +++++ package.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 154bf83..8f2872d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.1.0 + +- `vue` and `highlight.js` moved to `peerDependencies` (#17) +- no other changes + ## 2.0.1 - Export `component` also diff --git a/package.json b/package.json index 99d639d..25f2850 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@highlightjs/vue-plugin", - "version": "2.0.1", + "version": "2.1.0", "description": "Highlight.js Vue Plugin", "main": "dist/highlightjs-vue.min.js", "module": "dist/highlightjs-vue.esm.min.js", From 02c47570fe190888261fbc207cd941781bff6e74 Mon Sep 17 00:00:00 2001 From: Stephen Li Date: Thu, 7 Oct 2021 17:35:14 -0400 Subject: [PATCH 04/11] (doc): Fix usage of highlight.js/lib/common (#20) Modern bundlers will optimize out unused imported names. Importing the module directly will indicate that it is a side effect and should not be optimized out. Fix #18 --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 44c1f0d..e74472e 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ Note: The plugin imports `highlight.js/lib/core` internally (but no languages). You can also simply load all "common" languages at once (as of v11): ```js -import hljs from 'highlight.js/lib/common'; +import 'highlight.js/lib/common'; import hljsVuePlugin from "@highlightjs/vue-plugin"; const app = createApp(App) @@ -67,6 +67,8 @@ app.use(hljsVuePlugin) app.mount('#app') ``` +Note that the `highlight.js/lib/common` import does not import the `hljs` object because it registers common languages internally and modern web bundlers like `webpack` will optimize out unused imported names. If you want to customize the `hljs` object, you can import it like the [previous example](#using-es6-modules--bundling). + ## Using component locally ```vue @@ -78,7 +80,7 @@ app.mount('#app') - +```shell +npm add @highlightjs/vue-plugin ``` -Then simply register the plugin with Vue: - -```js -const app = createApp(App) -app.use(hljsVuePlugin) -``` - - ## Using ES6 modules / bundling +As a [Vue Plugin](https://vuejs.org/guide/reusability/plugins.html): + ```js import 'highlight.js/styles/stackoverflow-light.css' import hljs from 'highlight.js/lib/core'; @@ -73,6 +65,8 @@ Note that the `highlight.js/lib/common` import does not import the `hljs` object ## Using component locally +The component can also be imported locally. However, you still have to import the css styles somewhere. + ```vue