markdown-exec
Utilities to execute code blocks in Markdown files.
Decision gist · record as of 2026-08-14
Yes, if you maintain documentation with code examples that need to stay current. The low install friction, active maintenance, permissive license, and lack of known vulnerabilities make it safe to adopt. Install with caution only if your documentation build process runs untrusted code, since execution happens at build time—otherwise it's a straightforward win for keeping examples accurate.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; pymdown-extensions must be installed as a runtime dependency.
- Low friction: pure Python wheel with a single runtime dependency (pymdown-extensions).
- Actively maintained with recent releases; last commit 2026-07-08.
License · maintenance · safety
ISC (permissive) — ISC license is permissive and imposes minimal restrictions; suitable for both open-source and commercial use without copyleft obligations.
last release 2026-07-07 (38 days) · last repo commit 2026-07-08 · 172 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 975,437 downloads/mo, #4,596 on PyPI
Alternatives
Verify before relying
pip install markdown-exec
from markdown import Markdown
from markdown_exec import formatter, validator
Markdown(
extensions=["pymdownx.superfences"],
extension_configs={
"pymdownx.superfences": {
"custom_fences": [{
"name": "python",
"class": "python",
"validator": validator,
"format": formatter,
}]
}
}
)- Security implications of executing arbitrary code blocks during documentation builds
- Performance impact when processing large numbers of code blocks or long-running scripts
- Whether pyodide support is fully functional or still experimental
What it is and what it does
Markdown Exec is a Markdown extension that transforms code blocks into executable snippets. When you mark a code block with `exec="on"`, the extension runs that code and injects the output back into the document in place of the original block. It works as a plugin for MkDocs or as a standalone Markdown extension, integrating with pymdown-extensions' SuperFences to handle multiple languages including Python, bash, and console sessions.
The package is designed for documentation workflows where you want code examples to stay synchronized with their actual output—write a Python snippet that generates HTML or a bash command that lists files, and the rendered documentation automatically shows what that code produces. It supports optional ANSI color rendering for terminal output via the `ansi` extra, and can be configured to expect specific exit codes or handle errors gracefully.
Use it for
- Auto-generate API documentation by executing code examples that produce formatted output
- Keep shell command examples in docs synchronized with their real output
- Build documentation sites where Python snippets compute and display results
- Create reproducible tutorials where code blocks run during the build and embed their results
- Generate tables or formatted lists in Markdown by executing Python code that produces them
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you maintain documentation with code examples that need to stay current.
The low install friction, active maintenance, permissive license, and lack of known vulnerabilities make it safe to adopt. Install with caution only if your documentation build process runs untrusted code, since execution happens at build time—otherwise it's a straightforward win for keeping examples accurate.
Install
markdown-exec on PyPI
Before you install
Low friction: pure Python wheel with a single runtime dependency (pymdown-extensions). Actively maintained with recent releases; last commit 2026-07-08. Requires Python 3.10 or later.
Requires Python 3.10 or later; pymdown-extensions must be installed as a runtime dependency.
License in practice
ISC license is permissive and imposes minimal restrictions; suitable for both open-source and commercial use without copyleft obligations.
Quickstart
pip install markdown-exec
from markdown import Markdown
from markdown_exec import formatter, validator
Markdown(
extensions=["pymdownx.superfences"],
extension_configs={
"pymdownx.superfences": {
"custom_fences": [{
"name": "python",
"class": "python",
"validator": validator,
"format": formatter,
}]
}
}
)
Verify before relying
- Security implications of executing arbitrary code blocks during documentation builds
- Performance impact when processing large numbers of code blocks or long-running scripts
- Whether pyodide support is fully functional or still experimental
Package facts
| License | ISC permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepymdown-extensions |
| Maintenance | Actively maintained 38 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 975,437 / month, #4,596 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: DocumentationTopic :: Software DevelopmentTopic :: UtilitiesTyping :: Typed |
Evidence: markdown_exec-1.12.3-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “execute code in markdown”
- markdown-execExecutes code blocks embedded in Markdown files and replaces them…
- pytest-codeblocksA pytest plugin that automatically discovers and runs Python and…
- pytest-markdown-docsA pytest plugin that executes Python code snippets embedded in…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also cogapp · pytest-markdown-docs · doccmd · markdown-callouts · mkdocs-markdownextradata-plugin · md2pdf · mkdocs-kroki-plugin · mkdocs-macros-plugin · mkdocs-click · sybil