diff --git a/src/app/markdown.rs b/src/app/markdown.rs index 1410776..0b5f096 100644 --- a/src/app/markdown.rs +++ b/src/app/markdown.rs @@ -37,7 +37,9 @@ pub fn render(inp: &str) -> Result { format_html(child, &options, &mut message)?; } let message = std::str::from_utf8(&message)?; - let message = markdown_to_html(message, &options); + let mut message = markdown_to_html(message, &options); + crop_letters(&mut message, 3); + message.drain((message.len() - 5)..); let mood = without_first(u.path()); let name = u.host_str().unwrap_or("Mara"); @@ -79,3 +81,14 @@ fn without_first(string: &str) -> &str { .and_then(|(i, _)| string.get(i..)) .unwrap_or("") } + +fn crop_letters(s: &mut String, pos: usize) { + match s.char_indices().nth(pos) { + Some((pos, _)) => { + s.drain(..pos); + } + None => { + s.clear(); + } + } +} diff --git a/templates/mara.rs.html b/templates/mara.rs.html index 06d977e..f892c1e 100644 --- a/templates/mara.rs.html +++ b/templates/mara.rs.html @@ -8,7 +8,7 @@ @if smol { -
<@character> @message
+
<@character> @message
} else {