Skip to content

Commit 36538da

Browse files
committed
Documentation
1 parent b93af80 commit 36538da

File tree

4 files changed

+102
-12
lines changed

4 files changed

+102
-12
lines changed
2.55 KB
Loading

docs/assets/screenshots/tags.png

2.95 KB
Loading

docs/reference/admonitions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ theme:
6464

6565
=== ":octicons-mark-github-16: Octicons"
6666

67-
``` yaml title="Admonition with alternate icon set"
67+
``` yaml
6868
theme:
6969
icon:
7070
admonition:
@@ -91,7 +91,7 @@ theme:
9191

9292
=== ":fontawesome-brands-font-awesome: FontAwesome"
9393

94-
``` yaml title="Admonition with alternate icon set"
94+
``` yaml
9595
theme:
9696
icon:
9797
admonition:
@@ -116,7 +116,7 @@ theme:
116116
</div>
117117

118118
[Insiders]: ../insiders/index.md
119-
[custom icon]: icons-emojis.md#additional-icons
119+
[custom icon]: ../setup/changing-the-logo-and-icons.md#additional-icons
120120
[supported types]: #supported-types
121121
[icon search]: icons-emojis.md#search
122122
[Octicons]: ../assets/screenshots/admonition-octicons.png

docs/setup/setting-up-tags.md

+99-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
---
22
template: overrides/main.html
3+
tags:
4+
- HTML5
5+
- JavaScript
6+
- CSS
7+
- Other
38
---
49

510
# Setting up tags
611

712
Material for MkDocs adds first-class support for categorizing pages with tags,
813
which adds the possibility to group related pages and make them discoverable
9-
via search and a dedicated tags index. If your documentation is large, tags
14+
via search and a dedicated [tags index]. If your documentation is large, tags
1015
can help to discover relevant information faster.
1116

17+
[tags index]: #adding-a-tags-index
18+
1219
## Configuration
1320

1421
### Built-in tags plugin
@@ -32,8 +39,9 @@ The following configuration options are available:
3239

3340
: :octicons-milestone-24: Default: _none_ – This option specifies which file
3441
should be used to render the tags index. See the section on [adding a tags
35-
index] for more information. If this option is specified, tags will
36-
become clickable, pointing to the corresponding section in the tags index:
42+
index][tags index] for more information. If this option is specified, tags
43+
will become clickable, pointing to the corresponding section in the tags
44+
index:
3745

3846
``` yaml
3947
plugins:
@@ -42,12 +50,92 @@ The following configuration options are available:
4250
```
4351

4452
The page holding the tags index can be linked anywhere in the `nav` section
45-
of `mkdocs.yml`. Note, however, that this options is not required. If this
46-
option is not specified, tags are still rendered and searchable,
47-
but without a tags index.
53+
of `mkdocs.yml`. Note, however, that this options is not required – only use
54+
it if you want a tags index page.
4855

4956
[tags support]: https://github.com/squidfunk/mkdocs-material/releases/tag/8.2.0
50-
[adding a tags index]: #adding-a-tags-index
57+
58+
### Tag icons
59+
60+
[:octicons-heart-fill-24:{ .mdx-heart } Insiders][Insiders]{ .mdx-insiders } ·
61+
[:octicons-tag-24: insiders-4.13.0][Insiders] ·
62+
:octicons-beaker-24: Experimental
63+
64+
Each tag can be associated with an icon, which is then rendered inside the tag.
65+
Before assigning icons to tags, associate each tag with a unique identifier,
66+
by adding the following to `mkdocs.yml`:
67+
68+
``` yaml
69+
extra:
70+
tags:
71+
<tag>: <identifier> # (1)!
72+
```
73+
74+
1. The identifier can only include alphanumeric characters, as well as dashes
75+
and underscores. For example, if you have a tag `Compatibility`, you can
76+
set `compat` as an identifier:
77+
78+
``` yaml
79+
extra:
80+
tags:
81+
Compatibility: compat
82+
```
83+
84+
Identifiers can be reused between tags. Tags which are not explicitly
85+
associated will use the default tag icon which is :material-pound:
86+
87+
Next, each identifier can be associated with an icon, or even a [custom icon],
88+
by adding the following lines to `mkdocs.yml` under the `theme.icon`
89+
configuration setting:
90+
91+
=== "Tag icon"
92+
93+
``` yaml
94+
theme:
95+
icon:
96+
tag:
97+
<identifier>: <icon> # (1)!
98+
```
99+
100+
1. Enter a few keywords to find the perfect icon using our [icon search] and
101+
click on the shortcode to copy it to your clipboard:
102+
103+
<div class="mdx-iconsearch" data-mdx-component="iconsearch">
104+
<input class="md-input md-input--stretch mdx-iconsearch__input" placeholder="Search icon" data-mdx-component="iconsearch-query" value="tag" />
105+
<div class="mdx-iconsearch-result" data-mdx-component="iconsearch-result" data-mdx-mode="file">
106+
<div class="mdx-iconsearch-result__meta"></div>
107+
<ol class="mdx-iconsearch-result__list"></ol>
108+
</div>
109+
</div>
110+
111+
=== "Tag default icon"
112+
113+
``` yaml
114+
theme:
115+
icon:
116+
tag:
117+
default: <icon>
118+
```
119+
120+
??? example "Expand to inspect example"
121+
122+
``` yaml
123+
theme:
124+
icon:
125+
tag:
126+
html: fontawesome/brands/html5
127+
js: fontawesome/brands/js
128+
css: fontawesome/brands/css3
129+
extra:
130+
tags:
131+
HTML5: html
132+
JavaScript: js
133+
CSS: css
134+
```
135+
136+
[Insiders]: ../insiders/index.md
137+
[custom icon]: changing-the-logo-and-icons.md#additional-icons
138+
[icon search]: ../reference/icons-emojis.md#search
51139

52140
## Usage
53141

@@ -60,8 +148,10 @@ lines at the top of a Markdown file:
60148
``` sh
61149
---
62150
tags:
63-
- insiders
64-
- brand new
151+
- html
152+
- js
153+
- css
154+
- other
65155
---
66156
67157
...

0 commit comments

Comments
 (0)