Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit e8aa17a

Browse files
committed
Migrated examples to new structure
1 parent 2c455e2 commit e8aa17a

File tree

35 files changed

+142
-339
lines changed

35 files changed

+142
-339
lines changed

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Examples
22

3-
- [Tags]
4-
- [Tags with icons]
3+
This repository contains runnable examples for [Material for MkDocs].
54

6-
[Tags]: example/tags/
7-
[Tags with icons]: examples/tags-with-icons/
5+
[Material for MkDocs]: https://squidfunk.github.io/mkdocs-material/

examples/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,8 @@ def transform(project: MkDocsConfig, config: MkDocsConfig):
4545
project.copyright = config.copyright
4646

4747
# Inherit settings for theme
48-
merge(project.theme["icon"], config.theme["icon"])
4948
project.theme["features"].extend(config.theme["features"])
49+
if "icon" in project.theme:
50+
merge(project.theme["icon"], config.theme["icon"])
51+
else:
52+
project.theme["icon"] = config.theme["icon"]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Using the color palette system preference
2+
3+
This example shows how to implement the [color palette toggle] so that it
4+
automatically uses the user's [system preference]. Click on the button left
5+
to the search bar to switch between modes.
6+
7+
[color palette toggle]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#color-palette-toggle
8+
[system preference]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#system-preference
Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Martin Donath <[email protected]>
1+
# Copyright (c) 2016-2023 Martin Donath <[email protected]>
22

33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to
@@ -19,42 +19,41 @@
1919
# IN THE SOFTWARE.
2020

2121
# -----------------------------------------------------------------------------
22-
# Recommended: set up configuration validation, see https://bit.ly/3WT2GkR
22+
# Recommended: set up configuration validation, see https://t.ly/xpZXU
2323
# -----------------------------------------------------------------------------
2424

2525
# Project information
26-
site_name: Linking a color palette to the user's system preference
27-
28-
# Repository
29-
repo_name: mkdocs-material/examples
30-
repo_url: https://github.com/mkdocs-material/examples
31-
edit_uri: edit/master/examples/color-palette-system-preferencence/docs
26+
site_name: Using the color palette system preference
3227

3328
# Theme
3429
theme:
3530
name: material
3631
features:
3732
- navigation.sections
38-
3933
palette:
40-
41-
# Palette toggle for light mode
34+
- media: "(prefers-color-scheme)"
35+
toggle:
36+
icon: material/brightness-auto
37+
name: Switch to light mode
4238
- media: "(prefers-color-scheme: light)"
4339
scheme: default
40+
primary: indigo
41+
accent: indigo
4442
toggle:
4543
icon: material/brightness-7
4644
name: Switch to dark mode
47-
48-
# Palette toggle for dark mode
4945
- media: "(prefers-color-scheme: dark)"
5046
scheme: slate
47+
primary: indigo
48+
accent: indigo
5149
toggle:
5250
icon: material/brightness-4
53-
name: Switch to light mode
51+
name: Switch to system preference
5452

5553
# Markdown extensions
5654
markdown_extensions:
5755
- attr_list
5856
- toc:
5957
permalink: true
60-
58+
- pymdownx.highlight
59+
- pymdownx.superfences

packages/cookie-consent/requirements.txt renamed to examples/color-palette-system-preference/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Martin Donath <[email protected]>
1+
# Copyright (c) 2016-2023 Martin Donath <[email protected]>
22

33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Using the color palette toggle
2+
3+
This example shows how to implement the [color palette toggle] to let users switch
4+
between light and dark mode. Click on the button left to the search bar to
5+
switch between modes.
6+
7+
[color palette toggle]: https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#color-palette-toggle
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Martin Donath <[email protected]>
1+
# Copyright (c) 2016-2023 Martin Donath <[email protected]>
22

33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to
@@ -19,43 +19,35 @@
1919
# IN THE SOFTWARE.
2020

2121
# -----------------------------------------------------------------------------
22-
# Recommended: set up configuration validation, see https://bit.ly/3WT2GkR
22+
# Recommended: set up configuration validation, see https://t.ly/xpZXU
2323
# -----------------------------------------------------------------------------
2424

2525
# Project information
26-
site_name: Using a light and dark color palette
27-
28-
# Repository
29-
repo_name: mkdocs-material/examples
30-
repo_url: https://github.com/mkdocs-material/examples
31-
edit_uri: edit/master/examples/color-palette-toggle/docs
26+
site_name: Using the color palette toggle
3227

3328
# Theme
3429
theme:
3530
name: material
3631
features:
3732
- navigation.sections
38-
39-
4033
palette:
41-
42-
# Palette toggle for light mode
4334
- scheme: default
35+
primary: indigo
36+
accent: indigo
4437
toggle:
4538
icon: material/brightness-7
4639
name: Switch to dark mode
47-
48-
# Palette toggle for dark mode
4940
- scheme: slate
41+
primary: indigo
42+
accent: indigo
5043
toggle:
5144
icon: material/brightness-4
5245
name: Switch to light mode
5346

54-
55-
5647
# Markdown extensions
5748
markdown_extensions:
5849
- attr_list
5950
- toc:
6051
permalink: true
61-
52+
- pymdownx.highlight
53+
- pymdownx.superfences

packages/cookie-consent-settings/requirements.txt renamed to examples/color-palette-toggle/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Martin Donath <[email protected]>
1+
# Copyright (c) 2016-2023 Martin Donath <[email protected]>
22

33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
title: Overview
3+
---
4+
5+
# Adding a cookie consent
6+
7+
This example shows how to add a [cookie consent]. [Click here] to bring
8+
up the cookie consent again.
9+
10+
[cookie consent]: https://squidfunk.github.io/mkdocs-material/setup/ensuring-data-privacy/#cookie-consent
11+
[Click here]: #__consent
Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022 Martin Donath <[email protected]>
1+
# Copyright (c) 2016-2023 Martin Donath <[email protected]>
22

33
# Permission is hereby granted, free of charge, to any person obtaining a copy
44
# of this software and associated documentation files (the "Software"), to
@@ -19,37 +19,32 @@
1919
# IN THE SOFTWARE.
2020

2121
# -----------------------------------------------------------------------------
22-
# Recommended: set up configuration validation, see https://bit.ly/3WT2GkR
22+
# Recommended: set up configuration validation, see https://t.ly/xpZXU
2323
# -----------------------------------------------------------------------------
2424

2525
# Project information
26-
site_name: Integrating a cookie consent
27-
28-
# Repository
29-
repo_name: mkdocs-material/examples
30-
repo_url: https://github.com/mkdocs-material/examples
31-
edit_uri: edit/master/examples/cookie-consent/docs
26+
site_name: Adding a cookie consent
3227

3328
# Theme
3429
theme:
3530
name: material
3631
features:
3732
- navigation.sections
3833

39-
34+
# Additional configuration
4035
extra:
4136
consent:
4237
title: Cookie consent
43-
description: >-
38+
description: >-
4439
We use cookies to recognize your repeated visits and preferences, as well
4540
as to measure the effectiveness of our documentation and whether users
4641
find what they're searching for. With your consent, you're helping us to
4742
make our documentation better.
4843
49-
5044
# Markdown extensions
5145
markdown_extensions:
5246
- attr_list
5347
- toc:
5448
permalink: true
55-
49+
- pymdownx.highlight
50+
- pymdownx.superfences

0 commit comments

Comments
 (0)