docs: lint fix
This commit is contained in:
parent
ed48677397
commit
ca097146cf
@ -27,7 +27,6 @@ tags:
|
|||||||
|
|
||||||
#### 标题4 Badge <Badge type="danger" text="Badge" />
|
#### 标题4 Badge <Badge type="danger" text="Badge" />
|
||||||
|
|
||||||
|
|
||||||
正文内容。
|
正文内容。
|
||||||
|
|
||||||
`@property` CSS at-rule是 [CSS Houdini API](https://developer.mozilla.org/zh-CN/docs/Web/Guide/Houdini) 的一部分,它允许开发者显式地定义他们的 [CSS 自定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/--*), 允许进行属性类型检查、设定默认值以及定义该自定义属性是否可以被继承。
|
`@property` CSS at-rule是 [CSS Houdini API](https://developer.mozilla.org/zh-CN/docs/Web/Guide/Houdini) 的一部分,它允许开发者显式地定义他们的 [CSS 自定义属性](https://developer.mozilla.org/zh-CN/docs/Web/CSS/--*), 允许进行属性类型检查、设定默认值以及定义该自定义属性是否可以被继承。
|
||||||
@ -88,7 +87,6 @@ H~2~O
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
**Badge**
|
**Badge**
|
||||||
|
|
||||||
- <Badge type="info" text="info badge" />
|
- <Badge type="info" text="info badge" />
|
||||||
@ -96,17 +94,14 @@ H~2~O
|
|||||||
- <Badge type="warning" text="warning badge" />
|
- <Badge type="warning" text="warning badge" />
|
||||||
- <Badge type="danger" text="danger badge" />
|
- <Badge type="danger" text="danger badge" />
|
||||||
|
|
||||||
|
|
||||||
**图标**
|
**图标**
|
||||||
|
|
||||||
- home - <Icon name="material-symbols:home" color="currentColor" size="1em" />
|
- home - <Icon name="material-symbols:home" color="currentColor" size="1em" />
|
||||||
- vscode - <Iconify name="skill-icons:vscode-dark" size="2em" />
|
- vscode - <Iconify name="skill-icons:vscode-dark" size="2em" />
|
||||||
- twitter - <Iconify name="skill-icons:twitter" size="2em" />
|
- twitter - <Iconify name="skill-icons:twitter" size="2em" />
|
||||||
|
|
||||||
|
|
||||||
**demo wrapper**
|
**demo wrapper**
|
||||||
|
|
||||||
|
|
||||||
::: demo-wrapper title="示例" no-padding height="200px"
|
::: demo-wrapper title="示例" no-padding height="200px"
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.open-door {
|
.open-door {
|
||||||
@ -151,14 +146,14 @@ const obj = {
|
|||||||
|
|
||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @errors: 2339
|
// @errors: 2339
|
||||||
const welcome = "Tudo bem gente?"
|
const welcome = 'Tudo bem gente?'
|
||||||
const words = welcome.contains(" ")
|
const words = welcome.contains(' ')
|
||||||
```
|
```
|
||||||
|
|
||||||
```ts twoslash
|
```ts twoslash
|
||||||
import express from "express"
|
import express from 'express'
|
||||||
const app = express()
|
const app = express()
|
||||||
app.get("/", function (req, res) {
|
app.get('/', (req, res) => {
|
||||||
res.send
|
res.send
|
||||||
})
|
})
|
||||||
app.listen(3000)
|
app.listen(3000)
|
||||||
@ -193,8 +188,8 @@ todo.title = 'Hello'
|
|||||||
Number.parseInt('123', 10)
|
Number.parseInt('123', 10)
|
||||||
// ^|
|
// ^|
|
||||||
|
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
```
|
```
|
||||||
|
|
||||||
```vue twoslash
|
```vue twoslash
|
||||||
@ -334,9 +329,9 @@ const c = a + b
|
|||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
document.querySelector("#very").addEventListener("click", () => {
|
document.querySelector('#very').addEventListener('click', () => {
|
||||||
alert("非常强大");
|
alert('非常强大')
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
```css
|
```css
|
||||||
|
|||||||
@ -5,5 +5,4 @@ createTime: 2024/03/04 11:06:24
|
|||||||
permalink: /en/guide/intro/
|
permalink: /en/guide/intro/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
Todo...
|
Todo...
|
||||||
|
|||||||
@ -43,7 +43,6 @@ export default defineUserConfig({
|
|||||||
|
|
||||||
详见 [vuepress-plugin-md-enhance](https://plugin-md-enhance.vuejs.press/zh/config.html)
|
详见 [vuepress-plugin-md-enhance](https://plugin-md-enhance.vuejs.press/zh/config.html)
|
||||||
|
|
||||||
|
|
||||||
:::tip 说明
|
:::tip 说明
|
||||||
主题还未完全对 该插件提供的 所有 增强功能 进行 样式上的适配。
|
主题还未完全对 该插件提供的 所有 增强功能 进行 样式上的适配。
|
||||||
如果你在使用过程中遇到样式上的问题,可以在 [issue](https://github.com/pengzhanbo/vuepress-theme-plume/issues) 里提出。
|
如果你在使用过程中遇到样式上的问题,可以在 [issue](https://github.com/pengzhanbo/vuepress-theme-plume/issues) 里提出。
|
||||||
|
|||||||
@ -49,7 +49,6 @@ export default defineUserConfig({
|
|||||||
- 类型: `string[]`
|
- 类型: `string[]`
|
||||||
- 默认值: `[]`
|
- 默认值: `[]`
|
||||||
|
|
||||||
|
|
||||||
需要高亮的编程语言, 例如 `javascript`、`typescript`、`python`、`java`、`c++`、`c#`等。
|
需要高亮的编程语言, 例如 `javascript`、`typescript`、`python`、`java`、`c++`、`c#`等。
|
||||||
默认会根据代码块的语言自动识别。
|
默认会根据代码块的语言自动识别。
|
||||||
|
|
||||||
@ -88,8 +87,8 @@ export default defineUserConfig({
|
|||||||
效果:
|
效果:
|
||||||
|
|
||||||
```ts whitespace
|
```ts whitespace
|
||||||
function block( ) {
|
function block() {
|
||||||
space( )
|
space()
|
||||||
table( )
|
table()
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -5,7 +5,6 @@ createTime: 2024/03/06 15:23:39
|
|||||||
permalink: /config/plugins/reading-time/
|
permalink: /config/plugins/reading-time/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## 概述
|
## 概述
|
||||||
|
|
||||||
为每个页面生成字数统计与预计阅读时间。
|
为每个页面生成字数统计与预计阅读时间。
|
||||||
|
|||||||
@ -197,7 +197,6 @@ interface BlogOptions {
|
|||||||
- 默认值: `/article/`
|
- 默认值: `/article/`
|
||||||
- 详情: 文章链接前缀
|
- 详情: 文章链接前缀
|
||||||
|
|
||||||
|
|
||||||
### navbar
|
### navbar
|
||||||
|
|
||||||
- 类型: `NavItem[]`
|
- 类型: `NavItem[]`
|
||||||
@ -317,7 +316,6 @@ type NavItem = string | {
|
|||||||
|
|
||||||
如果你在站点配置中设置了多个 [locales](#locales) ,那么 _选择语言菜单_ 就会显示在导航栏中仓库按钮的旁边。
|
如果你在站点配置中设置了多个 [locales](#locales) ,那么 _选择语言菜单_ 就会显示在导航栏中仓库按钮的旁边。
|
||||||
|
|
||||||
|
|
||||||
### selectLanguageAriaLabel
|
### selectLanguageAriaLabel
|
||||||
|
|
||||||
- 类型: `string`
|
- 类型: `string`
|
||||||
@ -445,5 +443,5 @@ interface NotFound {
|
|||||||
quote?: string
|
quote?: string
|
||||||
linkLabel?: string
|
linkLabel?: string
|
||||||
linkText?: string
|
linkText?: string
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@ -16,29 +16,29 @@ permalink: /config/locales/
|
|||||||
::: code-tabs
|
::: code-tabs
|
||||||
@tab 单语言
|
@tab 单语言
|
||||||
```ts
|
```ts
|
||||||
import { defineUserConfig } from "vuepress";
|
import { defineUserConfig } from 'vuepress'
|
||||||
|
|
||||||
export default defineUserConfig({
|
export default defineUserConfig({
|
||||||
// 设置正在使用的语言
|
// 设置正在使用的语言
|
||||||
lang: "zh-CN",
|
lang: 'zh-CN',
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
@tab 多语言
|
@tab 多语言
|
||||||
```ts
|
```ts
|
||||||
import { defineUserConfig } from "vuepress";
|
import { defineUserConfig } from 'vuepress'
|
||||||
|
|
||||||
export default defineUserConfig({
|
export default defineUserConfig({
|
||||||
locales: {
|
locales: {
|
||||||
"/": {
|
'/': {
|
||||||
// 设置正在使用的语言
|
// 设置正在使用的语言
|
||||||
lang: "zh-CN",
|
lang: 'zh-CN',
|
||||||
},
|
},
|
||||||
"/en/": {
|
'/en/': {
|
||||||
// 设置正在使用的语言
|
// 设置正在使用的语言
|
||||||
lang: "en-US",
|
lang: 'en-US',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|||||||
@ -43,7 +43,7 @@ export default defineUserConfig({
|
|||||||
locales: {
|
locales: {
|
||||||
'/': { lang: 'zh-CN', title: '博客' }, // 简体中文
|
'/': { lang: 'zh-CN', title: '博客' }, // 简体中文
|
||||||
'/en/': { lang: 'en-US', title: 'Blog' }, // English
|
'/en/': { lang: 'en-US', title: 'Blog' }, // English
|
||||||
}
|
},
|
||||||
theme: plumeTheme({
|
theme: plumeTheme({
|
||||||
locales: {
|
locales: {
|
||||||
'/': {
|
'/': {
|
||||||
@ -165,7 +165,6 @@ export default defineUserConfig({
|
|||||||
|
|
||||||
这表示,以 `/blog/` 或 `/article/` 开头的页面链接地址,该链接元素将被激活。
|
这表示,以 `/blog/` 或 `/article/` 开头的页面链接地址,该链接元素将被激活。
|
||||||
|
|
||||||
|
|
||||||
## 配置帮助函数
|
## 配置帮助函数
|
||||||
|
|
||||||
主题提供了 `defineNavbar(config)` 函数,为主题使用者提供导航栏配置的类型帮助。
|
主题提供了 `defineNavbar(config)` 函数,为主题使用者提供导航栏配置的类型帮助。
|
||||||
|
|||||||
@ -45,7 +45,6 @@ export default defineUserConfig({
|
|||||||
|
|
||||||
在 VuePress 中,有三种配置类型:
|
在 VuePress 中,有三种配置类型:
|
||||||
|
|
||||||
|
|
||||||
- 站点配置: 这是你在 配置文件 中直接导出的对象
|
- 站点配置: 这是你在 配置文件 中直接导出的对象
|
||||||
- 主题配置: 传递给 `plumeTheme` 的对象参数
|
- 主题配置: 传递给 `plumeTheme` 的对象参数
|
||||||
- 页面配置: 由在页面顶部基于 YAML 语法的 Frontmatter 提供
|
- 页面配置: 由在页面顶部基于 YAML 语法的 Frontmatter 提供
|
||||||
|
|||||||
@ -11,14 +11,12 @@ permalink: /guide/api/client/
|
|||||||
import { useDarkMode } from 'vuepress-theme-plume/client'
|
import { useDarkMode } from 'vuepress-theme-plume/client'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## `useDarkMode()`
|
## `useDarkMode()`
|
||||||
|
|
||||||
- 类型: `() => Ref<boolean>`
|
- 类型: `() => Ref<boolean>`
|
||||||
|
|
||||||
Composable `useDarkMode()` 用于获取当前的 `dark` 状态。
|
Composable `useDarkMode()` 用于获取当前的 `dark` 状态。
|
||||||
|
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { useDarkMode } from 'vuepress-theme-plume/client'
|
import { useDarkMode } from 'vuepress-theme-plume/client'
|
||||||
|
|
||||||
@ -31,7 +29,6 @@ const isDark = useDarkMode()
|
|||||||
|
|
||||||
自定义首页时,提供给 区域 的 包装容器。
|
自定义首页时,提供给 区域 的 包装容器。
|
||||||
|
|
||||||
|
|
||||||
### Props
|
### Props
|
||||||
|
|
||||||
| 名称 | 类型 | 默认值 | 说明 |
|
| 名称 | 类型 | 默认值 | 说明 |
|
||||||
|
|||||||
@ -415,7 +415,7 @@ end tell
|
|||||||
`````md
|
`````md
|
||||||
````md
|
````md
|
||||||
```js
|
```js
|
||||||
const a = 1;
|
const a = 1
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
`````
|
`````
|
||||||
@ -424,7 +424,7 @@ const a = 1;
|
|||||||
|
|
||||||
````md
|
````md
|
||||||
```js
|
```js
|
||||||
const a = 1;
|
const a = 1
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,6 @@ permalink: /guide/markdown/extensions/
|
|||||||
主题默认对每个 md 文件自动生成一个新的 链接,并保存在对应的 md 文件的 frontmatter 的 `permalink` 中。
|
主题默认对每个 md 文件自动生成一个新的 链接,并保存在对应的 md 文件的 frontmatter 的 `permalink` 中。
|
||||||
你可以随时修改它们。
|
你可以随时修改它们。
|
||||||
|
|
||||||
|
|
||||||
#### 内部链接
|
#### 内部链接
|
||||||
|
|
||||||
建议使用 生成的 `permalink` 作为内部链接的目标。
|
建议使用 生成的 `permalink` 作为内部链接的目标。
|
||||||
@ -354,7 +353,7 @@ export default {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
msg: 'Highlighted!' // [!code highlight]
|
msg: 'Highlighted!' // [!code highlight]
|
||||||
}
|
}
|
||||||
@ -386,7 +385,7 @@ export default {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
msg: 'Focused!' // [!code focus]
|
msg: 'Focused!' // [!code focus]
|
||||||
}
|
}
|
||||||
@ -405,7 +404,7 @@ export default {
|
|||||||
export default {
|
export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
msg: 'Removed' // [\!code --]
|
msg: 'Removed', // [\!code --]
|
||||||
msg: 'Added' // [\!code ++]
|
msg: 'Added' // [\!code ++]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -417,9 +416,9 @@ export default {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
msg: 'Removed' // [!code --]
|
msg: 'Removed', // [!code --]
|
||||||
msg: 'Added' // [!code ++]
|
msg: 'Added' // [!code ++]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -449,7 +448,7 @@ export default {
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
export default {
|
export default {
|
||||||
data () {
|
data() {
|
||||||
return {
|
return {
|
||||||
msg: 'Error', // [!code error]
|
msg: 'Error', // [!code error]
|
||||||
msg: 'Warning' // [!code warning]
|
msg: 'Warning' // [!code warning]
|
||||||
@ -506,7 +505,6 @@ console.log(options.foo) // 这个不会被高亮显示
|
|||||||
|
|
||||||
可以像这样对多个代码块进行分组:
|
可以像这样对多个代码块进行分组:
|
||||||
|
|
||||||
|
|
||||||
**输入**
|
**输入**
|
||||||
|
|
||||||
````md
|
````md
|
||||||
@ -525,7 +523,7 @@ export default config
|
|||||||
|
|
||||||
@tab config.ts
|
@tab config.ts
|
||||||
```ts
|
```ts
|
||||||
import { type UserConfig } from 'vuepress'
|
import type { UserConfig } from 'vuepress'
|
||||||
|
|
||||||
const config: UserConfig = {
|
const config: UserConfig = {
|
||||||
// ..
|
// ..
|
||||||
@ -552,7 +550,7 @@ export default config
|
|||||||
```
|
```
|
||||||
@tab config.ts
|
@tab config.ts
|
||||||
```ts
|
```ts
|
||||||
import { type UserConfig } from 'vuepress'
|
import type { UserConfig } from 'vuepress'
|
||||||
|
|
||||||
const config: UserConfig = {
|
const config: UserConfig = {
|
||||||
// ..
|
// ..
|
||||||
|
|||||||
@ -37,7 +37,6 @@ import { getHighlighterCore } from 'shiki/core'
|
|||||||
const highlighter = await getHighlighterCore({})
|
const highlighter = await getHighlighterCore({})
|
||||||
// ^?
|
// ^?
|
||||||
|
|
||||||
|
|
||||||
// @log: Custom log message
|
// @log: Custom log message
|
||||||
const a = 1
|
const a = 1
|
||||||
// @error: Custom error message
|
// @error: Custom error message
|
||||||
@ -56,7 +55,6 @@ import { getHighlighterCore } from 'shiki/core'
|
|||||||
const highlighter = await getHighlighterCore({})
|
const highlighter = await getHighlighterCore({})
|
||||||
// ^?
|
// ^?
|
||||||
|
|
||||||
|
|
||||||
// @log: Custom log message
|
// @log: Custom log message
|
||||||
const a = 1
|
const a = 1
|
||||||
// @error: Custom error message
|
// @error: Custom error message
|
||||||
@ -94,14 +92,14 @@ $ pnpm patch @vuepress/markdown --edit-dir _tmp/vuepress__markdown
|
|||||||
找到 `270` 行,其内容如下:
|
找到 `270` 行,其内容如下:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const code = options.highlight?.(token.content, language.name, "") || md.utils.escapeHtml(token.content);
|
const code = options.highlight?.(token.content, language.name, '') || md.utils.escapeHtml(token.content)
|
||||||
```
|
```
|
||||||
|
|
||||||
对其进行修改:
|
对其进行修改:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const code = options.highlight?.(token.content, language.name, "") || md.utils.escapeHtml(token.content); // [!code --]
|
const code = options.highlight?.(token.content, language.name, '') || md.utils.escapeHtml(token.content) // [!code --]
|
||||||
const code = options.highlight?.(token.content, language.name, info || "") || md.utils.escapeHtml(token.content); // [!code ++]
|
const code = options.highlight?.(token.content, language.name, info || '') || md.utils.escapeHtml(token.content) // [!code ++]
|
||||||
```
|
```
|
||||||
|
|
||||||
你可以直接复制上面的代码内容,然后粘贴到 `_tmp/vuepress__markdown/dist/index.js` 文件中替换 `248` 行。
|
你可以直接复制上面的代码内容,然后粘贴到 `_tmp/vuepress__markdown/dist/index.js` 文件中替换 `248` 行。
|
||||||
@ -119,7 +117,6 @@ $ pnpm patch-commit '_tmp/vuepress__markdown'
|
|||||||
|
|
||||||
之后你就可以选择 删除 `_tmp/vuepress__markdown` 目录了。
|
之后你就可以选择 删除 `_tmp/vuepress__markdown` 目录了。
|
||||||
|
|
||||||
|
|
||||||
#### 步骤四
|
#### 步骤四
|
||||||
|
|
||||||
在 主题配置中,将 `twoslash` 选项打开。
|
在 主题配置中,将 `twoslash` 选项打开。
|
||||||
@ -169,7 +166,7 @@ const a = 1
|
|||||||
```ts twoslash
|
```ts twoslash
|
||||||
const a = 1
|
const a = 1
|
||||||
// ^?
|
// ^?
|
||||||
//
|
//
|
||||||
```
|
```
|
||||||
|
|
||||||
**需要注意的是,`^`必须正确指向需要突出显示类型的变量**
|
**需要注意的是,`^`必须正确指向需要突出显示类型的变量**
|
||||||
@ -182,9 +179,9 @@ const a = 1
|
|||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @noErrors
|
// @noErrors
|
||||||
// @esModuleInterop
|
// @esModuleInterop
|
||||||
import express from "express"
|
import express from 'express'
|
||||||
const app = express()
|
const app = express()
|
||||||
app.get("/", function (req, res) {
|
app.get('/', (req, res) => {
|
||||||
res.sen
|
res.sen
|
||||||
// ^|
|
// ^|
|
||||||
})
|
})
|
||||||
@ -195,16 +192,16 @@ app.listen(3000)
|
|||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @noErrors
|
// @noErrors
|
||||||
// @esModuleInterop
|
// @esModuleInterop
|
||||||
import express from "express"
|
import express from 'express'
|
||||||
const app = express()
|
const app = express()
|
||||||
app.get("/", function (req, res) {
|
app.get('/', (req, res) => {
|
||||||
res.sen
|
res.sen
|
||||||
// ^|
|
// ^|
|
||||||
})
|
})
|
||||||
app.listen(3000)
|
app.listen(3000)
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
```
|
```
|
||||||
|
|
||||||
**需要注意的是,`^`必须正确指向需要进行内容预测的位置**
|
**需要注意的是,`^`必须正确指向需要进行内容预测的位置**
|
||||||
@ -219,14 +216,14 @@ app.listen(3000)
|
|||||||
````md
|
````md
|
||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @errors: 2339
|
// @errors: 2339
|
||||||
const welcome = "Tudo bem gente?"
|
const welcome = 'Tudo bem gente?'
|
||||||
const words = welcome.contains(" ")
|
const words = welcome.contains(' ')
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @errors: 2339
|
// @errors: 2339
|
||||||
const welcome = "Tudo bem gente?"
|
const welcome = 'Tudo bem gente?'
|
||||||
const words = welcome.contains(" ")
|
const words = welcome.contains(' ')
|
||||||
```
|
```
|
||||||
|
|
||||||
你需要在 `@errors` 后面,声明对应的 `typescript` 错误码。
|
你需要在 `@errors` 后面,声明对应的 `typescript` 错误码。
|
||||||
@ -255,7 +252,7 @@ const hi = 'hi'
|
|||||||
// ---cut---
|
// ---cut---
|
||||||
const msg = `${hi} words` as const
|
const msg = `${hi} words` as const
|
||||||
// ^?
|
// ^?
|
||||||
//
|
//
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 自定义输出信息 {id=twoslash-custom-message}
|
#### 自定义输出信息 {id=twoslash-custom-message}
|
||||||
@ -284,7 +281,6 @@ const c = 1
|
|||||||
// @annotate: Custom annotation message
|
// @annotate: Custom annotation message
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
#### import_files {id=twoslash-import-files}
|
#### import_files {id=twoslash-import-files}
|
||||||
|
|
||||||
`@filename: <filename>` 用于声明后续的代码将来自哪个文件,
|
`@filename: <filename>` 用于声明后续的代码将来自哪个文件,
|
||||||
@ -293,35 +289,35 @@ const c = 1
|
|||||||
````md
|
````md
|
||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @filename: sum.ts
|
// @filename: sum.ts
|
||||||
export function sum(a: number, b: number): number {
|
|
||||||
return a + b
|
|
||||||
}
|
|
||||||
|
|
||||||
// @filename: ok.ts
|
// @filename: ok.ts
|
||||||
import { sum } from "./sum"
|
import { sum } from './sum'
|
||||||
sum(1, 2)
|
|
||||||
|
|
||||||
// @filename: error.ts
|
// @filename: error.ts
|
||||||
// @errors: 2345
|
// @errors: 2345
|
||||||
import { sum } from "./sum"
|
import { sum } from './sum'
|
||||||
sum(4, "woops")
|
|
||||||
|
export function sum(a: number, b: number): number {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
sum(1, 2)
|
||||||
|
sum(4, 'woops')
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
|
|
||||||
```ts twoslash
|
```ts twoslash
|
||||||
// @filename: sum.ts
|
// @filename: sum.ts
|
||||||
export function sum(a: number, b: number): number {
|
|
||||||
return a + b
|
|
||||||
}
|
|
||||||
|
|
||||||
// @filename: ok.ts
|
// @filename: ok.ts
|
||||||
import { sum } from "./sum"
|
import { sum } from './sum'
|
||||||
sum(1, 2)
|
|
||||||
|
|
||||||
// @filename: error.ts
|
// @filename: error.ts
|
||||||
// @errors: 2345
|
// @errors: 2345
|
||||||
import { sum } from "./sum"
|
import { sum } from './sum'
|
||||||
sum(4, "woops")
|
|
||||||
|
export function sum(a: number, b: number): number {
|
||||||
|
return a + b
|
||||||
|
}
|
||||||
|
sum(1, 2)
|
||||||
|
sum(4, 'woops')
|
||||||
```
|
```
|
||||||
|
|
||||||
::: warning
|
::: warning
|
||||||
|
|||||||
@ -12,7 +12,7 @@ permalink: /guide/markdown/advance/
|
|||||||
::: code-tabs
|
::: code-tabs
|
||||||
@tab .vuepress/config.ts
|
@tab .vuepress/config.ts
|
||||||
```ts
|
```ts
|
||||||
export default defineUserConfig{
|
export default defineUserConfig({
|
||||||
theme: plumeTheme({
|
theme: plumeTheme({
|
||||||
plugins: {
|
plugins: {
|
||||||
markdownEnhance: {
|
markdownEnhance: {
|
||||||
@ -20,7 +20,7 @@ export default defineUserConfig{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
})
|
||||||
```
|
```
|
||||||
:::
|
:::
|
||||||
|
|
||||||
@ -96,9 +96,9 @@ JSON 块是可选的,可用的配置详见[配置](https://vuepress-theme-hope
|
|||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const message: string = "VuePress Theme Hope";
|
const message: string = 'VuePress Theme Hope'
|
||||||
|
|
||||||
document.querySelector("h1").innerHTML = message;
|
document.querySelector('h1').innerHTML = message
|
||||||
```
|
```
|
||||||
|
|
||||||
```scss
|
```scss
|
||||||
@ -124,9 +124,9 @@ h1 {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
const message: string = "VuePress Theme Hope";
|
const message: string = 'VuePress Theme Hope'
|
||||||
|
|
||||||
document.querySelector("h1").innerHTML = message;
|
document.querySelector('h1').innerHTML = message
|
||||||
```
|
```
|
||||||
|
|
||||||
```scss
|
```scss
|
||||||
@ -143,7 +143,6 @@ h1 {
|
|||||||
````
|
````
|
||||||
::::
|
::::
|
||||||
|
|
||||||
|
|
||||||
### 普通代码演示
|
### 普通代码演示
|
||||||
格式:
|
格式:
|
||||||
```` md
|
```` md
|
||||||
@ -165,10 +164,10 @@ h1 {
|
|||||||
// 配置 (可选)
|
// 配置 (可选)
|
||||||
{
|
{
|
||||||
"jsLib": [
|
"jsLib": [
|
||||||
...
|
// ...
|
||||||
],
|
],
|
||||||
"cssLib":[
|
"cssLib": [
|
||||||
...
|
// ...
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -189,9 +188,9 @@ h1 {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
document.querySelector("#very").addEventListener("click", () => {
|
document.querySelector('#very').addEventListener('click', () => {
|
||||||
alert("非常强大");
|
alert('非常强大')
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
```css
|
```css
|
||||||
@ -212,9 +211,9 @@ span {
|
|||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
document.querySelector("#very").addEventListener("click", () => {
|
document.querySelector('#very').addEventListener('click', () => {
|
||||||
alert("非常强大");
|
alert('非常强大')
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
```css
|
```css
|
||||||
@ -235,14 +234,17 @@ span {
|
|||||||
|
|
||||||
```vue
|
```vue
|
||||||
<!-- ↑ 你也可以使用 html -->
|
<!-- ↑ 你也可以使用 html -->
|
||||||
<template>
|
|
||||||
<!-- vue 模板 -->
|
|
||||||
</template>
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
// vue 组件
|
// vue 组件
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<!-- vue 模板 -->
|
||||||
|
<div>demo</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
/* css 代码 */
|
/* css 代码 */
|
||||||
</style>
|
</style>
|
||||||
@ -250,6 +252,7 @@ export default {
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
// 配置 (可选)
|
// 配置 (可选)
|
||||||
|
{}
|
||||||
```
|
```
|
||||||
|
|
||||||
:::
|
:::
|
||||||
@ -266,31 +269,32 @@ export default {
|
|||||||
::: vue-demo 一个 Vue Composition 演示
|
::: vue-demo 一个 Vue Composition 演示
|
||||||
|
|
||||||
```vue
|
```vue
|
||||||
<template>
|
|
||||||
<div class="box">
|
|
||||||
<code>Hello Word</code> is
|
|
||||||
<span @click="handler">{{ message }}</span
|
|
||||||
>!
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
<script>
|
||||||
const { ref } = Vue;
|
const { ref } = Vue
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const message = ref("powerful");
|
const message = ref('powerful')
|
||||||
|
|
||||||
const handler = () => {
|
const handler = () => {
|
||||||
message.value = "very " + message.value;
|
message.value = `very ${message.value}`
|
||||||
};
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message,
|
message,
|
||||||
handler,
|
handler,
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="box">
|
||||||
|
<code>Hello Word</code> is
|
||||||
|
<span @click="handler">{{ message }}</span>!
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.box span {
|
.box span {
|
||||||
color: red;
|
color: red;
|
||||||
@ -305,31 +309,32 @@ export default {
|
|||||||
::: vue-demo 一个 Vue Composition 演示
|
::: vue-demo 一个 Vue Composition 演示
|
||||||
|
|
||||||
```vue
|
```vue
|
||||||
<template>
|
|
||||||
<div class="box">
|
|
||||||
<code>Hello Word</code> is
|
|
||||||
<span @click="handler">{{ message }}</span
|
|
||||||
>!
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<script>
|
<script>
|
||||||
const { ref } = Vue;
|
const { ref } = Vue
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
const message = ref("powerful");
|
const message = ref('powerful')
|
||||||
|
|
||||||
const handler = () => {
|
const handler = () => {
|
||||||
message.value = "very " + message.value;
|
message.value = `very ${message.value}`
|
||||||
};
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
message,
|
message,
|
||||||
handler,
|
handler,
|
||||||
};
|
}
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="box">
|
||||||
|
<code>Hello Word</code> is
|
||||||
|
<span @click="handler">{{ message }}</span>!
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
.box span {
|
.box span {
|
||||||
color: red;
|
color: red;
|
||||||
@ -358,6 +363,7 @@ export default {
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
// 配置 (可选)
|
// 配置 (可选)
|
||||||
|
{}
|
||||||
```
|
```
|
||||||
|
|
||||||
:::
|
:::
|
||||||
@ -374,14 +380,14 @@ export default {
|
|||||||
::: react-demo 一个函数式 React Demo
|
::: react-demo 一个函数式 React Demo
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { useState } = React;
|
const { useState } = React
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [message, setMessage] = useState(" 强大");
|
const [message, setMessage] = useState(' 强大')
|
||||||
|
|
||||||
const handler = () => {
|
const handler = () => {
|
||||||
setMessage(`十分${message}`);
|
setMessage(`十分${message}`)
|
||||||
};
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="box">
|
<div className="box">
|
||||||
@ -390,8 +396,8 @@ export default () => {
|
|||||||
{message}
|
{message}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```css
|
```css
|
||||||
@ -407,14 +413,14 @@ export default () => {
|
|||||||
::: react-demo 一个函数式 React Demo
|
::: react-demo 一个函数式 React Demo
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const { useState } = React;
|
const { useState } = React
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
const [message, setMessage] = useState(" 强大");
|
const [message, setMessage] = useState(' 强大')
|
||||||
|
|
||||||
const handler = () => {
|
const handler = () => {
|
||||||
setMessage(`十分${message}`);
|
setMessage(`十分${message}`)
|
||||||
};
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="box">
|
<div className="box">
|
||||||
@ -423,8 +429,8 @@ export default () => {
|
|||||||
{message}
|
{message}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
)
|
||||||
};
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```css
|
```css
|
||||||
@ -503,7 +509,6 @@ export default () => {
|
|||||||
你可以在每个选项卡中使用 Vue 语法和组件,并且你可以访问 value 和 isActive,
|
你可以在每个选项卡中使用 Vue 语法和组件,并且你可以访问 value 和 isActive,
|
||||||
表示选项卡的绑定值和选项卡是否处于激活状态。
|
表示选项卡的绑定值和选项卡是否处于激活状态。
|
||||||
|
|
||||||
|
|
||||||
**输入**
|
**输入**
|
||||||
|
|
||||||
````
|
````
|
||||||
|
|||||||
@ -25,7 +25,6 @@ export default a
|
|||||||
|
|
||||||
### 代码组
|
### 代码组
|
||||||
|
|
||||||
|
|
||||||
::: code-tabs
|
::: code-tabs
|
||||||
@tab foo.js
|
@tab foo.js
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -42,7 +42,6 @@ export default defineUserConfig({
|
|||||||
|
|
||||||
然而,当你的站点包含大量页面时,搜索索引文件也会变得非常大,它可能会拖慢你的页面加载速度。在这种情况下,我们建议你使用更成熟的解决方案 - [Algolia DocSearch](#algolia-docsearch) 。
|
然而,当你的站点包含大量页面时,搜索索引文件也会变得非常大,它可能会拖慢你的页面加载速度。在这种情况下,我们建议你使用更成熟的解决方案 - [Algolia DocSearch](#algolia-docsearch) 。
|
||||||
|
|
||||||
|
|
||||||
## Algolia DocSearch
|
## Algolia DocSearch
|
||||||
|
|
||||||
使用 [Algolia DocSearch](https://docsearch.algolia.com/) 提供支持的网站内容搜索插件
|
使用 [Algolia DocSearch](https://docsearch.algolia.com/) 提供支持的网站内容搜索插件
|
||||||
@ -123,7 +122,7 @@ new Crawler({
|
|||||||
indexHeadings: true, // [!code highlight]
|
indexHeadings: true, // [!code highlight]
|
||||||
aggregateContent: true, // [!code highlight]
|
aggregateContent: true, // [!code highlight]
|
||||||
recordVersion: 'v3', // [!code highlight]
|
recordVersion: 'v3', // [!code highlight]
|
||||||
});
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -202,7 +201,7 @@ new Crawler({
|
|||||||
removeWordsIfNoResults: 'allOptional',
|
removeWordsIfNoResults: 'allOptional',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
`recordProps` 部分的配置选项用于本主题进行索引的爬取配置。
|
`recordProps` 部分的配置选项用于本主题进行索引的爬取配置。
|
||||||
|
|||||||
@ -15,7 +15,6 @@ permalink: /guide/blog/
|
|||||||
同时,主题会生成一个 链接地址为 `/blog/` 的 博客文章列表页。
|
同时,主题会生成一个 链接地址为 `/blog/` 的 博客文章列表页。
|
||||||
展示所有的博客文章,以及 博主的相关信息。
|
展示所有的博客文章,以及 博主的相关信息。
|
||||||
|
|
||||||
|
|
||||||
## 国际化支持
|
## 国际化支持
|
||||||
|
|
||||||
如果启用了 国际化,那么博客列表页将会 根据 不同的语言,展示对应语言目录下的博客列表。
|
如果启用了 国际化,那么博客列表页将会 根据 不同的语言,展示对应语言目录下的博客列表。
|
||||||
|
|||||||
@ -63,7 +63,7 @@ export default defineUserConfig({
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
'/zh/': {
|
'/zh/': {
|
||||||
selectLanguageName: "简体中文",
|
selectLanguageName: '简体中文',
|
||||||
navbar: [
|
navbar: [
|
||||||
{ text: '首页', link: '/zh/' },
|
{ text: '首页', link: '/zh/' },
|
||||||
{ text: '博客', link: '/zh/blog/' },
|
{ text: '博客', link: '/zh/blog/' },
|
||||||
|
|||||||
@ -5,7 +5,6 @@ createTime: 2024/03/04 10:06:06
|
|||||||
permalink: /guide/write/
|
permalink: /guide/write/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
::: info 提示
|
::: info 提示
|
||||||
以下内容中,以 `sourceDir` 表示 项目中用于保存 `Markdown` 文件的目录。
|
以下内容中,以 `sourceDir` 表示 项目中用于保存 `Markdown` 文件的目录。
|
||||||
|
|
||||||
@ -44,7 +43,6 @@ __example:__
|
|||||||
- 运维
|
- 运维
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## 文章写作
|
## 文章写作
|
||||||
|
|
||||||
你可以使用 `markdown` 语法开始在 `sourceDir` 下新建 `Markdown` 文件,编写你自己的文章了,
|
你可以使用 `markdown` 语法开始在 `sourceDir` 下新建 `Markdown` 文件,编写你自己的文章了,
|
||||||
|
|||||||
@ -5,7 +5,6 @@ createTime: 2024/03/04 20:18:52
|
|||||||
permalink: /guide/custom-style/
|
permalink: /guide/custom-style/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## 主题定制
|
## 主题定制
|
||||||
|
|
||||||
支持自定义样式。
|
支持自定义样式。
|
||||||
|
|||||||
@ -291,7 +291,6 @@ config:
|
|||||||
<img src="/images/custom-features.png" />
|
<img src="/images/custom-features.png" />
|
||||||
:::
|
:::
|
||||||
|
|
||||||
|
|
||||||
### text-image | image-text
|
### text-image | image-text
|
||||||
|
|
||||||
- 类型: `PlumeThemeHomeTextImage`
|
- 类型: `PlumeThemeHomeTextImage`
|
||||||
|
|||||||
@ -5,7 +5,6 @@ createTime: 2024/03/04 11:58:59
|
|||||||
permalink: /guide/features/comments/
|
permalink: /guide/features/comments/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
||||||
## 概述
|
## 概述
|
||||||
|
|
||||||
文章评论由 [vuepress-plugin-comment2](https://vuepress-theme-hope.github.io/v2/comment2/zh) 提供支持。
|
文章评论由 [vuepress-plugin-comment2](https://vuepress-theme-hope.github.io/v2/comment2/zh) 提供支持。
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import config from '@pengzhanbo/eslint-config-vue'
|
import config from '@pengzhanbo/eslint-config-vue'
|
||||||
|
|
||||||
export default config({
|
export default config({
|
||||||
ignores: ['lib', 'docs/**/*.md'],
|
ignores: ['lib'],
|
||||||
globals: {
|
globals: {
|
||||||
__VUEPRESS_VERSION__: 'readonly',
|
__VUEPRESS_VERSION__: 'readonly',
|
||||||
__VUEPRESS_BASE__: 'readonly',
|
__VUEPRESS_BASE__: 'readonly',
|
||||||
@ -16,4 +16,10 @@ export default config({
|
|||||||
rules: {
|
rules: {
|
||||||
'vue/no-v-text-v-html-on-component': 'off',
|
'vue/no-v-text-v-html-on-component': 'off',
|
||||||
},
|
},
|
||||||
|
}, {
|
||||||
|
files: ['**/*.md/*.ts'],
|
||||||
|
rules: {
|
||||||
|
'import/no-duplicates': 'off',
|
||||||
|
'no-new': 'off',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user