Pymdown Extensions
raw JSON → 10.21.2 verified Tue May 12 auth: no python install: verified
Pymdown Extensions is an extension pack for Python Markdown, offering a comprehensive collection of features to enhance Markdown rendering. It provides over 30 extensions for capabilities such as enhanced code blocks with highlighting, content tabs, emoji support, and mathematical notation. Currently at version 10.21.2, the library is actively developed with a consistent release cadence.
pip install pymdown-extensions Common errors
error Error: Failed loading extension "pymdownx.<extension_name>" ↓
cause This error typically occurs when an extension listed in the MkDocs configuration (`mkdocs.yml`) is either not installed, misspelled, or has an incorrect YAML configuration (e.g., improper indentation for options).
fix
Ensure
pymdown-extensions is installed (pip install pymdown-extensions). Double-check the extension name for typos in mkdocs.yml, confirm correct YAML indentation for any extension options, and verify that all necessary sub-dependencies (like Pygments for highlight) are met. Sometimes, a pip install pymdown-extensions --force followed by mkdocs build --clean can resolve caching issues. error ModuleNotFoundError: No module named 'pymdownx' ↓
cause This error means the Python interpreter cannot find the `pymdown-extensions` package or its modules, usually due to the package not being installed, installed in a different environment, or an issue with Python's path.
fix
Install the package using pip:
pip install pymdown-extensions. If it's already installed, ensure you're running your application in the correct Python environment where the package is installed. If using MkDocs, ensure it's installed in the same environment as MkDocs itself. error Arithmatex Generic Mode Not Working in MkDocs ↓
cause When using the `Arithmatex` extension in generic mode with MkDocs, math rendering may fail if there are conflicts with other plugins, notably `mkdocs-minify-plugin`, or if MathJax/KaTeX is not correctly configured to process the generic output format.
fix
If
mkdocs-minify-plugin is in use, either disable it or switch Arithmatex to its 'default' mode with proper MathJax configuration as outlined in the documentation. Ensure your MathJax/KaTeX configuration explicitly looks for the Arithmatex generic output patterns (e.g., \(...\) and \[...\]) and that processEnvironments is enabled for \begin{}...\end{} blocks. error Code blocks with new pymdownx.tabbed not rendering ↓
cause This issue often arises when the syntax for code blocks within `pymdownx.tabbed` (or its newer block-style equivalent `pymdownx.blocks.tab`) is incorrect, or if `pymdownx.tabbed` and `pymdownx.blocks.tab` are used simultaneously, causing conflicts due to identical output.
fix
Ensure the Markdown syntax for tabs and nested code blocks is correct. If migrating from
pymdownx.tabbed to pymdownx.blocks.tab, disable pymdownx.tabbed in mkdocs.yml as they are not meant to be used together. Verify that pymdownx.superfences (which handles code block highlighting) is also correctly configured if using pymdownx.tabbed or pymdownx.blocks.tab. error ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. ↓
cause This message indicates a dependency conflict where different installed packages require incompatible versions of `pymdown-extensions` (or other shared libraries), preventing a clean installation or upgrade.
fix
Identify the conflicting packages. You might need to either upgrade/downgrade the conflicting packages to a compatible version, or install
pymdown-extensions with a specific version that satisfies all dependencies. For example, pip install pymdown-extensions==<compatible_version> or use pip install --no-deps <package_name> and manage dependencies manually (with caution). Warnings
breaking The 'Critic' extension's `view` mode was deprecated in version 10.18 and is slated for future removal. Users should explicitly set `mode` to either `accept` or `reject` to avoid warnings and ensure future compatibility. ↓
fix Update Critic extension configuration to use `mode: accept` or `mode: reject` instead of `view`.
gotcha The 'Highlight' extension, prior to version 10.21.2, had issues handling `None` as a filename for code block titles, leading to potential errors with newer Pygments versions. ↓
fix Upgrade to version 10.21.2 or later. Ensure a string is always provided for `filename` if custom titles are used.
gotcha The new 'Quotes' extension (introduced in 10.20) handles blockquote grouping differently than Python Markdown's default, following a more modern parsing approach. This may change expected behavior if migrating from the default blockquote parsing. ↓
fix Review documentation for the 'Quotes' extension, especially regarding its grouping behavior, and adjust content or expectations if coming from Python Markdown's default blockquote parsing.
gotcha A bug in 'Arithmatex' prior to 10.19.1 could cause incorrect parsing of block math (`$$`) when used inline within a paragraph, resulting in nested math parsing issues. ↓
fix Upgrade to version 10.19.1 or later to resolve the nested math parsing issue.
breaking The test script (`/script.py`) encountered a Python `SyntaxError: unmatched ')'`, indicating an issue with the script's syntax rather than a direct library behavior. This prevents the library from being effectively tested. ↓
fix Correct the Python syntax error in `/script.py` (specifically, the unmatched parenthesis on line 15) to allow the test to proceed and evaluate the library functionality.
Install compatibility verified last tested: 2026-05-12 v10.21.2 (up to date)
python os / libc status wheel install import disk mem side effects
3.10 alpine (musl) wheel - 0.15s 25.1M 5.7M clean
3.10 alpine (musl) - - 0.14s 25.1M 5.7M -
3.10 slim (glibc) wheel 1.9s 0.12s 26M 5.7M clean
3.10 slim (glibc) - - 0.14s 26M 5.7M -
3.11 alpine (musl) wheel - 0.17s 26.1M 5.9M clean
3.11 alpine (musl) - - 0.21s 26.1M 5.9M -
3.11 slim (glibc) wheel 2.0s 0.15s 27M 5.9M clean
3.11 slim (glibc) - - 0.16s 27M 5.9M -
3.12 alpine (musl) wheel - 0.14s 17.8M 5.8M clean
3.12 alpine (musl) - - 0.17s 17.8M 5.8M -
3.12 slim (glibc) wheel 1.8s 0.15s 19M 5.8M clean
3.12 slim (glibc) - - 0.16s 19M 5.8M -
3.13 alpine (musl) wheel - 0.18s 17.6M 6.1M clean
3.13 alpine (musl) - - 0.17s 17.5M 6.1M -
3.13 slim (glibc) wheel 1.8s 0.14s 19M 5.9M clean
3.13 slim (glibc) - - 0.15s 19M 5.9M -
3.9 alpine (musl) wheel - 0.09s 23.2M 5.6M clean
3.9 alpine (musl) - - 0.12s 23.2M 5.6M -
3.9 slim (glibc) wheel 2.4s 0.09s 24M 5.6M clean
3.9 slim (glibc) - - 0.13s 24M 5.6M -
Imports
- markdown.Markdown
import markdown html = markdown.Markdown(extensions=['pymdownx.superfences', 'pymdownx.highlight']).convert(md_text)
Quickstart last tested: 2026-04-24
import markdown
md_text = '''
# Hello Pymdown!
This is a simple markdown with `inline code`.
```python
# SuperFences and Highlight example
def greet(name):
print(f"Hello, {name}!")
greet("World")
```
''')
# To use Pymdown Extensions, pass their names (prefixed with 'pymdownx.')
# to the 'extensions' argument of markdown.Markdown.
# 'superfences' allows nested code blocks, and 'highlight' provides syntax highlighting.
html = markdown.Markdown(
extensions=[
'pymdownx.superfences',
'pymdownx.highlight',
'pymdownx.emoji'
]
).convert(md_text)
print(html)