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.17.tar.gz (32.3 kB view details)

Uploaded Source

Built Distribution

docstring_to_markdown-0.17-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: docstring_to_markdown-0.17.tar.gz
  • Upload date:
  • Size: 32.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for docstring_to_markdown-0.17.tar.gz
Algorithm Hash digest
SHA256 df72a112294c7492487c9da2451cae0faeee06e86008245c188c5761c9590ca3
MD5 c0376556ad66ae9dacd4bbdfae420fea
BLAKE2b-256 52d88abe80d62c5dce1075578031bcfde07e735bcf0afe2886dd48b470162ab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for docstring_to_markdown-0.17.tar.gz:

Publisher: publish.yml on python-lsp/docstring-to-markdown

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for docstring_to_markdown-0.17-py3-none-any.whl
Algorithm Hash digest
SHA256 fd7d5094aa83943bf5f9e1a13701866b7c452eac19765380dead666e36d3711c
MD5 4aba454952a09c150976a72e78fd60cf
BLAKE2b-256 567baf3d0da15bed3a8665419bb3a630585756920f4ad67abfdfef26240ebcc0

See more details on using hashes here.

Provenance

The following attestation bundles were made for docstring_to_markdown-0.17-py3-none-any.whl:

Publisher: publish.yml on python-lsp/docstring-to-markdown

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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