Skip to content

Commit

Permalink
docs: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Jun 9, 2024
1 parent d47a68f commit 545a531
Showing 1 changed file with 81 additions and 2 deletions.
83 changes: 81 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,81 @@
# shiki-transformers
Shiki transformers used by Typlog
# @typlog/shiki-transformers

Shiki transformers by Typlog.

## Install

Install via npm:

```
npm i @typlog/shiki-transformers
```

Import from CDN:

```html
<script type="module">
import { transformerLineHighlight } from 'https://esm.sh/@typlog/shiki-transformers'
</script>
```

## Usage

```ts
import { codeToHtml } from 'shiki'
import { transformerLineHighlight } from '@typlog/shiki-transformers'

const code = `console.log('a')
console.log('b')
console.log('c')
console.log('e')
console.log('f')
console.log('g')
console.log('h')
`
const html = await codeToHtml(code, {
lang: 'ts',
theme: 'nord',
transformers: [
transformerLineHighlight({
highlight: '1,3-5',
showLines: true,
}),
],
})
```

## Options

```ts
export interface TransformerHighlightOptions {
/**
* Lines to be highlighted
*/
highlight?: string;

/**
* Class for highlighted lines
*
* @default 'highlighted'
*/
className?: string;

/**
* Line numbers starts from
*
* @default 1
*/
lineStart?: number;

/**
* Display line numbers
*
* @default false
*/
showLines?: boolean;
}
```

## License

MIT License

0 comments on commit 545a531

Please sign in to comment.