Skip to content

Commit

Permalink
Fix emoji hashtags
Browse files Browse the repository at this point in the history
  • Loading branch information
dsaxton committed Dec 19, 2024
1 parent 659ce45 commit 7916961
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions crates/notedeck_columns/src/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ impl NewPost {
for word in content.split_whitespace() {
if word.starts_with('#') && word.len() > 1 {
let tag = word[1..]
.trim_end_matches(|c: char| !c.is_alphanumeric())
.trim_end_matches(|c: char| c.is_ascii_punctuation())
.to_lowercase();
if !tag.is_empty() {
hashtags.insert(tag);
Expand All @@ -155,9 +155,8 @@ mod tests {
("No hashtags here", vec![]),
("#tag1 with #tag2!", vec!["tag1", "tag2"]),
("Ignore # empty", vec![]),
("Keep #alphanumeric123", vec!["alphanumeric123"]),
("Testing emoji #🍌sfd", vec!["🍌sfd"]),
("Testing emoji with space #🍌 sfd", vec!["🍌"]),
("Testing emoji #🍌banana", vec!["🍌banana"]),
("Testing emoji #🍌", vec!["🍌"]),
("Duplicate #tag #tag #tag", vec!["tag"]),
("Mixed case #TaG #tag #TAG", vec!["tag"]),
(
Expand Down

0 comments on commit 7916961

Please sign in to comment.