Skip to content

Commit

Permalink
Improved edit_uri documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
squidfunk committed Feb 18, 2023
1 parent 8796d90 commit 3b6c142
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions docs/setup/adding-a-git-repository.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,20 +102,29 @@ Some popular choices:
[:octicons-tag-24: 9.0.0][Code actions support] ·
:octicons-unlock-24: Feature flag

If the [repository URL] points to a [GitHub], [GitLab] or [Bitbucket] repository,
buttons for code actions can be added at the top of each document. Currently,
two types of code actions are supported: `edit` and `view` (GitHub only). Add
the following lines to `mkdocs.yml`:
If the [repository URL] points to a valid [GitHub], [GitLab] or [Bitbucket]
repository, [MkDocs] provides a setting called [`edit_uri`][edit_uri], which
resolves to the subfolder where your documentation is hosted.

=== ":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
theme:
features:
- content.action.edit
```

=== ":material-eye: View source of this page"
=== ":material-file-eye-outline: View source of this page"

``` yaml
theme:
Expand Down Expand Up @@ -145,10 +154,11 @@ theme:

[Code actions support]: https://github.com/squidfunk/mkdocs-material/releases/tag/9.0.0
[repository URL]: #repository
[edit_uri]: https://www.mkdocs.org/user-guide/configuration/#edit_uri
[GitHub]: https://github.com/
[GitLab]: https://about.gitlab.com/
[Bitbucket]: https://bitbucket.org/
[MkDocs]: https://www.mkdocs.org
[edit_uri]: https://www.mkdocs.org/user-guide/configuration/#edit_uri

### Revisioning

Expand Down
2 changes: 1 addition & 1 deletion docs/setup/setting-up-a-blog.md
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ the [built-in blog plugin] would create it:
├─ docs/
│ └─ blog/
│ ├─ category/
│ │ └─ hello.md #(1)!
│ │ └─ hello.md # (1)!
│ ├─ posts/
│ └─ index.md
└─ mkdocs.yml
Expand Down

0 comments on commit 3b6c142

Please sign in to comment.