Update notes rendering

This commit is contained in:
Leendert de Borst
2026-01-30 21:05:59 +01:00
parent 05c81cc76c
commit 46d7195928
3 changed files with 157 additions and 55 deletions
@@ -20,8 +20,11 @@
private static string ConvertUrlsToLinks(string text)
{
// HTML-encode the text before processing URLs
var encodedText = System.Web.HttpUtility.HtmlEncode(text);
string urlPattern = @"(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})";
return Regex.Replace(text, urlPattern, match =>
return Regex.Replace(encodedText, urlPattern, match =>
{
string url = match.Value;
if (!url.StartsWith("http://") && !url.StartsWith("https://"))