2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-15 11:59:37 +03:00
Files
bbob/packages/bbob-parser
2018-07-23 23:06:50 +02:00
..
2018-07-23 22:36:43 +02:00
2018-07-08 13:30:13 +02:00
2018-06-12 20:08:15 +02:00
2018-07-14 01:54:41 +02:00
2018-07-20 23:37:22 +02:00
2018-07-08 11:59:59 +02:00

@bbob/parser

install size Known Vulnerabilities

Parses BBCode and returns 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!"]
    }
]