diff --git a/web-ui/html/detective-app.html b/web-ui/html/detective-app.html
index 59eed11..7af86ae 100644
--- a/web-ui/html/detective-app.html
+++ b/web-ui/html/detective-app.html
@@ -2018,6 +2018,7 @@ function renderMd(text){
return text
.replace(/&/g,'&').replace(//g,'>')
.replace(/```[\w]*\n?([\s\S]*?)```/g,'
$1
')
+ .split(/([\s\S]*?<\/pre>)/).map((seg,i)=>i%2?seg:mdTables(seg)).join('')
.replace(/`([^`]+)`/g,'$1')
.replace(/\*\*(.+?)\*\*/g,'$1')
.replace(/\*(.+?)\*/g,'$1')
@@ -2026,7 +2027,27 @@ function renderMd(text){
.replace(/^[-*]\s+(.+)$/gm,'$1')
.replace(/([\s\S]+?<\/li>)/g,m=>``)
.replace(/\n\n/g,'').replace(/^/,'
').replace(/$/,'
')
- .replace(/<\/p>/g,'').replace(/
(<[hup])/g,'$1').replace(/(<\/[hup][^>]*>)<\/p>/g,'$1');
+ .replace(/
<\/p>/g,'').replace(/
(<[hup]|
)/g,'$1').replace(/(<\/[hup][^>]*>|<\/table><\/div>)<\/p>/g,'$1');
+}
+
+// 마크다운 표: '|'로 시작하는 연속 줄 + 두 번째 줄이 구분선(|---|---|)인 블록만
로 바꾼다.
+// 입력은 이미 HTML 이스케이프된 상태. 셀 안의 `코드`·**굵게**는 이후 인라인 변환이 처리한다.
+function mdTables(text){
+ const cells=l=>l.trim().replace(/^\|/,'').replace(/\|$/,'').split('|').map(c=>c.trim());
+ const isSep=l=>/^\s*\|?\s*:?-{2,}:?\s*(\|\s*:?-{2,}:?\s*)*\|?\s*$/.test(l)&&l.includes('-')&&/\|/.test(l);
+ const lines=text.split('\n'),out=[];
+ for(let i=0;i/^:-+:$/.test(c)?'center':/-:$/.test(c)?'right':'');
+ let j=i+2;const rows=[];
+ while(j`<${t}${al[k]?` style="text-align:${al[k]}"`:''}>${c}${t}>`;
+ out.push(''+head.map((c,k)=>td('th',c,k)).join('')+'
'+
+ rows.map(r=>''+head.map((_,k)=>td('td',r[k]??'',k)).join('')+'
').join('')+'
');
+ i=j;
+ }else out.push(lines[i++]);
+ }
+ return out.join('\n');
}
async function sendMessage(){