Skip to main content

Wrappers to translate Napoleon/Sphinx docstrings to HTML.

Project description

napoleon2html

https://badge.fury.io/py/napoleon2html.png https://pypip.in/d/napoleon2html/badge.png

This project contains functions that encapsulate tranlation of Sphinx or Napoleon docstrings to HTML.

Documentation

There are three function, that can be used: napoleon_to_sphinx(), sphinx_to_html() and napoleon_to_html().

napoleon_to_sphinx()

This function can take documentation in Napoleon format and translate it to Sphinx.

Usage:

napoleon2html.napoleon_to_sphinx("""
    Description of function

    Args:
        argument (str): Description of argument.

    Returns:
        int: Description of return.
""")

Output:

Description of function

:Parameters: **argument** (*str*) --
             Description of argument.

:returns: *int* --
          Description of return.

sphinx_to_html()

Then there is the sphinx_to_html(), which converts string in Sphinx format to HTML:

napoleon2html.sphinx_to_html("""
    Description of function

    :Parameters: **argument** (*str*) --
                 Description of argument.

    :returns: *int* --
              Description of return.
""")

Output:

<blockquote>
<p>Description of function</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>argument</strong> (<em>str</em>) --
Description of argument.</td>
</tr>
<tr class="field"><th class="field-name">returns:</th><td class="field-body"><em>int</em> --
Description of return.</td>
</tr>
</tbody>
</table>
</blockquote>

napoleon_to_html()

Last function is napoleon_to_html(), which wraps the previous two.

Changelog

0.1.0

  • Project created.

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

napoleon2html-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

File details

Details for the file napoleon2html-0.1.0.tar.gz.

File metadata

File hashes

Hashes for napoleon2html-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7f7f9f03141c9b41da89b9bdf133931dda7118d2acef9164d497c40baa27dfd
MD5 0f46cd1c22a0f3881aecf35d2a789190
BLAKE2b-256 81ea438bc3a146b0294ff222397de4d3c292792ca7487a3564a5df0f1bdf115d

See more details on using hashes here.

Supported by

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