From 931c3e464770765e03d9f79fad6e3229c7b94e46 Mon Sep 17 00:00:00 2001 From: kim Date: Wed, 7 Oct 2026 16:07:13 +0900 Subject: [PATCH] =?UTF-8?q?feat(detective):=20=EC=B1=84=ED=8C=85=EC=B0=BD?= =?UTF-8?q?=20=EB=A7=88=ED=81=AC=EB=8B=A4=EC=9A=B4=20=ED=91=9C=20=EB=A0=8C?= =?UTF-8?q?=EB=8D=94=EB=A7=81=20=E2=80=94=20=EC=A4=84=20=EB=8B=A8=EC=9C=84?= =?UTF-8?q?=20=ED=91=9C=20=EB=B8=94=EB=A1=9D=20=EB=B3=80=ED=99=98,=20?= =?UTF-8?q?=EC=A0=95=EB=A0=AC=C2=B7=EC=BD=94=EB=93=9C=EB=B8=94=EB=A1=9D=20?= =?UTF-8?q?=EC=98=88=EC=99=B8=C2=B7=EA=B0=80=EB=A1=9C=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A1=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- web-ui/html/detective-app.html | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) 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=>`
      ${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}`; + 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(){