Skip to main content

On the fly conversion of Python docstrings to markdown

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

docstring_to_markdown-0.16.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docstring_to_markdown-0.16-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file docstring_to_markdown-0.16.tar.gz.

File metadata

  • Download URL: docstring_to_markdown-0.16.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for docstring_to_markdown-0.16.tar.gz
Algorithm Hash digest
SHA256 097bf502fdf040b0d019688a7cc1abb89b98196801448721740e8aa3e5075627
MD5 9d120935a4a478ff249311dd73f840f9
BLAKE2b-256 581f16e6d4026e94224d662dcd344dcd3563bc8a74a272f2c27b325793cad5fc

See more details on using hashes here.

File details

Details for the file docstring_to_markdown-0.16-py3-none-any.whl.

File metadata

File hashes

Hashes for docstring_to_markdown-0.16-py3-none-any.whl
Algorithm Hash digest
SHA256 f92cc42357b2c932f70ca2ebc79f7805039a34011ad381c1b6ac3481e81596ce
MD5 cc8ea6093179058ddd3f42664de25148
BLAKE2b-256 47a6bf7cda3cc85ad1f8cfbf1ede45ade2c5c25f0a315f8a11e4a7943de66af7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page