8000 (doc) Add Installation instructions (#51) · highlightjs/vue-plugin@ecdd052 · GitHub
[go: up one dir, main page]

Skip to content

Commit ecdd052

Browse files
(doc) Add Installation instructions (#51)
Co-authored-by: Beat Reichenbach <beatreichenbach@users.noreply.github.com>
1 parent 454575a commit ecdd052

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,16 @@ This plugin provides a `highlightjs` component for use in your Vue.js 3 applicat
2424

2525
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.
2626

27-
## Using the pre-built libraries
27+
## Installation
2828

29-
```html
30-
<link rel="stylesheet" href="/path/to/styles/default.css">
31-
<script src="/path/to/highlight.min.js"></script>
32-
<script src="/path/to/highlight-vue.min.js"></script>
29+
```shell
30+
npm add @highlightjs/vue-plugin
3331
```
3432

35-
Then simply register the plugin with Vue:
36-
37-
```js
38-
const app = createApp(App)
39-
app.use(hljsVuePlugin)
40-
```
41-
42-
4333
## Using ES6 modules / bundling
4434

35+
As a [Vue Plugin](https://vuejs.org/guide/reusability/plugins.html):
36+
4537
```js
4638
import 'highlight.js/styles/stackoverflow-light.css'
4739
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
7365

7466
## Using component locally
7567

68+
The component can also be imported locally. However, you still have to import the css styles somewhere.
69+
7670
```vue
7771
<template>
7872
<highlightjs
@@ -93,6 +87,21 @@ export default {
9387
</script>
9488
```
9589

90+
## Using the pre-built libraries
91+
92+
```html
93+
<link rel="stylesheet" href="/path/to/styles/default.css">
94+
<script src="/path/to/highlight.min.js"></script>
95+
<script src="/path/to/highlight-vue.min.js"></script>
96+
```
97+
98+
Then simply register the plugin with Vue:
99+
100+
```js
101+
const app = createApp(App)
102+
app.use(hljsVuePlugin)
103+
```
104+
96105
## Building the pre-built library from source
97106

98107
We use rollup to build the `dist` distributable.

0 commit comments

Comments
 (0)
0