# markdown-it-regex

> Plugin for markdown-it, replaces strings that match a regular expression pattern.

Latest version **0.2.2** (published 2025-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install markdown-it-regex
pnpm add markdown-it-regex
yarn add markdown-it-regex
bun add markdown-it-regex
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2025-01-07 |
| First published | 2017-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Tyler Liu |
| Maintainers | tylerlong |

## Links

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

## Recent versions

- 0.2.2 (latest) — 2025-01-07
- 0.2.1 — 2025-01-07
- 0.2.0 — 2017-12-18
- 0.1.4 — 2017-01-02
- 0.1.3 — 2017-01-02
- 0.1.2 — 2017-01-02
- 0.1.1 — 2017-01-02
- 0.1.0 — 2017-01-02

## README

# markdown-it-regex

Plugin for markdown-it, replaces strings that match a regular expression
pattern.

## Installation

```
yarn add markdown-it-regex
```

## Usage

```javascript
import markdownIt from "markdown-it";
import markdownItRegex from "markdown-it-regex";
const mdi = markdownIt();
mdi.use(markdownItRegex, {
  name: "emoji",
  regex: /(:(?:heart|panda_face|car):)/,
  replace: (match) => {
    return `<i class="e1a-${match.slice(1, -1)}"></i>`;
  },
});
mdi.render("I :heart: you"); // <p>I <i class="e1a-heart"></i> you</p>
```

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