Skip to main content

it

David LiuAbout 2 min

it

html5嵌入: markdown-it-html5-embed(typora自带支持html5)

markdown videoopen in new window

Depending on your markdown processor, there may be a built-in syntax.

Pandoc the image syntaxopen in new window with a video file extension (.mov, .mp4) can be used:

![](video.mov)

The other answer is correct, but if you're dealing with GitHub, now you can just add a URL to the videoopen in new window and it will automatically be embedded, as long as it's surrounded by empty lines. For example:

# cool-beans

https://example.com/video.mp4

Press play to see the video.

For GitHub markdown (in website), you can drag the video file from your file explorer and drop it into the comment or text box.

This action will automatically generate a URL and store it in GitHub Assets.


For other processors, you can always write raw-HTML in your markdown:

<video width="320" height="240" controls>
  <source src="video.mov" type="video/mp4">
</video>

或者使用iframe,视频网站外链,效果如下(推荐 Google Drive 外链)

bilibili player bvid

boolean 类型,在 QueryString 中可以使用 01 表示。

参数名类型必要说明
aidnumberUGC 视频 ID。aid、bvid 选择其一即可
cidnumberUGC 视频 ID
bvidstringUGC 视频 ID。aid、bvid 选择其一即可
seasonIdnumberOGV 视频 ID
episodeIdnumberOGV 视频 ID。优先级高于 aid、bvid
posterboolean展示封面
autoplayboolean自动播放
mutedboolean静音
tnumber跳转到媒体的初始时间点,单位:秒
danmakubooleanfalse 表示关闭弹幕,其他表示默认值
kindnumber群组种类。非通用业务需要此参数
referboolean跳链时携带当前的 Referrer。用于合作方查询来自嵌入网站的跳转次数
pnumber多 P 视频的集数。从 1 开始计数,若有 cid 参数,则此参数不生效


fregante's answer works fine for videos you upload to GitHub yourself, but not for youtube video links.

mb21's answer works fine for links if you want to provide the image yourself, but that means you'll have to use the plain thumbnail image without the play button (in which case it doesn't look like a video), or edit an image yourself, which is time-consuming.

In case you wanna get the thumbnail from a video on the web automatically... you can use an API I made which essentially gets the video's thumbnail, then adds a play button and backdrop to it.

You can use it in markdown like this:

[![](https://markdown-videos-api.jorgenkh.no/youtube/{video_id})](https://youtu.be/{video_id})

Clicking on the image will open the video in your browser.

open in new window

open in new window