vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

PDF not included in assets directory

Open g-dx opened this issue 1 year ago • 2 comments

Describe the bug

If I reference a PDF from a Markdown file like so:

Please see this [document](./doc.pdf)

And the doc.pdf lives in the same directory as the Markdown file, Vitepress does not process the PDF & add it to the assetsDir during build, resulting in 404 when the site is deployed.

The documentation on Referencing Static Assets seems to suggest it should. Am I missing something or is this not supported?

(Right now I'm working round this by placing the file in the /public directory)

Reproduction

Explained above.

Expected behavior

I would expect the PDF to be available as an asset.

System Info

System:
    OS: Linux 6.5 Ubuntu 23.10 23.10 (Mantic Minotaur)
    CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
    Memory: 47.97 GB / 62.54 GB
    Container: Yes
    Shell: 5.2.15 - /bin/bash
  Binaries:
    Node: 20.11.0 - /usr/bin/node
    Yarn: 1.22.19 - /usr/bin/yarn
    npm: 10.2.4 - /usr/bin/npm
    pnpm: 8.6.12 - ~/.local/share/pnpm/pnpm
  Browsers:
    Chrome: 121.0.6167.139
    Chromium: 121.0.6167.85
  npmPackages:
    vitepress: 1.0.0-rc.40 => 1.0.0-rc.40

Additional context

No response

Validations

g-dx avatar Feb 02 '24 10:02 g-dx

Things referenced by links are not treated like assets. Only these are:

{
  video: ['src', 'poster'],
  source: ['src'],
  img: ['src'],
  image: ['xlink:href', 'href'],
  use: ['xlink:href', 'href']
}

You'll need to keep other things in public directory.

brc-dd avatar Feb 02 '24 10:02 brc-dd

First, thanks for the super quick response on this.

Second, might it worth updating the documentation to make this a little more explicit? As currently written the example seems to imply that as long as the asset is referenced from Markdown, then Vitepress will handle it.

Thanks again for Vitepress :+1:

g-dx avatar Feb 02 '24 10:02 g-dx