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

自托管示例源目录,相对于 base(默认 demos/)。

继承自 ​

ResolveOptions.demosPath


cssUrls? ​

optional cssUrls?: readonly string[]

Runner 注入的样式表 URL(注入到其 chrome 和每个渲染结果中):组件 样式表、多主题令牌样式表,以及插件/表面样式表。Runner 通过切换 data-pantoken-theme 属性来应用主题,因此单个令牌样式表即可覆盖所有主题。

继承自 ​

ResolveOptions.cssUrls


labels? ​

optional labels?: RunnerLabels

针对运行器视图选项卡的本地化 RunnerLabels,在运行器 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

解析当前页面的运行器视图选项卡标签,来自其 markdown-it env.relativePath — 与 DemoMarkdownItOptions.localePrefix 相同的区域设置查找。Omit for a single-locale site(运行器随后显示其英文默认值))。

参数 ​

relativePath ​

string

返回值 ​

RunnerLabels | undefined