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

Commit fe93eb8

Browse files
committed
Adjusted transform to new projects plugin API
1 parent 02e8211 commit fe93eb8

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

examples/__init__.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,39 +22,38 @@
2222
import posixpath
2323

2424
from mergedeep import merge
25-
from mkdocs.config.defaults import MkDocsConfig
25+
from material.plugins.projects.structure import Project
2626

2727
# -----------------------------------------------------------------------------
2828
# Functions
2929
# -----------------------------------------------------------------------------
3030

3131
# Transform project configuration
32-
def transform(project: MkDocsConfig, config: MkDocsConfig):
33-
base = os.path.dirname(project.config_file_path)
32+
def transform(project: Project, root: Project):
33+
config = root.config
34+
35+
base = os.path.dirname(project.config.config_file_path)
3436
name = os.path.basename(base)
3537

3638
# Determine path of examples relative to root
3739
root = os.path.dirname(config.config_file_path)
3840
path = os.path.relpath(base, root)
3941

4042
# Inherit settings for repository
41-
project.repo_name = config.repo_name
42-
project.repo_url = f"{config.repo_url}/tree/master/{path}"
43+
project.config.repo_name = config.repo_name
44+
project.config.repo_url = f"{config.repo_url}/tree/master/{path}"
4345

4446
# Inherit settings for site URL and edit URI
45-
project.site_url = posixpath.join(config.site_url, name, "")
46-
project.edit_uri = f"edit/master/examples/{name}/docs/"
47-
48-
# Inherit settings for copyright
49-
project.copyright = config.copyright
47+
project.config.site_url = posixpath.join(config.site_url, name, "")
48+
project.config.edit_uri = f"edit/master/examples/{name}/docs/"
5049

5150
# Inherit settings for theme
52-
if "features" in project.theme:
53-
project.theme["features"].extend(config.theme["features"])
51+
if "features" in project.config.theme:
52+
project.config.theme["features"].extend(config.theme["features"])
5453
else:
55-
project.theme["features"] = config.theme["features"]
54+
project.config.theme["features"] = config.theme["features"]
5655

57-
if "icon" in project.theme:
58-
merge(project.theme["icon"], config.theme["icon"])
56+
if "icon" in project.config.theme:
57+
merge(project.config.theme["icon"], config.theme["icon"])
5958
else:
60-
project.theme["icon"] = config.theme["icon"]
59+
project.config.theme["icon"] = config.theme["icon"]

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ plugins:
5050
cache: false
5151
projects_dir: examples
5252
projects_config_transform: !!python/name:examples.transform
53-
log_level: warn
53+
log_level: info
5454

5555
# Hooks
5656
hooks:

0 commit comments

Comments
 (0)