Skip to content

Commit 1532878

Browse files
authored
Fix check for superfences config when loaded via pymdownx.extra
The check for the `superfences` config failed when `superfences` was loaded by `pymdownx.extra`. In particular, this means that the plugin failed to work with the defaults set up by Spotify's `techdocs-core` plugin. In this PR, the check is adapted to also check for the `pymdownx.superfences` configuration inside the `pymdownx.extra` configuration.
1 parent aa7a774 commit 1532878

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mkdocs_charts_plugin/plugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ def on_config(self, config, **kwargs):
5959
config["extra_javascript"] = ["js/mkdocs-charts-plugin.js"] + config["extra_javascript"]
6060

6161
# Make sure custom fences are configured.
62-
custom_fences = config.get("mdx_configs", {}).get("pymdownx.superfences", {}).get("custom_fences", {})
62+
parent_config = config.get("mdx_configs", {})
63+
if "pymdownx.superfences" not in parent_config:
64+
# If "superfences" was loaded through the "extra" plugin,
65+
# then its config will be in a different place
66+
parent_config = parent_config.get("pymdownx.extra", {})
67+
custom_fences = parent_config.get("pymdownx.superfences", {}).get("custom_fences", {})
6368
if not custom_fences:
6469
raise PluginError(
6570
"[mkdocs_charts_plugin]: You have not configured any custom fences, please see the setup instructions."

0 commit comments

Comments
 (0)