Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mishushakov/pre-highlighted

Custom element that extends <pre> with syntax highlighting
https://github.com/mishushakov/pre-highlighted

component custom-elements highlight syntax-highlighting webcomponents

Last synced: about 2 months ago
JSON representation

Custom element that extends <pre> with syntax highlighting

Awesome Lists containing this project

README

        

# pre-highlighted

HTML5 custom element that extends `

` element with syntax highlighting using ShikiJS

https://user-images.githubusercontent.com/10400064/145210244-e19c9299-2b8e-422f-8d2c-3e0bca9a00f0.mov

## Installation

1. Load Shiki into DOM

```html

```

2. Load the custom element

```html

```

Using npm

```sh
npm i pre-highlighted
```

## Usage

```html

.red {
background: red;
}

```

Or alternatively:

```html


.red {
background: red;
}

```

### Attributes

- `lang`, programming language
- `theme`, theme, consult [Shiki docs](https://github.com/shikijs/shiki/blob/main/docs/themes.md) for more