Skip to content

Commit

Permalink
fix: Support custom theme directory configuration
Browse files Browse the repository at this point in the history
This fixes the mkdocs-material's `custom_dir` configuration,
where theme `name` is set to null in mkdocs.yaml.
Thereby, this fix adds support to automatically read `theme_name` from `dirs` attribute,
if `name` attribute is None (null), otherwise default behaviour will occur.

Fixes #120.
PR #121.
  • Loading branch information
abhiTronix authored Jun 7, 2020
1 parent e114b21 commit 1243cf6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/mkdocstrings/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"""

import logging
import os
import random
import re
import string
Expand Down Expand Up @@ -151,8 +152,14 @@ def on_config(self, config: Config, **kwargs) -> Config:

log.debug("mkdocstrings.plugin: Adding extension to the list")

theme_name = None
if config["theme"].name is None:
theme_name = os.path.dirname(config["theme"].dirs[0])
else:
theme_name = config["theme"].name

extension_config = {
"theme_name": config["theme"].name,
"theme_name": theme_name,
"mdx": config["markdown_extensions"],
"mdx_configs": config["mdx_configs"],
"mkdocstrings": self.config,
Expand Down

0 comments on commit 1243cf6

Please sign in to comment.