Skip to content

Commit fed5ad6

Browse files
committed
Prepared 8.1.0 release
1 parent d447324 commit fed5ad6

File tree

9 files changed

+129
-9
lines changed

9 files changed

+129
-9
lines changed

CHANGELOG

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
1-
mkdocs-material-8.0.5+insiders-4.x.x (2021-xx-xx)
1+
mkdocs-material-8.1.0+insiders-4.1.0 (2021-12-12)
22

3+
* Added support for code annotation anchor links (deep linking)
4+
* Added new code annotation syntax modifier to strip comment
35
* Updated German translations for cookie consent
46

7+
mkdocs-material-8.1.0 (2012-12-12)
8+
9+
* Added basic support for code block line anchors
10+
* Switched code annotation markers to + signs to improve usability
11+
* Switched main site title to bold font
12+
* Improved admonition icon positioning to align when font-size is increased
13+
* Improved and simplified footnotes CSS
14+
* Improved and simplified code annotation positioning
15+
* Fixed syntax error in Russian translations
16+
517
mkdocs-material-8.0.5 (2012-12-04)
618

719
* Fixed #3302: Footer refactoring induced ellipsis in some browsers

docs/changelog/index.md

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

77
## Material for MkDocs
88

9+
### 8.1.0 <small>_ December 10, 2021</small> { id="8.1.0" }
10+
11+
- Added basic support for code block line anchors
12+
- Switched code annotation markers to `+` signs to improve usability
13+
- Switched main site title to bold font
14+
- Improved admonition icon positioning to align when `font-size` is increased
15+
- Improved and simplified footnotes CSS
16+
- Improved and simplified code annotation positioning
17+
- Fixed syntax error in Russian translations
18+
919
### 8.0.5 <small>_ December 6, 2021</small> { id="8.0.5" }
1020

1121
- Fixed #3302: Footer refactoring induced ellipsis in some browsers

docs/customization.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ the `docs` directory.
2020
### Additional CSS
2121

2222
If you want to tweak some colors or change the spacing of certain elements,
23-
you can do this in a separate stylesheet. The easiest way is by creating a
24-
new stylesheet file in the `docs` directory:
23+
you can do this in a separate style sheet. The easiest way is by creating a
24+
new style sheet file in the `docs` directory:
2525

2626
``` sh
2727
.

docs/reference/code-blocks.md

+84
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,26 @@ theme:
8080
[Code annotations support]: https://github.com/squidfunk/mkdocs-material/releases/tag/8.0.0
8181
[Attribute Lists]: ../setup/extensions/python-markdown.md#attribute-lists
8282

83+
#### Anchor links
84+
85+
[:octicons-heart-fill-24:{ .mdx-heart } Insiders][Insiders]{ .mdx-insiders } ·
86+
[:octicons-tag-24: insiders-4.1.0][Insiders] ·
87+
:octicons-beaker-24: Experimental
88+
89+
In order to link to code annotations and share them more easily, [Insiders] adds
90+
an anchor link to each annotation automatically, which you can copy via right
91+
click or open in a new tab:
92+
93+
``` yaml
94+
# (1)!
95+
```
96+
97+
1. If you ++cmd++ :material-plus::material-cursor-default-outline: me, I'm
98+
rendered open in a new tab. You can also right-click me to __copy link
99+
address__ to share me with others.
100+
101+
[Insiders]: ../insiders/index.md
102+
83103
## Usage
84104

85105
Code blocks must be enclosed with two separate lines containing three backticks.
@@ -173,6 +193,38 @@ theme:
173193
1. :man_raising_hand: I'm a code annotation! I can contain `code`, __formatted
174194
text__, images, ... basically anything that can be expressed in Markdown.
175195

196+
#### Stripping comments
197+
198+
[:octicons-heart-fill-24:{ .mdx-heart } Insiders][Insiders]{ .mdx-insiders } ·
199+
[:octicons-tag-24: insiders-4.1.0][Insiders] ·
200+
:octicons-beaker-24: Experimental
201+
202+
If you wish to strip the comment characters surrounding a code annotation,
203+
[Insiders] adds a new syntax that allows for just that. Simply add an `!` after
204+
the closing parens of the code annotation:
205+
206+
_Example_:
207+
208+
```` markdown
209+
``` yaml
210+
# (1)!
211+
```
212+
213+
1. Look ma, less line noise!
214+
````
215+
216+
_Result_:
217+
218+
``` yaml
219+
# (1)!
220+
```
221+
222+
1. Look ma, less line noise!
223+
224+
Note that this only allows for a single code annotation to be rendered per
225+
comment. If you want to add multiple code annotations, comments cannot be
226+
stripped for technical reasons.
227+
176228
### Adding line numbers
177229

178230
Line numbers can be added to a code block by using the `linenums="<start>"`
@@ -367,3 +419,35 @@ override it as part of your [additional style sheet]:
367419
[types of string tokens]: https://pygments.org/docs/tokens/#literals
368420
[additional style sheet]: ../customization.md#additional-css
369421
[syntax theme definition]: https://github.com/squidfunk/mkdocs-material/blob/master/src/assets/stylesheets/main/extensions/pymdownx/_highlight.scss
422+
423+
### Annotations with numbers
424+
425+
Prior to [:octicons-tag-24: 8.1.0][code annotation markers], code annotations
426+
were rendered with markers showing the original number as used by the author.
427+
However, for technical reasons code annotation numbers restart each code block,
428+
which might lead to confusion. For this reason, code annotations now render as
429+
`+` signs which are rotated if they're open to denote that clicking them again
430+
will close them.
431+
432+
If you wish to revert to the prior behavior and display code annotation numbers,
433+
you can add an [additional style sheet] and copy and paste the following CSS:
434+
435+
=== ":octicons-file-code-16: docs/stylesheets/extra.css"
436+
437+
``` css
438+
.md-typeset .md-annotation__index > ::before {
439+
content: attr(data-md-annotation-id);
440+
}
441+
.md-typeset :focus-within > .md-annotation__index > ::before {
442+
transform: none;
443+
}
444+
```
445+
446+
=== ":octicons-file-code-16: mkdocs.yml"
447+
448+
``` yaml
449+
extra_css:
450+
- stylesheets/extra.css
451+
```
452+
453+
[code annotation markers]: https://github.com/squidfunk/mkdocs-material/releases/tag/8.1.0

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

+16-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ The [Highlight] extension adds support for syntax highlighting of code blocks
308308

309309
``` yaml
310310
markdown_extensions:
311-
- pymdownx.highlight
311+
- pymdownx.highlight:
312+
anchor_linenums: true
312313
- pymdownx.superfences # (1)
313314
```
314315

@@ -414,6 +415,19 @@ The following configuration options are supported:
414415
copying a code block to the clipboard. Thus, the usage of either `table`
415416
or `pymdownx-inline` is recommended.
416417

418+
`anchor_linenums`{ #anchor-linenums }
419+
420+
: [:octicons-tag-24: 8.1.0][anchor_linenums support] · :octicons-milestone-24:
421+
Default: `false` – If a code blocks contains line numbers, enabling this
422+
setting will wrap them with anchor links, so they can be hyperlinked and
423+
shared more easily:
424+
425+
``` yaml
426+
markdown_extensions:
427+
- pymdownx.highlight:
428+
anchor_linenums: true
429+
```
430+
417431
The other configuration options of this extension are not officially supported
418432
by Material for MkDocs, which is why they may yield unexpected results. Use
419433
them at your own risk.
@@ -435,6 +449,7 @@ See reference for usage:
435449
[additional CSS]: ../../customization.md#additional-css
436450
[Highlight.js]: https://highlightjs.org/
437451
[title]: ../../reference/code-blocks.md#adding-a-title
452+
[anchor_linenums support]: https://github.com/squidfunk/mkdocs-material/releases/tag/8.1.0
438453
[Adding line numbers]: ../../reference/code-blocks.md#adding-line-numbers
439454
[Using code blocks]: ../../reference/code-blocks.md#usage
440455
[Adding a title]: ../../reference/code-blocks.md#adding-a-title

material/base.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<link rel="canonical" href="{{ page.canonical_url }}">
2323
{% endif %}
2424
<link rel="icon" href="{{ config.theme.favicon | url }}">
25-
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-8.0.5">
25+
<meta name="generator" content="mkdocs-{{ mkdocs_version }}, mkdocs-material-8.1.0">
2626
{% endblock %}
2727
{% block htmltitle %}
2828
{% if page and page.meta and page.meta.title %}

mkdocs.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ markdown_extensions:
137137
emoji_index: !!python/name:materialx.emoji.twemoji
138138
emoji_generator: !!python/name:materialx.emoji.to_svg
139139
- pymdownx.highlight:
140-
line_spans: __codeline
141-
anchor_linenums: True
140+
anchor_linenums: true
142141
- pymdownx.inlinehilite
143142
- pymdownx.keys
144143
- pymdownx.magiclink:

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mkdocs-material",
3-
"version": "8.0.5",
3+
"version": "8.1.0",
44
"description": "A Material Design theme for MkDocs",
55
"keywords": [
66
"mkdocs",

0 commit comments

Comments
 (0)