vitepress
vitepress copied to clipboard
静态资源解析打包的时候报错
Describe the bug
像 下面这样的资源路径在打包的时候报错 “Error: [vite]: Rollup failed to resolve import "09_Java 语法.assets/image-20210630002730821.png" from "/home/jayce/workspace_personal/learn-content/contents/java-kuangshen_learn/09_Java 语法.md".”

必须换成
[image-20210630003516350](./09_Java 语法.assets/image-20210630003516350.png)
太多了换起来好麻烦
Reproduction
Expected behavior
希望能支持像 [image-20210630003516350](09_Java 语法.assets/image-20210630003516350.png)
这种资源引入方式, 或者支持正则配置
System Info
System:
OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
CPU: (12) x64 Intel(R) Core(TM) i5-10400 CPU @ 2.90GHz
Memory: 13.57 GB / 15.54 GB
Container: Yes
Shell: 5.1.16 - /bin/bash
Binaries:
Node: 18.19.0 - ~/.nvm/versions/node/v18.19.0/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - ~/.nvm/versions/node/v18.19.0/bin/npm
pnpm: 8.7.1 - /usr/local/bin/pnpm
npmPackages:
vitepress: 1.0.0-rc.31 => 1.0.0-rc.31
Additional context
No response
Validations
- [X] Check if you're on the latest VitePress version.
- [X] Follow our Code of Conduct
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 这个你自己处理下啊,这是 Node.js 的规则,和 vitepress 无关,并且路径不要用中文。
- 如果你用的是 Typora ,那么可以这么设置:
- 这样,你可以截图的时候,直接在 markdown 文档里面复制即可,会自动帮你粘贴到对应的目录中。
Cannot reproduce this on macOS.
On macOS, 
won't be parsed as an image for there is a blank space.
But 
and 
both work fine.
No errors occur when vitepress build
in all cases above.
won't be parsed as an image for there is a blank space
Yeah, that's compliant with commonmark spec. You can either manually percent encode it (to %20
) or use angular brackets - 
- Both seem to be working fine for me. But anyway parsing errors shouldn't give that error unless that file doesn't actually exist.
并且路径不要用中文
This is also not an issue. You can use non-ascii characters just fine as long as they are permitted by your OS.
自己整个图床,不好么
@yangdong520 可能觉得图床会宕机吧
@yangdong520 可能觉得图床会宕机吧
不能这么想,那放在本地,磁盘还会损坏呢,能工提升自己生产力的东西,能用坚决用,省下来时间不是又可以多敲几行代码了么
Off topic, closing for now.