nuxt-highlightjs
Highlight.js syntax highlighting for Nuxt.js
Setup
- Add
nuxt-highlightjs
dependency to your project
npm install --save nuxt-highlightjs
- Add
nuxt-highlightjs
to the modules
section of nuxt.config.js
modules: [
'nuxt-highlightjs',
['nuxt-highlightjs', {
}]
],
Usage
In your .vue
template:
<pre>
<code v-highlight class="javascript">console.log('Hello World')</code>
</pre>
<pre>
<code v-highlight="code" class="javascript">console.log('Hello World')</code>
</pre>
The example above uses javascript highlighting, you can change the class on the code element to any of the supported languages to set the highlighting.
Module Options
style
- Type:
string
- Default:
default
Set the highlight.js theme
See list of available style options
modules: [
['nuxt-highlightjs', {
style: 'obsidian'
}]
],
License
MIT