# markdown-it-custom-block

> Custom blocks for markdown-it

Latest version **1.0.0** (published 2024-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-custom-block
pnpm add markdown-it-custom-block
yarn add markdown-it-custom-block
bun add markdown-it-custom-block
```

## Health

**Score 55/100 (C)** — status: stable.

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

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2024-12-04 |
| First published | 2017-05-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >= 20.0.0 |
| Dependencies | 0 |
| Unpacked size | 11.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 64 |
| Maintainers | posva |
| Keywords | markdown-it-plugin, markdown-it, markdown |

## Links

- npm: https://www.npmjs.com/package/markdown-it-custom-block
- Repository: https://github.com/posva/markdown-it-custom-block
- Homepage: https://github.com/posva/markdown-it-custom-block#readme
- Issues: https://github.com/posva/markdown-it-custom-block/issues
- npm.io page: https://npm.io/package/markdown-it-custom-block

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2024-12-04
- 0.1.2 — 2020-11-26
- 0.1.1 — 2017-05-11
- 0.1.0 — 2017-05-07
- 0.0.0 — 2017-05-07

## README

# markdown-it-custom-block

> Handle custom blocks transformations

## Usage

```js
import customBlock from 'markdown-it-custom-block'

markdownit().use(customBlock, {
  example(arg) {
    return `<example-${arg}/>`
  },
  video(url) {
    return `<video controls>
        <source src="${url}" type="video/mp4">
      </video>`
  },
})
```

```md
@[example](hello)

@[video](video.mp4)
```

becomes

```html
<example-hello />
<video controls>
  <source src="video.mp4" type="video/mp4" />
</video>
```

## License

[MIT](http://opensource.org/licenses/MIT)

---
_Source: https://npm.io/package/markdown-it-custom-block · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
