While Markdown doesn't offer "official" syntax for videos like it does for images, you can easily embed videos in your Markdown documents by using raw HTML. Markdown offers full support for raw HTML, meaning you can include any HTML you like in your document and it will automatically be rendered correctly (and it won't be treated as Markdown).
YouTube makes embedding videos very easy.
Find a YouTube video you like and click the Share tab below the video (it's currently to the right of the "About" tab).
After clicking the Share tab, you'll see several options for sharing on social networks. Don't click those though.
Click the "Embed" option, which will display some special code used to embed the video. (It will likely look like
(optional) You can customize the video size, etc. in the options below the code.
Copy the code and paste it in your Markdown document.
If you see an error message in the LivePreview pane that says something like Error: Generic Failure Occurred, take a look at the
<iframe> code you copied from YouTube. Locate the part of the code that contains the URL for the video, which may look like
src="//www.youtube.com/...". Notice that the URL starts with two slashes (
//). You must modify the URL to start with a
https:// for a secure connection) instead.
For example, if you originally had the following code from YouTube:
<iframe width="420" height="315" src="//www.youtube.com/embed/QH2-TGUlwu4" frameborder="0" allowfullscreen></iframe>
You must modify it like this, to add the
<iframe width="420" height="315" src="http://www.youtube.com/embed/QH2-TGUlwu4" frameborder="0" allowfullscreen></iframe>
Here's the result:
Most video services are very similar to YouTube. For Channel9 videos, just locate the "Embed" button at the bottom right of a video. Clicking that button will immediately give you the
<iframe> code you need to embed the video. In my test, it did not need to have the
http:// added as it already included it.
When watching a Vimeo video, click the "Share" button on the right side of the video. This will display a window that includes the
<iframe> code for embedding.
Adding any type of HTML to a Markdown document
You don't have to do anything special to use raw HTML in Markdown, simply just start typing HTML and it will automatically work.
For example, this sentence uses both Markdown and HTML interchangeably, and works just fine:
**This is a bold sentence** and <strong>this is also a bold sentence</strong>.
In general, I recommend using Markdown syntax when it's available (bold, italics, images, etc.), and only use HTML when you're trying to do something that isn't available in the standard Markdown syntax.
I hope this information is helpful!