usage: argparse-html.py [-h] [-a ARG_A] [-b PARAM_B] [-v] [-d] [-c] [--html-usage] [--html-usage-raw]

This script demonstrates how to automatically convert argparse output to HTML. See also the class HTMLFormatter.

It's a hack. It does not produce a very clean HTML (there's an extra ', for instance). But it's good enough for me. An empty (or spaces-only) line is considered as a paragraph separator.

I needed to produce HTML as a single line and thus this is the default output. This is not part of the class and can be easily changed in the wrapper function html_usage().

optional arguments

For Interactive Use

Note that we use RawTextHelpFormatter as the parser, rather than HelpFormatter itself. Otherwise splitting to paragarphs with empty lines won't show up in the standard --help output.

If you have no problem with that, you can remove the formatter_class parameter above.