Metadata-Version: 2.2
Name: help2md
Version: 1.5
Summary: Convert a help message to markdown text
Home-page: https://www.pg12.org/software
Author: A Andersen
Author-email: a.andersen@pg12.org
License: Modified BSD License
Project-URL: Download, https://www.pg12.org/dist/py/lib/help2md/
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: project-url
Dynamic: summary

 - [Convert a help message to markdown text](#Convert+a+help+messa)
 - [Install the `help2md` module](#Install+the+%60help2md)
 - [Function `help2md`](#help2md1)
 - [Use the  `help2md` module as a console script](#Use+the++%60help2md%60+m)
     - [Command `help2md`](#Command+%60help2md%60)

### <a id="Convert+a+help+messa"></a>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`](https://github.com/valeriangalliat/help2md) and my own
version of this awk script updated to better match the help message
generated by the `argparse` module:
[`help2md-argparse.awk`](https://www.pg12.org/dist/py/lib/help2md/help2md-argparse.awk)
([web-friendly
format](https://www.pg12.org/dist/py/lib/help2md/help2md-argparse.html)).

### <a id="Install+the+%60help2md"></a>Install the `help2md` module

The `help2md` module should be installed with `pip`:

```bash
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`](https://pypi.org/project/pypimdoc/)
module. The source code of the module (without the console script part) can
be found at my [file repository](https://www.pg12.org/dist/py/lib/help2md/).


### <a id="help2md1"></a>Function `help2md`

```python
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


### <a id="Use+the++%60help2md%60+m"></a>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`:

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


#### <a id="Command+%60help2md%60"></a>Command `help2md`


*Convert a help message to markdown text*

**Usage:**

```bash
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)

