@ruan-cat/vitepress-preset-config 1.2.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.mts +0 -1
- package/dist/config.mjs +14 -4
- package/dist/theme.mjs +2 -0
- package/package.json +10 -10
- package/src/config.mts +17 -11
- package/src/theme.ts +5 -0
- package/src/.vitepress/config.mts +0 -35
- package/src/.vitepress/theme/index.ts +0 -15
- package/src/.vitepress/theme/style.css +0 -130
- package/src/bug-to-fix/code-line-number-bug/code/001/index.ts +0 -9
- package/src/bug-to-fix/code-line-number-bug/code/001/raw-code-twoslash.txt +0 -17
- package/src/bug-to-fix/code-line-number-bug/code/001/raw-code.txt +0 -11
- package/src/bug-to-fix/code-line-number-bug/code/002/index.ts +0 -56
- package/src/bug-to-fix/code-line-number-bug/code/002/raw-code-twoslash.txt +0 -89
- package/src/bug-to-fix/code-line-number-bug/code/002/raw-code.txt +0 -70
- package/src/bug-to-fix/code-line-number-bug/try-to-fix-lineNumberPlugin.ts +0 -49
package/dist/config.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import { UserConfig, DefaultTheme } from 'vitepress';
|
|
|
3
3
|
export { defineConfig } from 'vitepress';
|
|
4
4
|
import { generateSidebar } from 'vitepress-sidebar';
|
|
5
5
|
export { addChangelog2doc, copyReadmeMd } from '@ruan-cat/utils/node-esm';
|
|
6
|
-
export { withMermaid } from 'vitepress-plugin-mermaid';
|
|
7
6
|
|
|
8
7
|
type VitePressSidebarOptions = Parameters<typeof generateSidebar>[0];
|
|
9
8
|
/**
|
package/dist/config.mjs
CHANGED
|
@@ -8,11 +8,16 @@ import consola from "consola";
|
|
|
8
8
|
import { addChangelog2doc, hasChangelogMd, copyReadmeMd } from "@ruan-cat/utils/node-esm";
|
|
9
9
|
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
|
|
10
10
|
import llmstxt from "vitepress-plugin-llms";
|
|
11
|
-
import {
|
|
11
|
+
import { MermaidPlugin } from "@leelaa/vitepress-plugin-extended";
|
|
12
12
|
import { defineTeekConfig } from "vitepress-theme-teek/config";
|
|
13
13
|
var teekConfig = defineTeekConfig({
|
|
14
14
|
/** @see https://vp.teek.top/reference/config/global-config.html#sidebartrigger */
|
|
15
15
|
sidebarTrigger: true,
|
|
16
|
+
/**
|
|
17
|
+
* 关闭 Teek 主题的首页风格
|
|
18
|
+
* @see https://vp.teek.top/reference/config/global-config.html#teekhome
|
|
19
|
+
*/
|
|
20
|
+
teekHome: false,
|
|
16
21
|
vitePlugins: {
|
|
17
22
|
/**
|
|
18
23
|
* 关闭 vitepress-plugin-permalink 插件
|
|
@@ -104,7 +109,8 @@ var defaultUserConfig = {
|
|
|
104
109
|
},
|
|
105
110
|
vite: {
|
|
106
111
|
server: {
|
|
107
|
-
open: true
|
|
112
|
+
open: true,
|
|
113
|
+
port: 8080
|
|
108
114
|
},
|
|
109
115
|
plugins: [
|
|
110
116
|
/** @see https://github.com/okineadev/vitepress-plugin-llms */
|
|
@@ -133,6 +139,7 @@ var defaultUserConfig = {
|
|
|
133
139
|
markdown: {
|
|
134
140
|
config(md) {
|
|
135
141
|
md.use(vitepressDemoPlugin);
|
|
142
|
+
MermaidPlugin(md);
|
|
136
143
|
},
|
|
137
144
|
codeTransformers: [
|
|
138
145
|
// @ts-ignore FIXME: 这里出现奇怪的类型报错 屏蔽了
|
|
@@ -143,6 +150,10 @@ var defaultUserConfig = {
|
|
|
143
150
|
* FIXME: 在开启 twoslash 后 ,行号显示是不正确的。 这个故障是vitepress的bug,暂时没有好的方案来解决。
|
|
144
151
|
*/
|
|
145
152
|
lineNumbers: true,
|
|
153
|
+
/** @see https://vitepress-ext.leelaa.cn/Mermaid.html#扩展-md-插件 */
|
|
154
|
+
lazyLoading: true,
|
|
155
|
+
breaks: true,
|
|
156
|
+
math: true,
|
|
146
157
|
container: {
|
|
147
158
|
tipLabel: "\u63D0\u793A",
|
|
148
159
|
warningLabel: "\u8B66\u544A",
|
|
@@ -175,6 +186,5 @@ export {
|
|
|
175
186
|
copyReadmeMd,
|
|
176
187
|
defineConfig,
|
|
177
188
|
setGenerateSidebar,
|
|
178
|
-
setUserConfig
|
|
179
|
-
withMermaid
|
|
189
|
+
setUserConfig
|
|
180
190
|
};
|
package/dist/theme.mjs
CHANGED
|
@@ -5,9 +5,11 @@ import TwoslashFloatingVue from "@shikijs/vitepress-twoslash/client";
|
|
|
5
5
|
import "@shikijs/vitepress-twoslash/style.css";
|
|
6
6
|
import Teek from "vitepress-theme-teek";
|
|
7
7
|
import "vitepress-theme-teek/index.css";
|
|
8
|
+
import { Mermaid } from "@leelaa/vitepress-plugin-extended";
|
|
8
9
|
function defaultEnhanceAppPreset({ app, router, siteData }) {
|
|
9
10
|
app.use(NolebaseGitChangelogPlugin);
|
|
10
11
|
app.use(TwoslashFloatingVue);
|
|
12
|
+
app.component("Mermaid", Mermaid);
|
|
11
13
|
}
|
|
12
14
|
var defaultTheme = {
|
|
13
15
|
extends: Teek,
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ruan-cat/vitepress-preset-config",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "用于给大多数的vitepress项目提供一个预设的配置文件。",
|
|
5
5
|
"homepage": "https://vitepress-preset.ruancat6312.top",
|
|
6
6
|
"types": "./src/config.mts",
|
|
7
7
|
"main": "./src/config.mts",
|
|
8
8
|
"dependencies": {
|
|
9
|
+
"@leelaa/vitepress-plugin-extended": "^1.0.7",
|
|
9
10
|
"@nolebase/vitepress-plugin-git-changelog": "^2.18.2",
|
|
10
|
-
"@shikijs/vitepress-twoslash": "^3.
|
|
11
|
+
"@shikijs/vitepress-twoslash": "^3.12.0",
|
|
11
12
|
"consola": "^3.4.2",
|
|
12
13
|
"js-yaml": "^4.1.0",
|
|
13
14
|
"lodash-es": "^4.17.21",
|
|
14
15
|
"markdown-it-async": "^2.2.0",
|
|
15
|
-
"
|
|
16
|
+
"markdown-it-mathjax3": "^4.3.2",
|
|
16
17
|
"vitepress-demo-plugin": "^1.4.7",
|
|
17
18
|
"vitepress-plugin-llms": "^1.7.3",
|
|
18
|
-
"vitepress-plugin-mermaid": "^2.0.17",
|
|
19
19
|
"vitepress-sidebar": "^1.33.0",
|
|
20
|
-
"vitepress-theme-teek": "^1.4.
|
|
21
|
-
"vue": "^3.5.
|
|
20
|
+
"vitepress-theme-teek": "^1.4.6",
|
|
21
|
+
"vue": "^3.5.20",
|
|
22
22
|
"@ruan-cat/utils": "^4.10.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/lodash-es": "^4.17.12",
|
|
26
26
|
"automd": "^0.4.0",
|
|
27
|
-
"element-plus": "^2.
|
|
27
|
+
"element-plus": "^2.11.1",
|
|
28
28
|
"tsup": "^8.5.0",
|
|
29
29
|
"vitepress": "^1.6.4"
|
|
30
30
|
},
|
|
@@ -89,15 +89,15 @@
|
|
|
89
89
|
"!**/.vercel/**",
|
|
90
90
|
"dist",
|
|
91
91
|
"src",
|
|
92
|
-
"!src/
|
|
92
|
+
"!src/docs/**",
|
|
93
93
|
"!src/**/tests",
|
|
94
94
|
"!src/**/*.md",
|
|
95
95
|
"!src/.vitepress/cache",
|
|
96
96
|
"!src/.vitepress/dist"
|
|
97
97
|
],
|
|
98
98
|
"scripts": {
|
|
99
|
-
"docs:dev": "vitepress dev src --port 8080",
|
|
100
|
-
"build:docs": "vitepress build src",
|
|
99
|
+
"docs:dev": "vitepress dev src/docs --port 8080",
|
|
100
|
+
"build:docs": "vitepress build src/docs",
|
|
101
101
|
"build": "tsup",
|
|
102
102
|
"prebuild": "automd"
|
|
103
103
|
}
|
package/src/config.mts
CHANGED
|
@@ -15,17 +15,8 @@ import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
|
|
|
15
15
|
|
|
16
16
|
import llmstxt from "vitepress-plugin-llms";
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
* @see https://emersonbottero.github.io/vitepress-plugin-mermaid/guide/getting-started.html
|
|
21
|
-
*/
|
|
22
|
-
import { withMermaid } from "vitepress-plugin-mermaid";
|
|
23
|
-
/**
|
|
24
|
-
* 不考虑这种二次包装的写法
|
|
25
|
-
* 本库仅仅是负责二次导出该函数
|
|
26
|
-
* mermaid 需求并不是常用的需求 故设计成让用户自己二次包装使用
|
|
27
|
-
*/
|
|
28
|
-
export { withMermaid };
|
|
18
|
+
/** @see https://vitepress-ext.leelaa.cn/Mermaid.html#扩展-md-插件 */
|
|
19
|
+
import { MermaidPlugin } from "@leelaa/vitepress-plugin-extended";
|
|
29
20
|
|
|
30
21
|
// https://vp.teek.top/guide/quickstart.html#teek-引入
|
|
31
22
|
import { defineTeekConfig } from "vitepress-theme-teek/config";
|
|
@@ -35,6 +26,12 @@ const teekConfig = defineTeekConfig({
|
|
|
35
26
|
/** @see https://vp.teek.top/reference/config/global-config.html#sidebartrigger */
|
|
36
27
|
sidebarTrigger: true,
|
|
37
28
|
|
|
29
|
+
/**
|
|
30
|
+
* 关闭 Teek 主题的首页风格
|
|
31
|
+
* @see https://vp.teek.top/reference/config/global-config.html#teekhome
|
|
32
|
+
*/
|
|
33
|
+
teekHome: false,
|
|
34
|
+
|
|
38
35
|
vitePlugins: {
|
|
39
36
|
/**
|
|
40
37
|
* 关闭 vitepress-plugin-permalink 插件
|
|
@@ -158,6 +155,7 @@ const defaultUserConfig: UserConfig<DefaultTheme.Config> = {
|
|
|
158
155
|
vite: {
|
|
159
156
|
server: {
|
|
160
157
|
open: true,
|
|
158
|
+
port: 8080,
|
|
161
159
|
},
|
|
162
160
|
|
|
163
161
|
plugins: [
|
|
@@ -192,6 +190,9 @@ const defaultUserConfig: UserConfig<DefaultTheme.Config> = {
|
|
|
192
190
|
markdown: {
|
|
193
191
|
config(md) {
|
|
194
192
|
md.use(vitepressDemoPlugin);
|
|
193
|
+
|
|
194
|
+
// @ts-ignore
|
|
195
|
+
MermaidPlugin(md);
|
|
195
196
|
},
|
|
196
197
|
|
|
197
198
|
codeTransformers: [
|
|
@@ -205,6 +206,11 @@ const defaultUserConfig: UserConfig<DefaultTheme.Config> = {
|
|
|
205
206
|
*/
|
|
206
207
|
lineNumbers: true,
|
|
207
208
|
|
|
209
|
+
/** @see https://vitepress-ext.leelaa.cn/Mermaid.html#扩展-md-插件 */
|
|
210
|
+
lazyLoading: true,
|
|
211
|
+
breaks: true,
|
|
212
|
+
math: true,
|
|
213
|
+
|
|
208
214
|
container: {
|
|
209
215
|
tipLabel: "提示",
|
|
210
216
|
warningLabel: "警告",
|
package/src/theme.ts
CHANGED
|
@@ -17,6 +17,10 @@ import "@shikijs/vitepress-twoslash/style.css";
|
|
|
17
17
|
import Teek from "vitepress-theme-teek";
|
|
18
18
|
import "vitepress-theme-teek/index.css";
|
|
19
19
|
|
|
20
|
+
/** @see https://vitepress-ext.leelaa.cn/Mermaid.html#全局引入 */
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
import { Mermaid } from "@leelaa/vitepress-plugin-extended";
|
|
23
|
+
|
|
20
24
|
/**
|
|
21
25
|
* 一个回调函数 用来暴露变量 实现注册
|
|
22
26
|
*/
|
|
@@ -39,6 +43,7 @@ export interface DefineRuancatPresetThemeParams {
|
|
|
39
43
|
function defaultEnhanceAppPreset({ app, router, siteData }: EnhanceAppContext) {
|
|
40
44
|
app.use(NolebaseGitChangelogPlugin);
|
|
41
45
|
app.use(TwoslashFloatingVue);
|
|
46
|
+
app.component("Mermaid", Mermaid);
|
|
42
47
|
/**
|
|
43
48
|
* 放弃全局注册demo展示组件
|
|
44
49
|
* 在生产环境内使用peer对等依赖
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
// 避免直接使用自己的包
|
|
2
|
-
// import { setUserConfig, setGenerateSidebar, addChangelog2doc } from "@ruan-cat/vitepress-preset-config/config";
|
|
3
|
-
// @ts-ignore
|
|
4
|
-
import { setUserConfig, setGenerateSidebar, addChangelog2doc } from "../config.mts";
|
|
5
|
-
import { description } from "../../package.json";
|
|
6
|
-
|
|
7
|
-
addChangelog2doc({
|
|
8
|
-
target: "./src",
|
|
9
|
-
data: {
|
|
10
|
-
order: 1000,
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 本文档的渲染配置
|
|
16
|
-
*/
|
|
17
|
-
const thisDocUserConfig = setUserConfig({
|
|
18
|
-
title: "vitepress预设配置",
|
|
19
|
-
description,
|
|
20
|
-
themeConfig: {
|
|
21
|
-
socialLinks: [
|
|
22
|
-
{
|
|
23
|
-
icon: "github",
|
|
24
|
-
link: "https://github.com/ruan-cat/monorepo/tree/main/packages/vitepress-preset-config",
|
|
25
|
-
},
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
thisDocUserConfig.themeConfig.sidebar = setGenerateSidebar({
|
|
32
|
-
documentRootPath: "./src",
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
export default thisDocUserConfig;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { defineRuancatPresetTheme } from "@ruan-cat/vitepress-preset-config/theme";
|
|
2
|
-
import type { EnhanceAppContext } from "vitepress";
|
|
3
|
-
|
|
4
|
-
// 增加用户自定义样式
|
|
5
|
-
import "./style.css";
|
|
6
|
-
|
|
7
|
-
// 全局导入element-plus组件 并全局注册
|
|
8
|
-
import ElementPlus from "element-plus";
|
|
9
|
-
import "element-plus/dist/index.css";
|
|
10
|
-
|
|
11
|
-
export default defineRuancatPresetTheme({
|
|
12
|
-
enhanceAppCallBack({ app, router, siteData }) {
|
|
13
|
-
app.use(ElementPlus);
|
|
14
|
-
},
|
|
15
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Customize default theme styling by overriding CSS variables:
|
|
3
|
-
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Colors
|
|
8
|
-
*
|
|
9
|
-
* Each colors have exact same color scale system with 3 levels of solid
|
|
10
|
-
* colors with different brightness, and 1 soft color.
|
|
11
|
-
*
|
|
12
|
-
* - `XXX-1`: The most solid color used mainly for colored text. It must
|
|
13
|
-
* satisfy the contrast ratio against when used on top of `XXX-soft`.
|
|
14
|
-
*
|
|
15
|
-
* - `XXX-2`: The color used mainly for hover state of the button.
|
|
16
|
-
*
|
|
17
|
-
* - `XXX-3`: The color for solid background, such as bg color of the button.
|
|
18
|
-
* It must satisfy the contrast ratio with pure white (#ffffff) text on
|
|
19
|
-
* top of it.
|
|
20
|
-
*
|
|
21
|
-
* - `XXX-soft`: The color used for subtle background such as custom container
|
|
22
|
-
* or badges. It must satisfy the contrast ratio when putting `XXX-1` colors
|
|
23
|
-
* on top of it.
|
|
24
|
-
*
|
|
25
|
-
* The soft color must be semi transparent alpha channel. This is crucial
|
|
26
|
-
* because it allows adding multiple "soft" colors on top of each other
|
|
27
|
-
* to create a accent, such as when having inline code block inside
|
|
28
|
-
* custom containers.
|
|
29
|
-
*
|
|
30
|
-
* - `default`: The color used purely for subtle indication without any
|
|
31
|
-
* special meanings attched to it such as bg color for menu hover state.
|
|
32
|
-
*
|
|
33
|
-
* - `brand`: Used for primary brand colors, such as link text, button with
|
|
34
|
-
* brand theme, etc.
|
|
35
|
-
*
|
|
36
|
-
* - `tip`: Used to indicate useful information. The default theme uses the
|
|
37
|
-
* brand color for this by default.
|
|
38
|
-
*
|
|
39
|
-
* - `warning`: Used to indicate warning to the users. Used in custom
|
|
40
|
-
* container, badges, etc.
|
|
41
|
-
*
|
|
42
|
-
* - `danger`: Used to show error, or dangerous message to the users. Used
|
|
43
|
-
* in custom container, badges, etc.
|
|
44
|
-
* -------------------------------------------------------------------------- */
|
|
45
|
-
|
|
46
|
-
:root {
|
|
47
|
-
--vp-c-default-1: var(--vp-c-gray-1);
|
|
48
|
-
--vp-c-default-2: var(--vp-c-gray-2);
|
|
49
|
-
--vp-c-default-3: var(--vp-c-gray-3);
|
|
50
|
-
--vp-c-default-soft: var(--vp-c-gray-soft);
|
|
51
|
-
|
|
52
|
-
--vp-c-brand-1: var(--vp-c-indigo-1);
|
|
53
|
-
--vp-c-brand-2: var(--vp-c-indigo-2);
|
|
54
|
-
--vp-c-brand-3: var(--vp-c-indigo-3);
|
|
55
|
-
--vp-c-brand-soft: var(--vp-c-indigo-soft);
|
|
56
|
-
|
|
57
|
-
--vp-c-tip-1: var(--vp-c-brand-1);
|
|
58
|
-
--vp-c-tip-2: var(--vp-c-brand-2);
|
|
59
|
-
--vp-c-tip-3: var(--vp-c-brand-3);
|
|
60
|
-
--vp-c-tip-soft: var(--vp-c-brand-soft);
|
|
61
|
-
|
|
62
|
-
--vp-c-warning-1: var(--vp-c-yellow-1);
|
|
63
|
-
--vp-c-warning-2: var(--vp-c-yellow-2);
|
|
64
|
-
--vp-c-warning-3: var(--vp-c-yellow-3);
|
|
65
|
-
--vp-c-warning-soft: var(--vp-c-yellow-soft);
|
|
66
|
-
|
|
67
|
-
--vp-c-danger-1: var(--vp-c-red-1);
|
|
68
|
-
--vp-c-danger-2: var(--vp-c-red-2);
|
|
69
|
-
--vp-c-danger-3: var(--vp-c-red-3);
|
|
70
|
-
--vp-c-danger-soft: var(--vp-c-red-soft);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Component: Button
|
|
75
|
-
* -------------------------------------------------------------------------- */
|
|
76
|
-
|
|
77
|
-
:root {
|
|
78
|
-
--vp-button-brand-border: transparent;
|
|
79
|
-
--vp-button-brand-text: var(--vp-c-white);
|
|
80
|
-
--vp-button-brand-bg: var(--vp-c-brand-3);
|
|
81
|
-
--vp-button-brand-hover-border: transparent;
|
|
82
|
-
--vp-button-brand-hover-text: var(--vp-c-white);
|
|
83
|
-
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
|
|
84
|
-
--vp-button-brand-active-border: transparent;
|
|
85
|
-
--vp-button-brand-active-text: var(--vp-c-white);
|
|
86
|
-
--vp-button-brand-active-bg: var(--vp-c-brand-1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Component: Home
|
|
91
|
-
* -------------------------------------------------------------------------- */
|
|
92
|
-
|
|
93
|
-
:root {
|
|
94
|
-
--vp-home-hero-name-color: transparent;
|
|
95
|
-
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #bd34fe 30%, #41d1ff);
|
|
96
|
-
|
|
97
|
-
--vp-home-hero-image-background-image: linear-gradient(-45deg, #bd34fe 50%, #47caff 50%);
|
|
98
|
-
--vp-home-hero-image-filter: blur(44px);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@media (min-width: 640px) {
|
|
102
|
-
:root {
|
|
103
|
-
--vp-home-hero-image-filter: blur(56px);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@media (min-width: 960px) {
|
|
108
|
-
:root {
|
|
109
|
-
--vp-home-hero-image-filter: blur(68px);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Component: Custom Block
|
|
115
|
-
* -------------------------------------------------------------------------- */
|
|
116
|
-
|
|
117
|
-
:root {
|
|
118
|
-
--vp-custom-block-tip-border: transparent;
|
|
119
|
-
--vp-custom-block-tip-text: var(--vp-c-text-1);
|
|
120
|
-
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
|
|
121
|
-
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Component: Algolia
|
|
126
|
-
* -------------------------------------------------------------------------- */
|
|
127
|
-
|
|
128
|
-
.DocSearch {
|
|
129
|
-
--docsearch-primary-color: var(--vp-c-brand-1) !important;
|
|
130
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
<div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code twoslash lsp" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> type</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>TestType</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">type</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> TestType</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
2
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
3
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> age</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
4
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre></code></span></template></v-menu></span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
5
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>name</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: string</span></code></span></template></v-menu></span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
6
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>age</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">age</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: number</span></code></span></template></v-menu></span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
7
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">};</span></span>
|
|
8
|
-
<span class="line"></span>
|
|
9
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>testType</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> testType</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> TestType</span></code></span></template></v-menu></span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>TestType</span><template
|
|
10
|
-
v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">type</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> TestType</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
11
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
12
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> age</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
13
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}</span></span></code></pre></code></span></template></v-menu></span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
14
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>name</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: string</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"test"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
15
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>age</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">age</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: number</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">18</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
16
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">};</span></span></code></pre>
|
|
17
|
-
</div>
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0" v-pre=""><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> type</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> TestType</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
2
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> name</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> string</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
3
|
-
<span class="line"><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"> age</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> number</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
4
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">};</span></span>
|
|
5
|
-
<span class="line"></span>
|
|
6
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> const</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> testType</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> TestType</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> =</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
7
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> name:
|
|
8
|
-
</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"test"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
9
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> age: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">18</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
10
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">};</span></span></code></pre>
|
|
11
|
-
</div>
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "vitepress";
|
|
2
|
-
|
|
3
|
-
// https://vitepress.dev/reference/site-config
|
|
4
|
-
|
|
5
|
-
import { transformerTwoslash } from "@shikijs/vitepress-twoslash";
|
|
6
|
-
|
|
7
|
-
// @ts-ignore
|
|
8
|
-
import { lineNumberPlugin } from "./temp-plugins/temp-lineNumberPlugin";
|
|
9
|
-
|
|
10
|
-
export default defineConfig({
|
|
11
|
-
title: "My Awesome Project",
|
|
12
|
-
description: "A VitePress Site",
|
|
13
|
-
themeConfig: {
|
|
14
|
-
// https://vitepress.dev/reference/default-theme-config
|
|
15
|
-
nav: [
|
|
16
|
-
{ text: "Home", link: "/" },
|
|
17
|
-
{ text: "Examples", link: "/markdown-examples" },
|
|
18
|
-
],
|
|
19
|
-
|
|
20
|
-
sidebar: [
|
|
21
|
-
{
|
|
22
|
-
text: "Examples",
|
|
23
|
-
items: [
|
|
24
|
-
{ text: "Markdown Examples", link: "/markdown-examples" },
|
|
25
|
-
{ text: "Runtime API Examples", link: "/api-examples" },
|
|
26
|
-
],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
|
|
30
|
-
socialLinks: [
|
|
31
|
-
{ icon: "github", link: "https://github.com/vuejs/vitepress" },
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
vite: {
|
|
36
|
-
server: {
|
|
37
|
-
open: true,
|
|
38
|
-
port: 8080,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
markdown: {
|
|
43
|
-
codeTransformers: [
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
transformerTwoslash(),
|
|
46
|
-
],
|
|
47
|
-
|
|
48
|
-
config(md) {
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
md.use(lineNumberPlugin, true);
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
// Explicitly load these languages for types hightlighting
|
|
54
|
-
// languages: ["js", "jsx", "ts", "tsx"] as LanguageInput[],
|
|
55
|
-
},
|
|
56
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
<div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code twoslash lsp" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>defineConfig</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> defineConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> UserConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">DefaultTheme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">Config</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">>)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> UserConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">DefaultTheme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">Config</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">></span></code><div class="twoslash-popup-docs vp-doc"><p>Type config helper</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">
|
|
2
|
-
"vitepress"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
3
|
-
<span class="line"></span>
|
|
4
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// https://vitepress.dev/reference/site-config</span></span>
|
|
5
|
-
<span class="line"></span>
|
|
6
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>transformerTwoslash</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> transformerTwoslash</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">options</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> VitePressPluginTwoslashOptions</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> ShikiTransformer</span></code><div class="twoslash-popup-docs vp-doc"><p>Create a Shiki transformer for VitePress to enable twoslash integration</p>
|
|
7
|
-
<p>Add this to <code>markdown.codeTransformers</code> in <code>.vitepress/config.ts</code></p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "@shikijs/vitepress-twoslash"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
8
|
-
<span class="line"></span>
|
|
9
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// @ts-ignore</span></span>
|
|
10
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>lineNumberPlugin</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> lineNumberPlugin</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "./temp-plugins/temp-lineNumberPlugin"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
11
|
-
<span class="line"></span>
|
|
12
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>defineConfig</span><template
|
|
13
|
-
v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> defineConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> UserConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">DefaultTheme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">Config</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">>)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> UserConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">DefaultTheme</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">Config</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">></span></code><div class="twoslash-popup-docs vp-doc"><p>Type config helper</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span>
|
|
14
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>title</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">LocaleSpecificConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.title</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"My Awesome Project"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
15
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>description</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">LocaleSpecificConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.description</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"A VitePress Site"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
16
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>themeConfig</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">LocaleSpecificConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.themeConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> DefaultTheme.Config </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: {</span></span>
|
|
17
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // https://vitepress.dev/reference/default-theme-config</span></span>
|
|
18
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>nav</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config.nav</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> DefaultTheme.NavItem[] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The nav items.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span>
|
|
19
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>text</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">text</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: string</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Home"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>link</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.NavItemWithLink.link: string</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
20
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>text</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">text</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: string</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>link</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.NavItemWithLink.link: string</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/markdown-examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
21
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
22
|
-
<span class="line"></span>
|
|
23
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>sidebar</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config.sidebar</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> DefaultTheme.Sidebar </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The sidebar items.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span>
|
|
24
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
25
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
26
|
-
</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>text</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">text</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The text label of the item.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
27
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
28
|
-
</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>items</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">items</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: {</span></span>
|
|
29
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> text</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: string;</span></span>
|
|
30
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> link</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: string;</span></span>
|
|
31
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}[]</span></span></code></pre></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span>
|
|
32
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
33
|
-
{ </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>text</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">text</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The text label of the item.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Markdown Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover"
|
|
34
|
-
popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>link</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">link</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The link of the item.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/markdown-examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
35
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
36
|
-
{ </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>text</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">text</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The text label of the item.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Runtime API Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>link</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">link</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The link of the item.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/api-examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
37
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
38
|
-
],</span></span>
|
|
39
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
40
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
41
|
-
<span class="line"></span>
|
|
42
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>socialLinks</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config.socialLinks</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> DefaultTheme.SocialLink[] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>The social links to be displayed at the end of the nav bar. Perfect for
|
|
43
|
-
placing links to social services such as GitHub, Twitter, Facebook, etc.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span>
|
|
44
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>icon</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.SocialLink.icon: DefaultTheme.SocialLinkIcon</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"github"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>link</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.SocialLink.link: string</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"https://github.com/vuejs/vitepress"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
45
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
46
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
47
|
-
<span class="line"></span>
|
|
48
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>vite</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">UserConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.vite</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (UserConfig </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">&</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
49
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> configFile?: string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> false</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
50
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">}) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></span></code></pre></code><div class="twoslash-popup-docs vp-doc"><p>Vite config</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: {</span></span>
|
|
51
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>server</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">UserConfig.server</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ServerOptions </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>Server specific options, e.g. host, port, https...</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: {</span></span>
|
|
52
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>open</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">CommonServerOptions.open</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> string </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> boolean </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>Open browser window on startup</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
53
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>port</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">CommonServerOptions.port</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> number </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>Specify server port. Note if
|
|
54
|
-
the port is already being used, Vite will
|
|
55
|
-
automatically try the next available port so this may not be the actual
|
|
56
|
-
port the server ends up listening on.</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">8080</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
57
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
58
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
59
|
-
<span class="line"></span>
|
|
60
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>markdown</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">UserConfig</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">DefaultTheme.Config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.markdown</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> MarkdownOptions </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>MarkdownIt options</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: {</span></span>
|
|
61
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>codeTransformers</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">MarkdownOptions.codeTransformers</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ShikiTransformer[] </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>Transformers applied to code blocks</p></div><div class="twoslash-popup-docs twoslash-popup-docs-tags vp-doc"><span class="twoslash-popup-docs-tag"><span class="twoslash-popup-docs-tag-name">@see</span><span class="twoslash-popup-docs-tag-value"><a href="https://shiki.style/guide/transformers">https://shiki.style/guide/transformers</a></span></span></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: [</span></span>
|
|
62
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // @ts-ignore</span></span>
|
|
63
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>transformerTwoslash</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> transformerTwoslash</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">options</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> VitePressPluginTwoslashOptions</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> ShikiTransformer</span></code><div class="twoslash-popup-docs vp-doc"><p>Create a Shiki transformer for VitePress to enable
|
|
64
|
-
twoslash integration</p>
|
|
65
|
-
<p>Add this to <code>markdown.codeTransformers</code> in <code>.vitepress/config.ts</code></p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(),</span></span>
|
|
66
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
67
|
-
<span class="line"></span>
|
|
68
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>config</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">MarkdownOptions.config</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ((</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">md</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">:</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> MarkdownIt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=></span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> void</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span></code><div class="twoslash-popup-docs vp-doc"><p>Setup markdown-it instance</p></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>md</span><template
|
|
69
|
-
v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">md</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: MarkdownIt</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span>
|
|
70
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // @ts-ignore</span></span>
|
|
71
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> </span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>md</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">md</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">: MarkdownIt</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>use</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">MarkdownIt.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">use</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">boolean</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">>(plugin: PluginWithOptions</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"><</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">boolean</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, options</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">?:</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> boolean </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">|</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF"> undefined</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">): </span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">MarkdownIt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">2</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> overloads)</span></code><div class="twoslash-popup-docs vp-doc"><p><em>chainable</em></p>
|
|
72
|
-
<p>Load specified plugin with given params into current parser instance.
|
|
73
|
-
It's just a sugar to call <code>plugin(md, params)</code> with curring.</p>
|
|
74
|
-
<h5>Example</h5>
|
|
75
|
-
<code><pre class="shiki shiki-themes github-light github-dark" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> iterator </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> require</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'markdown-it-for-inline'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span>
|
|
76
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">var</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> md </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> require</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'markdown-it'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">)()</span></span>
|
|
77
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
78
|
-
.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">use</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(iterator, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'foo_replace'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'text'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">function</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> (</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">tokens</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">idx</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span>
|
|
79
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
80
|
-
tokens[idx].content </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">=</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> tokens[idx].content.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">replace</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">/</span><span style="--shiki-light:#032F62;--shiki-dark:#DBEDFF">foo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">/</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">g</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">'bar'</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span>
|
|
81
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
82
|
-
});</span></span></code></pre></code></div></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"><v-menu class="twoslash-hover" popper-class="shiki twoslash-floating vp-copy-ignore" theme="twoslash"><span>lineNumberPlugin</span><template v-slot:popper="{}"><span class="twoslash-popup-container vp-copy-ignore" v-pre=""><code class="twoslash-popup-code"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> lineNumberPlugin</span></code></span></template></v-menu></span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span>
|
|
83
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
84
|
-
<span class="line"></span>
|
|
85
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Explicitly load these languages for types hightlighting</span></span>
|
|
86
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // languages: ["js", "jsx", "ts", "tsx"] as LanguageInput[],</span></span>
|
|
87
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
88
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">});</span></span></code></pre>
|
|
89
|
-
</div>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
<div class="language-ts vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ts</span><pre class="shiki shiki-themes github-light github-dark vp-code" style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e" tabindex="0" v-pre=""><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { defineConfig } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "vitepress"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
2
|
-
<span class="line"></span>
|
|
3
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// https://vitepress.dev/reference/site-config</span></span>
|
|
4
|
-
<span class="line"></span>
|
|
5
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { transformerTwoslash } </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span
|
|
6
|
-
style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "@shikijs/vitepress-twoslash"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
7
|
-
<span class="line"></span>
|
|
8
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D">// @ts-ignore</span></span>
|
|
9
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">import</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> { lineNumberPlugin }
|
|
10
|
-
</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">from</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF"> "./temp-plugins/temp-lineNumberPlugin"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">;</span></span>
|
|
11
|
-
<span class="line"></span>
|
|
12
|
-
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583">export</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583"> default</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> defineConfig</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">({</span></span>
|
|
13
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> title: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"My Awesome Project"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
14
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> description: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"A VitePress
|
|
15
|
-
Site"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> themeConfig: {</span></span>
|
|
16
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // https://vitepress.dev/reference/default-theme-config</span></span>
|
|
17
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> nav: [</span></span>
|
|
18
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {
|
|
19
|
-
text: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Home"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, link: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
20
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {
|
|
21
|
-
text: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, link: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/markdown-examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
22
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
23
|
-
<span class="line"></span>
|
|
24
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> sidebar: [</span></span>
|
|
25
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {</span></span>
|
|
26
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
27
|
-
text: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
28
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
29
|
-
items: [</span></span>
|
|
30
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
31
|
-
{ text: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Markdown
|
|
32
|
-
Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, link: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/markdown-examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
33
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
34
|
-
{ text: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"Runtime API Examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, link:
|
|
35
|
-
</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"/api-examples"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
36
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">
|
|
37
|
-
],</span></span>
|
|
38
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
39
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
40
|
-
<span class="line"></span>
|
|
41
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> socialLinks: [</span></span>
|
|
42
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> {
|
|
43
|
-
icon: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"github"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">, link: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF">"https://github.com/vuejs/vitepress"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
44
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
45
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
46
|
-
<span class="line"></span>
|
|
47
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> vite:
|
|
48
|
-
{</span></span>
|
|
49
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> server: {</span></span>
|
|
50
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> open: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
51
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> port: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">8080</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">,</span></span>
|
|
52
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
53
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
54
|
-
<span class="line"></span>
|
|
55
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> markdown: {</span></span>
|
|
56
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> codeTransformers: [</span></span>
|
|
57
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // @ts-ignore</span></span>
|
|
58
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> transformerTwoslash</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(),</span></span>
|
|
59
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> ],</span></span>
|
|
60
|
-
<span class="line"></span>
|
|
61
|
-
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0"> config</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70">md</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">) {</span></span>
|
|
62
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // @ts-ignore</span></span>
|
|
63
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> md.</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0">use</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">(lineNumberPlugin, </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">);</span></span>
|
|
64
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
65
|
-
<span class="line"></span>
|
|
66
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // Explicitly load these languages for types hightlighting</span></span>
|
|
67
|
-
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D"> // languages: ["js", "jsx", "ts", "tsx"] as LanguageInput[],</span></span>
|
|
68
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8"> },</span></span>
|
|
69
|
-
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8">});</span></span></code></pre>
|
|
70
|
-
</div>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// markdown-it plugin for generating line numbers.
|
|
2
|
-
// It depends on preWrapper plugin.
|
|
3
|
-
|
|
4
|
-
import type { MarkdownItAsync } from "markdown-it-async";
|
|
5
|
-
import { consola } from "consola";
|
|
6
|
-
export const lineNumberPlugin = (md: MarkdownItAsync, enable = false) => {
|
|
7
|
-
const fence = md.renderer.rules.fence!;
|
|
8
|
-
md.renderer.rules.fence = (...args) => {
|
|
9
|
-
const rawCode = fence(...args);
|
|
10
|
-
|
|
11
|
-
// consola.log(` 查看 rawCode \n\n`, rawCode);
|
|
12
|
-
// console.log(`\n\n`);
|
|
13
|
-
|
|
14
|
-
const [tokens, idx] = args;
|
|
15
|
-
const info = tokens[idx].info;
|
|
16
|
-
|
|
17
|
-
if ((!enable && !/:line-numbers($| |=)/.test(info)) || (enable && /:no-line-numbers($| )/.test(info))) {
|
|
18
|
-
return rawCode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let startLineNumber = 1;
|
|
22
|
-
const matchStartLineNumber = info.match(/=(\d*)/);
|
|
23
|
-
if (matchStartLineNumber && matchStartLineNumber[1]) {
|
|
24
|
-
startLineNumber = parseInt(matchStartLineNumber[1]);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const code = rawCode.slice(rawCode.indexOf("<code>"), rawCode.indexOf("</code>"));
|
|
28
|
-
|
|
29
|
-
// consola.log(` 查看 code \n\n`, code);
|
|
30
|
-
// console.log(`\n\n`);
|
|
31
|
-
|
|
32
|
-
const lines = code.split("\n");
|
|
33
|
-
|
|
34
|
-
// consola.log(` 查看 lines \n\n`, lines);
|
|
35
|
-
// console.log(`\n\n`);
|
|
36
|
-
|
|
37
|
-
const lineNumbersCode = [...Array(lines.length)]
|
|
38
|
-
.map((_, index) => `<span class="line-number">${index + startLineNumber}</span><br>`)
|
|
39
|
-
.join("");
|
|
40
|
-
|
|
41
|
-
const lineNumbersWrapperCode = `<div class="line-numbers-wrapper" aria-hidden="true">${lineNumbersCode}</div>`;
|
|
42
|
-
|
|
43
|
-
const finalCode = rawCode
|
|
44
|
-
.replace(/<\/div>$/, `${lineNumbersWrapperCode}</div>`)
|
|
45
|
-
.replace(/"(language-[^"]*?)"/, '"$1 line-numbers-mode"');
|
|
46
|
-
|
|
47
|
-
return finalCode;
|
|
48
|
-
};
|
|
49
|
-
};
|