Skip to content

Commit

Permalink
feat: check dead link (#103)
Browse files Browse the repository at this point in the history
* feat: check dead link

* feat: add checkLink configuration

* fix: type error
  • Loading branch information
callqh committed Oct 19, 2022
1 parent c643faa commit 538dfcc
Show file tree
Hide file tree
Showing 10 changed files with 317 additions and 24 deletions.
1 change: 1 addition & 0 deletions docs/.island/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default defineConfig({
markdown: {
rehypePlugins: [],
remarkPlugins: []
// checkLink: {}
},
route: {
exclude: ['custom.tsx', '**/fragments/**']
Expand Down
24 changes: 23 additions & 1 deletion docs/en/api/config-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,4 +190,26 @@ export default defineConfig({
lineNumbers: true
}
});
```
```

### markdown.checkLink

- Type: `Object`
- default: `null`

Whether to enable the link check of the document, this configuration only takes effect when building the development environment code.

When a link in the documentation is not accessible properly, an error is thrown and the build is terminated.

```js
import { defineConfig } from 'islandjs';

export default defineConfig({
markdown: {
checkLink: {
exclude: ['github.com'],
timeout: 30000
}
}
});
```
26 changes: 24 additions & 2 deletions docs/zh/api/config-extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default defineConfig({
### markdown.lineNumbers

- Type: `Boolean`,
- Default: false
- Default: `false`

是否给代码块加上行号,默认是不展示。

Expand All @@ -190,4 +190,26 @@ export default defineConfig({
lineNumbers: true
}
});
```
```

### markdown.checkLink

- Type: `Object`
- default: `null`

是否开启文档的链接检查,该配置仅在构建开发环境代码时生效。

当文档中的链接无法正常访问时,会抛出错误并终止构建。

```js
import { defineConfig } from 'islandjs';

export default defineConfig({
markdown: {
checkLink: {
exclude: ['github.com'],
timeout: 30000
}
}
});
```
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"@vitejs/plugin-react": "2.0.1",
"acorn": "^8.8.0",
"cac": "6.7.12",
"check-links": "^1.1.8",
"chokidar": "^3.5.3",
"compression": "^1.7.4",
"copy-to-clipboard": "^3.3.2",
Expand Down
Loading

1 comment on commit 538dfcc

@vercel
Copy link

@vercel vercel bot commented on 538dfcc Oct 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.