File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -205,24 +205,20 @@ fn get_help_text(arg: &Arg) -> Cow<'static, str> {
205205}
206206
207207fn render_examples_section < ' a > ( lines : impl Iterator < Item = & ' a str > , out : & mut String ) {
208- let mut current_title: Option < & ' a str > = None ;
209208 for line in lines {
210209 let line = line. trim ( ) ;
211210
212211 if line. is_empty ( ) {
213212 continue ;
214213 }
215214
216- if let Some ( cmd) = line. strip_prefix ( '$' ) . map ( str:: trim) {
217- let heading = if let Some ( title) = current_title. take ( ) {
218- title. to_string ( )
219- } else {
220- format ! ( "`{cmd}`" )
221- } ;
222- out. push_str ( & format ! ( "### {heading}\n \n ```sh\n {cmd}\n ```\n \n " ) ) ;
223- } else {
224- current_title = Some ( line) ;
215+ if let Some ( command) = line. strip_prefix ( '$' ) {
216+ let command = command. trim ( ) ;
217+ out. push_str ( & format ! ( "```sh\n {command}\n ```\n \n " ) ) ;
218+ continue ;
225219 }
220+
221+ out. push_str ( & format ! ( "### {line}\n \n " ) ) ;
226222 }
227223}
228224
You can’t perform that action at this time.
0 commit comments