Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/zhangyu1818/rehype-default-code-lang

Add a default programming language to your code tags.
https://github.com/zhangyu1818/rehype-default-code-lang

rehype rehype-plugin shiki

Last synced: 23 days ago
JSON representation

Add a default programming language to your code tags.

Awesome Lists containing this project

README

        

# rehype-default-code-lang

Add a default programming language to your code tags.

> [!TIP]
> This plugin is ideal for migrating to Shiki, as `@shikijs/rehype` does not style code blocks without an explicit language. This plugin addresses that issue.

## Features

- Automatically adds a default language class to `` tags that lack a language specification.
- Facilitates the integration of syntax highlighting libraries like Shiki, especially when existing content lacks language annotations.

## Installation

```bash
pnpm install rehype-default-code-lang
```

## Usage

```javascript
import { rehypeDefaultCodeLang } from 'rehype-default-code-lang'
```