# @code-blocks/rehype-transform

> A rehype transform to render code blocks

Latest version **0.1.10** (published 2021-08-07) · GPLv2 license · 0 weekly downloads

## Install

```sh
npm install @code-blocks/rehype-transform
pnpm add @code-blocks/rehype-transform
yarn add @code-blocks/rehype-transform
bun add @code-blocks/rehype-transform
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.10 |
| Published | 2021-08-07 |
| First published | 2020-08-20 |
| Weekly downloads | 0 |
| License | GPLv2 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | idris-maps |
| Maintainers | idris-maps |

## Links

- npm: https://www.npmjs.com/package/@code-blocks/rehype-transform
- Repository: https://github.com/idris-maps/code-blocks
- Homepage: https://code-blocks.surge.sh
- Issues: https://github.com/idris-maps/code-blocks/issues
- npm.io page: https://npm.io/package/@code-blocks/rehype-transform

## Dependencies (5)

- [parse5](https://npm.io/package/parse5.md) ^6.0.1
- [unist-util-visit](https://npm.io/package/unist-util-visit.md) ^2.0.3
- [@code-blocks/types](https://npm.io/package/@code-blocks/types.md) ^0.1.0
- [hast-util-to-string](https://npm.io/package/hast-util-to-string.md) ^1.0.4
- [hast-util-from-parse5](https://npm.io/package/hast-util-from-parse5.md) ^6.0.0

## Recent versions

- 0.1.10 (latest) — 2021-08-07
- 0.1.9 — 2021-08-07
- 0.1.8 — 2021-08-07
- 0.1.7 — 2020-08-30
- 0.1.6 — 2020-08-30
- 0.1.4 — 2020-08-24
- 0.1.0 — 2020-08-20

## README

# @code-blocks/rehype-transform

A rehype transform to render code blocks

## Usage

Install the transform:

```bash
npm install @code-blocks/rehype-transform --save
```

Install the renderers you need, for example:

```bash
npm install @code-blocks/charts --save
```

An use it:

```js
const unified = require('unified')
const stream = require('unified-stream')
const markdown = require('remark-parse')
const remark2rehype = require('remark-rehype')
const html = require('rehype-stringify')

// the rehype transform
const codeblocks = require('@code-blocks/rehype-transform')

// some renderers
const charts = require('@code-blocks/charts')
const graphviz = require('@code-blocks/graphviz')

const processor = unified()
  .use(markdown)
  .use(remark2rehype)
  // add the transform and the renderers in an array as options
  .use(codeblocks, [charts, graphviz])
  .use(html)

process.stdin.pipe(stream(processor)).pipe(process.stdout)
```

Available renderers:

* [@code-blocks/charts](https://github.com/idris-maps/code-blocks/tree/master/packages/charts)
* [@code-blocks/graphviz](https://github.com/idris-maps/code-blocks/tree/master/packages/graphviz)
* [@code-blocks/math](https://github.com/idris-maps/code-blocks/tree/master/packages/math)
* [@code-blocks/music](https://github.com/idris-maps/code-blocks/tree/master/packages/music)
* [@code-blocks/tables](https://github.com/idris-maps/code-blocks/tree/master/packages/tables)
* [@code-blocks/prism](https://github.com/idris-maps/code-blocks/tree/master/packages/prism)

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