diff --git a/plume-common/src/utils.rs b/plume-common/src/utils.rs index 8b14959c..1ed399a6 100644 --- a/plume-common/src/utils.rs +++ b/plume-common/src/utils.rs @@ -31,7 +31,7 @@ pub fn md_to_html(md: &str) -> (String, Vec) { if (c.is_alphanumeric() || c == '@' || c == '.' || c == '-' || c == '_') && (n < (txt.chars().count() - 1)) { (events, in_mention, text_acc + c.to_string().as_ref(), n + 1, mentions) } else { - let mention = text_acc + c.to_string().as_ref(); + let mention = text_acc; let short_mention = mention.clone(); let short_mention = short_mention.splitn(1, '@').nth(0).unwrap_or(""); let link = Tag::Link(format!("/@/{}/", mention).into(), short_mention.to_string().into()); @@ -41,6 +41,10 @@ pub fn md_to_html(md: &str) -> (String, Vec) { events.push(Event::Text(format!("@{}", short_mention).into())); events.push(Event::End(link)); + if n >= (txt.chars().count() - 1) { + events.push(Event::Text(c.to_string().into())) + } + (events, false, c.to_string(), n + 1, mentions) } } else {