writing-docs by remotion-dev/remotion
npx skills add https://github.com/remotion-dev/remotion --skill writing-docs文档以 .mdx 文件形式存放在 packages/docs/docs 目录中。
packages/docs/docs 目录中创建新的 .mdx 文件packages/docs/sidebars.tspackages/docs 目录中运行 bun render-cards.ts 以生成社交预览卡片面包屑导航 (crumb):如果文档页面属于某个包,请在 frontmatter 中添加 crumb: '@remotion/package-name'。这将在标题上方显示包名作为面包屑导航。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
---
image: /generated/articles-docs-my-package-my-api.png
title: '<MyComponent>'
crumb: '@remotion/my-package'
---
每个页面一个 API:每个函数或 API 应有其独立的文档页面。不要将多个 API(例如 getEncodableVideoCodecs() 和 getEncodableAudioCodecs())合并到单个页面上。
仅限公共 API:文档仅针对公共 API。不要提及、引用或与内部/私有 API 或实现细节进行比较。
为所有字段使用标题:记录 API 选项或返回值时,每个属性应作为独立的标题。使用 ### 表示顶级属性,使用 #### 表示选项对象内的嵌套属性。不要为单个字段使用项目符号。
基本语法高亮:
```ts
const x = 1;
```
使用 twoslash 根据 TypeScript 检查片段:
```ts twoslash
import {useCurrentFrame} from 'remotion';
const frame = useCurrentFrame();
```
使用 // ---cut--- 隐藏设置代码——仅显示以下内容:
```ts twoslash
import {useCurrentFrame} from 'remotion';
// ---cut---
const frame = useCurrentFrame();
```
始终为显示示例用法的代码块添加 title:
```ts twoslash title="MyComponent.tsx"
console.log('Hello');
```
- <Step>1</Step> 第一步
- <Step>2</Step> 第二步
<ExperimentalBadge>
<p>此功能是实验性的。</p>
</ExperimentalBadge>
<Demo type="rect"/>
演示必须在 packages/docs/components/demos/index.tsx 中实现。有关添加新演示的详细信息,请参阅 docs-demo 技能。
用于指示功能或参数何时添加。无需导入——它是全局可用的。
对于页面级版本指示器,使用带有内联 <AvailableFrom> 的 # h1 标题,使其出现在标题旁边(而不是下方)。在组件名称中使用 < 和 > 来转义尖括号:
# <MyComponent><AvailableFrom v="4.0.123" />
# @remotion/my-package<AvailableFrom v="4.0.123" />
对于章节标题:
## 保存到其他云端<AvailableFrom v="3.2.23" />
用于指示组件或 API 支持哪些运行时和环境。无需导入。将其放在 ## 兼容性 部分,位于 ## 另请参阅 之前。
可用的布尔属性:chrome、firefox、safari、player、studio、clientSideRendering、serverSideRendering。设置为 true(支持)或 {false}(不支持)。
对于前端 API,如果不适用,则设置为空字符串 "":nodejs=""、bun=""、serverlessFunctions=""。如果这是前端 API,请使用 hideServers 隐藏 Node.js/Bun/serverless 行。
## 兼容性
<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering={false} serverSideRendering player studio hideServers />
对于 API 文档中的可选参数:
? - 这表示参数是可选的 --> 如果是 CLI 标志(以 -- 开头),请不要这样做 - CLI 标志始终是可选的_optional_ 文本 - ? 后缀已足够### onError?
发生错误时调用。默认值:错误会被抛出。
不要这样做:
### onError?
_optional_
发生错误时调用。
当参数既是可选的,又在特定版本中添加时:
### onError?<AvailableFrom v="4.0.50" />
发生错误时调用。
如果参数在特定版本中变为可选(之前是必需的):
### codec?
自 <AvailableFrom v="5.0.0" inline /> 起可选。之前是必需的。
添加或编辑页面后,生成社交媒体预览卡片:
cd packages/docs && bun render-cards.ts
检查文档构建是否无错误:
# 从 monorepo 根目录
bun run build-docs
这将验证 MDX 语法、twoslash 片段和损坏的链接。
每周安装量
449
代码仓库
GitHub 星标数
40.6K
首次出现
2026年1月20日
安全审计
安装于
claude-code381
gemini-cli326
opencode326
cursor321
codex312
github-copilot264
Documentation lives in packages/docs/docs as .mdx files.
.mdx file in packages/docs/docspackages/docs/sidebars.tsbun render-cards.ts in packages/docs to generate social preview cardsBreadcrumb (crumb): If a documentation page belongs to a package, add crumb: '@remotion/package-name' to the frontmatter. This displays the package name as a breadcrumb above the title.
---
image: /generated/articles-docs-my-package-my-api.png
title: '<MyComponent>'
crumb: '@remotion/my-package'
---
One API per page : Each function or API should have its own dedicated documentation page. Do not combine multiple APIs (e.g., getEncodableVideoCodecs() and getEncodableAudioCodecs()) on a single page.
Public API only : Documentation is for public APIs only. Do not mention, reference, or compare against internal/private APIs or implementation details.
Use headings for all fields : When documenting API options or return values, each property should be its own heading. Use ### for top-level properties and #### for nested properties within an options object. Do not use bullet points for individual fields.
Basic syntax highlighting:
```ts
const x = 1;
```
Use twoslash to check snippets against TypeScript:
```ts twoslash
import {useCurrentFrame} from 'remotion';
const frame = useCurrentFrame();
```
Use // ---cut--- to hide setup code - only content below is displayed:
```ts twoslash
import {useCurrentFrame} from 'remotion';
// ---cut---
const frame = useCurrentFrame();
```
Always add a title to code fences that show example usage:
```ts twoslash title="MyComponent.tsx"
console.log('Hello');
```
- <Step>1</Step> First step
- <Step>2</Step> Second step
<ExperimentalBadge>
<p>This feature is experimental.</p>
</ExperimentalBadge>
<Demo type="rect"/>
Demos must be implemented in packages/docs/components/demos/index.tsx. See the docs-demo skill for details on adding new demos.
Use to indicate when a feature or parameter was added. No import needed - it's globally available.
For page-level version indicators , use an # h1 heading with <AvailableFrom> inline so it appears next to the title (not below it). Use < and > to escape angle brackets in component names:
# <MyComponent><AvailableFrom v="4.0.123" />
# @remotion/my-package<AvailableFrom v="4.0.123" />
For section headings:
## Saving to another cloud<AvailableFrom v="3.2.23" />
Use to indicate which runtimes and environments a component or API supports. No import needed. Place it in a ## Compatibility section before ## See also.
Available boolean props: chrome, firefox, safari, player, studio, clientSideRendering, serverSideRendering. Set to true (supported) or {false} (not supported).
Set to empty string "" for not applicable if this is a frontend API: nodejs="", bun="", serverlessFunctions="". Use hideServers to hide the Node.js/Bun/serverless row if this is a frontend API.
## Compatibility
<CompatibilityTable chrome firefox safari nodejs="" bun="" serverlessFunctions="" clientSideRendering={false} serverSideRendering player studio hideServers />
For optional parameters in API documentation:
? to the heading - this indicates the parameter is optional --> Don't do it if it is a CLI flag (beginning with --) - CLI flags are always optional_optional_ text - the ? suffix is sufficient### onError?
Called when an error occurs. Default: errors are thrown.
Do NOT do this:
### onError?
_optional_
Called when an error occurs.
When a parameter is both optional and was added in a specific version:
### onError?<AvailableFrom v="4.0.50" />
Called when an error occurs.
If a parameter became optional in a specific version (was previously required):
### codec?
Optional since <AvailableFrom v="5.0.0" inline />. Previously required.
After adding or editing a page, generate social media preview cards:
cd packages/docs && bun render-cards.ts
To check that documentation builds without errors:
# from the monorepo root
bun run build-docs
This validates MDX syntax, twoslash snippets, and broken links.
Weekly Installs
449
Repository
GitHub Stars
40.6K
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code381
gemini-cli326
opencode326
cursor321
codex312
github-copilot264
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
MUI v7 使用指南:组件样式、主题定制与响应式设计模式详解
431 周安装
HubSpot CRM 集成指南:使用 Membrane CLI 自动化销售、营销与客户服务
431 周安装
index-knowledge:自动生成层级化AGENTS.md文档工具,Turso数据库出品
431 周安装
产品问题陈述框架指南:如何用共情驱动方法定义用户问题 | 产品管理技能
432 周安装
机会解决方案树(OST)指南:产品经理结构化探索方法,避免功能工厂综合症
432 周安装
Obsidian Canvas 创建器:一键将文本转换为思维导图和视觉画布 | AI 驱动
432 周安装