Skip to content

Commit

Permalink
unbreak markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
WanderingHogan committed Nov 8, 2023
1 parent 540b420 commit 285b437
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions kit/src/components/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,14 +450,17 @@ fn markdown(text: &str, emojis: bool) -> String {
let r = replace_emojis(txt);
// TODO: Watch this issue for a fix: https://github.com/open-i18n/rust-unic/issues/280
// This is a temporary workaround for some characters unic-emoji-char thinks are emojis
if !r.contains('#') // for multiple #
&& !r.contains('*') // for multiple *
&& !r.chars().all(char::is_alphanumeric) // for any numbers, eg 1, 11, 111
if !r.chars().all(char::is_alphanumeric) // for any numbers, eg 1, 11, 111
&& r != "#"
&& r != "*"
&& r != "##"
&& r != "**"
&& r != "-"
&& is_only_emojis(&r)
{
return format!("<span class=\"big-emoji\">{r}</span>");
} else {
return format!("<p>{r}</p>");
} else if is_only_emojis(txt) || r == "-" {
return format!("<p>{txt}</p>");
}
}

Expand Down

0 comments on commit 285b437

Please sign in to comment.