{"id":1580,"date":"2023-03-25T19:26:47","date_gmt":"2023-03-25T11:26:47","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1580"},"modified":"2023-04-27T21:30:55","modified_gmt":"2023-04-27T13:30:55","slug":"vuepress-image-resource-chinese-path-problem","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/vuepress-image-resource-chinese-path-problem\/","title":{"rendered":"VuePress\u56fe\u7247\u8d44\u6e90\u4e2d\u6587\u8def\u5f84\u95ee\u9898"},"content":{"rendered":"<h2>\u73b0\u8c61\u63cf\u8ff0<\/h2>\n<ul>\n<li>\u56fe\u7247\u8d44\u6e90\u4ee5\u82f1\u6587\u5b57\u7b26\u4e3a\u8def\u5f84<\/li>\n<li>\u76f8\u5bf9\u8def\u5f84\u4ee5<code>.\/<\/code>\u6216\u8005<code>..\/<\/code>\u5f00\u59cb\u7684\u6b63\u786e\u8def\u5f84<\/li>\n<\/ul>\n<p>\u540c\u65f6\u7b26\u5408\u4ee5\u4e0a\u4e24\u6761\uff0c\u5c31\u6ca1\u95ee\u9898<\/p>\n<p><!-- more --><\/p>\n<ul>\n<li>\u56fe\u7247\u8d44\u6e90\u8def\u5f84\u5982\u679c\u4e0d\u662f\u82f1\u6587<\/li>\n<li>\u56fe\u7247\u8d44\u6e90\u662f\u76f8\u5bf9(\u77ed)\u8def\u5f84(\u4e0d\u4ee5<code>.\/<\/code> <code>..\/<\/code>\u5f00\u59cb )<\/li>\n<\/ul>\n<p>\u53ea\u8981\u6709\u4ee5\u4e0a\u4efb\u4f55\u4e00\u6761\uff0c\u7f16\u8bd1\u5c06\u5931\u8d25<\/p>\n<h2>\u95ee\u9898\u5206\u6790<\/h2>\n<ul>\n<li>Vuepress \u672c\u8eab\u4f7f\u7528\u7684\u662f<code>webpack<\/code><\/li>\n<li>\u56fe\u7247\u5f15\u7528\u4f7f\u7528\u7684\u5e94\u8be5\u662f<code>url-loader\/file-loader<\/code><\/li>\n<li><code>*.md<\/code>\u6587\u4ef6\u7684\u7f16\u8bd1\u4f7f\u7528\u7684\u662f<code>markdown-it<\/code><\/li>\n<\/ul>\n<p>\u5982\u679c\u56fe\u7247\u8d44\u6e90\u7684\u5f15\u7528\u662f\u4f7f\u7528<code>url-loader<\/code>\uff0c\u90a3\u4e48\u77ed\u8def\u5f84\u8bbf\u95ee\u7684\u5c31\u4e0d\u518d\u662f\u76f8\u5bf9\u8def\u5f84\uff0c\u800c\u662f<code>node_modules<\/code>\u76ee\u5f55\u4e0b\u8d44\u6e90\u3002\u6240\u4ee5\uff0c\u5728VuePress\u4e2d\u7684\u8def\u5f84\u8d44\u6e90\u5fc5\u987b\u662f\u4ee5<code>.\/<\/code>or<code>..\/<\/code>\u5f00\u59cb<br \/>\n<code>markdown-it<\/code>\u4f1a\u5bf9\u8def\u5f84\u505a\u4e00\u4e2a<code>encode<\/code>\u64cd\u4f5c\uff0c\u5177\u4f53\u8f6c\u6362\u7531<code>mdurl<\/code>\u6267\u884c\uff0c\u53c2\u8003\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/markdown-it\/markdown-it\/blob\/575cfeab8acd2d59d637e856d3a205c6e81419cb\/lib\/index.js#L47\">https:\/\/github.com\/markdown-it\/markdown-it\/blob\/575cfeab8acd2d59d637e856d3a205c6e81419cb\/lib\/index.js#L47<\/a><\/p>\n<h2>\u89e3\u51b3\u65b9\u6848<\/h2>\n<ul>\n<li>\u5c06\u77ed\u8def\u7ecf\u4e4b\u524d\u586b\u8865<code>.\/<\/code><\/li>\n<li>\u5c06\u8d44\u6e90 url \u6267\u884c\u4e00\u6b21<code>mdurl.decode<\/code><\/li>\n<\/ul>\n<p>markdown-it-disable-url-encode: <a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/nanyuantingfeng\/markdown-it-disable-url-encode\">https:\/\/github.com\/nanyuantingfeng\/markdown-it-disable-url-encode<\/a><\/p>\n<p>\uff081\uff09\u5b89\u88c5 markdown-it-disable-url-encode<\/p>\n<pre><code class=\"language-bash\">yarn add markdown-it-disable-url-encode<\/code><\/pre>\n<p>\uff082\uff09\u5c06\u5176\u6ce8\u5165VuePress\u914d\u7f6e\u6587\u4ef6\u4e2d<\/p>\n<pre><code class=\"language-bash\">vim docs\/.vuepress\/config.js<\/code><\/pre>\n<pre><code class=\"language-javascript\">module.exports = {\n  \/\/ .....\n  markdown: {\n    \/\/ ......\n    extendMarkdown: md =&gt; {\n      md.use(require(&quot;markdown-it-disable-url-encode&quot;));\n    }\n  }\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u73b0\u8c61\u63cf\u8ff0 \u56fe\u7247\u8d44\u6e90\u4ee5\u82f1\u6587\u5b57\u7b26\u4e3a\u8def\u5f84 \u76f8\u5bf9\u8def\u5f84\u4ee5.\/\u6216\u8005..\/\u5f00\u59cb\u7684\u6b63\u786e\u8def\u5f84 \u540c\u65f6\u7b26\u5408\u4ee5\u4e0a\u4e24\u6761\uff0c\u5c31\u6ca1\u95ee\u9898 \u56fe\u7247\u8d44 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[395],"class_list":["post-1580","post","type-post","status-publish","format-standard","hentry","category-vue","tag-vuepress"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1580","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=1580"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1580\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}