I'm writing documentation using the asciidoc markup language and pushing it to a github repo. Github renders asciidoc files (*.adoc) automatically but does for (me) unknown reasons not want to accept my embedding of a youtube video.
I've tried the recommended way from the asciidoc writer's guide (e.g.)
video::rAteGra5-xM[youtube]
The preview in atom editor works, export to HTML version works. Can you help? What is the preferred way to get this to work in github rendered asciidoc pages?
Thanks
GitHub strips away <iframe>
(for security reasons I guess) so you won't be able to embed a YouTube video in your README.
As a workaround you can do the following:
ifdef::env-github[]
image:https://img.youtube.com/vi/rAteGra5-xM/maxresdefault.jpg[link=https://youtu.be/rAteGra5-xM]
endif::[]
ifndef::env-github[]
video::rAteGra5-xM[youtube]
endif::[]
In the above example, I'm using the image
macro to show the thumbnail of the YouTube video with a link to the video on YouTube when the README is rendered on GitHub. Otherwise I'm using the video
macro.
And here's the result on GitHub:
And if I click on the image, it will open https://youtu.be/rAteGra5-xM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With