diff --git a/packages/bbob-parser/README.md b/packages/bbob-parser/README.md index 5ab6863..fb0b00b 100644 --- a/packages/bbob-parser/README.md +++ b/packages/bbob-parser/README.md @@ -5,8 +5,16 @@ Valid for use with [posthtml-render](https://github.com/posthtml/posthtml-render) +## Install + +```bash +npm i @bbob/parser +``` + ## Usage +### API + ```js import parse from '@bbob/parser' @@ -17,7 +25,7 @@ const options = { const ast = parse('[url=https://github.com]hello world![/url]', options) ``` -## Results +**Results to** ```json [ @@ -30,3 +38,17 @@ const ast = parse('[url=https://github.com]hello world![/url]', options) } ] ``` + +### PostHTML + +```js +import render from 'posthtml-render' +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) +const html = render(ast) // hello world! +```