diff --git a/M01_MasterData/M01_MasterData_UI_LogicLab_Side.css b/M01_MasterData/M01_MasterData_UI_LogicLab_Side.css index eb4724990..977a12f4d 100644 --- a/M01_MasterData/M01_MasterData_UI_LogicLab_Side.css +++ b/M01_MasterData/M01_MasterData_UI_LogicLab_Side.css @@ -40,6 +40,11 @@ line-height: 1.6; } +/* [주] 글 — 본문(--text-body)보다 한 단 작게 */ +.m01lab-src__note { + font-size: var(--text-body-sm); +} + .m01lab-src__file { margin: 0; font-size: var(--text-body-sm); diff --git a/M01_MasterData/M01_MasterData_UI_LogicLab_Source.ts b/M01_MasterData/M01_MasterData_UI_LogicLab_Source.ts index b587d1892..ede0ecc99 100644 --- a/M01_MasterData/M01_MasterData_UI_LogicLab_Source.ts +++ b/M01_MasterData/M01_MasterData_UI_LogicLab_Source.ts @@ -65,6 +65,18 @@ function rawNode(b: Block): HTMLElement { return el("p", { className: "m01lab-src__p", text: b.p ?? "" }); } +/** 「[주]」 줄부터 다음 제목 앞까지 글 줄 = 한 단 작은 글자(`m01lab-src__note`) */ +function noteMarked(blocks: Block[]): HTMLElement[] { + let inNote = false; + return blocks.map((b) => { + if (b.h) inNote = false; + else if (b.p?.trim().startsWith("[주]")) inNote = true; + const node = blockNode(b); + if (inNote && b.p !== undefined) node.classList.add("m01lab-src__note"); + return node; + }); +} + export interface SourceView { root: HTMLElement; /** 그 출처 글의 원문을 그림 — 지금 보이는 것과 같으면 안 부름 */ @@ -122,19 +134,21 @@ export function createSourceView(opts: SourceViewOptions = {}): SourceView { if (shown !== src) return; if (!found.length) return none(); body.replaceChildren( - ...found.flatMap((f) => [ - el("p", { - className: "ui-text ui-text--muted m01lab-src__file", - text: [ - f.file, - f.matched === f.number ? "" : ts("Near", f.number), - f.item ? (/^\d+$/.test(f.item) ? `${f.item}항` : f.item) : "", - ] - .filter(Boolean) - .join(" · "), - }), - ...f.blocks.map(blockNode), - ]), + ...found.flatMap((f) => { + // 파일 경로는 안 보임 — 가까운 절 · 항 안내만 + const note = [ + f.matched === f.number ? "" : ts("Near", f.number), + f.item ? (/^\d+$/.test(f.item) ? `${f.item}항` : f.item) : "", + ] + .filter(Boolean) + .join(" · "); + return [ + ...(note + ? [el("p", { className: "ui-text ui-text--muted m01lab-src__file", text: note })] + : []), + ...noteMarked(f.blocks), + ]; + }), ); // 강조 항을 패널 몸 가운데로 — 몸만 굴림(85-5 · scrollIntoView 는 메인 창까지 굴림) requestAnimationFrame(() => {