rehype-shikix
TypeScript icon, indicating that this package has built-in type declarations

0.0.3 • Public • Published

rehype-shikix

rehype plugin for shikix.

Install

npm i -D rehype-shikix

Usage

import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype'
import rehypeStringify from 'rehype-stringify'
import rehypeShikix from 'rehype-shikix'
import { expect, test } from 'vitest'

const file = await unified()
   .use(remarkParse)
   .use(remarkRehype)
   .use(rehypeShikix, {
      // or `theme` for a single theme
      themes: {
         light: 'lumos-light',
         dark: 'lumos-dark',
      }
   })
   .use(rehypeStringify)
   .process(await fs.readFile('./input.md'))

Features

Line Highlight

In addition to the features of shikix, this plugin also supports line highlighting. You can add {1,3-4} after the language name to highlight the specified lines. For example:

# Hello World

```js {1,3-4}
console.log('line1') // highlighted
console.log('line2')
console.log('line3') // highlighted
console.log('line4') // highlighted
```

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i rehype-shikix

Weekly Downloads

2

Version

0.0.3

License

MIT

Unpacked Size

8.54 kB

Total Files

6

Last publish

Collaborators

  • dennisollhoff