Skip to content

pantoken-root / tools/demo/src / DemoMarkdownItOptions

介面: DemoMarkdownItOptions ​

為 demoMarkdownIt 的選項:resolveDemo 欄位,以及可選的即時範例接合。

擴充自 ​

屬性 ​

base? ​

optional base?: string

網站基底路徑,例如 /pantoken/(預設 /)。

繼承自 ​

ResolveOptions.base


runnerPath? ​

optional runnerPath?: string

Runner 頁面路徑,相對於 base(預設 play/index.html)。

繼承自 ​

ResolveOptions.runnerPath


demosPath? ​

optional demosPath?: string

自我託管的 demo 原始碼目錄,相對於 base(預設 demos/)。

繼承自 ​

ResolveOptions.demosPath


cssUrls? ​

optional cssUrls?: readonly string[]

Runner 注入的樣式表 URL(注入其 chrome 以及每個呈現結果):元件 樣式表、多主題代幣樣式表,以及外掛/表面樣式表。Runner 透過切換 data-pantoken-theme 屬性來切換主題,因此一個代幣樣式表即可涵蓋所有主題。

繼承自 ​

ResolveOptions.cssUrls


labels? ​

optional labels?: RunnerLabels

本地化的 RunnerLabels 用於 runner 的檢視分頁,會在 runner URL 中轉發。

繼承自 ​

ResolveOptions.labels


liveExample? ​

optional liveExample?: LiveExampleOptions

When set, appends a live preview after each html fence on matching pages — the same markup, rendered live, beneath its source. Overlay examples (<dialog>, [popover]) are skipped: they're hidden until opened, so a ## Demo iframe drives their preview instead.


localePrefix? ​

optional localePrefix?: (relativePath) => string

Route a demo:self:<name> fence to a locale-specific self-hosted demo directory, from the current page's markdown-it env.relativePath (e.g. "hu/" for pages under hu/, "" for the root locale). Prepended to demosPath so the localized clone of a demo (translated prose, same markup) loads instead of the English source. Omit for a single-locale site.

參數 ​

relativePath ​

string

回傳 ​

string


localeLabels? ​

optional localeLabels?: (relativePath) => RunnerLabels | undefined

解析 runner 的檢視分頁標籤(針對當前頁面),來源為其 markdown-it env.relativePath

— 與 DemoMarkdownItOptions.localePrefix 相同的語系查找。對於單一語系

site(此時 runner 會顯示其英文預設值).

參數 ​

relativePath ​

string

回傳 ​

RunnerLabels | undefined