vuejs / vitepress

Vite & Vue powered static site generator.
https://vitepress.dev
MIT License
12.89k stars 2.08k forks source link

image markdown not working as expected #4285

Closed tomoayan closed 4 days ago

tomoayan commented 4 days ago

Describe the bug

image embed markdown not rendering as a image insted it is rendered as a plain text when link (of media/image) have spaces. ![An image](/image inside public.png) - renders as plain text ![An image](/image-inside-public.png) - renders as normal image


why can't i use "-" or "_"? I am making a personal blog, something like obsidian publish, using obsidian as a cms. I already have many many attachments in the vault and can't change/rename every attachment's name one by one.

Reproduction

![An image](/image inside public.png)

Expected behavior

render as a image

System Info

System (WSL):
    OS: Linux 5.15 Ubuntu 22.04.4 LTS 22.04.4 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 5600G with Radeon Graphics
    Memory: 4.80 GB / 7.45 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.16.0 - /usr/bin/node
    npm: 10.9.0 - /usr/bin/npm
    pnpm: 9.12.1 - /usr/bin/pnpm
  npmPackages:
    vitepress: ^1.4.1 => 1.4.1

Additional context

No response

Validations

brc-dd commented 4 days ago

Because that's how commonmark and URLs in general work:

image

\ You can't have spaces in URLs. You don't need to rename your files. You just need to encode ` to%20`:

image

\ https://en.wikipedia.org/wiki/Percent-encoding