docs: format and add docs

pull/698/head
Kia Ishii 3 years ago
parent 074d268077
commit e778f92dfd

@ -188,6 +188,30 @@ export interface Footer {
}
```
## editLink
- Type: `EditLink`
Edit Link lets you display a link to edit the page on Git management services such as GitHub, or GitLab. See [Theme: Edit Link](../guide/theme-edit-link) for more details.
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
}
}
}
```
```ts
export interface EditLink {
pattern: string
text?: string
}
```
## lastUpdatedText
- Type: `string`

@ -1,3 +1,28 @@
# Edit Link
Documentation coming soon...
Edit Link lets you display a link to edit the page on Git management services such as GitHub, or GitLab. To enable it, add `themeConfig.editLink` options to your config.
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
}
}
}
```
The `pattern` option defines the URL structure for the link, and `:path` is going to be replaced with the page path.
By default, this will add the link text "Edit this page" at the bottom of the doc page. You may customize this text by defining the `text` option.
```js
export default {
themeConfig: {
editLink: {
pattern: 'https://github.com/vuejs/vitepress/edit/main/docs/:path',
text: 'Edit this page on GitHub'
}
}
}
```

@ -8,6 +8,7 @@ export function useEditLink() {
const { text = 'Edit this page', pattern } = theme.value.editLink || {}
const { relativePath } = page.value
const url = pattern.replace(/:path/g, relativePath)
return { url, text }
})
}

@ -127,18 +127,18 @@ export namespace DefaultTheme {
export interface EditLink {
/**
* Custom text for edit link.
* Pattern for edit link.
*
* @default 'Edit this page'
* @example 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
*/
text?: string
pattern: string
/**
* Pattern for edit link.
* Custom text for edit link.
*
* @example 'https://github.com/vuejs/vitepress/edit/main/docs/:path'
* @default 'Edit this page'
*/
pattern: string
text?: string
}
// social link ---------------------------------------------------------------

Loading…
Cancel
Save