Added more code block annotations

This commit is contained in:
squidfunk 2021-06-17 08:51:16 +02:00
parent 40060ea3ca
commit 80eca35077
2 changed files with 40 additions and 18 deletions

View File

@ -25,11 +25,11 @@ contents:
=== "Material for MkDocs" === "Material for MkDocs"
``` yaml ``` { .yaml .annotate }
name: ci name: ci # (1)
on: on:
push: push:
branches: branches: # (2)
- master - master
- main - main
jobs: jobs:
@ -40,10 +40,25 @@ contents:
- uses: actions/setup-python@v2 - uses: actions/setup-python@v2
with: with:
python-version: 3.x python-version: 3.x
- run: pip install mkdocs-material - run: pip install mkdocs-material # (3)
- run: mkdocs gh-deploy --force - 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" === "Insiders"
``` yaml ``` yaml
@ -75,13 +90,14 @@ the workflow in action.
Your documentation should shortly appear at `<username>.github.io/<repository>`. Your documentation should shortly appear at `<username>.github.io/<repository>`.
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your _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 [personal access token][4] when deploying [Insiders][5], which can be done
using [secrets][5]._ using [secrets][6]._
[2]: https://github.com/features/actions [2]: https://github.com/features/actions
[3]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token [3]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
[4]: insiders/index.md [4]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
[5]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets [5]: insiders/index.md
[6]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
### with MkDocs ### with MkDocs
@ -94,8 +110,8 @@ mkdocs gh-deploy --force
## GitLab Pages ## GitLab Pages
If you're hosting your code on GitLab, deploying to [GitLab Pages][6] can be If you're hosting your code on GitLab, deploying to [GitLab Pages][7] can be
done by using the [GitLab CI][7] task runner. At the root of your repository, 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 create a task definition named `.gitlab-ci.yml` and copy and paste the
following contents: following contents:
@ -138,9 +154,9 @@ workflow in action.
Your documentation should shortly appear at `<username>.gitlab.io/<repository>`. Your documentation should shortly appear at `<username>.gitlab.io/<repository>`.
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your _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 [personal access token][4] when deploying [Insiders][5], which can be done
using [masked custom variables][8]._ using [masked custom variables][9]._
[6]: https://gitlab.com/pages [7]: https://gitlab.com/pages
[7]: https://docs.gitlab.com/ee/ci/ [8]: https://docs.gitlab.com/ee/ci/
[8]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui [9]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui

View File

@ -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], visits any other version than the latest version. Using [theme extension][8],
you can [define the `outdated` block][9]: you can [define the `outdated` block][9]:
``` html ``` { .html .annotate }
{% block outdated %} {% block outdated %}
You're not viewing the latest version. You're not viewing the latest version.
<a href="{{ '../' ~ base_url }}"> <a href="{{ '../' ~ base_url }}"> <!-- (1) -->
<strong>Click here to go to latest.</strong> <strong>Click here to go to latest.</strong>
</a> </a>
{% endblock %} {% 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: This will render a version warning above the header:
[![Version warning][10]][10] [![Version warning][10]][10]