Skip to content

Commit f5a98fc

Browse files
committed
Prepare 8.1.6 release
1 parent bcf2f78 commit f5a98fc

13 files changed

+251
-15
lines changed

CHANGELOG

+10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
mkdocs-material-8.1.6-insiders-4.6.0 (2022-01-11)
2+
3+
* Added support for annotations (outside of code blocks)
4+
5+
mkdocs-material-8.1.6 (2022-01-11)
6+
7+
* Fixed spacing of blockquotes (8.1.5 regression)
8+
* Fixed edge cases for rounded corners on code blocks (8.1.5 regression)
9+
* Fixed rendering issues with code annotation line heights
10+
111
mkdocs-material-8.1.5 (2022-01-09)
212

313
* Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+

docs/changelog/index.md

+6
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ template: overrides/main.html
66

77
## Material for MkDocs
88

9+
### 8.1.6 <small>_ January 11, 2022</small> { id="8.1.6" }
10+
11+
- Fixed spacing of blockquotes (8.1.5 regression)
12+
- Fixed edge cases for rounded corners on code blocks (8.1.5 regression)
13+
- Fixed issues with code annotation line heights
14+
915
### 8.1.5 <small>_ January 9, 2022</small> { id="8.1.5" }
1016

1117
- Improved browser support: Chrome 49+, Safari 10+, Firefox 53+, Edge 79+

docs/insiders/changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ template: overrides/main.html
66

77
## Material for MkDocs Insiders
88

9+
### 4.6.0 <small>_ January 11, 2022</small> { id="4.6.0" }
10+
11+
- Added support for annotations (outside of code blocks)
12+
913
### 4.5.2 <small>_ January 8, 2022</small> { id="4.5.2" }
1014

1115
- Fixed #3440: Content tab indicator not moving when using linking

docs/insiders/index.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,10 @@ The following features are solely available via Material for MkDocs Insiders:
162162

163163
<div class="mdx-columns" markdown>
164164

165+
- [x] [Annotations] :material-new-box:
165166
- [x] [Navigation icons] :material-new-box:
166-
- [x] [Code annotations: anchor links] :material-new-box:
167-
- [x] [Code annotations: strip comments] :material-new-box:
167+
- [x] [Code annotations: anchor links]
168+
- [x] [Code annotations: strip comments]
168169
- [x] [Dismissable announcement bar]
169170
- [x] [Was this page helpful?]
170171
- [x] [Brand new search plugin]
@@ -251,12 +252,13 @@ are released for general availability.
251252

252253
#### $ 12,000 – Piri Piri
253254

255+
- [x] [Annotations]
254256
- [x] [Navigation icons]
255257
- [ ] Navigation status badges
256258
- [ ] Navigation pruning
257-
- [ ] Text annotations
258259
- [ ] Blog
259260

261+
[Annotations]: ../reference/annotations.md
260262
[Navigation icons]: ../reference/index.md#setting-the-page-icon
261263

262264
### Goals completed

docs/reference/annotations.md

+204
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
---
2+
template: overrides/main.html
3+
icon: material/plus-circle
4+
---
5+
6+
# Annotations
7+
8+
One of the flagship features of Material for MkDocs is the ability to inject
9+
annotations – little markers that can be added almost anywhere in a document
10+
and expand a tooltip containing arbitrary Markdown on click or keyboard focus.
11+
12+
## Configuration
13+
14+
This configuration allows to add annotations to all inline- and block-level
15+
elements, as well as code blocks, and nest annotations inside each other. Add
16+
the following lines to `mkdocs.yml`:
17+
18+
``` yaml
19+
markdown_extensions:
20+
- attr_list
21+
- md_in_html
22+
- pymdownx.superfences
23+
```
24+
25+
See additional configuration options:
26+
27+
- [Attribute Lists]
28+
- [Markdown in HTML]
29+
- [SuperFences]
30+
31+
[Attribute Lists]: ../setup/extensions/python-markdown.md#attribute-lists
32+
[Markdown in HTML]: ../setup/extensions/python-markdown.md#markdown-in-html
33+
[SuperFences]: ../setup/extensions/python-markdown-extensions.md#superfences
34+
35+
## Usage
36+
37+
### Using annotations
38+
39+
[:octicons-heart-fill-24:{ .mdx-heart } Insiders][Insiders]{ .mdx-insiders } ·
40+
[:octicons-tag-24: insiders-4.6.0][Insiders] ·
41+
:octicons-beaker-24: Experimental
42+
43+
Annotations consist of two parts: a marker, which can be placed anywhere in
44+
a block marked with the `annotate` class, and content located in a list below
45+
the block containing the marker:
46+
47+
``` markdown title="Text with annotations"
48+
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
49+
{ .annotate }
50+
51+
1. :man_raising_hand: I'm an annotation! I can contain `code`, __formatted
52+
text__, images, ... basically anything that can be expressed in Markdown.
53+
```
54+
55+
<div class="result" markdown>
56+
57+
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
58+
{ .annotate }
59+
60+
1. :man_raising_hand: I'm an annotation! I can contain `code`, __formatted
61+
text__, images, ... basically anything that can be written in Markdown.
62+
63+
</div>
64+
65+
Note that the `annotate` class must only be added to the outermost block. All
66+
nested elements can use the same list to define annotations, except when
67+
annotations are nested themselves.
68+
69+
[Insiders]: ../insiders/index.md
70+
71+
#### in annotations
72+
73+
When [SuperFences] is enabled, annotations can be nested inside annotations by
74+
adding the `annotate` class to the list item hosting the annotation content,
75+
repeating the process:
76+
77+
``` markdown title="Text with nested annotations"
78+
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
79+
{ .annotate }
80+
81+
1. :man_raising_hand: I'm an annotation! (1)
82+
{ .annotate }
83+
84+
1. :woman_raising_hand: I'm an annotation as well!
85+
```
86+
87+
<div class="result" markdown>
88+
89+
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
90+
{ .annotate }
91+
92+
1. :man_raising_hand: I'm an annotation! (1)
93+
{ .annotate style="margin-bottom: 0" }
94+
95+
1. :woman_raising_hand: I'm an annotation as well!
96+
97+
</div>
98+
99+
#### in admonitions
100+
101+
The titles and bodies of [admonitions] can also host annotations by adding the
102+
`annotate` modifier after the type qualifier, which is similar to how
103+
[inline blocks] work:
104+
105+
``` markdown title="Admonition with annotations"
106+
!!! note annotate "Phasellus posuere in sem ut cursus (1)"
107+
108+
Lorem ipsum dolor sit amet, (2) consectetur adipiscing elit. Nulla et
109+
euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo
110+
purus auctor massa, nec semper lorem quam in massa.
111+
112+
1. :man_raising_hand: I'm an annotation!
113+
2. :woman_raising_hand: I'm an annotation as well!
114+
```
115+
116+
<div class="result" markdown>
117+
118+
!!! note annotate "Phasellus posuere in sem ut cursus (1)"
119+
120+
Lorem ipsum dolor sit amet, (2) consectetur adipiscing elit. Nulla et
121+
euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo
122+
purus auctor massa, nec semper lorem quam in massa.
123+
124+
1. :man_raising_hand: I'm an annotation!
125+
2. :woman_raising_hand: I'm an annotation as well!
126+
127+
</div>
128+
129+
[admonitions]: admonitions.md
130+
[inline blocks]: admonitions.md#inline-blocks
131+
132+
#### in content tabs
133+
134+
Content tabs can host annotations by adding the `annotate` class to the block
135+
of a dedicated content tab (and not to the container, which is not supported):
136+
137+
``` markdown title="Content tabs with annotations"
138+
=== "Tab 1"
139+
140+
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
141+
{ .annotate }
142+
143+
1. :man_raising_hand: I'm an annotation!
144+
145+
=== "Tab 2"
146+
147+
Phasellus posuere in sem ut cursus (1)
148+
{ .annotate }
149+
150+
1. :woman_raising_hand: I'm an annotation as well!
151+
```
152+
153+
<div class="result" markdown>
154+
155+
=== "Tab 1"
156+
157+
Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
158+
{ .annotate }
159+
160+
1. :man_raising_hand: I'm an annotation!
161+
162+
=== "Tab 2"
163+
164+
Phasellus posuere in sem ut cursus (1)
165+
{ .annotate }
166+
167+
1. :woman_raising_hand: I'm an annotation as well!
168+
169+
</div>
170+
171+
#### in everything else
172+
173+
The [Attribute Lists] extension is the key ingredient for adding annotations to
174+
most elements, but it has some [limitations]. However, it's always possible to
175+
leverage the [Markdown in HTML] extension to wrap arbitrary elements with a
176+
`div` with the `annotate` class:
177+
178+
```` html title="HTML with annotations"
179+
<div class="annotate" markdown>
180+
181+
> Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
182+
183+
</div>
184+
185+
1. :man_raising_hand: I'm an annotation!
186+
````
187+
188+
<div class="result" markdown>
189+
<div class="annotate" markdown>
190+
191+
> Lorem ipsum dolor sit amet, (1) consectetur adipiscing elit.
192+
193+
</div>
194+
195+
1. :man_raising_hand: I'm an annotation!
196+
197+
</div>
198+
199+
With this trick, annotations can also be added to blockquotes, data tables,
200+
lists, and many other elements that are not supported by the [Attribute Lists]
201+
extension. Furthermore, note that [code blocks follow different semantics].
202+
203+
[limitations]: https://python-markdown.github.io/extensions/attr_list/#limitations
204+
[code blocks follow different semantics]: code-blocks.md#adding-annotations

docs/reference/data-tables.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ and/or end of the divider.
6363

6464
=== "Left"
6565

66-
``` markdown hl_lines="2" title="Data table, aligned to left"
66+
``` markdown hl_lines="2" title="Data table, columns aligned to left"
6767
| Method | Description |
6868
| :---------- | :----------------------------------- |
6969
| `GET` | :material-check: Fetch resource |
@@ -83,7 +83,7 @@ and/or end of the divider.
8383

8484
=== "Center"
8585

86-
``` markdown hl_lines="2" title="Data table, centered"
86+
``` markdown hl_lines="2" title="Data table, columns centered"
8787
| Method | Description |
8888
| :---------: | :----------------------------------: |
8989
| `GET` | :material-check: Fetch resource |
@@ -103,7 +103,7 @@ and/or end of the divider.
103103

104104
=== "Right"
105105

106-
``` markdown hl_lines="2" title="Data table, aligned to right"
106+
``` markdown hl_lines="2" title="Data table, columns aligned to right"
107107
| Method | Description |
108108
| ----------: | -----------------------------------: |
109109
| `GET` | :material-check: Fetch resource |
@@ -153,7 +153,7 @@ loading] via [additional JavaScript]:
153153
After applying the customization, data tables can be sorted by clicking on a
154154
column:
155155

156-
``` markdown title="Data table"
156+
``` markdown title="Data table, columns sortable"
157157
| Method | Description |
158158
| ----------- | ------------------------------------ |
159159
| `GET` | :material-check: Fetch resource |

docs/reference/diagrams.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ No further configuration is necessary. Advantages over a custom integration:
5656
are rendered as nodes of various kinds and are connected by edges, describing
5757
the necessary order of steps:
5858

59-
```` markdown title="Mermaid.js flow chart"
59+
```` markdown title="Flow chart"
6060
``` mermaid
6161
graph LR
6262
A[Start] --> B{Error?};
@@ -88,7 +88,7 @@ graph LR
8888
between multiple objects or actors, including the messages that are exchanged
8989
between those actors:
9090

91-
```` markdown title="Mermaid.js sequence diagram"
91+
```` markdown title="Sequence diagram"
9292
``` mermaid
9393
sequenceDiagram
9494
Alice->>John: Hello John, how are you?
@@ -126,7 +126,7 @@ sequenceDiagram
126126
decomposing it into a finite number of states, and transitions between those
127127
states:
128128

129-
```` markdown title="Mermaid.js state diagram"
129+
```` markdown title="State diagram"
130130
``` mermaid
131131
stateDiagram-v2
132132
state fork_state <<fork>>
@@ -168,7 +168,7 @@ stateDiagram-v2
168168
structure of a system by modelling entities as classes and relationships between
169169
them:
170170

171-
```` markdown title="Mermaid.js class diagram"
171+
```` markdown title="Class diagram"
172172
``` mermaid
173173
classDiagram
174174
Person <|-- Student
@@ -240,7 +240,7 @@ An [entity-relationship diagram] is composed of entity types and specifies
240240
relationships that exist between entities. It describes inter-related things in
241241
a specific domain of knowledge:
242242

243-
```` markdown title="Mermaid.js entity-relationship diagram"
243+
```` markdown title="Entity-relationship diagram"
244244
``` mermaid
245245
erDiagram
246246
CUSTOMER ||--o{ ORDER : places

docs/setup/extensions/python-markdown-extensions.md

+2
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@ them at your own risk.
604604

605605
See reference for usage:
606606

607+
- [Annotations]
607608
- [Using flowcharts]
608609
- [Using sequence diagrams]
609610
- [Using state diagrams]
@@ -615,6 +616,7 @@ See reference for usage:
615616
[Fenced Code Blocks]: python-markdown.md#fenced-code-blocks
616617
[Mermaid.js]: https://mermaid-js.github.io/mermaid/
617618
[diagrams]: ../../reference/diagrams.md
619+
[Annotations]: ../../reference/annotations.md
618620
[Using flowcharts]: ../../reference/diagrams.md#using-flowcharts
619621
[Using sequence diagrams]: ../../reference/diagrams.md#using-sequence-diagrams
620622
[Using state diagrams]: ../../reference/diagrams.md#using-state-diagrams

0 commit comments

Comments
 (0)