feat: auto-link bare URLs in forum posts
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Plain https:// URLs are now automatically converted to clickable links.
Markdown [text](url) syntax continues to work without duplication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-02-23 08:51:19 +01:00
parent 2a4c217ba2
commit 53c0d24e2a

View File

@ -107,6 +107,13 @@ def parse_forum_markdown(text):
text = re.sub(r'\[([^\]]+)\]\(([^)]+)\)', safe_link, text)
# Auto-link bare URLs (must come after [text](url) so already-linked URLs aren't doubled)
text = re.sub(
r'(?<!["\'>=/])(?<!\()https?://[^\s<\)]+',
lambda m: f'<a href="{m.group(0)}" target="_blank" rel="noopener noreferrer" class="forum-link">{m.group(0)}</a>',
text
)
# @mentions - highlight them
text = re.sub(
r'@([\w.\-]+)',