comark-embed

中文文档
0.9.0发布于 2026/11/03MITTypeScriptES Module零依赖构建来源已验证

Video, audio, and tool embeds from a link: YouTube, Vimeo, Loom, Spotify, CodePen, StackBlitz, Figma, and X, with no network fetch. A Comark plugin.

原始使用文档

comark-embed

npm version npm downloads license docs

Video, audio, and live code from a link: YouTube, Vimeo, Loom, Spotify, CodePen, StackBlitz, Figma, and X players, read from the link alone with no network fetch. A Comark plugin for HTML, Vue, React, and Svelte.

pnpm add comark comark-embed
import { createHtmlRenderer } from "@comark/html";
import embed, { components } from "comark-embed/html";

const render = createHtmlRenderer({ plugins: [embed()], components });
::embed{url="https://youtu.be/KCrXgy8qtjM" title="Watch before standup: Vite in 100 Seconds" start=30}
::

::embed{url="https://comark.dev" title="Comark docs, for the duck report"}
::

url must be an https:// link. title names the player and is the text of the link under it, which keeps the page readable in print, in feed readers, and where iframes are blocked. start is seconds into a YouTube or Vimeo video. Close the block with :: on the next line.

ProviderLinks it reads
YouTubeyoutube.com/watch?v=, youtu.be/, /shorts/, /embed/, /live/; plays from youtube-nocookie.com
Vimeovimeo.com/<number>, unlisted links with their hash; plays with dnt=1
Loomloom.com/share/<id>, /embed/<id>
Spotifyopen.spotify.com/ track, album, playlist, episode, show, and artist
CodePencodepen.io/<user>/pen/<id> (also full, details, or embed)
StackBlitzstackblitz.com/edit/<project>, stackblitz.com/github/<owner>/<repo>[/<path>]
Figmafigma.com/design, file, proto, board, slides, and deck
Xx.com/<user>/status/<id>, twitter.com, and mobile. links; grows to the post's height

Any other https:// link renders as a card with its title and host. Cards don't fetch the page's title yet, so give each one a title.

The plugin adds every problem to meta.issues, so a host can reject a document before publishing it. A url that isn't https:// renders nothing.

Renderers

RendererImport
@comark/htmlcomark-embed/html: the styles are inlined
@comark/vuecomark-embed/vue
@comark/reactcomark-embed/react
@comark/sveltecomark-embed/svelte

Each entry exports the parse plugin as default and the renderer's components. The Vue, React, and Svelte components add the styles when they mount; import comark-embed/style.css with your styles so a server-rendered page doesn't shift.

The styles follow shadcn/ui: they read its CSS variables, such as --background and --border, when the page has them, and use its neutral theme otherwise. Set the shared --comark-* tokens to theme every plugin at once; the rules sit in a comark CSS layer, so any plain rule of your own wins. Override --ce-app-height to change the height of CodePen, StackBlitz, and Figma; see the embed's Theming page.

版本与发布记录

comark-embed 共发布 11 个版本,首次发布于 2026/10/21;过去 12 个月发布了 11 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.0latest2026/11/03今天
0.8.22026/11/021 天前
0.8.12026/11/011 天前
0.8.02026/10/312 天前
0.7.62026/10/313 天前
0.7.52026/10/303 天前

关于 comark-embed 的常见问题

comark-embed 是什么?

视频,音频和工具嵌入从一个链接:YouTube, Vimeo, Loom, Spotify, CodePen, StackBlitz, Figma和X,没有网络获取。一个Comark插件。

如何安装 comark-embed?

在项目目录运行 npm install comark-embed,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:comark(^0.8.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

comark-embed 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

comark-embed 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

comark-embed 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.12.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

comark-embed 可以商用吗?

comark-embed 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

comark-embed 还在维护吗?

最新版本 0.9.0 发布于 2026/11/03(今天);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2026/10/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。