mirror of
https://github.com/tenrok/BBob.git
synced 2026-05-15 11:59:37 +03:00
chore(parser): update readme
This commit is contained in:
committed by
GitHub
parent
b48feab135
commit
d22a2895a4
@@ -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) // <url url="https://github.com">hello world!</url>
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user