From aa681eafadd3804d63a9fe9d6ef84221e97a1778 Mon Sep 17 00:00:00 2001 From: NetterSilver <133535268+Silvertree2010@users.noreply.github.com> Date: Thu, 15 Oct 2026 10:43:29 +0200 Subject: [PATCH] =?UTF-8?q?Keep=20leading=20'-',=20'*'=20and=20'=E2=80=A2'?= =?UTF-8?q?=20text=20when=20importing=20outlines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found while testing crates/format/src/lib.rs:421 Co-Authored-By: Claude Haiku 5.5 Co-Authored-By: Claude Opus 5.5 --- crates/format/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/format/src/lib.rs b/crates/format/src/lib.rs index f1d0dc83..524b7e70 100644 --- a/crates/format/src/lib.rs +++ b/crates/format/src/lib.rs @@ -418,7 +418,12 @@ pub fn outline_to_slides(p: &mut Presentation, text: &str) -> usize { let tabs = raw.chars().take_while(|c| *c == '\t').count(); let spaces = raw.chars().take_while(|c| *c == ' ').count() / 2; let level = tabs.max(spaces); - let line = raw.trim().trim_start_matches(['-', '*', '•']).trim().to_string(); + let t = raw.trim(); + let line = match t.strip_prefix(['-', '*', '•']) { + Some(rest) if rest.starts_with([' ', '\t']) => rest.trim(), + _ => t, + } + .to_string(); if level == 0 { slides.push((line, Vec::new())); } else if let Some((_, body)) = slides.last_mut() { @@ -811,6 +816,15 @@ mod tests { assert!(o.contains("Intro\n\tPoint one\n\t\tSub point\nSecond"), "{o}"); } + #[test] + fn outline_keeps_leading_dash_text() { + let mut p = defaults::blank_presentation(defaults::WIDE, Default::default(), false); + let n = outline_to_slides(&mut p, "-5 °C tonight\n\t--verbose flag\n\t*args and **kwargs\n- Bullets\n\t- Point\n\t• Other"); + assert_eq!(n, 2); + let o = slides_to_outline(&p); + assert!(o.contains("-5 °C tonight\n\t--verbose flag\n\t*args and **kwargs\nBullets\n\tPoint\n\tOther"), "{o}"); + } + #[test] fn markdown_headings_and_list_items() { assert_eq!(md_heading("# Intro"), Some("Intro"));