Skip to content

python-lsp/docstring-to-markdown

Folders and files

NameName
Last commit message
Last commit date
Mar 25, 2025
Mar 25, 2025
Mar 25, 2025
Feb 7, 2021
Feb 7, 2021
Mar 21, 2023
Mar 25, 2025
Mar 24, 2025
Mar 24, 2025
Mar 25, 2025
Nov 19, 2022

Repository files navigation

docstring-to-markdown

tests CodeQL pypi-version

On the fly conversion of Python docstrings to markdown

  • Python 3.7+ (tested on 3.8 up to 3.13)
  • can recognise reStructuredText and convert multiple of its features to Markdown
  • since v0.13 includes initial support for Google-formatted docstrings

Installation

pip install docstring-to-markdown

Example

Convert reStructuredText:

>>> import docstring_to_markdown
>>> docstring_to_markdown.convert(':math:`\\sum`')
'$\\sum$'

When given the format cannot be recognised an exception will be raised:

>>> docstring_to_markdown.convert('\\sum')
Traceback (most recent call last):
    raise UnknownFormatError()
docstring_to_markdown.UnknownFormatError

Extensibility

docstring_to_markdown entry point group allows to add custom converters which follow the Converter protocol. The built-in converters can be customized by providing entry point with matching name.

Development

pip install -e .
pytest

About

On the fly conversion of Python docstrings to markdown

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

Languages