Add url support in tokenizer and qdoc preview

This commit is contained in:
Veronica Berglyd Olsen
2024-10-25 17:51:40 +02:00
parent 759cfd77e9
commit 058758122c
4 changed files with 35 additions and 3 deletions
+7
View File
@@ -1117,6 +1117,13 @@ class Tokenizer(ABC):
for n, fmt in enumerate(fmts) if fmt > 0
)
# Match URLs
for res in REGEX_PATTERNS.url.finditer(text):
s = res.start(0)
e = res.end(0)
temp.append((s, s, TextFmt.HRF_B, res.group(0)))
temp.append((e, e, TextFmt.HRF_E, ""))
# Match Shortcodes
for res in REGEX_PATTERNS.shortcodePlain.finditer(text):
temp.append((