fix: defaults for mike incorrectly set

Signed-off-by: squidfunk <martin.donath@squidfunk.com>
This commit is contained in:
Martin Donath
2026-08-13 14:37:29 +02:00
committed by GitHub
parent d1602b04a2
commit bb2cbee9e8
2 changed files with 22 additions and 11 deletions
+17
View File
@@ -171,6 +171,23 @@ class TestPluginShimming:
config = self._parse_yaml(tmp_path, plugins={"glightbox": {}})
assert GlightboxExtension.name in config["markdown_extensions"]
def test_mike_plugin_defaults_with_versioned_build(
self, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
) -> None:
monkeypatch.setenv("MIKE_DOCS_VERSION", "0.3")
config = self._parse_yaml(
tmp_path,
site_url="https://example.com",
plugins=["mike"],
)
assert config["site_url"] == "https://example.com/0.3"
assert config["plugins"]["mike"]["config"] == {
"alias_type": "symlink",
"redirect_template": None,
"deploy_prefix": "",
"canonical_version": None,
}
def test_glightbox_adds_extension_and_forwards_config(
self, tmp_path: Path
) -> None:
+5 -11
View File
@@ -1286,17 +1286,11 @@ def _convert_plugins(value: Any, config: dict) -> dict:
# building the site, while only allowing for our theme at the moment.
version = os.environ.get("MIKE_DOCS_VERSION")
if version and config.get("site_url"):
mike = set_default(
plugins,
"mike",
{
"alias_type": "symlink",
"redirect_template": None,
"deploy_prefix": "",
"canonical_version": None,
},
dict,
)
mike = set_default(plugins, "mike", {}, dict)
set_default(mike, "alias_type", "symlink", str)
set_default(mike, "redirect_template", None)
set_default(mike, "deploy_prefix", "", str)
set_default(mike, "canonical_version", None)
# Copied and adapted from mike's plugin implementation
if mike["canonical_version"] is not None: