Skip to main content

md

Function md 

Source
pub fn md(source: &str) -> String
Expand description

Render a help block for whoever is reading it.

Help is markdown: examples in fenced blocks, flags and keys as code, so the procedure reads as a procedure. A terminal gets it rendered; anything else — a pipe, an agent, --help > file — gets the source, because reflowed text with escape codes in it is worse to read than the markdown was, and an agent reads markdown natively.

clap is told not to wrap help (term_width(0)): it counts escape codes as characters, so it would cut a rendered table in half and break an example mid-flag.