Skip to content
This repository was archived by the owner on May 22, 2024. It is now read-only.

Commit c5c0da4

Browse files
Upgrade to mkdocs-material 9.1.0 and move tag css into custom css (#14)
1 parent 822b1e6 commit c5c0da4

File tree

10 files changed

+50
-49
lines changed

10 files changed

+50
-49
lines changed

docs/ADRs/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ hide:
77

88
This section demos how to record and summarise Architecture Decision Records [(ADRs)](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions) using the MkDocs Material [tags](https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/?h=tags) in-built plugin.
99

10-
You'll need to add a `tag` keyword to the front-matter and specify the status for example:
10+
You'll need to add a `tag` keyword to the front-matter and specify the ADR status for example:
1111

1212
```
1313
---
@@ -16,6 +16,8 @@ tags:
1616
---
1717
```
1818

19-
You can associate [icons](https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/?h=tags#tag-icons-and-identifiers) with the ADR status tags on the `mkdocs.yml` file.
19+
I have associated [icons](https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/?h=tags#tag-icons-and-identifiers) with the ADR status tags on the `mkdocs.yml` file.
2020

21-
The tags plugin will automatically include all markdown files in the `docs` repository with a `tags` keyword. This is great because it means you don't have to list the ADRs in the `nav` section of the mkdocs.yml file. However it also means you cannot use non ADR-status tags, unless you use mkdocs-insiders with [scoped tags indexes](https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/?h=tags#+tags.tags_extra_files).
21+
I have modified the background colors for the ADR status tags by [adding a separate style sheet](https://squidfunk.github.io/mkdocs-material/customization/#additional-css).
22+
23+
The tags plugin will automatically include all markdown files in the `docs` repository with a `tags` keyword. This is great because it means you don't have to list the individual ADRs in the `nav` section of the mkdocs.yml file. However it also means you cannot use non ADR-status tags, unless you use [mkdocs material Insiders](https://squidfunk.github.io/mkdocs-material/insiders/) with [scoped tags indexes](https://squidfunk.github.io/mkdocs-material/setup/setting-up-tags/?h=tags#+tags.tags_extra_files).

docs/setup/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,19 @@ This creates the following structure:
2727

2828
## Configuration
2929

30-
Update/add the following variables to `mkdocs.yml`:
30+
MkDocs projects settings are configured by default using a YAML configuration file in the root directory named `mkdocs.yml`. You should add the following variables to `mkdocs.yml` at minimum:
3131

3232
```
33-
- site_name: <website-name>
34-
- repo_url: <url>
35-
- theme:
33+
site_name: <website-name>
34+
repo_url: <url>
35+
theme:
3636
name: tech_docs_template
37+
plugins:
38+
- material/search
3739
```
3840

41+
See [configuration](https://www.mkdocs.org/user-guide/configuration/) for more details and configuration values.
42+
3943
## Preview
4044

4145
MkDocs includes a live preview server, so you can preview your changes as you write your documentation. The server will automatically rebuild the site upon saving. Start it with:

docs/stylesheets/tags-color.css

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* This sets the color of the ADR status tags see https://github.com/squidfunk/mkdocs-material/discussions/5101 */
2+
3+
.md-typeset .md-tag--draft, .md-typeset .md-tag--draft[href] {
4+
background-color: #5694ca;
5+
color: white;
6+
}
7+
8+
.md-typeset .md-tag--accepted, .md-typeset .md-tag--accepted[href] {
9+
background-color: #00703c;
10+
color: white;
11+
}
12+
13+
.md-typeset .md-tag--deprecated, .md-typeset .md-tag--deprecated[href] {
14+
background-color: #b1b4b6;
15+
color: white;
16+
}
17+
18+
.md-typeset .md-tag--proposed, .md-typeset .md-tag--proposed[href] {
19+
background-color: #003078;
20+
color: white;
21+
}
22+
23+
.md-typeset .md-tag--rejected, .md-typeset .md-tag--rejected[href] {
24+
background-color: #f47738;
25+
color: white;
26+
}
27+
28+
.md-typeset .md-tag--superseded, .md-typeset .md-tag--superseded[href] {
29+
background-color: #505a5f;
30+
color: white;
31+
}

mkdocs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
site_name: MkDocs Tech Docs Template
33
repo_url: https://github.com/ministryofjustice/mkdocs-tech-docs-template
4-
4+
repo_name: mkdocs-tech-docs-template
55
theme:
66
name: material
77
custom_dir: 'tech_docs_template/'
@@ -39,7 +39,8 @@ theme:
3939
toggle:
4040
icon: material/brightness-4
4141
name: Switch to light mode
42-
42+
extra_css:
43+
- stylesheets/tags-color.css
4344
edit_uri: edit/main/docs/
4445
plugins:
4546
- material/search

requirements-doc.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
mkdocs-material==9.0.9
1+
mkdocs-material==9.1.0
22
mkdocs-git-revision-date-localized-plugin==1.1.0
33
mkdocs-table-reader-plugin==1.2
44
mknotebooks==0.7.1

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ packages = find:
1919
include_package_data = True
2020
zip_safe = False
2121
install_requires =
22-
mkdocs-material
22+
mkdocs-material >= 9
2323

2424
[options.entry_points]
2525
mkdocs.themes =

tech_docs_template/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.22"
1+
__version__ = "0.0.23"

tech_docs_template/assets/stylesheets/extra.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,4 @@
182182

183183
.md-typeset .md-tag-icon::before {
184184
background-color: white;
185-
}
186-
187-
.md-typeset .md-tag[href] {
188-
color: white;
189185
}

tech_docs_template/assets/stylesheets/tags-color.css

Lines changed: 0 additions & 32 deletions
This file was deleted.

tech_docs_template/main.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
{% block styles %}
55
{{ super() }}
66
<link rel="stylesheet" href="{{ 'assets/stylesheets/extra.css' | url }}">
7-
<link rel="stylesheet" href="{{ 'assets/stylesheets/tags-color.css' | url }}">
87
{% endblock %}
98

109
{% block footer %}

0 commit comments

Comments
 (0)