nuxt-highlightjs

Highlightjs code block styling and syntax highlighting for Nuxt 2
21,276 20
Install
npm install nuxt-highlightjs
Latest Version:1.0.3
License:MIT
Last Updated:Aug 3, 2022
Links: GitHub  ·  npm
Maintainer: llang8

nuxt-highlightjs

Highlight.js syntax highlighting for Nuxt.js

NPM Version

Setup

  1. Add nuxt-highlightjs dependency to your project
npm install --save nuxt-highlightjs
  1. Add nuxt-highlightjs to the modules section of nuxt.config.js
  modules: [
    // Simple Usage
    'nuxt-highlightjs',
    
    // With Options
    ['nuxt-highlightjs', {
      // Module Options
    }]
  ],

Usage

In your .vue template:

      <!-- Adding codeblock content in HTML -->
      <pre>
        <code v-highlight class="javascript">console.log('Hello World')</code>
      </pre>

      <!-- Adding codeblock content with a variable 
        (where the variable 'code' lives in your component's data function) -->
      <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: [
    // With Options
    ['nuxt-highlightjs', {
      style: 'obsidian'
    }]
  ],

License

MIT

Related Packages

@nuxtjs/redirect-module

Nuxt module to dynamically redirect initial requests

248,427 307
nuxt-translation-manager

Simple and easy to use translation manager for nuxt and nuxt-i18n that allows to...

16,873 19
@thunderid/nuxt

Nuxt SDK for ThunderID

6,771 7
@traum-ferienwohnungen/nuxt-advanced-healthcheck

Module for adding healthcheck urls to a nuxt project

2,621 3
@agency-undone/nuxt-module-ipfs

A Nuxt module that enables nuxt routing for both the intended path and IPFS gate...

945 8

Version History

Version Released License
1.0.3 MIT
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT