diff --git a/.markdownlint.json b/.markdownlint.json index 967af391..817cb214 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -23,6 +23,7 @@ "code-block-style": false, "emphasis-style": false, "no-hard-tabs": { - "spaces_per_tab": 2 + "spaces_per_tab": 2, + "ignore_code_languages": ["xml"] } } diff --git a/docs/README.md b/docs/README.md index ef215379..ca5ee5e8 100644 --- a/docs/README.md +++ b/docs/README.md @@ -78,7 +78,7 @@ config: description: 支持全站加密、部分加密(加密目录、加密文章)。 - title: 代码 - description: 代码复制,CodePen演示,Replit演示,JSFiddle演示,CodeSandbox演示,\n代码组,行高亮,行聚焦,行警告,差异对比等。\n + description: 代码复制,CodePen演示,Replit演示,JSFiddle演示,CodeSandbox演示,代码组,行高亮,行聚焦,行警告,差异对比等。 - title: 资源嵌入 description: 图表,视频,PDF diff --git a/docs/notes/theme/guide/代码/特性支持.md b/docs/notes/theme/guide/代码/特性支持.md index 1b10ecdf..c00f3c20 100644 --- a/docs/notes/theme/guide/代码/特性支持.md +++ b/docs/notes/theme/guide/代码/特性支持.md @@ -245,3 +245,26 @@ const options = { foo: 'bar' } options.foo = 'baz' console.log(options.foo) // 这个不会被高亮显示 ``` + +## 代码块中的 空白符 + +将空白字符(Tab 和空格)渲染为可见状态。 + + + +还可以在 `theme.plugins.shiki` 中全局启用 `whitespace` 功能: + +::: code-tabs +@tab .vuepress/config.ts + +```ts +export default defineUserConfig({ + theme: plumeTheme({ + plugins: { + shiki: { whitespace: true } + } + }) +}) +``` + +::: diff --git a/docs/notes/theme/snippet/whitespace.snippet.md b/docs/notes/theme/snippet/whitespace.snippet.md new file mode 100644 index 00000000..1b9c945b --- /dev/null +++ b/docs/notes/theme/snippet/whitespace.snippet.md @@ -0,0 +1,48 @@ +渲染每行代码行前的空格: + +**输入:** + +```` +```xml whitespace + + + Everyday Italian + + +``` +``` +```` + +**输出:** + +```xml whitespace + + + Everyday Italian + + +``` + +渲染每行代码行前的 Tab : + +**输入:** + +```` +```xml whitespace + + + Everyday Italian + + +``` +```` + +**输出:** + +```xml whitespace + + + Everyday Italian + + +``` diff --git a/eslint.config.js b/eslint.config.js index d04d5640..dda5695f 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -4,6 +4,7 @@ export default config({ ignores: [ 'lib', 'docs/notes/theme/snippet/code-block.snippet.md', + 'docs/notes/theme/snippet/whitespace.snippet.md', ], globals: { __VUEPRESS_VERSION__: 'readonly',