5 releases

0.1.3 Dec 28, 2022
0.1.2 Dec 28, 2022
0.1.1 Dec 27, 2022
0.1.0 Dec 17, 2022
0.0.1 Dec 13, 2022

#66 in Development tools

Download history 1917/week @ 2024-01-06 1556/week @ 2024-01-13 1026/week @ 2024-01-20 1577/week @ 2024-01-27 4414/week @ 2024-02-03 4140/week @ 2024-02-10 3154/week @ 2024-02-17 2063/week @ 2024-02-24 2982/week @ 2024-03-02 2532/week @ 2024-03-09 2705/week @ 2024-03-16 2937/week @ 2024-03-23 3338/week @ 2024-03-30 2410/week @ 2024-04-06 3599/week @ 2024-04-13 2409/week @ 2024-04-20

12,168 downloads per month
Used in 40 crates (39 directly)


249 lines


Crates.io License Documentation

API Documentation | Changelog | Contributing

Automatically generate Markdown documentation for clap command-line tools.


Generate Markdown text for a basic clap app:

struct Cli {
    name: String,

let markdown: String = clap_markdown::help_markdown::<Cli>();

Generated Markdown Examples:

See clap example programs and the corresponding Markdown generated by clap-markdown:

Program Markdown
./complex_app.rs complex-app.md

Usage Convention: CommandLineHelp.md

This section describes a suggested convention for using clap-markdown to generate a CommandLineHelp.md file, which can be committed to source control and viewed as online documentation.

  1. Add a hidden --markdown-help option to your clap application:
use clap::Parser;

struct Cli {
    #[arg(long, hide = true)]
    markdown_help: bool,

fn main() {
    let args = Cli::parse();

    // Invoked as: `$ my-app --markdown-help`
    if args.markdown_help {
  1. Invoke --markdown-help to generate a CommandLineHelp.md file:
$ cargo run -- --markdown-help > docs/CommandLineHelp.md
  1. Save CommandLineHelp.md in git, and link to it from the project's README.md or other relevant documentation.

For projects that have multiple associated executables, consider using the command name as a suffix. For example: CommandLineHelp-your-app.md, CommandLineHelp-other-app.md.

Comitting CommandLineHelp.md to version control makes it easy to track user-visible changes to the command-line interface.

Projects using clap-markdown

The following projects use clap-markdown to generate a CommandLineHelp.md reference document:

To request the addition of a project to this list, please file an issue.

Compatibility with clap

When this crate adds support for a new MAJOR version of clap, the MAJOR version number of clap-markdown will be changed.

Compability History:

clap-markdown clap
v0.0.1 – v0.1.3 "4.*.*"


Licensed under either of

at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

See Development.md for instructions on how to perform common development tasks.

See Maintenance.md for instructions on how to maintain this project.


~16K SLoC