1
0
mirror of https://github.com/ihabunek/toot synced 2024-12-24 08:00:39 +01:00
Toot-Mastodon-CLI-TUI-clien.../toot/tui/utils.py
2019-09-03 15:40:43 +02:00

11 lines
211 B
Python

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)
]