rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
17.81k stars 1.61k forks source link

Embed video #2214

Open mleonhard opened 11 months ago

mleonhard commented 11 months ago

Problem

I need to embed a screen recording:

![screen recording](screen_recording.mp4)

Proposed Solution

When processing an embedded image ![alt text](file.ext) definition, check for common video file extensions (.mp4, .webm, etc.) and emit a <video> element instead of an <img> element.

Here are some ideas for handling embedded videos in PDFs:

Notes

No response

mleonhard commented 11 months ago

The workaround is to embed HTML:

<video controls>
  <source src="screen_recording.mp4" type="video/mp4" />
</video>
KFearsoff commented 9 months ago

Video embedding isn't part of the Commonmark spec (or the extensions of it that I'm aware of), so the upstream project we use for parsing markdown-to-html considers it out of scope: https://github.com/raphlinus/pulldown-cmark/issues/584

It would be nice to document that you can just embed with HTML, but I think this is a WONTFIX otherwise

@rustbot label +S-Not-wrong