1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-25 00:20:55 +01:00
Toot-Mastodon-CLI-TUI-clien.../toot/tui/utils.py

11 lines
211 B
Python
Raw Normal View History

2019-08-24 14:14:46 +02:00
import re
HASHTAG_PATTERN = re.compile(r'(?<!\w)(#\w+)\b')
def highlight_hashtags(line):
return [
("hashtag", p) if p.startswith("#") else p
for p in re.split(HASHTAG_PATTERN, line)
]