-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(plugin-links-check): add links check plugin
- Loading branch information
1 parent
6927f23
commit 082a953
Showing
33 changed files
with
454 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# links-check | ||
|
||
<NpmBadge package="@vuepress/plugin-links-check" /> | ||
|
||
This plugin will check dead links in your markdown files. | ||
|
||
This plugin has been integrated into the default theme. | ||
|
||
## Usage | ||
|
||
```bash | ||
npm i -D @vuepress/plugin-links-check@next | ||
``` | ||
|
||
```ts | ||
import { linksCheckPlugin } from '@vuepress/plugin-links-check' | ||
|
||
export default { | ||
plugins: [ | ||
linksCheckPlugin({ | ||
// options | ||
}), | ||
], | ||
} | ||
``` | ||
|
||
## Options | ||
|
||
### dev | ||
|
||
- Type: `boolean` | ||
|
||
- Default: `true` | ||
|
||
- Details: | ||
|
||
Whether check dead links in markdown in devServer | ||
|
||
### build | ||
|
||
- Type: `boolean | 'error'` | ||
|
||
- Default: `true` | ||
|
||
- Details: | ||
|
||
Whether check dead links in markdown in build. If set to `'error'`, the build will fail if there are dead links. | ||
|
||
### exclude | ||
|
||
- Type: `(string | RegExp)[] | ((link: string, isDev: boolean) => boolean)` | ||
|
||
- Details: | ||
|
||
The links that should be excluded from checking. You can use a list of strings or regular expressions, or a function that returns a boolean. | ||
|
||
- Example: | ||
|
||
```ts | ||
linksCheckPlugin({ | ||
exclude: [ | ||
// exclude links by string | ||
'/exclude-link', | ||
// exclude links by regex | ||
/\/exclude-link-regex/, | ||
], | ||
|
||
// or exclude links by function | ||
exclude: (link, isDev) => { | ||
if (isDev) { | ||
return link.startsWith('/exclude-link-dev') | ||
} | ||
return link.startsWith('/exclude-link-build') | ||
}, | ||
}) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# links-check | ||
|
||
<NpmBadge package="@vuepress/plugin-links-check" /> | ||
|
||
此插件将检查您的 markdown 文件中的死链接。 | ||
|
||
此插件已集成到默认主题中。 | ||
|
||
## 使用 | ||
|
||
```bash | ||
npm i -D @vuepress/plugin-links-check@next | ||
``` | ||
|
||
```ts | ||
import { linksCheckPlugin } from '@vuepress/plugin-links-check' | ||
|
||
export default { | ||
plugins: [ | ||
linksCheckPlugin({ | ||
// 选项 | ||
}), | ||
], | ||
} | ||
``` | ||
|
||
## 选项 | ||
|
||
### dev | ||
|
||
- 类型:`boolean` | ||
|
||
- 默认值:`true` | ||
|
||
- 详情: | ||
|
||
是否在开发服务器中检查 markdown 中的死链接 | ||
|
||
### build | ||
|
||
- 类型:`boolean | 'error'` | ||
|
||
- 默认值:`true` | ||
|
||
- 详情: | ||
|
||
是否在构建中检查 markdown 中的死链接。如果设置为 `'error'`,则构建将在存在死链接时失败。 | ||
|
||
### exclude | ||
|
||
- 类型:`(string | RegExp)[] | ((link: string, isDev: boolean) => boolean)` | ||
|
||
- 详情: | ||
|
||
应该从检查中排除的链接。您可以使用字符串或正则表达式的列表,或者返回布尔值的函数。 | ||
|
||
- 示例: | ||
|
||
```ts | ||
linksCheckPlugin({ | ||
exclude: [ | ||
// 通过字符串排除链接 | ||
'/exclude-link', | ||
// 通过正则表达式排除链接 | ||
/\/exclude-link-regex/, | ||
], | ||
|
||
// 或者通过函数排除链接 | ||
exclude: (link, isDev) => { | ||
if (isDev) { | ||
return link.startsWith('/exclude-link-dev') | ||
} | ||
return link.startsWith('/exclude-link-build') | ||
}, | ||
}) | ||
``` |
Oops, something went wrong.