-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
Description
Describe the bug
static asset is not working for poster attribute of video element in raw html, but it works in custom vue component or manually import.
File structure
.
├─ docs # project root
│ ├─ .vitepress # config dir
│ ├─ public
│ ├─ video.mp4
│ └─ poster.png
│ ├─ getting-started.md
│ └─ index.md
└─ ...
Reproduction
this doesn't work
<!-- in getting-started.md -->
<video src="/video.mp4" controls poster="/poster.png"></video>
but this works (manually import asset):
<!-- in getting-started.md -->
<script setup>
import poster from "/poster.png";
</script>
<video src="/video.mp4" controls :poster="poster"></video>
this also works (static asset in custom component):
<!-- in MyVideo.vue -->
<template>
<video src="/video.mp4" controls poster="/poster.png"></video>
</template>
<!-- in getting-started.md -->
<script setup>
import MyVideo from "MyVideo.vue";
</script>
<MyVideo />
Expected behavior
static image asset should also work in raw video element in markdown file
System Info
System:
OS: Windows 11 10.0.26200
CPU: (16) x64 AMD Ryzen 9 5900HX with Radeon Graphics
Memory: 4.16 GB / 15.42 GB
Binaries:
Node: 22.20.0 - C:\Program Files\nodejs\node.EXE
npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
pnpm: 10.17.1 - C:\Users\Frank\AppData\Roaming\npm\pnpm.CMD
Browsers:
Chrome: 141.0.7390.108
Edge: Chromium (140.0.3485.54), ChromiumDev (140.0.3421.0)
Internet Explorer: 11.0.26100.1882
npmPackages:
vitepress: ^2.0.0-alpha.12 => 2.0.0-alpha.12
Additional context
No response
Validations
- Check if you're on the latest VitePress version.
- Follow our Code of Conduct
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.