Skip to main content

A light-weight markdown code documentation generator

Project description

MarkdownDocs

markdowndocs is a light-weight markdown documentation generator that generates a simple .md file that documents your code based on your docstrings and raw code.


Installation and usage | Usage | Using markdowndocs with pre-commit | Contributor guidelines | Code documentation


Installation and usage

Installation

Install with:

pip install markdowndocs

Usage

Options

To run markdowndocs on all modules in your working directory:

$ markdowndocs --all

To run markdowndocs on (a) specific module(s) in your working directory:

$ markdowndocs --module-names <my_module>

To run markdowndocs on on all modules in your working directory, except (a) specific module(s):

$ markdowndocs --exclude-modules <my_module>

Full options and use:

$ markdowndocs --help
usage: markdowndocs [-h] [--output-file-name NAME] [--add-to-readme]
                    [--exclude-dependencies] [--exclude-code] [--version]
                    (-a | -m NAME [NAME ...] | -e NAME [NAME ...])

Markdown documentation package.

optional arguments:
  -h, --help            show this help message and exit
  --output-file-name NAME
                        Use this option to specify a custom output file name
                        for the .md documentation [default:
                        code_documentation.md]
  --add-to-readme       If enabled, adds a link to your documentation file to
                        your README.md file with the following format: ## Code
                        documentation [Code
                        Documentation](code_documentation.md) [default: False]
  --exclude-dependencies
                        If enabled, includes a list of dependencies for each
                        module. [default: False]
  --exclude-code        If enabled, excludes the raw code for each function.
                        [default: False]
  --version             Show version information and exit.
  -a, --all             Use this option to generate documentation for all
                        modules in your current working directory [default:
                        False]
  -m NAME [NAME ...], --module-names NAME [NAME ...]
                        Use this option to generate documentation for a
                        specific module or modules
  -e NAME [NAME ...], --exclude-modules NAME [NAME ...]
                        Use this option to exclude a specific module or
                        multiple modules from the documentation generator

Output

By default, the generated markdown documentation is stored in a file called code_documentation.md. You can use the --output-file-name argument to set a custom file name. The following is included in the output by default:

  • User-defined docstrings for modules, classes, and functions (including private methods);
  • Internal links and nested tables of content for all modules, classes, and functions;
  • A list of dependencies (i.e. imports) for each module;
  • The raw code for each function.

Examples

Markdowndocs output for:

Known limitations

  • markdowndocs will only pick up modules in directories in your working directory, but not in sub-directories (i.e. only one level of "nestedness" is currently supported)
  • markdowndocs assumes that all imports in your code work, that is, do not refer to non-existing modules.
  • markdowndocs does not play nicely with pydantic.

Using markdowndocs with pre-commit hooks

To use markdowndocs to generate up-to-date documentation upon every new commit, add the following configuration to your .pre-commit-config.yaml file (and add your preferred configuration options in the args field):

repos:
-   repo: https://github.com/ngoet/markdowndocs
    rev: 0.1.0
    hooks:
    - id: markdowndocs
      pass_filenames: false
      args: ["-m", "<my-module-name>",
             "--add-to-readme"]

Contributor guidelines

Suggestions for improvements are appreciated. Please open an issue if you find anything is broken, or if you'd like to suggest changes.

Code documentation

Code documentation

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

markdowndocs-0.1.0.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

markdowndocs-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: markdowndocs-0.1.0.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.6

File hashes

Hashes for markdowndocs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d83fe0406bb5aee920f7ffb25b5ab31bcf0a063d3fe44640c405a3c46315550f
MD5 50636add98e00260fdc582cbec572915
BLAKE2b-256 49e1a288ba5c53c987f7c710f91b95076777c2c3b3370d6b0e3328799dc07263

See more details on using hashes here.

File details

Details for the file markdowndocs-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: markdowndocs-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.50.1 CPython/3.7.6

File hashes

Hashes for markdowndocs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07a25d86f3d663f99e038a13d755451251f5d0f68ffea205f8a469723ffce336
MD5 8f84ced14b3d00c6cf4abc2bd160115c
BLAKE2b-256 d5e1de3ca386b9bd2eb079e489d05326e64cf60689f76993ffd94db11fa596be

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