Skip to content

Commit cdd4760

Browse files
committed
script setup example
1 parent f8e792c commit cdd4760

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

Diff for: README.md

+18
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ 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 script setup
28+
29+
```html
30+
<template>
31+
<highlight-js autodetect code="function() {}" />
32+
</template>
33+
34+
<script setup>
35+
import 'highlight.js/styles/stackoverflow-light.css'
36+
import hljs from 'highlight.js/lib/core';
37+
import javascript from 'highlight.js/lib/languages/javascript';
38+
import { HighlightJs } from "@highlightjs/vue-plugin";
39+
40+
hljs.registerLanguage('javascript', javascript);
41+
42+
</script>
43+
```
44+
2745
## Using the pre-built libraries
2846

2947
```html

0 commit comments

Comments
 (0)