Skip to content

Commit

Permalink
feat: Pass config file path to handlers
Browse files Browse the repository at this point in the history
This is to allow handlers to build potential paths
(like Python search paths) relative to the MkDocs
configuration file path instead of the current
working directory. Without it, the build becomes
dependent on the CWD, breaking the --config-file
option.

Issue #311: #311
PR #425: #425
  • Loading branch information
pawamoy committed Apr 25, 2022
1 parent 3335310 commit cccebc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/mkdocstrings/handlers/base.py
Expand Up @@ -571,8 +571,9 @@ def get_handler(self, name: str, handler_config: Optional[dict] = None) -> BaseH
)
)
self._handlers[name] = module.get_handler(
self._config["theme_name"],
self._config["mkdocstrings"]["custom_templates"],
theme=self._config["theme_name"],
custom_templates=self._config["mkdocstrings"]["custom_templates"],
config_file_path=self._config["config_file_path"],
**handler_config,
)
return self._handlers[name]
Expand Down
1 change: 1 addition & 0 deletions src/mkdocstrings/plugin.py
Expand Up @@ -166,6 +166,7 @@ def on_config(self, config: Config, **kwargs: Any) -> Config: # noqa: W0613 (un

extension_config = {
"site_name": config["site_name"],
"config_file_path": config["config_file_path"],
"theme_name": theme_name,
"mdx": config["markdown_extensions"],
"mdx_configs": config["mdx_configs"],
Expand Down

0 comments on commit cccebc4

Please sign in to comment.