Skip to main content

Crate clap_markdown_generator

Crate clap_markdown_generator 

Source
Expand description

Generate Markdown documentation from a clap command definition.

The most common entry point is generate_markdown, which accepts any type deriving clap::Parser.

use clap::Parser;

#[derive(Parser)]
#[command(name = "node", about = "Runs a node")]
struct Cli {
    /// Path to the config file
    #[arg(long, default_value = "config.toml")]
    config: String,
}

let markdown = clap_markdown_generator::generate_markdown::<Cli>();
assert!(markdown.contains("--config <CONFIG>"));
assert!(markdown.contains("<a id=\"node-config\"></a>"));

Structs§

CommandInfo
Information available to command heading callbacks.
MarkdownOptions
Rendering options for Markdown generation.
ParameterContentOptions
ParameterInfo
Information available to parameter formatting callbacks.
SummaryOptions
Rendering options for the parameter summary.

Enums§

CommandHeadingStyle
Controls how command headings are rendered.
ParameterContentStyle
Controls how detailed parameter content is rendered.
ParameterHeadingStyle
Controls how detailed parameter headings are rendered.
SummaryEntryStyle
Controls how parameter summary entries are rendered.
SummaryValueStyle
Controls how parameter names are rendered in the summary.

Functions§

generate_markdown
Generate Markdown for any type that can build a clap::Command.
generate_markdown_for_command
Generate Markdown for an existing clap::Command.
generate_markdown_for_command_with_options
Generate Markdown for an existing clap::Command with explicit options.