From 2aacffc9d6d452fe3f9c294476b84dc809efa240 Mon Sep 17 00:00:00 2001 From: GeoJulien Date: Wed, 13 Dec 2023 12:17:37 +0100 Subject: [PATCH] add option to enable/disable integration --- mkdocs_rss_plugin/config.py | 1 + mkdocs_rss_plugin/plugin.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/mkdocs_rss_plugin/config.py b/mkdocs_rss_plugin/config.py index f4b57f1e..3da4120e 100644 --- a/mkdocs_rss_plugin/config.py +++ b/mkdocs_rss_plugin/config.py @@ -31,3 +31,4 @@ class RssPluginConfig(Config): pretty_print = config_options.Type(bool, default=False) url_parameters = config_options.Optional(config_options.Type(dict)) use_git = config_options.Type(bool, default=True) + use_material_social_cards = config_options.Type(bool, default=True) diff --git a/mkdocs_rss_plugin/plugin.py b/mkdocs_rss_plugin/plugin.py index cbcb2c60..e4cee0e9 100644 --- a/mkdocs_rss_plugin/plugin.py +++ b/mkdocs_rss_plugin/plugin.py @@ -83,14 +83,21 @@ def on_config(self, config: config_options.Config) -> dict: return config # integrations - check if theme is Material and if social cards are enabled - self.integration_material_social_cards_enabled = ( - is_social_plugin_enabled_mkdocs(mkdocs_config=config) - ) + if self.config.use_material_social_cards: + self.integration_material_social_cards_enabled = ( + is_social_plugin_enabled_mkdocs(mkdocs_config=config) + ) + else: + logger.debug( + "[rss-plugin] Integration with Social Cards (Material theme) is " + "disabled by option in Mkdocs configuration." + ) + self.integration_material_social_cards_enabled = False # instanciate plugin tooling self.util = Util( use_git=self.config.use_git, - integration_material=self.integration_material_social_cards_enabled, + integration_material_social_cards=self.integration_material_social_cards_enabled, ) # check template dirs