15
15
# package
16
16
from mkdocs_rss_plugin .constants import MKDOCS_LOGGER_NAME
17
17
18
+ # conditional
19
+ try :
20
+ from material import __version__ as material_version
21
+ except ImportError :
22
+ material_version = None
23
+
18
24
# ############################################################################
19
25
# ########## Globals #############
20
26
# ################################
@@ -32,6 +38,7 @@ class IntegrationMaterialSocialCards:
32
38
IS_SOCIAL_PLUGIN_ENABLED : bool = True
33
39
IS_SOCIAL_PLUGIN_CARDS_ENABLED : bool = True
34
40
IS_THEME_MATERIAL : bool = False
41
+ IS_INSIDERS : bool = False
35
42
36
43
def __init__ (self , mkdocs_config : Config , switch_force : bool = True ) -> None :
37
44
"""Integration instanciation.
@@ -84,6 +91,23 @@ def is_theme_material(self, mkdocs_config: Config) -> bool:
84
91
self .IS_THEME_MATERIAL = mkdocs_config .theme .name == "material"
85
92
return self .IS_THEME_MATERIAL
86
93
94
+ def is_theme_material_insiders (self ) -> bool | None :
95
+ """Check if the material theme is community or insiders edition.
96
+
97
+ Returns:
98
+ bool: True if the theme is Insiders edition. False if community. None if
99
+ the Material theme is not installed.
100
+ """
101
+ if not self .IS_THEME_MATERIAL :
102
+ return None
103
+
104
+ if material_version is not None and "insiders" in material_version :
105
+ logger .debug ("Material theme edition INSIDERS" )
106
+ return True
107
+ else :
108
+ logger .debug ("Material theme edition COMMUNITY" )
109
+ return False
110
+
87
111
def is_social_plugin_enabled_mkdocs (self , mkdocs_config : Config ) -> bool :
88
112
"""Check if social plugin is installed and enabled.
89
113
0 commit comments