# mfm-js

> An MFM parser implementation with TypeScript

Latest version **0.28.0** (published 2026-10-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install mfm-js
pnpm add mfm-js
yarn add mfm-js
bun add mfm-js
```

## Health

**Score 75/100 (B)** — status: active.

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

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.28.0 |
| Published | 2026-10-23 |
| First published | 2021-03-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 101.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 130 |
| Author | Marihachi |
| Maintainers | syuilo, marihachi |

## Links

- npm: https://www.npmjs.com/package/mfm-js
- Repository: https://github.com/misskey-dev/mfm.js
- npm.io page: https://npm.io/package/mfm-js

## Dependencies (1)

- [@misskey-dev/emoji-data](https://npm.io/package/@misskey-dev/emoji-data.md) 17.0.3

## Recent versions

- 0.28.0 (latest) — 2026-10-23
- 2022.7.21-dev.1 (dev) — 2022-07-20
- 0.23.0-canary.1 (canary) — 2022-07-10
- 0.27.0 — 2026-10-14
- 0.26.0 — 2026-05-07
- 0.25.0 — 2025-08-01
- 0.24.0 — 2023-12-18
- 0.23.3 — 2023-01-13
- 0.23.2 — 2023-01-10
- 0.23.1 — 2023-01-09
- 0.23.0 — 2022-07-22
- 0.22.1 — 2022-05-22
- 0.22.0 — 2022-05-21
- 0.21.0 — 2022-01-11
- 0.20.0 — 2021-10-02
- … 19 more at https://npm.io/package/mfm-js/versions

## README

# mfm.js
An MFM parser implementation with TypeScript.
[Try it out!](https://runkit.com/npm/mfm-js)

[![Test](https://github.com/misskey-dev/mfm.js/actions/workflows/test.yml/badge.svg)](https://github.com/misskey-dev/mfm.js/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/misskey-dev/mfm.js/branch/develop/graph/badge.svg?token=irAWFiHK8T)](https://codecov.io/gh/misskey-dev/mfm.js)

[![NPM](https://nodei.co/npm/mfm-js.png?downloads=true&downloadRank=true&stars=true)](https://www.npmjs.com/package/mfm-js)

## Installation
```
npm i mfm-js
```

## Usage
Please see [docs](./docs/index.md) for the detail.

TypeScript:
```ts
import * as mfm from 'mfm-js';

const inputText =
`<center>
Hello $[tada everynyan! 🎉]

I'm @ai, A bot of misskey!

https://github.com/syuilo/ai
</center>`;

// Generate a MFM tree from the full MFM text.
const mfmTree = mfm.parse(inputText);

// Generate a MFM tree from the simple MFM text.
const simpleMfmTree = mfm.parseSimple('I like the hot soup :soup:​');

// Reverse to a MFM text from the MFM tree.
const text = mfm.toString(mfmTree);

```

## Develop
### 1. Clone
```
git clone https://github.com/misskey-dev/mfm.js.git
```

### 2. Install packages
```
cd mfm.js

# This repository uses pnpm as its package manager.
pnpm i
```

### 3. Build
```
pnpm run build
```

### Use the interactive CLI parser
full parser:
```
pnpm run parse
```

simple parser:
```
pnpm run parse-simple
```

## License
This software is released under the [MIT License](LICENSE).

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