{"id":1527,"date":"2023-03-25T15:08:14","date_gmt":"2023-03-25T07:08:14","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1527"},"modified":"2023-04-27T21:44:20","modified_gmt":"2023-04-27T13:44:20","slug":"wechat-mini-program-integrate-markdown","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/wechat-mini-program-integrate-markdown\/","title":{"rendered":"\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u96c6\u6210Markdown"},"content":{"rendered":"<p>\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93 wemark\uff0cGitHub \u5730\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/TooBug\/wemark\">https:\/\/github.com\/TooBug\/wemark<\/a><\/p>\n<p>\u96c6\u6210\u6b65\u9aa4<\/p>\n<p>1\u3001\u4e0b\u8f7d wemark \u5e76\u62f7\u8d1d\u5230\u5c0f\u7a0b\u5e8f\u6839\u76ee\u5f55<\/p>\n<p><!-- more --><\/p>\n<p>2\u3001WXML \u5f15\u5165\u6a21\u677f<\/p>\n<pre><code class=\"language-xml\">&lt;import src=&quot;..\/..\/wemark\/wemark.wxml&quot; \/&gt;\n\n&lt;view class=&quot;article&quot;&gt;\n  &lt;!-- data\u4e2d\u7684\u53c2\u6570\u548c\u4e0a\u65b9\u786e\u5b9a\u7684\u6570\u636e\u540d\u79f0\u4fdd\u6301\u4e00\u81f4 --&gt;\n  &lt;template is=&quot;wemark&quot; data=&quot;{{...wemark}}&quot;&gt;&lt;\/template&gt;\n&lt;\/view&gt;<\/code><\/pre>\n<p>3\u3001WXSS \u5f15\u7528\u6837\u5f0f<\/p>\n<pre><code class=\"language-css\">@import &#039;\/wemark\/wemark.wxss&#039;;<\/code><\/pre>\n<p>4\u3001js \u90e8\u5206<\/p>\n<pre><code class=\"language-javascript\">\/\/ pages\/markdown\/markdown.js\nvar wemark = require(&#039;..\/..\/wemark\/wemark.js&#039;)\nPage({\n\n  \/**\n   * \u9875\u9762\u7684\u521d\u59cb\u6570\u636e\n   *\/\n  data: {\n    \/\/ \u786e\u5b9a\u4e00\u4e2a\u6570\u636e\u540d\u79f0\n    wemark: {},\n  },\n\n  \/**\n   * \u751f\u547d\u5468\u671f\u51fd\u6570--\u76d1\u542c\u9875\u9762\u52a0\u8f7d\n   *\/\n  onLoad: function (options) {\n    var content = &#039;# APP\u5f00\u53d1\u6280\u672f\u535a\u5ba2\\n&#039; +\n      &#039;1. \u535a\u5ba2\uff1a[http:\/\/www.appblog.cn\/](http:\/\/www.appblog.cn\/)\\n&#039; +\n      &#039;2. \u6807\u7b7e\uff1aAndroid\/iOS\/\u5fae\u4fe1\/PHP\/\u524d\u7aef\/\u8fd0\u7ef4&#039;;\n    wemark.parse(content, this, {\n      name: &#039;wemark&#039;\n    })\n  },\n})<\/code><\/pre>\n<p>OK\uff0c\u793a\u4f8b\u5b8c\u6210\uff0c\u8bf7\u6c42\u63a5\u53e3\uff0c\u5c06 content \u6362\u6210\u771f\u5b9e\u6570\u636e\u5373\u53ef\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93 wemark\uff0cGitHub \u5730\u5740\uff1ahttps:\/\/github.com\/TooBug\/wemar [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[46],"tags":[170],"class_list":["post-1527","post","type-post","status-publish","format-standard","hentry","category-wechat-mini-program","tag-markdown"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1527","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1527"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1527\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1527"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1527"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1527"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}