Markdown 代码配置
以下选项在 Markdown 中添加了新的代码功能,可以在主题选项的 markdown 属性下进行设置。
选项
boolean是否启用选项卡支持。
参考:Markdown → 代码选项卡 与 @vuepress/plugin-markdown-tab → codeTabs。
boolean是否启用文件树支持。
参考:Markdown → 文件树 与 @vuepress/plugin-markdown-file-tree → fileTree。
boolean | MarkdownCodeTreePluginOptions是否启用代码树支持。你也可以传入对象以自定义默认高度。
参考:Markdown → 代码树 与 @vuepress/plugin-markdown-file-tree → codeTree。
number | string"320px"代码树的默认高度,接受 CSS 长度或像素数值。
boolean是否启用预览支持。
PlaygroundGlobalOptions交互演示选项。
参考:Markdown → 交互演示。
(BuiltInPlaygroundPreset | PlaygroundOptions)[]交互演示预设。BuiltInPlaygroundPreset 是 "ts"、"vue" 与 "unocss" 之一,用于启用内置预设,而对象则用于配置自定义交互演示。
string交互演示容器名。
string"Playground"交互演示组件名称。
(data: PlaygroundData) => Record<string, string>属性获取器。其 data 参数类型如下:
interface PlaygroundCodeConfig {
/**
* 代码块扩展名
*
* @description 它基于文件名,而不是代码块语言
*/
ext: string;
/** 代码块内容 */
content: string;
}
interface PlaygroundData {
/** 交互演示标题 */
title?: string;
/**
* Import map 文件名
*
* @default "import-map.json"
*/
importMap?: string;
/** 交互演示文件信息 */
files: Record<
/** 文件名 */
string,
/** 文件详情 */
PlaygroundCodeConfig
>;
/**
* 交互演示设置
*
* @description 它是设置指令后的 json 内容的解析结果
*/
settings: Record<string, unknown>;
/**
* hash key based on playground content
*
* 根据交互演示内容生成的 hash key
*/
key: string;
}{ ts?: TSPresetPlaygroundOptions; vue?: VuePresetPlaygroundOptions; unocss?: UnoPresetPlaygroundOptions }内置预设的交互演示配置。
TSPresetPlaygroundOptionsts 预设的选项。
string"https://www.typescriptlang.org/play"交互演示外部地址。
VuePresetPlaygroundOptionsvue 预设的选项。
string"https://sfc.vuejs.org/"交互演示外部地址。
boolean是否启用开发版本。
boolean是否启用 SSR。
UnoPresetPlaygroundOptionsunocss 预设的选项。
string"https://unocss.dev/play"交互演示外部地址。
boolean是否启用 Kotlin 交互演示支持。
boolean是否启用 Vue 交互演示支持。
boolean是否启用 Sandpack 交互演示支持。
Partial<CodeDemoOptions> | boolean是否启用代码演示支持。
参考:Markdown → 代码演示。
string[]CodePen, JsFiddle 需要引入的外部 JS 库。
string[]CodePen, JsFiddle 需要引入的外部 CSS 库。
注意
上述两个选项仅仅是给第三方代码演示使用的,你需要自行在 head 中导入这些库。
booleantrue是否显示 JSFiddle 按钮。
booleantrue是否显示 CodePen 按钮。
"top" | "left" | "right""left"CodePen 编辑器布局。
string"101"CodePen 编辑器状态。
更新日志
0c1aa-于de40e-于fc49f-于b15c6-于68504-于ad7b8-于b1230-于1b917-于22787-于