Merge 2aa00e75e60a9b86c3c9be481892f756189b80f3 into 2b04b39f5d8eac1f61644b0d8d47f299b3290d76
This commit is contained in:
commit
2051a377b4
@ -31,7 +31,7 @@ pub fn md_to_html(md: &str) -> (String, Vec<String>) {
|
|||||||
if (c.is_alphanumeric() || c == '@' || c == '.' || c == '-' || c == '_') && (n < (txt.chars().count() - 1)) {
|
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)
|
(events, in_mention, text_acc + c.to_string().as_ref(), n + 1, mentions)
|
||||||
} else {
|
} else {
|
||||||
let mention = text_acc + c.to_string().as_ref();
|
let mention = text_acc;
|
||||||
let short_mention = mention.clone();
|
let short_mention = mention.clone();
|
||||||
let short_mention = short_mention.splitn(1, '@').nth(0).unwrap_or("");
|
let short_mention = short_mention.splitn(1, '@').nth(0).unwrap_or("");
|
||||||
let link = Tag::Link(format!("/@/{}/", mention).into(), short_mention.to_string().into());
|
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<String>) {
|
|||||||
events.push(Event::Text(format!("@{}", short_mention).into()));
|
events.push(Event::Text(format!("@{}", short_mention).into()));
|
||||||
events.push(Event::End(link));
|
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)
|
(events, false, c.to_string(), n + 1, mentions)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user