From 6a88cb3a1927161cd011cc5ba2d43c9c425ba59a Mon Sep 17 00:00:00 2001 From: lew <82828093+Llywelwyn@users.noreply.github.com> Date: Wed, 3 Jun 2026 16:24:15 +0100 Subject: [PATCH] Fixes bold/italics rendering in emotes and saved chatlog MIME type (#22577) format_emote has to come first, otherwise it will re-encode the markup into literals. however, the langchat_message does not want to have format_emote called on it. ergo, we have to either process the markup twice, once for each path, or we have to accept that one of the two will not support bold/italics. the perf from doing it twice is completely inconsequential image - bugfix: "Saved chat logs are now written with the correct text/html file type." - bugfix: "Emote markup like *bold* and /italics/ once again renders in chat instead of showing literal tags." --- code/modules/emotes/emote_mob.dm | 4 ++-- html/changelogs/llywelwyn-chatlog.yml | 5 +++++ tgui/packages/tgui-panel/chat/renderer.js | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 html/changelogs/llywelwyn-chatlog.yml diff --git a/code/modules/emotes/emote_mob.dm b/code/modules/emotes/emote_mob.dm index 2143ccb6b3f..11909b383b7 100644 --- a/code/modules/emotes/emote_mob.dm +++ b/code/modules/emotes/emote_mob.dm @@ -159,9 +159,9 @@ if (message) log_emote("[name]/[key] : [message]") - message = process_chat_markup(message, list("~", "_")) - var/langchat_message = message + var/langchat_message = process_chat_markup(message, list("~", "_")) message = format_emote(src, message) + message = process_chat_markup(message, list("~", "_")) var/list/emote_viewers = list() if(m_type == VISIBLE_MESSAGE) visible_message(message, show_observers = do_show_observers) diff --git a/html/changelogs/llywelwyn-chatlog.yml b/html/changelogs/llywelwyn-chatlog.yml new file mode 100644 index 00000000000..9ea22710d6c --- /dev/null +++ b/html/changelogs/llywelwyn-chatlog.yml @@ -0,0 +1,5 @@ +author: Llywelwyn +delete-after: True +changes: + - bugfix: "Saved chat logs are now written with the correct text/html file type." + - bugfix: "Emote markup like *bold* and /italics/ once again renders in chat instead of showing literal tags." diff --git a/tgui/packages/tgui-panel/chat/renderer.js b/tgui/packages/tgui-panel/chat/renderer.js index 59a1d0cddf0..c9dadc9ba16 100644 --- a/tgui/packages/tgui-panel/chat/renderer.js +++ b/tgui/packages/tgui-panel/chat/renderer.js @@ -616,7 +616,7 @@ class ChatRenderer { + '\n' + '\n'; // Create and send a nice blob - const blob = new Blob([pageHtml], { type: 'text/plain' }); + const blob = new Blob([pageHtml], { type: 'text/html' }); const timestamp = new Date() .toISOString() .substring(0, 19)