Skip to content

pantoken / demo

demo

@pantoken/demo@demo システムのレンダー側。

@pantoken/typedoc-plugin-demo turns a @demo <spec> tag into a fenced demo block whose body is the spec (a bare URL or a <provider>:<ref> pair). This package resolves that spec into an embeddable iframe and renders the surrounding panel — an MDN-style "live sample."

次の3つを提供します: resolveDemo(仕様 → iframe 属性、フレームワーク非依存)、 markdown-it プラグイン(demoMarkdownIt)は demo フェンスをパネル用の HTML に変換し、 セルフホスト型ランナー(@pantoken/demo/runner.html) — 同一オリジンのページで簡素な HTML/CSS/JS デモを取得し、トークンのスタイルシートを注入してレンダリングするため、self: デモはサードパーティのアカウントもフレーミングの回避策も必要としません。

ts
import { resolveDemo } from "@pantoken/demo";

resolveDemo("stackblitz:abc123").src; // → "https://stackblitz.com/edit/abc123?embed=1&…"
resolveDemo("self:button", { base: "/docs/", cssUrls: ["/docs/tokens.css"] }).src;

インターフェース

変数

関数