A beautiful VS Code Style Syntax Highlighter | shiki.js

Shiki is a beautiful Syntax Highlighter that uses monstrous TextMate grammar rules for a textbook for chains.

The rules of the format are used to adjust the strings and colors of icons that contain VS icon topics. In short, HTML Shiki generates just like your code in VS icon and works great in your fixed website generator.

How to make use of it:

1. Install the shiki.js with package deal managers.

# Yarn
$ yarn add shiki

# NPM
$ npm install shiki --save

2. Import the shiki.js library.

const shiki = require('shiki')
// or
<script src="dist/index.iife.js"></script>

3. Create a container to carry the Syntax Highlighter.

<div id="output"></div>

4. Initialize the shiki.js and insert the source code to be highlighted.

shiki
.getHighlighter({
  theme: 'nord'
})
.then(highlighter => {
  // codeToHtml(code, language)
  const code = highlighter.codeToHtml(`console.log('shiki');`, 'js')
  document.getElementById('output').innerHTML = code
})

VS Code Style Syntax Highlighter, Shiki Plugin/Github


See Demo And Download

Official Website(shikijs): Click Here

This superior jQuery/javascript plugin is developed by shikijs. For extra Advanced Usage, please go to the official website.

Share