feat: render BBCode in chat messages

Server, channel and private chat now render [b] [i] [u] [s] [color]
[url] (and [img] as a plain link), and bare http(s) URLs become links -
the welcome message's [URL]...[/URL] showed up as raw text before.
Built as React elements, so message text can't inject markup; only
http(s) links are allowed and [color] only takes a name or hex value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hu2cuPLqpuKVfd9wWFFakU
This commit is contained in:
MoepchiandClaude Opus 5.5 committed 2026-10-04 10:29:05 +00:00
1 parent 9b836d5830
commit e37e090ab2
3 files changed
+110 -3

No files matched your search

+4 -3
View File
@@ -143,6 +143,7 @@ import {
GreenteaSpeakChrome,
isGreenteaSpeakTheme,
} from "./themes/greenteaspeak";
import { renderBbcode } from "./lib/bbcode";
import { parseChannelName, spacerDisplayName } from "./lib/spacer";
import {
applyParkedGatewayEvent,
@@ -11646,7 +11647,7 @@ function AppInner() {
className={`ts-chat-line${entry.from === ownClient?.name ? " ts-chat-line-self" : ""}`}
>
<span className="ts-chat-from">{entry.from}:</span>{" "}
<span className="ts-chat-bubble">{entry.message}</span>
<span className="ts-chat-bubble">{renderBbcode(entry.message)}</span>
</div>
))
: activeTab === "server"
@@ -11661,7 +11662,7 @@ function AppInner() {
className={`ts-chat-line${entry.from === ownClient?.name ? " ts-chat-line-self" : ""}`}
>
<span className="ts-chat-from">{entry.from}:</span>{" "}
<span className="ts-chat-bubble">{entry.message}</span>
<span className="ts-chat-bubble">{renderBbcode(entry.message)}</span>
</div>
)
)
@@ -11670,7 +11671,7 @@ function AppInner() {
<span className="ts-chat-from">
{entry.fromSelf ? t("chat.you") : pmThreads[activeTab].partnerName}:
</span>{" "}
<span className="ts-chat-bubble">{entry.message}</span>
<span className="ts-chat-bubble">{renderBbcode(entry.message)}</span>
</div>
))}
<div ref={chatEndRef} />