mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
930 B
930 B
@bbob/parser
Parses BBCode and returns AST Tree looks like
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/JiLiZART/bbob/tree/master/packages/bbob-parser]hello world![/url]')
Results
[
{
"tag": "url",
"attrs": {
"url": "https://github.com/JiLiZART/bbob/tree/master/packages/bbob-parser"
},
"content": ["hello", " ", "world!"]
}
]