syntax-highlight

Syntax highlight component for vue-termui.

Install

npm install @vue-termui/syntax-highlight

Usage

<script lang="ts" setup>
  improt { TuiBox } from 'vue-termui'
  import SyntaxHighlight from '@vue-termui/syntax-highlight'

  const code = `const hello = 'world'`
</script>

<template>
  <TuiBox>
    <SyntaxHighlight :code="code" />
  </TuiBox>
</template>

Props

code

  • Type: string

Source code to highlight.

lang

  • Type: string

Language of the source code. If you don’t set it yourself, this component will try to auto-detect it. All languages of highlight.js are supported.

theme

You can write your custom theme and pass it as a prop. More info regarding custom theme.

GitHub

View Github