@hammad.fauz/parser

Fast, flexible, and lean implementation of BBcode parser

Stats

StarsIssuesVersionUpdatedCreatedSize
@hammad.fauz/parser
011.0.103 years ago3 years agoMinified + gzip package size for @hammad.fauz/parser in KB

Readme

@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!"]
    }
]

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.