Skip to content

Commit e30b814

Browse files
committed
Updated code block annotation usage
1 parent 4f15e6e commit e30b814

6 files changed

+21
-7
lines changed

docs/publishing-your-site.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ contents:
2525

2626
=== "Material for MkDocs"
2727

28-
``` { .yaml .annotate }
28+
``` yaml
2929
name: ci # (1)
3030
on:
3131
push:

docs/reference/code-blocks.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,14 @@ to the corresponding tooltip.
223223

224224
In order to opt-in to annotation support, a slightly different syntax is
225225
required – just add the respective [language short code][17] and the `.annotate`
226-
class, after the three backticks.
226+
class, after the three backticks. Alternatively, if you want to enable annotations
227+
globally, add the following to `mkdocs.yml`:
228+
229+
``` yaml
230+
theme:
231+
features:
232+
- content.code.annotate
233+
```
227234

228235
Note that annotations can be __placed anywhere__ in a code block where a comment
229236
for the language can be placed, which for JavaScript is `// (1)` and
@@ -232,7 +239,7 @@ for the language can be placed, which for JavaScript is `// (1)` and
232239
_Example_:
233240

234241
```` markdown
235-
``` { .js .annotate }
242+
``` js
236243
document$.subscribe(function() { // (1)
237244
var tables = document.querySelectorAll(/* (2) */ "article table")
238245
tables.forEach(function(table) {
@@ -247,7 +254,7 @@ document$.subscribe(function() { // (1)
247254

248255
_Result_:
249256

250-
``` { .js .annotate }
257+
``` js
251258
document$.subscribe(function() { // (1)
252259
var tables = document.querySelectorAll(/* (2) */ "article table")
253260
tables.forEach(function(table) {

docs/setup/setting-up-site-analytics.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,13 @@ Add the following to `mkdocs.yml`:
7272

7373
``` yaml
7474
extra:
75-
consent: true
75+
consent:
76+
title: Cookie consent
77+
description: >
78+
We use cookies to recognize your repeated visits and preferences, as well
79+
as to measure the effectiveness of our documentation and whether users
80+
find what they're searching for. With your consent, you're helping us to
81+
make our documentation better.
7682
```
7783
7884
When a user first visits your site, a cookie consent form is rendered:

docs/setup/setting-up-site-search.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ When a user enters a query into the search box, the query is pre-processed
276276
before it is submitted to the search index. Material for MkDocs will apply the
277277
following transformations, which can be customized by [extending the theme][20]:
278278

279-
``` { .ts .annotate }
279+
``` ts
280280
export function defaultTransform(query: string): string {
281281
return query
282282
.split(/"([^"]+)"/g) /* (1) */

docs/setup/setting-up-versioning.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ 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 .annotate }
78+
``` html
7979
{% block outdated %}
8080
You're not viewing the latest version.
8181
<a href="{{ '../' ~ base_url }}"> <!-- (1) -->

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ theme:
5151
# Default values, taken from mkdocs_theme.yml
5252
language: en
5353
features:
54+
- content.code.annotate
5455
- content.tabs.link
5556
# - navigation.instant
5657
- navigation.sections

0 commit comments

Comments
 (0)