Skip to content

pantoken / demo

demo

Beta

@pantoken/typedoc-plugin-demo — un plugin di TypeDoc per il tag di blocco @demo.

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.)

Il fence passa attraverso il markdown intatto — incluso qualsiasi pipeline di traduzione che preservi i blocchi di codice — quindi la demo sopravvive alla localizzazione.

Configurazione: aggiungi "@demo" all'opzione blockTags di TypeDoc. Il parser dei commenti legge quella lista prima che i plugin vengano caricati, quindi un plugin non può registrare il tag abbastanza tardi da sopprimere l'avviso "tag di blocco sconosciuto"; deve essere nel tuo typedoc.json.

Esempio

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

Variabili

Funzioni