From 918c42eaa09bc5313fd1702aabdd5dc7d6fb5d08 Mon Sep 17 00:00:00 2001 From: Kattni Date: Thu, 4 Jun 2026 22:19:08 -0400 Subject: [PATCH] Include dir only if present. --- src/beeware_docs_tools/md_tempdir.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/beeware_docs_tools/md_tempdir.py b/src/beeware_docs_tools/md_tempdir.py index e81090b1..e22c04e2 100644 --- a/src/beeware_docs_tools/md_tempdir.py +++ b/src/beeware_docs_tools/md_tempdir.py @@ -68,23 +68,22 @@ def save_config(project_path, temp_md_path, config, language="en"): base_path = config["markdown_extensions"]["pymdownx.snippets"].get("base_path", []) - contribution_root = config["extra"].get( - "contribution_guide_root", "how-to/contribute" - ) + contribution_root = config["extra"].get("contribution_guide_root") if language != "en": shared_content_path = temp_md_path.resolve() / f"shared_content/{language}" - local_docs_path = temp_md_path.resolve() / language / contribution_root + if contribution_root: + local_docs_path = temp_md_path.resolve() / language / contribution_root else: shared_content_path = (Path(__file__).parent / "shared_content/en").resolve() - local_docs_path = (project_path / "docs/en" / contribution_root).resolve() + if contribution_root: + local_docs_path = (project_path / "docs/en" / contribution_root).resolve() base_path.append(str(shared_content_path)) config["markdown_extensions"]["pymdownx.snippets"]["base_path"] = base_path - config["plugins"]["macros"]["include_dir"] = [ - str(shared_content_path), - str(local_docs_path), - ] + config["plugins"]["macros"]["include_dir"] = [str(shared_content_path)] + if contribution_root: + config["plugins"]["macros"]["include_dir"].append(str(local_docs_path)) with (temp_md_path / "config.yml").open("w", encoding="utf-8") as config_f: yaml.dump(config, config_f)