{"id":13604053,"url":"https://github.com/guozimo/taro-bdMark","last_synced_at":"2025-04-11T22:32:25.400Z","repository":{"id":65514602,"uuid":"176893543","full_name":"guozimo/taro-bdMark","owner":"guozimo","description":"taro-bdmark支持taro框架下的百度小程序markdown渲染","archived":false,"fork":false,"pushed_at":"2019-03-28T02:24:40.000Z","size":116,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T14:47:11.923Z","etag":null,"topics":[],"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/guozimo.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}},"created_at":"2019-03-21T07:37:06.000Z","updated_at":"2024-07-02T09:12:52.000Z","dependencies_parsed_at":"2023-01-26T21:05:19.407Z","dependency_job_id":null,"html_url":"https://github.com/guozimo/taro-bdMark","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guozimo%2Ftaro-bdMark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guozimo%2Ftaro-bdMark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guozimo%2Ftaro-bdMark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guozimo%2Ftaro-bdMark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guozimo","download_url":"https://codeload.github.com/guozimo/taro-bdMark/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248489850,"owners_count":21112652,"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":[],"created_at":"2024-08-01T19:00:39.012Z","updated_at":"2025-04-11T22:32:24.919Z","avatar_url":"https://github.com/guozimo.png","language":"JavaScript","funding_links":[],"categories":["第三方库和组件"],"sub_categories":["Taro1"],"readme":"#### taro-bdmark：百度小程序版本（taro框架）markdown解析器\n![输入图片说明](https://github.com/guozimo/publish/blob/gh-pages/img/md1.png)\n![输入图片说明](https://github.com/guozimo/publish/blob/gh-pages/img/md2.png)\n![输入图片说明](https://github.com/guozimo/publish/blob/gh-pages/img/md3.png)\n\n#### 来源\n修改自TooBug的wemark,由于不支持百度小程序使用，所以改造了一下，原wemark作者github地址：https://github.com/TooBug/wemark\n\n#### 介绍\n用于在百度小程序（taro框架）中渲染Markdown文本。\n在小程序诞生之前，Markdown的渲染一般需要解析成HTML，然后渲染解析后的HTML。然而小程序并没有提供HTML渲染的功能，因此在wemark诞生之前，几乎所有的Markdown渲染库全部无法在小程序下正常工作。\n\nbdmark可以实现在百度小程序下渲染Markdown内容，支持图片、表格在内的大部分Markdown特性。\ntaro-bdmark支持taro框架下的百度小程序md渲染。\n\n#### 特性\n\n- 以小程序自定义组件形式提供，可直接引入使用\n- 支持大部分markdown标记的解析、渲染（详细支持情况见下方附录）\n- 支持代码表格、代码高亮、HTML视频等特性\n- 支持使用原生rich-text进行渲染\n- 新增了markdown图片点击放大预览的能力\n\n#### 使用教程\n\n1、npm i taro-bdmark\n\n2、在页面的配置文件中引用bdmark组件\n\n```\n{\n\t\"usingComponents\": {\n\t\t\"bdmark\": \"/bdmark/bdmark\"\n\t}\n}\n```\n\n3、swan中使用：\n```\n\u003cbdmark md=\"{{md}}\" link highlight type=\"bdmark\"\u003e\u003c/bdmark\u003e\n\n```\n4、快速开始:\n\nnpm run dev:swan\n\n\n 参数说明：\n \n- md，必填，需要渲染的Markdown字符串；\n- link，是否解析链接，如果解析，会使用小程序navigator组件展现，可在小程序内跳转，默认为false；\n- highlight，是否对代码进行高亮处理，默认为false；\n- type，渲染方式，bdmark会使用bdmark的数据结构和模板进行渲染，rich-text会使用小程序内置的rich-text组件进行渲染（不支持链接跳转、视频）。\n\u003e 注：代码高亮会使标签数量和解析后的数据量增大，不排除产生渲染性能问题，请根据实际需要酌情使用。\n\n#### 不足之处\n对原作者的css做了部分调整，在bdmark.css下新增代码：\n\n```\n.wemark_block_code text{\n\tdisplay: inline;\n\twhite-space: normal;\n}\n```\n增加white-space: normal;是为了防止对父css的white-space: pre的继承，父css造成换行问题，很不美观，但是改成white-space: normal之后，会造成代码片段的空格消失，希望大家想办法支持改造一下！\n\n#### 修改部分\n\n- 1、修改wemark目录下的wxml为swan，修改wxss为css\n- 2、修改wemark.js中的wx:for,wx:if wx:index等兼容百度小程序\n- 3、新增部分css，并注释掉css中所有：last的css\n- 3、修改remarkable.js源码中void js保留字对taro 的支持程度 taro对void this.tokenize(s,s.line,s.lineMax)函数敏感并不会进入，原生百度小程序和微信小程序皆不会阻塞 去掉void 保留字以支持taro框架\n\n#### commit 代码提交规范(提交时提示)\n* Commit message格式\n  \u003ctype\u003e: \u003csubject\u003e\n  （type    和    subject 之前有个英文冒号以及个空格！）\n  用于说明 commit 的类别，只允许使用下面7个标识。\n  feat：新功能（feature）\n  fix：修补bug\n  docs：文档（documentation）\n  style： 格式（不影响代码运行的变动）\n  refactor：重构（即不是新增功能，也不是修改bug的代码变动）\n  test：增加测试\n  chore：构建过程或辅助工具的变动\n  如果type为feat和fix，则该 commit 将肯定出现在 Change log中.\n* npm run changelog  查看changelog日志\n\n### 参与贡献\n\n- 开发者：guozimo\n- github：(https://github.com/guozimo/taro-bdMark)\n- npm：(https://www.npmjs.com/package/taro-bdmark)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguozimo%2Ftaro-bdMark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguozimo%2Ftaro-bdMark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguozimo%2Ftaro-bdMark/lists"}