# @bbob/parser

> A BBCode to AST Parser part of @bbob

Latest version **4.4.1** (published 2026-07-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @bbob/parser
pnpm add @bbob/parser
yarn add @bbob/parser
bun add @bbob/parser
```

## 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.

## Facts

| | |
|---|---|
| Version | 4.4.1 |
| Published | 2026-07-27 |
| First published | 2018-06-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 165.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| Author | Nikolay Kostyurin <jilizart@gmail.com> |
| Maintainers | jilizart |
| Keywords | bbcode, parser, ast, bbcode parser, bbcodeparser, bbob, array, parse |

## Links

- npm: https://www.npmjs.com/package/@bbob/parser
- Repository: https://github.com/JiLiZART/bbob
- Issues: https://github.com/JiLiZART/bbob/issues
- npm.io page: https://npm.io/package/@bbob/parser

## Dependencies (2)

- [@bbob/types](https://npm.io/package/@bbob/types.md) *
- [@bbob/plugin-helper](https://npm.io/package/@bbob/plugin-helper.md) *

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 4.4.1 (latest) — 2026-07-27
- 0.0.0-alpha.e763e31 (pr_281) — 2025-10-14
- 0.0.0-alpha.b76fbba (pr_297) — 2025-10-14
- 0.0.0-alpha.5960231 (pr_292) — 2025-10-05
- 0.0.0-alpha.0b0f7e0 (pr_294) — 2025-10-05
- 0.0.0-alpha.0f6a72b (pr_290) — 2025-09-14
- 0.0.0-alpha.79337b0 (pr_287) — 2025-03-14
- 0.0.0-alpha.b033abe (pr_286) — 2025-03-14
- 0.0.0-alpha.419dc40 (pr_280) — 2025-03-09
- 0.0.0-alpha.91f6418 (pr_278) — 2025-03-09
- 0.0.0-alpha.d9ea378 (pr_277) — 2025-03-09
- 0.0.0-alpha.9a7e85c (pr_276) — 2025-03-09
- 0.0.0-alpha.566241 (pr_275) — 2025-03-09
- 0.0.0-alpha.300af4e (pr_272) — 2025-03-09
- 0.0.0-alpha.7daea28 (pr_267) — 2024-11-26
- … 84 more at https://npm.io/package/@bbob/parser/versions

## README

# @bbob/parser
[![install size](https://packagephobia.now.sh/badge?p=@bbob/parser)](https://packagephobia.now.sh/result?p=@bbob/parser) [![Known Vulnerabilities](https://snyk.io/test/github/JiLiZART/bbob/badge.svg?targetFile=packages%2Fbbob-parser%2Fpackage.json)](https://snyk.io/test/github/JiLiZART/bbob?targetFile=packages%2Fbbob-parser%2Fpackage.json)

> Parses BBCode and returns array AST tree 

Valid for use with [posthtml-render](https://github.com/posthtml/posthtml-render)

## Install

```bash
npm i @bbob/parser
```

## Usage

### API

```js
import { parse } from '@bbob/parser'

const options = {
    onlyAllowTags: ['url', 'h'],
    onError: (err) => console.warn(err.message, err.lineNumber, err.columnNumber)
};
const ast = parse('[url=https://github.com]hello world![/url]', options)
```

**Results to** 

```json
[
    {
        "tag": "url",
        "attrs": {
            "url": "https://github.com"
        },
        "content": ["hello", " ", "world!"]
    }
]
```

### PostHTML

```js
import render from 'posthtml-render'
import { parse } from '@bbob/parser'

const options = {
    onlyAllowTags: ['url', 'h'],
    onError: (err) => console.warn(err.message, err.lineNumber, err.columnNumber)
};

const ast = parse('[url=https://github.com]hello world![/url]', options);
const html = render(ast) // <url url="https://github.com">hello world!</url>
```

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