From 3b54421e9c86d0d492ce8b532ade3a38d6260ae2 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Tue, 21 Mar 2023 20:42:45 +0100 Subject: [PATCH] uucore: add comment to parse_help_section --- src/uucore_procs/src/lib.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uucore_procs/src/lib.rs b/src/uucore_procs/src/lib.rs index 0d8df7d9f..73054f9c4 100644 --- a/src/uucore_procs/src/lib.rs +++ b/src/uucore_procs/src/lib.rs @@ -170,11 +170,14 @@ fn parse_help_section(section: &str, content: &str) -> String { ) } + // Prefix includes space to allow processing of section with level 3-6 headers + let section_header_prefix = "## "; + content .lines() .skip_while(|&l| !is_section_header(l, section)) .skip(1) - .take_while(|l| !l.starts_with("## ")) + .take_while(|l| !l.starts_with(section_header_prefix)) .collect::>() .join("\n") .trim()