From 94f07543939dfe682bb382f6802cbe9ff3eea061 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Tue, 13 Feb 2024 05:57:37 -0800 Subject: [PATCH] fix: make sure descriptions are newline terminated Hugo was not correctly markdownifying codeblocks at the end of a comment without a newline. --- typegen/src/parse.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/typegen/src/parse.rs b/typegen/src/parse.rs index f556d74..3f46afd 100644 --- a/typegen/src/parse.rs +++ b/typegen/src/parse.rs @@ -425,10 +425,7 @@ fn parse_details(text: &str) -> String { } } }) - .fold(String::new(), |accum, line| { - let sep = if accum.is_empty() { "" } else { "\n" }; - accum + sep + line.as_ref() - }); + .fold(String::new(), |accum, line| accum + line.as_ref() + "\n"); if callout { str += "\n{{< /callout >}}"; @@ -439,9 +436,7 @@ fn parse_details(text: &str) -> String { fn parse_details_desc(text: &str) -> (Option, Option) { let details = parse_details(text); - dbg!(&details); if details.starts_with('!') { - dbg!(&details, &details[1..].split_once('\n')); match details[1..].split_once('\n') { Some((desc, details)) => (Some(desc.strip_prefix(' ').unwrap_or(desc).to_string()), Some(details.to_string())), None => (Some(details[1..].strip_prefix(' ').unwrap_or(&details[1..]).to_string()), None),