@hammad.fauz/parser

1.0.10 • Public • Published

@hammad.fauz/parser

fork of @bbob/parser

Parses BBCode and returns array AST tree

Valid for use with posthtml-render

Usage

import parse from '@hammad.fauz/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

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

Package Sidebar

Install

npm i @hammad.fauz/parser

Weekly Downloads

420

Version

1.0.10

License

MIT

Unpacked Size

29.2 kB

Total Files

9

Last publish

Collaborators

  • hammad.fauz