JSPM

  • Created
  • Published
  • Downloads 92092
  • Score
    100M100P100Q163686F
  • License MIT

Fast, flexible, and lean implementation of BBcode parser

Package Exports

  • @bbob/parser

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@bbob/parser) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@bbob/parser

install size Known Vulnerabilities

Parses BBCode and returns array AST tree

Valid for use with posthtml-render

Usage

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

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