mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-24 14:04:06 +03:00
10f6ff9ff1
- @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
@bbob/parser
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!"]
}
]