# @jasonlamv-t/rehype-code-title

> Rehype plugin to add code block title in pre element as div element.

Latest version **0.0.4** (published 2023-02-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install @jasonlamv-t/rehype-code-title
pnpm add @jasonlamv-t/rehype-code-title
yarn add @jasonlamv-t/rehype-code-title
bun add @jasonlamv-t/rehype-code-title
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2023-02-14 |
| First published | 2023-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jason Lam |
| Maintainers | jasonlam |
| Keywords | rehype, code, title, markdown |

## Links

- npm: https://www.npmjs.com/package/@jasonlamv-t/rehype-code-title
- Repository: https://github.com/JasonLamv-t/rehype-code-title
- Homepage: https://github.com/JasonLamv-t/rehype-code-title#readme
- Issues: https://github.com/JasonLamv-t/rehype-code-title/issues
- npm.io page: https://npm.io/package/@jasonlamv-t/rehype-code-title

## Dependencies (1)

- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^4.1.2

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2023-02-14
- 0.0.3 — 2023-02-14
- 0.0.2 — 2023-02-14
- 0.0.1 — 2023-02-14

## README

# Rehype-Code-Title

I'm writing a blog project with mdx-bundler and I want to annotate code title such as filename in the top of the code block. This plugin does just that!

### Usage

```js
import rehype from 'rehype';
import rehypeCodeTitle from '@jasonlamv-t/rehype-code-title';
import rehypePrism from 'rehype-prism-plus';

rehype()
  .use(rehypeCodeTitle) // better choice to be before rehypePrism.
  .use(rehypePrism)
  .process(/* some html */);
```

For some markdown files like this:

````md
```js:index.js
const codeType = 'js';
```
````

It will be processed as:

```html
<pre class="language-js">
  <div class="code-title">index.js</div>
  <code class="language-js code-highlight">
    <span class="code-line line-number" line="1">
      const codeType = 'js';
    </span>
  </code>
</pre>
```

---
_Source: https://npm.io/package/@jasonlamv-t/rehype-code-title · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
