https://github.com/retronav/rehype-shiki
Rehype plugin to highlight codeblocks using Shiki, with special support for Astro.
https://github.com/retronav/rehype-shiki
astro highlighter rehype rehype-plugin shiki
Last synced: 5 months ago
JSON representation
Rehype plugin to highlight codeblocks using Shiki, with special support for Astro.
- Host: GitHub
- URL: https://github.com/retronav/rehype-shiki
- Owner: retronav
- License: apache-2.0
- Created: 2022-01-15T17:47:46.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-16T07:51:35.000Z (about 2 years ago)
- Last Synced: 2024-11-15T21:14:18.724Z (6 months ago)
- Topics: astro, highlighter, rehype, rehype-plugin, shiki
- Language: TypeScript
- Homepage:
- Size: 129 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# `@retronav/rehype-shiki`
Rehype plugin to highlight your code blocks with [Shiki](https://shiki.matsu.io).
# Features
- Supports both `pre` (markdown codeblocks) and `raw` (raw HTML) nodes.
- Allows you to use your own Shiki highlighter with customizations.
- Shiki is added as a `peerDependency`, which means no locking on a particular
version.# Usage
Check [index.test.ts](./src/index.test.ts) for various use cases.
This plugin uses the `class` attribute on the code element to determine the
language of the codeblock. Example of a codeblock which is parsed by
`remark-rehype` from markdown and works with this plugin:```html
const foo = 'bar';
```# Inspiration
Much of the plugin's interface is inspired by [`@leafac/rehype-shiki`](https://github.com/leafac/rehype-shiki).