From d4203f65bb59c902251f48bbfe7681e2afecb60e Mon Sep 17 00:00:00 2001 From: squidfunk Date: Fri, 7 Feb 2025 10:42:04 +0700 Subject: [PATCH] Fixed group plugin crashing on ENV vars for enabled setting --- material/plugins/group/config.py | 9 ++++++++- src/plugins/group/config.py | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/material/plugins/group/config.py b/material/plugins/group/config.py index ce7156e4e..d9a45ad03 100644 --- a/material/plugins/group/config.py +++ b/material/plugins/group/config.py @@ -27,5 +27,12 @@ from mkdocs.config.base import Config # Group plugin configuration class GroupConfig(Config): - enabled = Type(bool, default = False) + # While the canonical type for this setting is obviously bool, setting it + # from environment variables seems to have different effects on different + # systems. For instance, setting CI=true seems to correctly work on macOS, + # but not on Linux – see https://t.ly/MWj0H. + # + # Thus, as long as the value evaluates to a truthy or falsy value, the + # plugin will work as expected, until we find a better solution. + enabled = Type((bool, str, int), default = False) plugins = Type((list, dict)) diff --git a/src/plugins/group/config.py b/src/plugins/group/config.py index ce7156e4e..d9a45ad03 100644 --- a/src/plugins/group/config.py +++ b/src/plugins/group/config.py @@ -27,5 +27,12 @@ from mkdocs.config.base import Config # Group plugin configuration class GroupConfig(Config): - enabled = Type(bool, default = False) + # While the canonical type for this setting is obviously bool, setting it + # from environment variables seems to have different effects on different + # systems. For instance, setting CI=true seems to correctly work on macOS, + # but not on Linux – see https://t.ly/MWj0H. + # + # Thus, as long as the value evaluates to a truthy or falsy value, the + # plugin will work as expected, until we find a better solution. + enabled = Type((bool, str, int), default = False) plugins = Type((list, dict))