diff --git a/src/lib.rs b/src/lib.rs index 374ffdd..1c4c095 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -305,9 +305,11 @@ fn build_command_markdown( writeln!(buffer, "{}\n", about)?; } - // TODO(feature): Support printing custom before and after help texts. - assert!(command.get_before_help().is_none()); - assert!(command.get_after_help().is_none()); + if let Some(help) = command.get_before_long_help() { + writeln!(buffer, "{}\n", help)?; + } else if let Some(help) = command.get_before_help() { + writeln!(buffer, "{}\n", help)?; + } writeln!( buffer, @@ -326,6 +328,12 @@ fn build_command_markdown( .replace("Usage: ", "") )?; + if let Some(help) = command.get_after_long_help() { + writeln!(buffer, "{}\n", help)?; + } else if let Some(help) = command.get_after_help() { + writeln!(buffer, "{}\n", help)?; + } + //---------------------------------- // Subcommands //----------------------------------