2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-17 19:21:20 +03:00

feat(parser): better handlinf of unclosed tags like '[My unclosed and [closed] tag'

This commit is contained in:
Nikolay Kostyurin
2018-09-24 00:33:27 +02:00
parent 505152bf4c
commit b49b7435da
5 changed files with 79 additions and 21 deletions
+6 -5
View File
@@ -16,12 +16,12 @@ npm i @bbob/parser
### API
```js
import parse from '@bbob/parser'
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)
```
@@ -43,12 +43,13 @@ const ast = parse('[url=https://github.com]hello world![/url]', options)
```js
import render from 'posthtml-render'
import parse from '@bbob/parser'
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 ast = parse('[url=https://github.com]hello world![/url]', options);
const html = render(ast) // <url url="https://github.com">hello world!</url>
```