fix: unordered list issue (#23454)

* fix: uordered list issue

* changes

* revert

* Update EventMeta.tsx

---------

Co-authored-by: Anik Dhabal Babu <[email protected]>
This commit is contained in:
Bandhan MajumderandAnik Dhabal Babu authored and GitHub committed 2025-08-30 15:37:10 +00:00
1 parent 73b0693632
commit 5c51b0632f
2 files changed
+16 -2

No files matched your search

+8 -1
View File
@@ -15,7 +15,7 @@ export function markdownToSafeHTML(markdown: string | null) {
const safeHTML = sanitizeHtml(html);
const safeHTMLWithListFormatting = safeHTML
let safeHTMLWithListFormatting = safeHTML
.replace(
/<ul>/g,
"<ul style='list-style-type: disc; list-style-position: inside; margin-left: 12px; margin-bottom: 4px'>"
@@ -26,5 +26,12 @@ export function markdownToSafeHTML(markdown: string | null) {
)
.replace(/<a\s+href=/g, "<a target='_blank' class='text-blue-500 hover:text-blue-600' href=");
// Match: <li>Some text </li><li><ul>...</ul></li>
// Convert to: <li>Some text <ul>...</ul></li>
safeHTMLWithListFormatting = safeHTMLWithListFormatting.replace(
/<li>([^<]+|<strong>.*?<\/strong>)<\/li>\s*<li>\s*<ul([^>]*)>([\s\S]*?)<\/ul>\s*<\/li>/g,
"<li>$1<ul$2>$3</ul></li>"
);
return safeHTMLWithListFormatting;
}