fix(console): 评审/归档卡片的 markdown 渲染成 HTML

内联评审闸卡片与归档详情此前把 agent 产出的 markdown(plan/spec/
operations)直接塞进 <pre> 当纯文本,满屏裸 ## / - / 反引号未渲染。
改为在 ui_kit 层用 window.MaestroRichDoc(marked + DOMPurify 净化)
渲染,与 TaskTree 既有写法一致;保留 280px 限高滚动与容器样式。

- GateSection.jsx: GateCard doc 改为 undefined,children 内对非
  attention 闸用 MaestroRichDoc 渲染 a.doc;删除未引用的 reportBox 死代码
- ArchiveSection.jsx: doc() 助手由 <pre> 改为 MaestroRichDoc 容器,
  SPEC/OPERATIONS 两块随之正确渲染
- 安全:两处均走 RichDoc 的 DOMPurify 净化,挡住 same-origin 存储型 XSS;
  不绕过 sanitize 直接注入 HTML。CDN 不可用时回退纯文本不崩
- 不改 GateCard.jsx(避免底层组件反向依赖 ui_kit 全局 + 触发 bundle 重编)
- DiffBody 的 <pre> 渲染 git diff(非 markdown)保持不动

类似但未改:console_mobile/MobileViews.jsx 为独立非在线 demo,其
index.html 未加载 RichDoc/marked/DOMPurify,修复需整套引入,超出本次范围。

tsk_sp0DwZ2Kc319

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-30 08:30:15 +08:00
parent 382afe3322
commit 5443ffa21c
2 changed files with 20 additions and 12 deletions
+1 -1
View File
@@ -126,7 +126,7 @@ function ArchiveModal({ item, t, onClose }) {
const d = item.detail || {};
const label = (text) => <div style={{ fontSize: 10.5, color: 'var(--muted)', letterSpacing: '.18em', margin: '14px 0 4px' }}>{text}</div>;
const doc = (text) => (
<pre style={{ background: 'var(--bg-deep)', border: '1px solid var(--line-soft)', borderLeft: '2px solid var(--green-dim)', borderRadius: 4, padding: '10px 12px', fontFamily: 'var(--mono)', fontSize: 12.5, lineHeight: 1.7, whiteSpace: 'pre-wrap', wordBreak: 'break-word', margin: 0, color: 'var(--ink)' }}>{text}</pre>
<div style={{ background: 'var(--bg-deep)', border: '1px solid var(--line-soft)', borderLeft: '2px solid var(--green-dim)', borderRadius: 4, padding: '10px 12px' }}><window.MaestroRichDoc md={text} /></div>
);
const kvGrid = { fontSize: 12, display: 'grid', gridTemplateColumns: 'auto 1fr', gap: '3px 12px', margin: 0 };
return (