npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@v5md/plugin-video

v0.0.8

Published

v5md 视频块渲染插件

Downloads

276

Readme

@v5md/plugin-video

把 ```video / ```audio 围栏块渲染成浏览器原生播放器。

Markdown 没有视频语法;v5md 沿用图表插件的围栏块方案:围栏在别的解析器里就是普通代码块,内容不会丢,在 v5md 里是一个可编辑的播放器。

安装

npm install @v5md/plugin-video

使用

import { createVideoPlugin, type VideoApi } from '@v5md/plugin-video'

const editor = new Editor({
  element,
  plugins: [createVideoPlugin()],
})

// 工具条「视频」、斜杠菜单或命令
await editor.runCommand('video.insert', 'https://cdn.example.com/clip.mp4')

const api = editor.getPlugin<VideoApi>('video')!.api
api.insert('https://cdn.example.com/clip.mp4', { poster: 'cover.jpg', title: '发布会回放', start: 42 })
api.insert('https://cdn.example.com/intro.mp3', { audio: true })

围栏写法

围栏正文支持四种写法,按顺序识别:

```video
https://cdn.example.com/clip.mp4
```
```video
[发布会回放](https://cdn.example.com/clip.mp4)
```
```video
src=https://cdn.example.com/clip.mp4 poster=cover.jpg title="发布会回放" start=42s
```
```video
{"src":"https://cdn.example.com/clip.mp4","poster":"cover.jpg","title":"发布会回放","start":42}
```

| 字段 | 说明 | | --- | --- | | src | 视频直链。相对路径(如 assets/clip.mp4)按页面地址解析 | | poster | 封面图,播放前和无法播放时显示 | | title | 标题,显示在播放器下方,同时作为 aria-label | | start | 起始秒数,写 42s 或 42;播放器上会出现 0:42 角标,点一下从该处播放 |

```audio 围栏用同一套写法,渲染成 <audio>;audio 围栏里也可以放视频地址,播放器会按标签决定。

选项

| 字段 | 说明 | | --- | --- | | name | 插件名,默认 video | | lang | 匹配的围栏语言,默认 ['video', 'audio'] | | toolbar | 是否显示「视频」「音频」按钮,默认 true | | mediaAttributes | 附加到 <video> / <audio> 的属性,如 { muted: '', crossOrigin: 'anonymous' } | | locale | 按钮与提示文案语言,zh-CN(默认)或 en |

行为

  • 播放器就是原生 <video controls>:不引入依赖,浏览器自带全屏、倍速、字幕。
  • 只改周边文字时播放器不重建:不会重新加载,播放进度保留。
  • 能播的格式按扩展名给 <source type>:mp4 / m4v / webm / ogv / ogg / mov,音频 mp3 / m4a / aac / wav / ogg / opus / flac / webm。
  • 不能播的地址不丢内容,显示封面块并说明原因:
    • B 站 / YouTube / 抖音等平台页面:v5md 不嵌 iframe,请换 mp4 直链;
    • 浏览器不支持的格式:换 mp4 或 webm;
    • 围栏为空:提示填地址。 封面上的播放按钮直接链接到源地址,新标签页打开。
  • 播放中途解码失败时自动换成封面,而不是留一块黑屏。

边界

| 场景 | 结果 | | --- | --- | | GitHub / GitLab 的 Markdown | 显示成代码块,地址仍在 | | 复制到公众号 | 公众号只接受微信自家视频,这里不会带过去 | | 导出 HTML / PDF / 图片 | 导出插件只导出当前 DOM 的文字,视频不会进去 | | 跨域播放 | 需要源站允许 Range 与 CORS;crossOrigin 用 mediaAttributes 配 |

未安装本插件时,video / audio 围栏按普通代码块高亮显示。