Improved edit_uri documentation

This commit is contained in:
squidfunk 2023-02-18 11:15:25 +01:00
parent 8796d90087
commit 3b6c142958
2 changed files with 18 additions and 8 deletions

View File

@ -102,12 +102,21 @@ Some popular choices:
[:octicons-tag-24: 9.0.0][Code actions support] · [:octicons-tag-24: 9.0.0][Code actions support] ·
:octicons-unlock-24: Feature flag :octicons-unlock-24: Feature flag
If the [repository URL] points to a [GitHub], [GitLab] or [Bitbucket] repository, If the [repository URL] points to a valid [GitHub], [GitLab] or [Bitbucket]
buttons for code actions can be added at the top of each document. Currently, repository, [MkDocs] provides a setting called [`edit_uri`][edit_uri], which
two types of code actions are supported: `edit` and `view` (GitHub only). Add resolves to the subfolder where your documentation is hosted.
the following lines to `mkdocs.yml`:
=== ":material-pencil: Edit this page" If your default branch is called `main`, change the setting to:
``` yaml
edit_uri: blob/main/docs/
```
After making sure that `edit_uri` is correctly configured, buttons for code
actions can be added. Two types of code actions are supported: `edit` and `view`
(GitHub only):
=== ":material-file-edit-outline: Edit this page"
``` yaml ``` yaml
theme: theme:
@ -115,7 +124,7 @@ the following lines to `mkdocs.yml`:
- content.action.edit - content.action.edit
``` ```
=== ":material-eye: View source of this page" === ":material-file-eye-outline: View source of this page"
``` yaml ``` yaml
theme: theme:
@ -145,10 +154,11 @@ theme:
[Code actions support]: https://github.com/squidfunk/mkdocs-material/releases/tag/9.0.0 [Code actions support]: https://github.com/squidfunk/mkdocs-material/releases/tag/9.0.0
[repository URL]: #repository [repository URL]: #repository
[edit_uri]: https://www.mkdocs.org/user-guide/configuration/#edit_uri
[GitHub]: https://github.com/ [GitHub]: https://github.com/
[GitLab]: https://about.gitlab.com/ [GitLab]: https://about.gitlab.com/
[Bitbucket]: https://bitbucket.org/ [Bitbucket]: https://bitbucket.org/
[MkDocs]: https://www.mkdocs.org
[edit_uri]: https://www.mkdocs.org/user-guide/configuration/#edit_uri
### Revisioning ### Revisioning

View File

@ -1279,7 +1279,7 @@ the [built-in blog plugin] would create it:
├─ docs/ ├─ docs/
│ └─ blog/ │ └─ blog/
│ ├─ category/ │ ├─ category/
│ │ └─ hello.md #(1)! │ │ └─ hello.md # (1)!
│ ├─ posts/ │ ├─ posts/
│ └─ index.md │ └─ index.md
└─ mkdocs.yml └─ mkdocs.yml