Note 20260828055037
TIL:
GitHub does not support embedding arbitrary HTML <video> elements in README.md files.
For example, if you want to embed a video tag in a GitHub README.md , instead of writing it like this:
<video width="100%" controls playsinline>
<source
src="https://github.com/YOUR-USERNAME/gallery-layout/raw/main//public/demo.mp4"
type="video/mp4"
/>
</video>you should do it directly like this:
Attach your video directly via GitHub by editing the README.md file and placing the attachment where you want it.
I think this is the most suitable way because github doesn't treat rendering <video> tags the same way as regular HTML pages.
The README.md for your package on npm.js also does not support embedding arbitrary HTML <video> elements; it will always strip them out.
In my opinion, the most sensible workaround is to place an <a> tag inside the <video> tag, or simply use an <a> tag and set the <href> attribute to point to your GitHub attachment. For instance, if you upload a video directly to GitHub, you will automatically get a link that looks something like this:
https://github.com/user-attachments/assets/random-numberYou can then set the <href> to point to that link.