{"id":16696982,"url":"https://github.com/eatgrass/wechat-richtext","last_synced_at":"2025-06-25T22:36:54.819Z","repository":{"id":93104182,"uuid":"100724898","full_name":"eatgrass/wechat-richtext","owner":"eatgrass","description":"wechat rich text data parser for browser side cms","archived":false,"fork":false,"pushed_at":"2018-04-16T10:22:48.000Z","size":7,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-14T08:49:41.464Z","etag":null,"topics":["cms","parser","richtext","wechat-app"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eatgrass.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-18T15:18:49.000Z","updated_at":"2020-02-15T09:53:30.000Z","dependencies_parsed_at":"2023-09-18T06:15:05.983Z","dependency_job_id":null,"html_url":"https://github.com/eatgrass/wechat-richtext","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eatgrass/wechat-richtext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eatgrass%2Fwechat-richtext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eatgrass%2Fwechat-richtext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eatgrass%2Fwechat-richtext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eatgrass%2Fwechat-richtext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eatgrass","download_url":"https://codeload.github.com/eatgrass/wechat-richtext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eatgrass%2Fwechat-richtext/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261965299,"owners_count":23237593,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cms","parser","richtext","wechat-app"],"created_at":"2024-10-12T17:45:37.358Z","updated_at":"2025-06-25T22:36:54.772Z","avatar_url":"https://github.com/eatgrass.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wechat-richtext\n\nWeb HTML转微信小程序`\u003crich-text\u003e`组件数据\n\n### 使用\n\n```\nnpm install wechat-richtext --save\n```\n\n```javascript\nconst wrapperHTML = document.querySelector('.wrapper'); //包含富文本内容的HTML节点\n\nconst parser = WechatRichText({\n  'useStyle': true, // 是否包含原始内联style\n  'useClass': false,  // 是否包含原始class\n  'style': { // 自定义内联样式, 将覆盖useStyle\n    'span': 'font-size:14px' \n  },\n  'class': { // 自定义标签的class名，将覆盖useClass\n    'p': 'text' \n  }\n});\n\nconst result = parser.parse(wrapperHTML);\n \n```\n\n### 场景\n\nCMS端可以灵活使用你熟悉的富文本编辑器编辑好内容后，使用`wechat-richtext`获取json格式数据，小程序端就可以使用自带的`\u003crich-text\u003e`组件对富文本数据进行渲染了。\n\n优点：\n\n1. 使用微信小程序自带控件，速度更快，更加稳定可靠\n2. 网络传输json比html文本更加小巧\n3. 小程序不再依赖第三方富文本模板库，体积更小，结构更加自然\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Featgrass%2Fwechat-richtext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Featgrass%2Fwechat-richtext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Featgrass%2Fwechat-richtext/lists"}