Skip to content

Commit

Permalink
chore: add log only when the theme is overriden
Browse files Browse the repository at this point in the history
  • Loading branch information
aladjadj committed May 23, 2022
1 parent 9dc5814 commit b93b069
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
log = logging.getLogger(__name__)
log.addFilter(warning_filter)


TECHDOCS_DEFAULT_THEME = "material"
class TechDocsCore(BasePlugin):
def __init__(self):
# This directory will be removed automatically once the docs are built
Expand All @@ -49,12 +49,14 @@ def on_config(self, config):
mdx_configs_override = config["mdx_configs"].copy()

# Theme
if config["theme"].name != "material":
log.info("[mkdocs-techdocs-core] The theme has been replaced by 'material'")
if config["theme"].name != TECHDOCS_DEFAULT_THEME:
config["theme"] = Theme(name=TECHDOCS_DEFAULT_THEME)
elif config["theme"].name == TECHDOCS_DEFAULT_THEME:
log.info(
"[mkdocs-techdocs-core] Set theme.name to 'material' to override theme options"
"[mkdocs-techdocs-core] Overridden '%s' theme settings in use",
TECHDOCS_DEFAULT_THEME
)
config["theme"] = Theme(name="material")

config["theme"].static_templates.update({"techdocs_metadata.json"})
config["theme"].dirs.append(self.tmp_dir_techdocs_theme.name)

Expand Down

0 comments on commit b93b069

Please sign in to comment.