{"id":384002,"date":"2021-03-11T06:13:15","date_gmt":"2021-03-10T22:13:15","guid":{"rendered":"http:\/\/4563.org\/?p=384002"},"modified":"2021-03-11T06:13:15","modified_gmt":"2021-03-10T22:13:15","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8-vue3-%e4%b8%ad%ef%bc%8c%e4%bd%bf%e7%94%a8-markdown-it-katex","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=384002","title":{"rendered":"\u5982\u4f55\u5728 vue3 \u4e2d\uff0c\u4f7f\u7528 markdown-it-katex"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5982\u4f55\u5728 vue3 \u4e2d\uff0c\u4f7f\u7528 markdown-it-katex               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : SunspotsInys <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u5728 markdown-it-katex \u7ed9\u7684demo \u7f51\u7ad9\u91cc\u9762\u5c31\u80fd\u5f88\u597d\u7684\u89e3\u6790 <img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/03\/20210311_604a4e0f7f712.jpg\" alt=\"\u5982\u4f55\u5728 vue3 \u4e2d\uff0c\u4f7f\u7528 markdown-it-katex\" \/><\/p>\n<p>\u800c\u6211\u5199\u7684<\/p>\n<pre><code>import MakrdownIt from \"markdown-it\"; import MarkdownItKatex from \"markdown-it-katex\"; import \"github-markdown-css\"; export function toHTML(s: string): string {  let mk = new MakrdownIt();  mk.use(MarkdownItKatex);  return mk.render(s); } <\/code><\/pre>\n<p>\u89e3\u6790\u7684\u5b8c\u5168\u662f\u4e00\u56e2\u7cdf <img decoding=\"async\" loading=\"lazy\" referrerpolicy=\"no-referrer\" rel=\"noreferrer\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2021\/03\/20210311_604a4e1037026.png\" alt=\"\u5982\u4f55\u5728 vue3 \u4e2d\uff0c\u4f7f\u7528 markdown-it-katex\" \/><\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>3<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"5398594\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mmlmml1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u770b\u6837\u5b50\u50cf\u662f CSS \u6ca1\u52a0\u8f7d\u3002\u5f00\u53d1\u8005\u5de5\u5177\u770b\u770b\u8d44\u6e90\u662f\u4e0d\u662f\u90fd\u52a0\u8f7d\u4e86\uff1f HTML \u6a21\u677f\u6709\u6ca1\u6709\u52a0\u5165 CSS \u76f8\u5173\u7684\u4ee3\u7801\uff1f\u6216\u8005\u624b\u52a8\u52a0\u8f7d `&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/KaTeX\/0.5.1\/katex.min.css&#8221;&gt;` \u770b\u770b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5398595\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : SunspotsInys <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mmlmml1 \u7684\u786e\uff0ccss \u6539\u4e00\u4e0b\u5c31 OK \u4e86\u3002\u4f46\u662f\u8fd8\u662f\u6709\u4e9b\u95ee\u9898\uff0c\u5982\u679c$\u540e\u9762\u6709\u7a7a\u683c\u5c31\u4e0d\u80fd\u89e3\u6790\u4e3a\u6570\u5b66\u516c\u5f0f\u4e86\uff0c\u4f46\u662f\u5b98\u65b9\u7684 demo \u5c31\u8fd8\u53ef\u4ee5\u3002[691Kts.jpg]( https:\/\/imgtu.com\/i\/691Kts)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"5398596\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mmlmml1 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u989d\uff0c\u8fd9\u4e2a\u95ee\u9898\u5728\u4e8e LaTex \u91cc\uff0c\u4e0b\u6807\u524d\u9762\u4e0d\u80fd\u52a0\u7a7a\u683c\u7684\uff0c\u4f60\u8bd5\u8bd5\u770b $ 1_3 $\uff0c\u800c\u4e0d\u662f $ 1 _3 $.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u5728 vue3 \u4e2d\uff0c\u4f7f\u7528 mar&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/384002"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=384002"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/384002\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=384002"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=384002"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=384002"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}