Skip to content

pantoken / demo

demo

Beta

@pantoken/typedoc-plugin-demo — 用于 @demo 块标签的 TypeDoc 插件。

Authors attach a live, embeddable demo to any symbol with @demo <spec>, where <spec> is either a bare URL or a <provider>:<ref> pair (for example stackblitz:abc123, codesandbox:xy12z, wp-playground:https://…/blueprint.json, or self:button). This plugin registers nothing about providers itself — it stays deliberately dumb and reusable: it moves each @demo tag's spec into a fenced demo block appended to the symbol's summary, and your docs renderer decides how to turn a spec into an iframe. (See @pantoken/demo for a renderer that resolves the providers.)

该代码围栏在 markdown 中原样保留——包括任何保留 code blocks 的翻译流程——因此演示可在本地化后仍然存活。

Setup:"@demo" 添加到 TypeDoc 的 blockTags 选项。注释解析器在该列表被读取时位于 插件加载之前,所以插件无法在足够晚的时候注册该标签以消除 "未知块标签" 警告;它必须位于你的 typedoc.json 中。

示例

jsonc
// typedoc.json
{
  "plugin": ["typedoc-plugin-markdown", "@pantoken/typedoc-plugin-demo"],
  "blockTags": ["@param", "@returns", "@example", "@demo"]
}

变量

函数