Skip to content

Fix pymdownx.extra config #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ We only use `material-mkdocs` as base styles because Backstage also uses the `Ma

## Changelog

### 1.4.2
- 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)

### 1.4.1
- Introduced mkdocs-redirects plugin (v`1.2.1`).

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@

setup(
name="mkdocs-techdocs-core",
version="1.4.1",
version="1.4.2",
description="The core MkDocs plugin used by Backstage's TechDocs as a wrapper around "
"multiple MkDocs plugins and Python Markdown extensions",
long_description=long_description,
long_description_content_type="text/markdown",
keywords="mkdocs",
url="https://github.com/backstage/mkdocs-techdocs-core",
author="TechDocs Core",
author_email="pulp-fiction@spotify.com",
author_email="protean@spotify.com",
license="Apache-2.0",
python_requires=">=3.7",
install_requires=required,
Expand Down
13 changes: 12 additions & 1 deletion src/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from material.plugins.search.plugin import SearchPlugin as MaterialSearchPlugin
from mkdocs_monorepo_plugin.plugin import MonorepoPlugin
from pymdownx.emoji import to_svg
from pymdownx.extra import extra_extensions

log = logging.getLogger(__name__)

Expand Down Expand Up @@ -114,7 +115,6 @@ def on_config(self, config):
config["markdown_extensions"].append("pymdownx.mark")
config["markdown_extensions"].append("pymdownx.smartsymbols")
config["markdown_extensions"].append("pymdownx.snippets")
config["markdown_extensions"].append("pymdownx.superfences")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing here since pymdownx.superfences is already supplied from pymdownx.extra

config["markdown_extensions"].append("pymdownx.highlight")
config["mdx_configs"]["pymdownx.highlight"] = {
"linenums": True,
Expand All @@ -134,6 +134,17 @@ def on_config(self, config):
}
config["markdown_extensions"].append("pymdownx.tilde")

# merge individual extension configs under the pymdownx.extra extension namespace if individual extension is supplied by pymdownx.extra
# https://facelessuser.github.io/pymdown-extensions/extensions/extra/
if "pymdownx.extra" not in config["mdx_configs"]:
config["mdx_configs"]["pymdownx.extra"] = {}
for extension in extra_extensions:
if extension in config["mdx_configs"]:
config["mdx_configs"]["pymdownx.extra"][extension] = config[
"mdx_configs"
][extension]
del config["mdx_configs"][extension]

config["markdown_extensions"].append("markdown_inline_graphviz")
config["markdown_extensions"].append("plantuml_markdown")
config["markdown_extensions"].append("mdx_truly_sane_lists")
Expand Down
Loading