1.1.2 • Published 1 year ago

vue-code-highlighter v1.1.2

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Vue Code Highlighter

Vue component for highlighting code or syntax with modern style, copy functionality, multicode and powered by Highlight.js

Installation

npm install vue-code-highlighter highlight.js

// or use yarn
yarn add vue-code-highlighter highlight.js

Usage

Importing

This package support either composition and options api with typescript or javascript.

import { VueCodeHighlighter, VueCodeHighlighterMulti } from 'vue-code-highlighter';
import 'vue-code-highlighter/dist/style.css'

This package does not need to call CSS from the highlight.js package because I have already wrapped it. What you need to do is install the highlight.js package.

Example & Demo

Example code and demo available in ichsanputr.github.io/vue-code-highlighter

Props

There are 2 types of components, namely VueCodeHighlighter and VueCodeHighlighterMulti, both of them have different props.

VueCodeHighlighter

AttributeTypeIs RequiredDescription
langStringtrueCode languange from Highlighter cheatset, see Supported languange
codeStringtruePlain code which will be displayed, please wrap your code using backtick ()
titleStringnoCustom title in header
disableCopyBooleannoDisable copy button and copy functionality to code

VueCodeHighlighterMulti

AttributeTypeIs RequiredDescription
langArraytrueSee example below
disableCopyBooleannoDisable copy button and copy functionality to code
const codeMulti = [
  {
    lang: "js",
    title: "vue",
    code: codeVue.value
  },
  {
    lang: "html",
    code: codeHtml.value,
    title: 'html'
  },
  {
    lang: "css",
    code: codeCss.value,
  },
]
1.1.1

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.1.2

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.1.0

7 years ago