Skip to content

Commit 923127d

Browse files
authored
update(theme): bump Material for Mkdocs minimal version to 9.7 and adapt to full features (#74)
See: https://squidfunk.github.io/mkdocs-material/blog/2025/11/11/insiders-now-free-for-everyone/
2 parents 71abea9 + b952ffd commit 923127d

12 files changed

+25
-232
lines changed

.github/labeler.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ theme:
4141
- changed-files:
4242
- any-glob-to-any-file:
4343
- content/theme/**/*
44-
- requirements-insiders.txt
4544
- head-branch:
4645
- theme
4746
- ^theme

.github/workflows/deploy.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,13 @@ jobs:
4242
- name: Set up Python
4343
uses: actions/setup-python@v6
4444
with:
45-
python-version: 3.11
45+
python-version: 3.12
4646
cache: "pip"
4747

4848
- name: Install dependencies
49-
env:
50-
GH_TOKEN_MATERIAL_INSIDERS: ${{ secrets.GH_TOKEN_MATERIAL_INSIDERS }}
5149
run: |
5250
python -m pip install --upgrade pip setuptools wheel
53-
python -m pip install --upgrade -r requirements-insiders.txt
51+
python -m pip install --upgrade -r requirements.txt
5452
5553
- name: Cache build dependencies (external assets downloaded)
5654
uses: actions/cache@v4

.github/workflows/issue_comment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
uses: actions/setup-python@v6
2222
with:
2323
cache: "pip"
24-
python-version: 3.11
24+
python-version: 3.12
2525

2626
- name: Parse template form
2727
uses: stefanbuck/github-issue-parser@v3

.github/workflows/links_checker.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ jobs:
2323
- name: Set up Python
2424
uses: actions/setup-python@v6
2525
with:
26-
python-version: 3.11
26+
python-version: 3.12
2727
cache: "pip"
2828

2929
- name: Install dependencies
30-
env:
31-
GH_TOKEN_MATERIAL_INSIDERS: ${{ secrets.GH_TOKEN_MATERIAL_INSIDERS }}
3230
run: |
3331
python -m pip install --upgrade pip setuptools wheel
34-
python -m pip install --upgrade -r requirements-insiders.txt
32+
python -m pip install --upgrade -r requirements.txt
3533
python -m pip install --upgrade "LinkChecker>=10,<11"
3634
3735
- name: Build static website

.github/workflows/pr_checker_build.yml

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,14 @@ jobs:
3434
- name: Set up Python
3535
uses: actions/setup-python@v6
3636
with:
37-
python-version: 3.11
37+
python-version: 3.12
3838
cache: "pip"
3939

4040
- name: Install dependencies
4141
id: dependencies
42-
env:
43-
GH_TOKEN_MATERIAL_INSIDERS: ${{ secrets.GH_TOKEN_MATERIAL_INSIDERS }}
4442
run: |
4543
python -m pip install -U pip setuptools wheel
46-
47-
# if secret (PR created by repo collaborator) exists = paid features, else only free
48-
if [[ -z "${GH_TOKEN_MATERIAL_INSIDERS}" ]]; then
49-
echo "::warning:: L'accès aux token est réservé aux comptes avec droits d'écriture sur le dépôt. La version gratuite du thème est donc utilisée sans mots-clés, etc.)"
50-
python -m pip install -U -r requirements-free.txt
51-
echo "MKDOCS_CONFIG_FILENAME=mkdocs-free.yml" >> $GITHUB_ENV
52-
else
53-
# install insiders version using token
54-
python -m pip install -U -r requirements-insiders.txt
55-
echo "MKDOCS_CONFIG_FILENAME=mkdocs.yml" >> $GITHUB_ENV
56-
fi
57-
44+
python -m pip install -U -r requirements.txt
5845
- name: Cache build dependencies (external assets downloaded)
5946
uses: actions/cache@v4
6047
with:
@@ -76,13 +63,13 @@ jobs:
7663
export MKDOCS_SITE_URL="https://${NETLIFY_SITE_PREFIX}--${NETLIFY_SITE_NAME}.netlify.app/"
7764
7865
# merge different configs
79-
python scripts/100_mkdocs_config_merger.py -c ${{ env.MKDOCS_CONFIG_FILENAME }}
66+
python scripts/100_mkdocs_config_merger.py
8067
8168
# build
82-
mkdocs build --config-file ${{ env.MKDOCS_CONFIG_FILENAME }} --strict
69+
mkdocs build --strict
8370
8471
# save mkdocs.yml for debug
85-
cp ${{ env.MKDOCS_CONFIG_FILENAME }} ${{ env.BUILD_DIR }}
72+
cp mkdocs.yml ${{ env.BUILD_DIR }}
8673
8774
# remove files reserved for production
8875
rm ${{ env.BUILD_DIR }}/CNAME

.github/workflows/pr_linter_markdown.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
uses: reviewdog/[email protected]
3131
with:
3232
github_token: ${{ secrets.GITHUB_TOKEN }}
33-
fail_on_error: true
33+
fail_level: warning
3434
filter_mode: added
3535
reporter: github-pr-review
3636

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
exclude: "node_modules|migrations|.venv|tests/dev/|tests/fixtures/"
1+
exclude: ".venv|tests/dev/|tests/fixtures/"
22

33
repos:
44
- repo: meta
@@ -25,7 +25,7 @@ repos:
2525
hooks:
2626
- id: pyupgrade
2727
args:
28-
- "--py39-plus"
28+
- "--py312-plus"
2929

3030
- repo: https://github.com/astral-sh/ruff-pre-commit
3131
rev: "v0.14.3"

hooks/mkdocs/G003_social_cards_adapter.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@
2727
# standard library
2828
import logging
2929
from pathlib import Path
30-
from typing import Optional
3130

3231
# Mkdocs
33-
from material import __version__ as material_version
3432
from material.plugins.social.plugin import SocialPlugin
3533
from mkdocs.config.defaults import MkDocsConfig
3634
from mkdocs.plugins import event_priority
@@ -44,9 +42,6 @@
4442
logger = logging.getLogger("mkdocs")
4543
hook_name = Path(__file__).stem
4644

47-
# check si c'est la version Insiders (payante) ou la version Communauté (gratuite) du thème
48-
is_insiders = "insiders" in material_version
49-
5045
# ###########################################################################
5146
# ########## Functions #############
5247
# ##################################
@@ -55,7 +50,7 @@
5550
@event_priority(50)
5651
def on_page_markdown(
5752
markdown: str, *, page: Page, config: MkDocsConfig, files: Files
58-
) -> Optional[str]:
53+
) -> str | None:
5954
"""
6055
The `page_markdown` event is called after the page's markdown is loaded
6156
from file and can be used to alter the Markdown source text. The meta-
@@ -106,23 +101,22 @@ def on_page_markdown(
106101

107102
# si la page a une icône, on adapte le template de l'image (disponible que pour Insiders)
108103
# ref : https://squidfunk.github.io/mkdocs-material/reference#setting-the-page-icon
109-
if page.meta.get("icon") and is_insiders:
104+
if page.meta.get("icon"):
110105
cards_layout = "default/variant"
111106
logger.info(
112107
f"[{hook_name}] La page {page.abs_url} a une icône définie "
113108
f"({page.meta.get('icon')}). Dans ce cas, le modèle de social "
114109
f"card est : {cards_layout}"
115110
)
116-
elif is_insiders:
111+
else:
117112
cards_layout = social_plugin.config.cards_layout
118113

119114
# définit les paramètres pour les social cards au niveau de la page
120-
if is_insiders:
121-
page.meta["social"] = {
122-
"cards": True,
123-
"cards_layout": cards_layout,
124-
"cards_layout_options": social_plugin.config.cards_layout_options,
125-
}
115+
page.meta["social"] = {
116+
"cards": True,
117+
"cards_layout": cards_layout,
118+
"cards_layout_options": social_plugin.config.cards_layout_options,
119+
}
126120
# else:
127121
# page.meta["social"] = {
128122
# "cards": True,

mkdocs-free.yml

Lines changed: 0 additions & 165 deletions
This file was deleted.

requirements-free.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)