Skip to main content

Pythonista markdown document generator from single file docstrings

Project description

docgen

Pythonista markdown document generator from a single file, intended to be used to generate documentation for Github. Included in the generated documentation are:

  • Module-level docstring.
  • Classes and their functions, with docstrings.
  • Module-level functions and their docstrings.
  • Decorators are included, with the following special cases:
    • Properties are placed in a separate section, using the docstring of the getter.
    • on_main_thread decorators are ignored.
  • A table of contents.

Functions and methods that start with '_' are not included in the documentation.

Usage

Include this script in the Pythonista action (wrench) menu, and run it to generate documentation for the file currently open in the editor.

You can choose to just view the resulting documentation as HTML, or also save it as either README.md or <script_name>.md.

Menu image

Table of contents is included after the module docstring.

There are some special directives you can use to fine-tune the output. These are magic comment strings that must be preceeded only by white space.

  • #docgen-toc - Table of contents will replace this string if found in the module docstring, so that you can have the ToC in the middle of it instead of at the end.
  • #docgen: (with a space after the colon) - Use to group functions into related groups. The text you provide after the colon will be included in the table of contents.

API

Class: Processor

Methods to generate markdown documentation from source classes, functions and their docstrings.

Methods

get_markdown(self, include_undocumented=False)

Produces the markdown for the file.

Optional arguments:

  • include_undocumented - set to True to include classes and methods without a docstring.

get_sections(self)

get_section_title(self, line_no)

for_classes(self)

for_functions(self, c, heading, toc_level)

build_toc(self, toc)

Functions

UTILITY FUNCTIONS

el(parent, astdef)

eldoc(body, astdef)

slugify(s)

Simplifies ugly strings into something URL-friendly.

slugify("[Some] _ Article's Title--") --> some-articles-title

From http://blog.dolphm.com/slugify-a-string-in-python/

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

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

Source Distribution

pythonista-docgen-1.0.tar.gz (297.2 kB view details)

Uploaded Source

Built Distribution

pythonista_docgen-1.0-py2.py3-none-any.whl (5.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pythonista-docgen-1.0.tar.gz.

File metadata

  • Download URL: pythonista-docgen-1.0.tar.gz
  • Upload date:
  • Size: 297.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.22.0

File hashes

Hashes for pythonista-docgen-1.0.tar.gz
Algorithm Hash digest
SHA256 1ae92b520b233ad52567ad4e573318bc990bbfabb0445197148a2afdc2ebb40f
MD5 1afdb591ad1ad07a52689348a9221ba4
BLAKE2b-256 7f6af71f0d83dc2e5dbc5eb24ba30159856a0e6e96f448c828e997a335a4d137

See more details on using hashes here.

File details

Details for the file pythonista_docgen-1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pythonista_docgen-1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d301398ecec9aa07497fd1a130e243fb67f2c304b15219aaa06d860217aace17
MD5 e0be9dd78008fc31b65cd0183a42c0bc
BLAKE2b-256 77740255a4de88afb800375b93427e3ff4c6d0f24186afd00667ccd18e33930f

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