Skip to content

Static file download parsing error #5078

@qylwhetc

Description

@qylwhetc

Describe the bug

Why is the image link correct but the download link incorrect ?

markdown--> html

Reproduction

Folder situation:

\public\dn\
    b.zip
\subdir\
    demo.md
    a.zip

config.mjs:

export default defineConfig({
  title: "xxx系统",
  description: "A VitePress Site",
  base:'/vp/',
  themeConfig: {}
})

The content of the file:demo.md

<a href="./a.zip" download> dn</a>
[a.zip](./a.zip){download}
[b.zip](/dn/b.zip){download}

build result:

.vitepress\dist\subdir\
    demo.html
     a.zip:does not exist 
.vitepress\dist\dn\
    b.zip,ok,exist 

The content of the file:demo.html

<p><a href="./a.zip" download>dn</a></p>
<p><a href="./a.zip" download>a.zip</a></p>
<p><a href="/dn/b.zip" download>b.zip</a></p>

Expected behavior

What I hope for is:

1. The file "a.zip" should be copied to ".vitepress\dist\subdir\a.zip"

2. Hyperlinks are built based on the {base}:

<p><a href="/vp/dn/b.zip" down>b.zip</a></p>

but The MD below parsing and file copying are both correct:

![pic](./c.png) 
![pic](/img/d.png) //public/img/d.png

to

<p><img src="/vp/assets/c.BbAI9XcS.png" alt="pic"></p>
<p><img src="/vp/img/d.png" alt="pic"></p>

My configuration is incomplete or there are bug?

System Info

windows 11,iis

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions