VS Code Style Syntax Highlighter – shiki.js

Category: Javascript , Recommended , Text | January 3, 2019
Author: octref
Views Total: 376
Official Page: Go to website
Last Update: January 3, 2019
License: MIT

Preview:

VS Code Style Syntax Highlighter – shiki.js

Description:

shiki.js is a fresh new Syntax, VS Code style syntax highlighter which uses Text Mate grammars to tokenize strings.

How to use it:

Installation.

# Yarn
$ yarn add shiki

# NPM
$ npm install shiki --save

Import the shiki.js.

const shiki = require('shiki')

Insert the code into <pre> and <code> tags.

<pre class="shiki">
  <code>
    Your Code Here
  </code>
</pre>

Initialize the shiki.js. Done.

shiki.getHighlighter({
  theme: 'nord'
}).then(highlighter => {
  // do something
})

You Might Be Interested In:


Leave a Reply