diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b1c36e..19017fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,25 @@ +## 2.1.3 + +- Fix `language` prop being ignored unless `autodetect` is explicitly set to `false` (#41) + +## 2.1.2 + +- Default to `tabindex="0"` on the internal `` element to allow keyboard scrolling when a scrollbar is applied to the element. This resolves an accessibility issue found by Vue-Axe. (#33) + +## 2.1.1 + +- add `exports "."` to `package.json` (#27) + +## 2.1.0 + +- `vue` and `highlight.js` moved to `peerDependencies` (#17) +- no other changes + +## 2.0.1 + +- Export `component` also +- Fix name of types file + ## 2.0.0 - Vue 3.x support @@ -15,4 +37,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 diff --git a/LICENSE b/LICENSE index 253731b..c40859e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ BSD 3-Clause License -Copyright (c) 2021, Josh Goebel +Copyright (c) 2022, Josh Goebel All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/README.md b/README.md index 44c1f0d..76aa460 100644 --- a/README.md +++ b/README.md @@ -22,27 +22,20 @@ This plugin provides a `highlightjs` component for use in your Vue.js 3 applicat ``` -Note: For Vue.js version 2 support see the [1-stable](https://github.com/highlightjs/vue-plugin/tree/1-stable) branch here on GitHub. The `latest` tag via NPM is compatible with Vue.js v2; the `next` tag Vue.js v3. +Note: For Vue.js version 2 support see the [1-stable](https://github.com/highlightjs/vue-plugin/tree/1-stable) branch here on GitHub. Version 1.x.x is compatible with Vue.js v2; version 2.x.x with Vue.js v3. -## Using the pre-built libraries - -```html - - - -``` - -Then simply register the plugin with Vue: +## Installation -```js -const app = createApp(App) -app.use(hljsVuePlugin) +```shell +npm add @highlightjs/vue-plugin ``` - ## 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'; import javascript from 'highlight.js/lib/languages/javascript'; import hljsVuePlugin from "@highlightjs/vue-plugin"; @@ -59,7 +52,8 @@ 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/styles/stackoverflow-light.css' +import 'highlight.js/lib/common'; import hljsVuePlugin from "@highlightjs/vue-plugin"; const app = createApp(App) @@ -67,8 +61,12 @@ 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 +The component can also be imported locally. However, you still have to import the css styles somewhere. + ```vue