Extension pack for Python Markdown that provides 20+ specialized extensions for enhanced text processing.
npx @tessl/cli install tessl/pypi-pymdown-extensions@10.16.0A comprehensive collection of extensions for Python Markdown that significantly enhances its functionality beyond the standard library. Provides 20+ specialized extensions covering syntax highlighting, mathematical expressions, enhanced emphasis formatting, code fencing with custom formatters, emoji support, task lists, tabbed content, progress bars, smart symbols, and advanced linking capabilities.
pip install pymdown-extensionspip install pymdown-extensions[extra] (includes Pygments for syntax highlighting)import markdownTypical usage pattern:
import markdown
# Use extensions by name
md = markdown.Markdown(extensions=['pymdownx.betterem', 'pymdownx.superfences'])Direct extension import:
from pymdownx import betterem, superfences
# Create extension instances
md = markdown.Markdown(extensions=[
betterem.makeExtension(),
superfences.makeExtension()
])import markdown
# Basic markdown with pymdown extensions
md = markdown.Markdown(extensions=[
'pymdownx.betterem', # Better emphasis handling
'pymdownx.superfences', # Enhanced code blocks
'pymdownx.tasklist', # Task lists with checkboxes
'pymdownx.emoji', # Emoji support
'pymdownx.magiclink' # Auto-linking
])
# Convert markdown to HTML
text = """
# Example Document
This is **bold** and *italic* text.
- [x] Completed task
- [ ] Pending task
:smile: :heart: :+1:
https://github.com/facelessuser/pymdown-extensions
"""
html = md.convert(text)
print(html)PyMdown Extensions follows the standard Python-Markdown extension pattern:
markdown.ExtensionmakeExtension() functions provide standard instantiation interfacepymdownx.util for extension developmentThe package provides a consistent API across all extensions while offering extensive customization options for each specific markdown enhancement.
Extensions that enhance text formatting including better emphasis handling, insert/delete markup, superscript/subscript, highlighting, and smart symbol replacement.
# Better emphasis with configurable asterisk/underscore handling
def makeExtension(**kwargs): ... # pymdownx.betterem
# Insert tags and superscript using caret syntax
def makeExtension(**kwargs): ... # pymdownx.caret
# Delete strikethrough and subscript using tilde syntax
def makeExtension(**kwargs): ... # pymdownx.tilde
# Text highlighting using mark tags
def makeExtension(**kwargs): ... # pymdownx.mark
# Smart replacement of ASCII with Unicode symbols
def makeExtension(**kwargs): ... # pymdownx.smartsymbolsExtensions for syntax highlighting, mathematical expressions, inline code highlighting, and enhanced fenced code blocks with custom formatters.
# Advanced code syntax highlighting
def makeExtension(**kwargs): ... # pymdownx.highlight
# Inline code syntax highlighting
def makeExtension(**kwargs): ... # pymdownx.inlinehilite
# Enhanced fenced code blocks with custom formatters
def makeExtension(**kwargs): ... # pymdownx.superfences
# LaTeX math rendering support
def makeExtension(**kwargs): ... # pymdownx.arithmatex
# Base64 image embedding for offline documents
def makeExtension(**kwargs): ... # pymdownx.b64Extensions for organizing content including task lists, tabbed interfaces, collapsible details, progress bars, and enhanced lists.
# GitHub-style task lists with checkboxes
def makeExtension(**kwargs): ... # pymdownx.tasklist
# Tabbed content blocks and interfaces
def makeExtension(**kwargs): ... # pymdownx.tabbed
# HTML details/summary collapsible blocks
def makeExtension(**kwargs): ... # pymdownx.details
# Visual progress bars with percentage indicators
def makeExtension(**kwargs): ... # pymdownx.progressbar
# Enhanced ordered lists with custom numbering
def makeExtension(**kwargs): ... # pymdownx.fancylistsExtensions for automatic linking, emoji support, keyboard key formatting, and link processing enhancements.
# Comprehensive emoji support with multiple providers
def makeExtension(**kwargs): ... # pymdownx.emoji
# Automatic linking for URLs, emails, repositories
def makeExtension(**kwargs): ... # pymdownx.magiclink
# Keyboard key styling and formatting
def makeExtension(**kwargs): ... # pymdownx.keys
# Convert and normalize file paths in links
def makeExtension(**kwargs): ... # pymdownx.pathconverterExtensions using the generic blocks framework for admonitions, captions, definitions, HTML blocks, and other structured content.
# Generic block processing framework
def makeExtension(**kwargs): ... # pymdownx.blocks
# Individual block implementations
class Admonition: ... # pymdownx.blocks.admonition
class Details: ... # pymdownx.blocks.details
class Tab: ... # pymdownx.blocks.tab
class Caption: ... # pymdownx.blocks.caption
class Definition: ... # pymdownx.blocks.definition
class HTML: ... # pymdownx.blocks.htmlUtility extensions, content processing tools, and specialized functionality including snippet inclusion, HTML processing, and development utilities.
# Include external file content and code snippets
def makeExtension(**kwargs): ... # pymdownx.snippets
# Remove or escape HTML tags
def makeExtension(**kwargs): ... # pymdownx.striphtml
# Escape any character with backslash
def makeExtension(**kwargs): ... # pymdownx.escapeall
# CriticMarkup support for tracked changes
def makeExtension(**kwargs): ... # pymdownx.critic
# Enhanced version of Python-Markdown Extra
def makeExtension(**kwargs): ... # pymdownx.extraAll PyMdown Extensions follow the standard Python-Markdown configuration pattern:
def makeExtension(*args, **kwargs):
"""
Standard extension factory function.
Parameters:
- *args: Positional arguments (usually config tuples)
- **kwargs: Configuration options as keyword arguments
Returns:
Extension instance configured with provided options
"""# Common utilities for extension development
class PatternSequenceProcessor: ...
def clamp(value, min_val, max_val): ...
def escape_chars(md, chars): ...
def deprecated(message): ...# Standard Python-Markdown types
from markdown import Extension, Preprocessor, InlineProcessor, BlockProcessor, Treeprocessor, Postprocessor
# Extension configuration
ConfigOption = Any # Configuration option value
ExtensionConfig = Dict[str, ConfigOption] # Extension configuration dictionary