fix: box-drawing 테이블 행 분리 문제 — 정규식 prefix만 검사하도록 수정
- BOX_RE: 전체 라인 검사 → 선두 box-drawing 문자만 확인 - 셀 내부 ' % ( ) 등 모든 문자 허용되어 행 분리 방지 - CSS 백업: .md-body pre에 font-family: var(--fm) 추가
This commit is contained in:
@@ -277,6 +277,7 @@
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
|
font-family: var(--fm);
|
||||||
}
|
}
|
||||||
.md-body pre code {
|
.md-body pre code {
|
||||||
background: transparent;
|
background: transparent;
|
||||||
|
|||||||
@@ -332,7 +332,25 @@ function docsExportPdf() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ── 마크다운 렌더 파이프라인 ──────────────────────────────── */
|
/* ── 마크다운 렌더 파이프라인 ──────────────────────────────── */
|
||||||
|
|
||||||
|
/// box-drawing 문자(┌─┬┐│├─┼┤└─┴┘) 라인을 fenced code block으로 감싸 고정폭 렌더링 보장
|
||||||
|
function docsWrapBoxDrawing(text) {
|
||||||
|
const BOX_RE = /^[ \t]*[┌┐└┘├┤┬┴┼│─━]/;
|
||||||
|
const lines = text.split('\n');
|
||||||
|
const out = [];
|
||||||
|
let inBlock = false;
|
||||||
|
for (const line of lines) {
|
||||||
|
const isBox = BOX_RE.test(line);
|
||||||
|
if (isBox && !inBlock) { out.push('```'); inBlock = true; }
|
||||||
|
else if (!isBox && inBlock) { out.push('```'); inBlock = false; }
|
||||||
|
out.push(line);
|
||||||
|
}
|
||||||
|
if (inBlock) out.push('```');
|
||||||
|
return out.join('\n');
|
||||||
|
}
|
||||||
|
|
||||||
function docsRenderMarkdownInto(el, text) {
|
function docsRenderMarkdownInto(el, text) {
|
||||||
|
text = docsWrapBoxDrawing(text);
|
||||||
const rawHtml = marked.parse(text, { gfm: true, breaks: false });
|
const rawHtml = marked.parse(text, { gfm: true, breaks: false });
|
||||||
el.innerHTML = DOMPurify.sanitize(rawHtml, { ADD_TAGS: ['details', 'summary'], ADD_ATTR: ['target'] });
|
el.innerHTML = DOMPurify.sanitize(rawHtml, { ADD_TAGS: ['details', 'summary'], ADD_ATTR: ['target'] });
|
||||||
docsExternalLinks(el);
|
docsExternalLinks(el);
|
||||||
|
|||||||
Reference in New Issue
Block a user