Support for <video> tags
bplump opened this issue · comments
We'd like to embed videos in our CommonMark content. We currently have the ![name](link)
syntax to generate an <img>
tag.
This CommonMark extension discussion/proposal doesn't seem to have gone anywhere, but it seems to coalesce around using the filename to auto-detect whether a <video>
or <audio>
tag should be generated over an <img>
.
Alternatively, I was considering using image attributes to specify if the renderer should generate a <video>
tag.
It appears that LeanPub's Markua uses a combination of the two: auto-detecting video formats but also allowing users to override the detected type with an attribute.
I'll try to put a PR forward to kick off a discussion about implementation but if you've got early thoughts, I'm all ears!
Hey! We already have an image attributes extension, but it seems to work in a different way to Markua's (where the attributes come before the image in a block). Not sure about extending that if we'd be the only ones with that syntax.
I was gonna say "What does GitHub do?" but it seems like they auto-detect video URLs if the video is hosted by them, but maybe that would also be an option for you? You could do that already by post-processing Link
nodes.
Auto-detecting based on the filename should already be possible with the current API by overriding the rendering of Image
nodes (or replacing them with a custom node in a post processor and then rendering that). Not super nice but workable.
Let me know what you're thinking of doing? Or do a PR if that's easier :)
We opted to hack our own solution in the frontend... (eww) so I'll close this.