# wx-html-parse
**Repository Path**: lbc19920615/wx-html-parse
## Basic Information
- **Project Name**: wx-html-parse
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-06-02
- **Last Updated**: 2020-12-18
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
### 微信小程序富文本解析器
微信小程序在 `rich-text` 组件后开始支持富文本解析,但需要对照一套自定义规则的 `JOSN` 数据格式,`API` 返回的富文本需要前端做数据转换。
[html2json](https://github.com/Jxck/html2json) 是一个将 `HTML` 解析为对应的 `json` 格式但 [html2json](https://github.com/Jxck/html2json) 库转换出来的 `JSON` 与微信小程序要求不一致:
- `attrs.class` 为数组格式
- 不支持解析 `style`
故在此库的基础上做的了扩展与调整。
> 多个平级 `html` 标签在 `htmlParse` 解析后会有层级问题,故这里需要注意,可使用包裹一层无意义的 `html` 标签绕过。
使用方法:
```xml