wr
we-rich
npm i we-rich
wr

we-rich

HTML转微信富文本节点, we just need rich, no text.

by tan

1.0.2 (see all)License:ISCTypeScript:Not Found
npm i we-rich
Readme

We Rich

Parse HTML into Weapp rich-text Nodes

HTML转小程序 rich-text 控件节点

npm

Usage

Node

npm install we-rich

const weRich = require('we-rich');
var nodes = weRich.parse(html);

例子 Input/Output

<div class='post post-featured'>
  <p>hello</p>
  <section>world</section>
  <img src="test.png" style="max-width:100%" />
</div>
[
  {
    "type": "node",
    "name": "div",
    "attrs": {"class": "post post-featured"},
    "children": [
      {
        "type": "node",
        "name": "p",
        "attrs": {},
        "children": [{"type": "text", "text": "hello"} ]
      },
      {
        "type": "node",
        "name": "div",
        "attrs": {},
        "children": [{"type": "text", "text": "world"}
        ]
      },
      {
        "type": "node",
        "name": "img",
        "attrs": {"src": "test.png", "style": "max-width:100%"},
        "children": []
      }
    ]
  }
]

功能

HTML into 微信小程序rich-text使用的nodes

安装

npm install we-rich --save
const weRich = require('we-rich');
var nodes = weRich.parse(html);

此项目基于 himalaya

Downloads/wk

37

GitHub Stars

36

LAST COMMIT

4yrs ago

MAINTAINERS

1

CONTRIBUTORS

0

OPEN ISSUES

2

OPEN PRs

0
VersionTagPublished
1.0.2
latest
4yrs ago
No alternatives found
No tutorials found
Add a tutorial