fix(ui): escape HTML entities in parseMarkdown to prevent swallowed angle brackets

This commit is contained in:
Will Miao
2026-05-26 21:55:44 +08:00
parent c97c802956
commit 8b856276bf

View File

@@ -731,9 +731,16 @@ export class UpdateService {
}
// Simple markdown parser for changelog items
// Simple markdown parser for changelog items
// Escape HTML entities first so angle brackets in content (e.g. `<lora:x>`)
// aren't swallowed by innerHTML's HTML parser as invalid tags
parseMarkdown(text) {
if (!text) return '';
text = text.replace(/&/g, '&amp;');
text = text.replace(/</g, '&lt;');
text = text.replace(/>/g, '&gt;');
// Handle bold text (**text**)
text = text.replace(/\*\*(.*?)\*\*/g, '<strong>$1</strong>');