Skip to content

Commit 8bc1e2a

Browse files
authored
Fix pymdownx.extra config (#214)
1 parent 08ea60c commit 8bc1e2a

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ We only use `material-mkdocs` as base styles because Backstage also uses the `Ma
149149

150150
## Changelog
151151

152+
### 1.4.2
153+
- Fixes an issue where individual extension configurations were being ignored if the extension was included within `pymdownx.extra`. See [#147](https://github.com/backstage/mkdocs-techdocs-core/issues/147)
154+
152155
### 1.4.1
153156
- Introduced mkdocs-redirects plugin (v`1.2.1`).
154157

setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@
2828

2929
setup(
3030
name="mkdocs-techdocs-core",
31-
version="1.4.1",
31+
version="1.4.2",
3232
description="The core MkDocs plugin used by Backstage's TechDocs as a wrapper around "
3333
"multiple MkDocs plugins and Python Markdown extensions",
3434
long_description=long_description,
3535
long_description_content_type="text/markdown",
3636
keywords="mkdocs",
3737
url="https://github.com/backstage/mkdocs-techdocs-core",
3838
author="TechDocs Core",
39-
author_email="pulp-fiction@spotify.com",
39+
author_email="protean@spotify.com",
4040
license="Apache-2.0",
4141
python_requires=">=3.7",
4242
install_requires=required,

src/core.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from material.plugins.search.plugin import SearchPlugin as MaterialSearchPlugin
2424
from mkdocs_monorepo_plugin.plugin import MonorepoPlugin
2525
from pymdownx.emoji import to_svg
26+
from pymdownx.extra import extra_extensions
2627

2728
log = logging.getLogger(__name__)
2829

@@ -114,7 +115,6 @@ def on_config(self, config):
114115
config["markdown_extensions"].append("pymdownx.mark")
115116
config["markdown_extensions"].append("pymdownx.smartsymbols")
116117
config["markdown_extensions"].append("pymdownx.snippets")
117-
config["markdown_extensions"].append("pymdownx.superfences")
118118
config["markdown_extensions"].append("pymdownx.highlight")
119119
config["mdx_configs"]["pymdownx.highlight"] = {
120120
"linenums": True,
@@ -134,6 +134,17 @@ def on_config(self, config):
134134
}
135135
config["markdown_extensions"].append("pymdownx.tilde")
136136

137+
# merge individual extension configs under the pymdownx.extra extension namespace if individual extension is supplied by pymdownx.extra
138+
# https://facelessuser.github.io/pymdown-extensions/extensions/extra/
139+
if "pymdownx.extra" not in config["mdx_configs"]:
140+
config["mdx_configs"]["pymdownx.extra"] = {}
141+
for extension in extra_extensions:
142+
if extension in config["mdx_configs"]:
143+
config["mdx_configs"]["pymdownx.extra"][extension] = config[
144+
"mdx_configs"
145+
][extension]
146+
del config["mdx_configs"][extension]
147+
137148
config["markdown_extensions"].append("markdown_inline_graphviz")
138149
config["markdown_extensions"].append("plantuml_markdown")
139150
config["markdown_extensions"].append("mdx_truly_sane_lists")

0 commit comments

Comments
 (0)