From 795a4bf4a9118266007a100f3fc0a29af9d98e24 Mon Sep 17 00:00:00 2001 From: DongHyeonka Date: Mon, 31 Aug 2026 09:28:30 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EB=AA=A9=EB=A1=9D=C2=B7=EA=B2=80?= =?UTF-8?q?=EC=83=89=20=EC=B9=B4=EB=93=9C=EC=97=90=EC=84=9C=20=EB=B0=B1?= =?UTF-8?q?=ED=8B=B1=EC=9D=84=20=EC=A7=80=EC=9A=B4=EB=8B=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 카드는 본문 요약을 그대로 가져다 세 줄로 자른다. 그 요약은 Markdown 으로 쓰였으므로 작성자가 코드 표시로 쓴 백틱이 카드에도 그대로 나왔다 — 문서 본문에서는 가 되지만 카드에서는 그냥 문자다. 홈·탐색·검색이 같은 텍스트를 쓰므로 세 곳에서 같이 보였다. 배포된 검색 모달을 열어 보고서야 알았다: 본문만 고치고 카드는 그대로 두었다. 카드에서 코드 스타일을 살리지 않는 이유는 카드가 훑어보는 자리이기 때문이다. 한 줄 안에 배경색 조각이 여럿 끼면 제목보다 그쪽이 먼저 눈에 든다. 문단 줄바꿈도 공백으로 접는다 — 어차피 세 줄에서 잘리므로 줄을 지켜 봐야 잘리는 위치만 어긋난다. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ --- .../public/components/home-focus.tsx | 3 ++- .../public/components/latest-index.tsx | 3 ++- .../public/components/public-record-list.tsx | 3 ++- .../public/components/search-dialog.tsx | 3 ++- .../presentation/shared/card-summary.ts | 15 ++++++++++++ tests/component/highlight-match.test.tsx | 24 +++++++++++++++++++ 6 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 src/features/tech-log/presentation/shared/card-summary.ts diff --git a/src/features/tech-log/presentation/public/components/home-focus.tsx b/src/features/tech-log/presentation/public/components/home-focus.tsx index ce81ab4..6b83d31 100644 --- a/src/features/tech-log/presentation/public/components/home-focus.tsx +++ b/src/features/tech-log/presentation/public/components/home-focus.tsx @@ -9,6 +9,7 @@ import { moveFocus, shouldNormalizeFocusUrl, } from "../../../domain/public/focus-state.ts"; +import { cardSummary } from "../../shared/card-summary.ts"; type HomeFocusProps = { items: ReadonlyArray; @@ -122,7 +123,7 @@ export function HomeFocus({ >

{item.title}

-

{item.summary}

+

{cardSummary(item.summary)}

작업 맥락 보기 diff --git a/src/features/tech-log/presentation/public/components/latest-index.tsx b/src/features/tech-log/presentation/public/components/latest-index.tsx index 9942107..536c606 100644 --- a/src/features/tech-log/presentation/public/components/latest-index.tsx +++ b/src/features/tech-log/presentation/public/components/latest-index.tsx @@ -1,4 +1,5 @@ import { Link } from "react-router-dom"; +import { cardSummary } from "../../shared/card-summary.ts"; export type LatestEntry = { id: string; @@ -55,7 +56,7 @@ export function LatestIndex({

{entry.title}

-

{entry.summary}

+

{cardSummary(entry.summary)}

{entry.topic} · {entry.project}

diff --git a/src/features/tech-log/presentation/public/components/public-record-list.tsx b/src/features/tech-log/presentation/public/components/public-record-list.tsx index 82995c3..0686b9d 100644 --- a/src/features/tech-log/presentation/public/components/public-record-list.tsx +++ b/src/features/tech-log/presentation/public/components/public-record-list.tsx @@ -2,6 +2,7 @@ import { Link } from "react-router-dom"; import type { PublicRecord } from "../../../application/ports/public-content-queries.ts"; import { DOCUMENT_KIND_LABELS } from "../../shared/document-kind-labels.ts"; +import { cardSummary } from "../../shared/card-summary.ts"; export function PublicRecordList({ records, @@ -22,7 +23,7 @@ export function PublicRecordList({ {DOCUMENT_KIND_LABELS[record.kind]}
{record.title} -

{record.summary}

+

{cardSummary(record.summary)}

{record.topic} · {record.projectTitle} diff --git a/src/features/tech-log/presentation/public/components/search-dialog.tsx b/src/features/tech-log/presentation/public/components/search-dialog.tsx index 43ecc06..3263c74 100644 --- a/src/features/tech-log/presentation/public/components/search-dialog.tsx +++ b/src/features/tech-log/presentation/public/components/search-dialog.tsx @@ -3,6 +3,7 @@ import { Link } from "react-router-dom"; import { usePublicContent } from "../use-public-content.tsx"; import { HighlightMatch } from "../../shared/highlight-match.tsx"; +import { cardSummary } from "../../shared/card-summary.ts"; type SearchDialogProps = { className?: string; @@ -110,7 +111,7 @@ export function SearchDialog({

- +

diff --git a/src/features/tech-log/presentation/shared/card-summary.ts b/src/features/tech-log/presentation/shared/card-summary.ts new file mode 100644 index 0000000..df49d16 --- /dev/null +++ b/src/features/tech-log/presentation/shared/card-summary.ts @@ -0,0 +1,15 @@ +/** + * 목록·검색 카드에 실을 요약을 평문으로 만든다. + * + *

카드는 본문 요약을 그대로 가져다 세 줄로 자른다. 그 요약은 Markdown 으로 쓰였으므로 + * 작성자가 코드 표시로 쓴 백틱이 카드에도 그대로 나왔다 — 문서 본문에서는 `` 가 되지만 + * 카드에서는 그냥 문자다. 홈·탐색·검색이 같은 텍스트를 쓰므로 세 곳에서 같이 보였다. + * + *

카드에서 코드 스타일을 살리지 않는 이유는 카드가 훑어보는 자리이기 때문이다. 한 줄 안에 + * 배경색 조각이 여럿 끼면 제목보다 그쪽이 먼저 눈에 든다. 문단 줄바꿈도 공백으로 접는다 — + * 어차피 세 줄에서 잘리므로 줄을 지켜 봐야 잘리는 위치만 어긋난다. + */ +export function cardSummary(text: string | null | undefined): string { + if (!text) return ""; + return text.replace(/`/gu, "").replace(/\s+/gu, " ").trim(); +} diff --git a/tests/component/highlight-match.test.tsx b/tests/component/highlight-match.test.tsx index f750bd1..b01b5b9 100644 --- a/tests/component/highlight-match.test.tsx +++ b/tests/component/highlight-match.test.tsx @@ -36,3 +36,27 @@ describe("검색어 강조", () => { expect(container.querySelectorAll("mark")).toHaveLength(0); }); }); + +/** + * 목록·검색 카드는 본문 요약을 그대로 가져다 세 줄로 자른다. 그 요약은 Markdown 이므로 + * 작성자가 코드 표시로 쓴 백틱이 카드에도 그대로 나왔다 — 홈·탐색·검색이 같은 텍스트를 쓰므로 + * 세 곳에서 같이 보였다. + */ +describe("카드 요약", () => { + it("백틱을 지우고 줄바꿈을 접는다", async () => { + const { cardSummary } = await import( + "../../src/features/tech-log/presentation/shared/card-summary.ts" + ); + expect(cardSummary("모두 하나의 `로그인 상태`로 보면\n안 된다.\n\n두 번째 문단.")).toBe( + "모두 하나의 로그인 상태로 보면 안 된다. 두 번째 문단.", + ); + }); + + it("빈 값이면 빈 문자열을 준다", async () => { + const { cardSummary } = await import( + "../../src/features/tech-log/presentation/shared/card-summary.ts" + ); + expect(cardSummary(undefined)).toBe(""); + expect(cardSummary(" ")).toBe(""); + }); +});