Skip to content

Commit 80eca35

Browse files
committed
Added more code block annotations
1 parent 40060ea commit 80eca35

File tree

2 files changed

+40
-18
lines changed

2 files changed

+40
-18
lines changed

docs/publishing-your-site.md

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ contents:
2525

2626
=== "Material for MkDocs"
2727

28-
``` yaml
29-
name: ci
28+
``` { .yaml .annotate }
29+
name: ci # (1)
3030
on:
3131
push:
32-
branches:
32+
branches: # (2)
3333
- master
3434
- main
3535
jobs:
@@ -40,10 +40,25 @@ contents:
4040
- uses: actions/setup-python@v2
4141
with:
4242
python-version: 3.x
43-
- run: pip install mkdocs-material
43+
- run: pip install mkdocs-material # (3)
4444
- run: mkdocs gh-deploy --force
4545
```
4646

47+
1. You can change the name to your liking.
48+
49+
2. At some point, GitHub renamed `master` to `main`. If your default branch
50+
is named `master`, you can safely remove `main`, vice versa.
51+
52+
3. This is the place to install further [MkDocs plugins][3] or Markdown
53+
extensions with `pip` to be used during the build:
54+
55+
``` sh
56+
pip install \
57+
mkdocs-material \
58+
mkdocs-awesome-pages-plugin \
59+
...
60+
```
61+
4762
=== "Insiders"
4863

4964
``` yaml
@@ -75,13 +90,14 @@ the workflow in action.
7590
Your documentation should shortly appear at `<username>.github.io/<repository>`.
7691

7792
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your
78-
[personal access token][3] when deploying [Insiders][4], which can be done
79-
using [secrets][5]._
93+
[personal access token][4] when deploying [Insiders][5], which can be done
94+
using [secrets][6]._
8095

8196
[2]: https://github.com/features/actions
82-
[3]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
83-
[4]: insiders/index.md
84-
[5]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
97+
[3]: https://github.com/mkdocs/mkdocs/wiki/MkDocs-Plugins
98+
[4]: https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token
99+
[5]: insiders/index.md
100+
[6]: https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
85101

86102
### with MkDocs
87103

@@ -94,8 +110,8 @@ mkdocs gh-deploy --force
94110

95111
## GitLab Pages
96112

97-
If you're hosting your code on GitLab, deploying to [GitLab Pages][6] can be
98-
done by using the [GitLab CI][7] task runner. At the root of your repository,
113+
If you're hosting your code on GitLab, deploying to [GitLab Pages][7] can be
114+
done by using the [GitLab CI][8] task runner. At the root of your repository,
99115
create a task definition named `.gitlab-ci.yml` and copy and paste the
100116
following contents:
101117

@@ -138,9 +154,9 @@ workflow in action.
138154
Your documentation should shortly appear at `<username>.gitlab.io/<repository>`.
139155

140156
_Remember to set the_ `GH_TOKEN` _environment variable to the value of your
141-
[personal access token][3] when deploying [Insiders][4], which can be done
142-
using [masked custom variables][8]._
157+
[personal access token][4] when deploying [Insiders][5], which can be done
158+
using [masked custom variables][9]._
143159

144-
[6]: https://gitlab.com/pages
145-
[7]: https://docs.gitlab.com/ee/ci/
146-
[8]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui
160+
[7]: https://gitlab.com/pages
161+
[8]: https://docs.gitlab.com/ee/ci/
162+
[9]: https://docs.gitlab.com/ee/ci/variables/#create-a-custom-variable-in-the-ui

docs/setup/setting-up-versioning.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,21 @@ If you're using versioning, you might want to display a warning when the user
7575
visits any other version than the latest version. Using [theme extension][8],
7676
you can [define the `outdated` block][9]:
7777

78-
``` html
78+
``` { .html .annotate }
7979
{% block outdated %}
8080
You're not viewing the latest version.
81-
<a href="{{ '../' ~ base_url }}">
81+
<a href="{{ '../' ~ base_url }}"> <!-- (1) -->
8282
<strong>Click here to go to latest.</strong>
8383
</a>
8484
{% endblock %}
8585
```
8686

87+
1. Given this value for the `href` attribute, the link will always redirect to
88+
the root of your site, which will then redirect to the latest version. This
89+
ensures that older versions of your site do not depend on a specific alias,
90+
e.g. `latest`, to allow for changing the alias later on without breaking
91+
earlier versions.
92+
8793
This will render a version warning above the header:
8894

8995
[![Version warning][10]][10]

0 commit comments

Comments
 (0)