1.0.0 • Published 1 year ago

shiki-element v1.0.0

Weekly downloads
18
License
MIT
Repository
github
Last release
1 year ago

shiki-element

A simple web component to render code using the shiki library for syntax highlighting.

Install

$ npm i -S shiki-element

Usage

You can load the shiki-highlight element by importing it in an ES module:

import 'shiki-element'; // registers the shiki highlight element

You may then use the element like so:

<shiki-highlight>
  {
    console.log('Hello world!');
  }
</shiki-highlight>

You can specify the language:

<shiki-highlight language="ts">
...
</shiki-highlight>

You can specify shiki options via the options property:

const node = document.querySelector('shiki-highlight');
node.options = {
  theme: 'nord',
  lang: 'ts'
};

Styling

The following CSS variables are available:

NameDefaultSummary
--shiki-padding.4emPadding of the inner pre tag
--shiki-overflowautoOverflow of the inner pre tag
1.0.0

1 year ago

1.0.0-beta.2

1 year ago

1.0.0-beta.1

1 year ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.1

4 years ago