docs: lint fix

This commit is contained in:
pengzhanbo 2024-03-09 01:09:31 +08:00
parent ed48677397
commit ca097146cf
34 changed files with 342 additions and 361 deletions

View File

@ -27,7 +27,6 @@ tags:
#### 标题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/--*), 允许进行属性类型检查、设定默认值以及定义该自定义属性是否可以被继承。
@ -88,7 +87,6 @@ H~2~O
![](/plume.png)
**Badge**
- <Badge type="info" text="info badge" />
@ -96,17 +94,14 @@ H~2~O
- <Badge type="warning" text="warning badge" />
- <Badge type="danger" text="danger badge" />
**图标**
- home - <Icon name="material-symbols:home" color="currentColor" size="1em" />
- vscode - <Iconify name="skill-icons:vscode-dark" size="2em" />
- twitter - <Iconify name="skill-icons:twitter" size="2em" />
**demo wrapper**
::: demo-wrapper title="示例" no-padding height="200px"
<style scoped>
.open-door {
@ -151,14 +146,14 @@ const obj = {
```ts twoslash
// @errors: 2339
const welcome = "Tudo bem gente?"
const words = welcome.contains(" ")
const welcome = 'Tudo bem gente?'
const words = welcome.contains(' ')
```
```ts twoslash
import express from "express"
import express from 'express'
const app = express()
app.get("/", function (req, res) {
app.get('/', (req, res) => {
res.send
})
app.listen(3000)
@ -334,9 +329,9 @@ const c = a + b
```
```js
document.querySelector("#very").addEventListener("click", () => {
alert("非常强大");
});
document.querySelector('#very').addEventListener('click', () => {
alert('非常强大')
})
```
```css

View File

@ -5,5 +5,4 @@ createTime: 2024/03/04 11:06:24
permalink: /en/guide/intro/
---
Todo...

View File

@ -43,7 +43,6 @@ export default defineUserConfig({
详见 [vuepress-plugin-md-enhance](https://plugin-md-enhance.vuejs.press/zh/config.html)
:::tip 说明
主题还未完全对 该插件提供的 所有 增强功能 进行 样式上的适配。
如果你在使用过程中遇到样式上的问题,可以在 [issue](https://github.com/pengzhanbo/vuepress-theme-plume/issues) 里提出。

View File

@ -49,7 +49,6 @@ export default defineUserConfig({
- 类型: `string[]`
- 默认值: `[]`
需要高亮的编程语言, 例如 `javascript``typescript``python``java``c++``c#`等。
默认会根据代码块的语言自动识别。

View File

@ -5,7 +5,6 @@ createTime: 2024/03/06 15:23:39
permalink: /config/plugins/reading-time/
---
## 概述
为每个页面生成字数统计与预计阅读时间。

View File

@ -197,7 +197,6 @@ interface BlogOptions {
- 默认值: `/article/`
- 详情: 文章链接前缀
### navbar
- 类型: `NavItem[]`
@ -317,7 +316,6 @@ type NavItem = string | {
如果你在站点配置中设置了多个 [locales](#locales) ,那么 _选择语言菜单_ 就会显示在导航栏中仓库按钮的旁边。
### selectLanguageAriaLabel
- 类型: `string`

View File

@ -16,29 +16,29 @@ permalink: /config/locales/
::: code-tabs
@tab 单语言
```ts
import { defineUserConfig } from "vuepress";
import { defineUserConfig } from 'vuepress'
export default defineUserConfig({
// 设置正在使用的语言
lang: "zh-CN",
});
lang: 'zh-CN',
})
```
@tab 多语言
```ts
import { defineUserConfig } from "vuepress";
import { defineUserConfig } from 'vuepress'
export default defineUserConfig({
locales: {
"/": {
'/': {
// 设置正在使用的语言
lang: "zh-CN",
lang: 'zh-CN',
},
"/en/": {
'/en/': {
// 设置正在使用的语言
lang: "en-US",
lang: 'en-US',
},
},
});
})
```
:::

View File

@ -43,7 +43,7 @@ export default defineUserConfig({
locales: {
'/': { lang: 'zh-CN', title: '博客' }, // 简体中文
'/en/': { lang: 'en-US', title: 'Blog' }, // English
}
},
theme: plumeTheme({
locales: {
'/': {
@ -165,7 +165,6 @@ export default defineUserConfig({
这表示,以 `/blog/``/article/` 开头的页面链接地址,该链接元素将被激活。
## 配置帮助函数
主题提供了 `defineNavbar(config)` 函数,为主题使用者提供导航栏配置的类型帮助。

View File

@ -45,7 +45,6 @@ export default defineUserConfig({
在 VuePress 中,有三种配置类型:
- 站点配置: 这是你在 配置文件 中直接导出的对象
- 主题配置: 传递给 `plumeTheme` 的对象参数
- 页面配置: 由在页面顶部基于 YAML 语法的 Frontmatter 提供

View File

@ -11,14 +11,12 @@ permalink: /guide/api/client/
import { useDarkMode } from 'vuepress-theme-plume/client'
```
## `useDarkMode()`
- 类型: `() => Ref<boolean>`
Composable `useDarkMode()` 用于获取当前的 `dark` 状态。
```ts
import { useDarkMode } from 'vuepress-theme-plume/client'
@ -31,7 +29,6 @@ const isDark = useDarkMode()
自定义首页时,提供给 区域 的 包装容器。
### Props
| 名称 | 类型 | 默认值 | 说明 |

View File

@ -415,7 +415,7 @@ end tell
`````md
````md
```js
const a = 1;
const a = 1
```
````
`````
@ -424,7 +424,7 @@ const a = 1;
````md
```js
const a = 1;
const a = 1
```
````

View File

@ -26,7 +26,6 @@ permalink: /guide/markdown/extensions/
主题默认对每个 md 文件自动生成一个新的 链接,并保存在对应的 md 文件的 frontmatter 的 `permalink` 中。
你可以随时修改它们。
#### 内部链接
建议使用 生成的 `permalink` 作为内部链接的目标。
@ -405,7 +404,7 @@ export default {
export default {
data () {
return {
msg: 'Removed' // [\!code --]
msg: 'Removed', // [\!code --]
msg: 'Added' // [\!code ++]
}
}
@ -419,7 +418,7 @@ export default {
export default {
data() {
return {
msg: 'Removed' // [!code --]
msg: 'Removed', // [!code --]
msg: 'Added' // [!code ++]
}
}
@ -506,7 +505,6 @@ console.log(options.foo) // 这个不会被高亮显示
可以像这样对多个代码块进行分组:
**输入**
````md
@ -525,7 +523,7 @@ export default config
@tab config.ts
```ts
import { type UserConfig } from 'vuepress'
import type { UserConfig } from 'vuepress'
const config: UserConfig = {
// ..
@ -552,7 +550,7 @@ export default config
```
@tab config.ts
```ts
import { type UserConfig } from 'vuepress'
import type { UserConfig } from 'vuepress'
const config: UserConfig = {
// ..

View File

@ -37,7 +37,6 @@ import { getHighlighterCore } from 'shiki/core'
const highlighter = await getHighlighterCore({})
// ^?
// @log: Custom log message
const a = 1
// @error: Custom error message
@ -56,7 +55,6 @@ import { getHighlighterCore } from 'shiki/core'
const highlighter = await getHighlighterCore({})
// ^?
// @log: Custom log message
const a = 1
// @error: Custom error message
@ -94,14 +92,14 @@ $ pnpm patch @vuepress/markdown --edit-dir _tmp/vuepress__markdown
找到 `270` 行,其内容如下:
```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
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, '') || 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` 行。
@ -119,7 +117,6 @@ $ pnpm patch-commit '_tmp/vuepress__markdown'
之后你就可以选择 删除 `_tmp/vuepress__markdown` 目录了。
#### 步骤四
在 主题配置中,将 `twoslash` 选项打开。
@ -182,9 +179,9 @@ const a = 1
```ts twoslash
// @noErrors
// @esModuleInterop
import express from "express"
import express from 'express'
const app = express()
app.get("/", function (req, res) {
app.get('/', (req, res) => {
res.sen
// ^|
})
@ -195,9 +192,9 @@ app.listen(3000)
```ts twoslash
// @noErrors
// @esModuleInterop
import express from "express"
import express from 'express'
const app = express()
app.get("/", function (req, res) {
app.get('/', (req, res) => {
res.sen
// ^|
})
@ -219,14 +216,14 @@ app.listen(3000)
````md
```ts twoslash
// @errors: 2339
const welcome = "Tudo bem gente?"
const words = welcome.contains(" ")
const welcome = 'Tudo bem gente?'
const words = welcome.contains(' ')
```
````
```ts twoslash
// @errors: 2339
const welcome = "Tudo bem gente?"
const words = welcome.contains(" ")
const welcome = 'Tudo bem gente?'
const words = welcome.contains(' ')
```
你需要在 `@errors` 后面,声明对应的 `typescript` 错误码。
@ -284,7 +281,6 @@ const c = 1
// @annotate: Custom annotation message
```
#### import_files {id=twoslash-import-files}
`@filename: <filename>` 用于声明后续的代码将来自哪个文件,
@ -293,35 +289,35 @@ const c = 1
````md
```ts twoslash
// @filename: sum.ts
export function sum(a: number, b: number): number {
return a + b
}
// @filename: ok.ts
import { sum } from "./sum"
sum(1, 2)
import { sum } from './sum'
// @filename: error.ts
// @errors: 2345
import { sum } from "./sum"
sum(4, "woops")
import { sum } from './sum'
export function sum(a: number, b: number): number {
return a + b
}
sum(1, 2)
sum(4, 'woops')
```
````
```ts twoslash
// @filename: sum.ts
export function sum(a: number, b: number): number {
return a + b
}
// @filename: ok.ts
import { sum } from "./sum"
sum(1, 2)
import { sum } from './sum'
// @filename: error.ts
// @errors: 2345
import { sum } from "./sum"
sum(4, "woops")
import { sum } from './sum'
export function sum(a: number, b: number): number {
return a + b
}
sum(1, 2)
sum(4, 'woops')
```
::: warning

View File

@ -12,7 +12,7 @@ permalink: /guide/markdown/advance/
::: code-tabs
@tab .vuepress/config.ts
```ts
export default defineUserConfig{
export default defineUserConfig({
theme: plumeTheme({
plugins: {
markdownEnhance: {
@ -20,7 +20,7 @@ export default defineUserConfig{
},
}
})
}
})
```
:::
@ -96,9 +96,9 @@ JSON 块是可选的,可用的配置详见[配置](https://vuepress-theme-hope
```
```ts
const message: string = "VuePress Theme Hope";
const message: string = 'VuePress Theme Hope'
document.querySelector("h1").innerHTML = message;
document.querySelector('h1').innerHTML = message
```
```scss
@ -124,9 +124,9 @@ h1 {
```
```ts
const message: string = "VuePress Theme Hope";
const message: string = 'VuePress Theme Hope'
document.querySelector("h1").innerHTML = message;
document.querySelector('h1').innerHTML = message
```
```scss
@ -143,7 +143,6 @@ h1 {
````
::::
### 普通代码演示
格式:
```` md
@ -165,10 +164,10 @@ h1 {
// 配置 (可选)
{
"jsLib": [
...
// ...
],
"cssLib": [
...
// ...
]
}
```
@ -189,9 +188,9 @@ h1 {
```
```js
document.querySelector("#very").addEventListener("click", () => {
alert("非常强大");
});
document.querySelector('#very').addEventListener('click', () => {
alert('非常强大')
})
```
```css
@ -212,9 +211,9 @@ span {
```
```js
document.querySelector("#very").addEventListener("click", () => {
alert("非常强大");
});
document.querySelector('#very').addEventListener('click', () => {
alert('非常强大')
})
```
```css
@ -235,14 +234,17 @@ span {
```vue
<!-- ↑ 你也可以使用 html -->
<template>
<!-- vue 模板 -->
</template>
<script>
export default {
// vue 组件
};
}
</script>
<template>
<!-- vue 模板 -->
<div>demo</div>
</template>
<style>
/* css 代码 */
</style>
@ -250,6 +252,7 @@ export default {
```json
// 配置 (可选)
{}
```
:::
@ -266,31 +269,32 @@ export default {
::: vue-demo 一个 Vue Composition 演示
```vue
<template>
<div class="box">
<code>Hello Word</code> is
<span @click="handler">{{ message }}</span
>!
</div>
</template>
<script>
const { ref } = Vue;
const { ref } = Vue
export default {
setup() {
const message = ref("powerful");
const message = ref('powerful')
const handler = () => {
message.value = "very " + message.value;
};
message.value = `very ${message.value}`
}
return {
message,
handler,
};
}
},
};
}
</script>
<template>
<div class="box">
<code>Hello Word</code> is
<span @click="handler">{{ message }}</span>!
</div>
</template>
<style>
.box span {
color: red;
@ -305,31 +309,32 @@ export default {
::: vue-demo 一个 Vue Composition 演示
```vue
<template>
<div class="box">
<code>Hello Word</code> is
<span @click="handler">{{ message }}</span
>!
</div>
</template>
<script>
const { ref } = Vue;
const { ref } = Vue
export default {
setup() {
const message = ref("powerful");
const message = ref('powerful')
const handler = () => {
message.value = "very " + message.value;
};
message.value = `very ${message.value}`
}
return {
message,
handler,
};
}
},
};
}
</script>
<template>
<div class="box">
<code>Hello Word</code> is
<span @click="handler">{{ message }}</span>!
</div>
</template>
<style>
.box span {
color: red;
@ -358,6 +363,7 @@ export default {
```json
// 配置 (可选)
{}
```
:::
@ -374,14 +380,14 @@ export default {
::: react-demo 一个函数式 React Demo
```js
const { useState } = React;
const { useState } = React
export default () => {
const [message, setMessage] = useState(" 强大");
const [message, setMessage] = useState(' 强大')
const handler = () => {
setMessage(`十分${message}`);
};
setMessage(`十分${message}`)
}
return (
<div className="box">
@ -390,8 +396,8 @@ export default () => {
{message}
</span>
</div>
);
};
)
}
```
```css
@ -407,14 +413,14 @@ export default () => {
::: react-demo 一个函数式 React Demo
```js
const { useState } = React;
const { useState } = React
export default () => {
const [message, setMessage] = useState(" 强大");
const [message, setMessage] = useState(' 强大')
const handler = () => {
setMessage(`十分${message}`);
};
setMessage(`十分${message}`)
}
return (
<div className="box">
@ -423,8 +429,8 @@ export default () => {
{message}
</span>
</div>
);
};
)
}
```
```css
@ -503,7 +509,6 @@ export default () => {
你可以在每个选项卡中使用 Vue 语法和组件,并且你可以访问 value 和 isActive
表示选项卡的绑定值和选项卡是否处于激活状态。
**输入**
````

View File

@ -25,7 +25,6 @@ export default a
### 代码组
::: code-tabs
@tab foo.js
```js

View File

@ -42,7 +42,6 @@ export default defineUserConfig({
然而,当你的站点包含大量页面时,搜索索引文件也会变得非常大,它可能会拖慢你的页面加载速度。在这种情况下,我们建议你使用更成熟的解决方案 - [Algolia DocSearch](#algolia-docsearch) 。
## Algolia DocSearch
使用 [Algolia DocSearch](https://docsearch.algolia.com/) 提供支持的网站内容搜索插件
@ -123,7 +122,7 @@ new Crawler({
indexHeadings: true, // [!code highlight]
aggregateContent: true, // [!code highlight]
recordVersion: 'v3', // [!code highlight]
});
})
},
},
],
@ -202,7 +201,7 @@ new Crawler({
removeWordsIfNoResults: 'allOptional',
},
},
});
})
```
`recordProps` 部分的配置选项用于本主题进行索引的爬取配置。

View File

@ -15,7 +15,6 @@ permalink: /guide/blog/
同时,主题会生成一个 链接地址为 `/blog/` 的 博客文章列表页。
展示所有的博客文章,以及 博主的相关信息。
## 国际化支持
如果启用了 国际化,那么博客列表页将会 根据 不同的语言,展示对应语言目录下的博客列表。

View File

@ -63,7 +63,7 @@ export default defineUserConfig({
]
},
'/zh/': {
selectLanguageName: "简体中文",
selectLanguageName: '简体中文',
navbar: [
{ text: '首页', link: '/zh/' },
{ text: '博客', link: '/zh/blog/' },

View File

@ -5,7 +5,6 @@ createTime: 2024/03/04 10:06:06
permalink: /guide/write/
---
::: info 提示
以下内容中,以 `sourceDir` 表示 项目中用于保存 `Markdown` 文件的目录。
@ -44,7 +43,6 @@ __example:__
- 运维
```
## 文章写作
你可以使用 `markdown` 语法开始在 `sourceDir` 下新建 `Markdown` 文件,编写你自己的文章了,

View File

@ -5,7 +5,6 @@ createTime: 2024/03/04 20:18:52
permalink: /guide/custom-style/
---
## 主题定制
支持自定义样式。

View File

@ -291,7 +291,6 @@ config:
<img src="/images/custom-features.png" />
:::
### text-image | image-text
- 类型: `PlumeThemeHomeTextImage`

View File

@ -5,7 +5,6 @@ createTime: 2024/03/04 11:58:59
permalink: /guide/features/comments/
---
## 概述
文章评论由 [vuepress-plugin-comment2](https://vuepress-theme-hope.github.io/v2/comment2/zh) 提供支持。

View File

@ -1,7 +1,7 @@
import config from '@pengzhanbo/eslint-config-vue'
export default config({
ignores: ['lib', 'docs/**/*.md'],
ignores: ['lib'],
globals: {
__VUEPRESS_VERSION__: 'readonly',
__VUEPRESS_BASE__: 'readonly',
@ -16,4 +16,10 @@ export default config({
rules: {
'vue/no-v-text-v-html-on-component': 'off',
},
}, {
files: ['**/*.md/*.ts'],
rules: {
'import/no-duplicates': 'off',
'no-new': 'off',
},
})