0.0.3 • Published 5 months ago

rehype-shikix v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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