docstring-to-markdown
On the fly conversion of Python docstrings to markdown
What it is and what it does
docstring-to-markdown is a lightweight converter that transforms Python docstrings written in reStructuredText or Google format into Markdown. It's designed to run on demand, making it useful in documentation pipelines, code analysis tools, or any workflow that needs to normalize docstring formats. The package supports Python 3.7 and later, with tested coverage through Python 3.13.
The converter works by recognizing the input format and applying format-specific transformations—for example, converting RST math notation like `:math:\`\\sum\`` to Markdown's dollar-sign syntax `$\\sum$`. When the format is unrecognized, it raises UnknownFormatError. The package is designed to be extended: custom converters can be registered via entry points, and built-in converters can be overridden by providing matching entry points.
Use it for:
- Normalize docstrings across a codebase from RST to Markdown for consistent documentation rendering.
- Generate Markdown documentation from existing Python modules with reStructuredText docstrings.
- Integrate into documentation build tools (e.g., Sphinx plugins) to convert docstring formats on the fly.
- Support Google-style docstrings in projects that need Markdown output for API documentation.
- Build custom docstring processors by extending the converter via entry points for domain-specific formats.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Converts Python docstrings from reStructuredText and Google format to Markdown on the fly, with extensibility via entry points for custom converters.
Yes, if you need to convert reStructuredText or Google-format docstrings to Markdown. The package is lightweight, has no security vulnerabilities, and integrates well into documentation workflows. The aging maintenance status (469 days since last release) is a minor concern for a stable, narrowly-scoped tool, but the repository remains active. The copyleft license (LGPL-2.1-or-later) is a consideration if you plan to redistribute or embed it in proprietary code.
Install
docstring-to-markdown on PyPI
pip
pip install docstring-to-markdownuv
uv add docstring-to-markdownpoetry
poetry add docstring-to-markdownInstalling docstring-to-markdown
Before you install
Low friction install with minimal dependencies (importlib-metadata, typing_extensions). Maintenance status is aging—last release was 469 days ago, though the repository remains active with a recent commit on 2025-06-20.
License in practice
Licensed under LGPL-2.1-or-later (copyleft). Any derivative work or distribution must preserve the same license terms and make source available.
Quickstart
pip install docstring-to-markdown
import docstring_to_markdown
result = docstring_to_markdown.convert(':math:`\\sum`')
print(result) # '$\\sum$'
Requires Python 3.7 or later; raises UnknownFormatError when docstring format cannot be recognized.
Verify before relying
- Extent of Google-format docstring support beyond 'initial' (v0.13 onward) and which Google-style features are actually handled.
- Performance characteristics when processing large batches of docstrings or very long docstrings.
- Completeness of reStructuredText feature coverage—which RST constructs convert successfully and which may fail or degrade.
Package facts
| License | LGPL-2.1-or-later (copyleft) |
| Python support | supports the current Python release (>=3.7) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — importlib-metadata, typing_extensions |
| Maintenance | aging — 469 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,419,455/month — #3,928 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: docstring_to_markdown-0.17-py3-none-any.whl
Keywords: Docstring, conversion, markdown
Tags
More Markup packages
PyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
markdown-it-pyA Python markdown parser that converts markdown…
permissive · top 100 on PyPI
beautifulsoup4Beautiful Soup parses HTML and XML documents…
permissive · top 100 on PyPI
et-xmlfileet_xmlfile writes large XML files with minimal…
permissive · top 1,000 on PyPI
tomlkitParses and edits TOML files while preserving…
permissive · top 1,000 on PyPI
docstring-parserParses Python docstrings in ReST, Google,…
permissive · top 1,000 on PyPI
m2r2Converts markdown files with embedded…
permissive · top 15,000 on PyPI
sphinxcontrib-napoleonA Sphinx extension that converts Google and…
permissive · top 15,000 on PyPI
docstrfmtAutomatically formats reStructuredText in files…
permissive · top 15,000 on PyPI
sphinx_mdincludeSphinx extension that lets you include and…
permissive · top 15,000 on PyPI
setuptools-markdownConverts Markdown files to reStructuredText…
permissive · top 15,000 on PyPI
docrepDocrep provides utilities to intelligently…
permissive · top 15,000 on PyPI
rich-rstRenders reStructuredText documents as Rich…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
docstring-parser-forkParses Python docstrings in ReST, Google,…
permissive · top 5,000 on PyPI
flake8-rst-docstringsA flake8 plugin that validates Python…
permissive · top 15,000 on PyPI