feat(frontend): per-message markdown rendering
Self-contained, HTML-escaped (XSS-safe) markdown for history messages; each message rendered independently so a syntax error (e.g. unclosed code fence) cannot leak into the next message. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import axios from 'axios'
|
||||
import { io, type Socket } from 'socket.io-client'
|
||||
import { useEffect, useMemo, useState } from 'react'
|
||||
import { useAuth } from '../auth/auth-context'
|
||||
import { renderMarkdown } from '../lib/markdown'
|
||||
import { guildMembersCenter, joinGuildCenter } from '../lib/center-auth-client'
|
||||
|
||||
type MessageItem = {
|
||||
@@ -470,7 +471,7 @@ export default function ChatPage() {
|
||||
<span className={`meta-badge ${m.wakeup ? 'on' : ''}`}>wakeup={String(m.wakeup)}</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="text">{m.content}</div>
|
||||
<div className="text md" dangerouslySetInnerHTML={{ __html: renderMarkdown(m.content) }} />
|
||||
{devMode ? (
|
||||
<pre className="meta-raw">
|
||||
{JSON.stringify(
|
||||
|
||||
Reference in New Issue
Block a user