fix: make sure descriptions are newline terminated
Hugo was not correctly markdownifying codeblocks at the end of a comment without a newline.
This commit is contained in:
parent
27b3274027
commit
94f0754393
|
@ -425,10 +425,7 @@ fn parse_details(text: &str) -> String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.fold(String::new(), |accum, line| {
|
.fold(String::new(), |accum, line| accum + line.as_ref() + "\n");
|
||||||
let sep = if accum.is_empty() { "" } else { "\n" };
|
|
||||||
accum + sep + line.as_ref()
|
|
||||||
});
|
|
||||||
|
|
||||||
if callout {
|
if callout {
|
||||||
str += "\n{{< /callout >}}";
|
str += "\n{{< /callout >}}";
|
||||||
|
@ -439,9 +436,7 @@ fn parse_details(text: &str) -> String {
|
||||||
|
|
||||||
fn parse_details_desc(text: &str) -> (Option<String>, Option<String>) {
|
fn parse_details_desc(text: &str) -> (Option<String>, Option<String>) {
|
||||||
let details = parse_details(text);
|
let details = parse_details(text);
|
||||||
dbg!(&details);
|
|
||||||
if details.starts_with('!') {
|
if details.starts_with('!') {
|
||||||
dbg!(&details, &details[1..].split_once('\n'));
|
|
||||||
match 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())),
|
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),
|
None => (Some(details[1..].strip_prefix(' ').unwrap_or(&details[1..]).to_string()), None),
|
||||||
|
|
Loading…
Reference in a new issue