mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-06-14 11:52:32 +03:00
Added more code block annotations
This commit is contained in:
parent
40060ea3ca
commit
80eca35077
@ -25,11 +25,11 @@ contents:
|
||||
|
||||
=== "Material for MkDocs"
|
||||
|
||||
``` yaml
|
||||
name: ci
|
||||
``` { .yaml .annotate }
|
||||
name: ci # (1)
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
branches: # (2)
|
||||
- master
|
||||
- main
|
||||
jobs:
|
||||
@ -40,10 +40,25 @@ contents:
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: pip install mkdocs-material
|
||||
- run: pip install mkdocs-material # (3)
|
||||
- run: mkdocs gh-deploy --force
|
||||
```
|
||||
|
||||
1. You can change the name to your liking.
|
||||
|
||||
2. At some point, GitHub renamed `master` to `main`. If your default branch
|
||||
is named `master`, you can safely remove `main`, vice versa.
|
||||
|
||||
3. This is the place to install further [MkDocs plugins][3] or Markdown
|
||||
extensions with `pip` to be used during the build:
|
||||
|
||||
``` sh
|
||||
pip install \
|
||||
mkdocs-material \
|
||||
mkdocs-awesome-pages-plugin \
|
||||
...
|
||||
```
|
||||
|
||||
=== "Insiders"
|
||||
|
||||
``` yaml
|
||||
@ -75,13 +90,14 @@ the workflow in action.
|
||||
Your documentation should shortly appear at `<username>.github.io/<repository>`.
|
||||
|
||||
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your
|
||||
[personal access token][3] when deploying [Insiders][4], which can be done
|
||||
using [secrets][5]._
|
||||
[personal access token][4] when deploying [Insiders][5], which can be done
|
||||
using [secrets][6]._
|
||||
|
||||
[2]: https://github.com/features/actions
|
||||
[3]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
|
||||
[4]: insiders/index.md
|
||||
[5]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
||||
[3]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
|
||||
[4]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
|
||||
[5]: insiders/index.md
|
||||
[6]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
|
||||
|
||||
### with MkDocs
|
||||
|
||||
@ -94,8 +110,8 @@ mkdocs gh-deploy --force
|
||||
|
||||
## GitLab Pages
|
||||
|
||||
If you're hosting your code on GitLab, deploying to [GitLab Pages][6] can be
|
||||
done by using the [GitLab CI][7] task runner. At the root of your repository,
|
||||
If you're hosting your code on GitLab, deploying to [GitLab Pages][7] can be
|
||||
done by using the [GitLab CI][8] task runner. At the root of your repository,
|
||||
create a task definition named `.gitlab-ci.yml` and copy and paste the
|
||||
following contents:
|
||||
|
||||
@ -138,9 +154,9 @@ workflow in action.
|
||||
Your documentation should shortly appear at `<username>.gitlab.io/<repository>`.
|
||||
|
||||
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your
|
||||
[personal access token][3] when deploying [Insiders][4], which can be done
|
||||
using [masked custom variables][8]._
|
||||
[personal access token][4] when deploying [Insiders][5], which can be done
|
||||
using [masked custom variables][9]._
|
||||
|
||||
[6]: https://gitlab.com/pages
|
||||
[7]: https://docs.gitlab.com/ee/ci/
|
||||
[8]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
|
||||
[7]: https://gitlab.com/pages
|
||||
[8]: https://docs.gitlab.com/ee/ci/
|
||||
[9]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
|
||||
|
@ -75,15 +75,21 @@ If you're using versioning, you might want to display a warning when the user
|
||||
visits any other version than the latest version. Using [theme extension][8],
|
||||
you can [define the `outdated` block][9]:
|
||||
|
||||
``` html
|
||||
``` { .html .annotate }
|
||||
{% block outdated %}
|
||||
You're not viewing the latest version.
|
||||
<a href="{{ '../' ~ base_url }}">
|
||||
<a href="{{ '../' ~ base_url }}"> <!-- (1) -->
|
||||
<strong>Click here to go to latest.</strong>
|
||||
</a>
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
1. Given this value for the `href` attribute, the link will always redirect to
|
||||
the root of your site, which will then redirect to the latest version. This
|
||||
ensures that older versions of your site do not depend on a specific alias,
|
||||
e.g. `latest`, to allow for changing the alias later on without breaking
|
||||
earlier versions.
|
||||
|
||||
This will render a version warning above the header:
|
||||
|
||||
[![Version warning][10]][10]
|
||||
|
Loading…
Reference in New Issue
Block a user