From d22a2895a48655021fbd399350c46bca17b39c20 Mon Sep 17 00:00:00 2001 From: Nikolay Kostyurin Date: Mon, 20 Aug 2018 08:54:50 +0200 Subject: [PATCH] chore(parser): update readme --- packages/bbob-parser/README.md | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) 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! +```