Skip to main content

Convert a help message to markdown text

This module provides the help2md Python function that converts a help message (the output from a command when the -h flag is given) to a valid and well-formated markdown text.

The module is inspired by the awk script help2md and my own version of this awk script updated to better match the help message generated by the argparse module: help2md-argparse.awk (web-friendly format).

Install the help2md module

The help2md module should be installed with pip:

pip install help2md

This will install the module help2md implementing the help2md function and the console script help2md. The help2md function is also embedded in the pypimdoc module. The source code of the module (without the console script part) can be found at my file repository.

Function help2md

help2md(help_msg: str) -> str

Convert a help message to markdown text

Convert a command help message (the output from a command when the -h flag is given) to a valid and well-formated markdown text. This function is tailored for the help messages produced by Python programs using the argparse module.

Arguments/return value:

help_msg: The help message to convert

returns: The markdown text

Use the help2md module as a console script

You can use the module as a console script to convert the help message output of a command to markdown. In this example the helpmessage of the pypimdoc command is converted to markdown and saved in the file pypimdoc-help.md:

pypimdoc -h | help2md -o pypimdoc-help.md

Command help2md

Convert a help message to markdown text

Usage:

help2md [-h] [-V] [-o OUTFILE] [-i INFILE]

Options:

Name Description
-h, --help show this help message and exit
-V, --version show program's version number and exit
-o, --outfile OUTFILE output file (default stdout)
-i, --infile INFILE input file (default stdin)

Metadata

Release files for help2md 1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for help2md 1.5
File Size Uploaded Provenance
help2md-1.5.tar.gz 5.3 kB Without provenance Details

Release files / help2md-1.5.tar.gz

Download URL help2md-1.5.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ae77837cb3dd4796ff284302a4e78a09b636f1a14a7c280101568546724fcc62
BLAKE2b-256 checksum
How to use checksums
c21eaaa5eea78bcc793ed5b165d015a527e84052568fbfcbbd671e960a716b9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for help2md 1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page