2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-05-24 14:04:06 +03:00
Files
bbob/packages/bbob-parser
Nikolay Kostyurin 10f6ff9ff1 Publish
- @bbob/cli@1.0.7
 - @bbob/core@1.1.0
 - @bbob/html@1.1.0
 - @bbob/parser@1.2.0
 - @bbob/plugin-helper@1.1.0
 - @bbob/preset-html5@1.1.0
 - @bbob/react@1.1.0
2018-08-09 02:46:35 +02:00
..
2018-06-12 20:08:15 +02:00
2018-08-09 02:46:35 +02:00
2018-08-09 02:46:35 +02:00
2018-07-08 11:59:59 +02:00

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