lanan-repair/node_modules/rich-text-parser/README.md
2024-09-27 20:58:56 +08:00

29 lines
660 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 在项目中使用该rich-text-parser
**安装**
```bash
$ npm i rich-text-parser -S --production
```
**使用**
```html
<rich-text nodes="{{nodes}}"></rich-text>
```
```bash
import parser from 'rich-text-parser'
parser.definedCustomTag({figure: 'p', figcaption: ''})
const nodes = parser.getRichTextJson(html)
```
### Api
| 参数 | 说明 | 参数 | 参数类型 | 返回值类型 |
|-----------|----------------------------------|-----------|---------|--------|
| getRichTextJson | 解析html | `html` | `String` | `Object` |
| definedCustomTag | 定义需要解析的特殊标签value不填默认是div | `options` | `Object` | `-` |