fix: 목록·검색 카드에서 백틱을 지운다

카드는 본문 요약을 그대로 가져다 세 줄로 자른다. 그 요약은 Markdown 으로
쓰였으므로 작성자가 코드 표시로 쓴 백틱이 카드에도 그대로 나왔다 — 문서
본문에서는 <code> 가 되지만 카드에서는 그냥 문자다. 홈·탐색·검색이 같은
텍스트를 쓰므로 세 곳에서 같이 보였다. 배포된 검색 모달을 열어 보고서야
알았다: 본문만 고치고 카드는 그대로 두었다.

카드에서 코드 스타일을 살리지 않는 이유는 카드가 훑어보는 자리이기
때문이다. 한 줄 안에 배경색 조각이 여럿 끼면 제목보다 그쪽이 먼저 눈에
든다. 문단 줄바꿈도 공백으로 접는다 — 어차피 세 줄에서 잘리므로 줄을
지켜 봐야 잘리는 위치만 어긋난다.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nAjrqNHGPNngN4aUbcyvJ
This commit is contained in:
DongHyeonka
2026-08-31 09:28:30 +09:00
co-authored by Claude Opus 5
parent 833943a286
commit 795a4bf4a9
6 changed files with 47 additions and 4 deletions
@@ -9,6 +9,7 @@ import {
moveFocus,
shouldNormalizeFocusUrl,
} from "../../../domain/public/focus-state.ts";
import { cardSummary } from "../../shared/card-summary.ts";
type HomeFocusProps = {
items: ReadonlyArray<HomeFocusItem>;
@@ -122,7 +123,7 @@ export function HomeFocus({
>
<div className="focus-summary">
<h2>{item.title}</h2>
<p>{item.summary}</p>
<p>{cardSummary(item.summary)}</p>
<Link className="text-link" to={item.targetPath}>
작업 맥락 보기 <span aria-hidden="true">↗</span>
</Link>
@@ -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({
</div>
<div className="latest-copy">
<h3>{entry.title}</h3>
<p>{entry.summary}</p>
<p>{cardSummary(entry.summary)}</p>
<p className="latest-mobile-meta">
{entry.topic} · {entry.project}
</p>
@@ -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({
<span className="record-kind">{DOCUMENT_KIND_LABELS[record.kind]}</span>
<div>
<strong>{record.title}</strong>
<p>{record.summary}</p>
<p>{cardSummary(record.summary)}</p>
<span className="record-context">
{record.topic} · {record.projectTitle}
</span>
@@ -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({
<HighlightMatch text={entry.title} query={query} />
</strong>
<p>
<HighlightMatch text={entry.summary} query={query} />
<HighlightMatch text={cardSummary(entry.summary)} query={query} />
</p>
</Link>
</li>
@@ -0,0 +1,15 @@
/**
* 목록·검색 카드에 실을 요약을 평문으로 만든다.
*
* <p>카드는 본문 요약을 그대로 가져다 세 줄로 자른다. 그 요약은 Markdown 으로 쓰였으므로
* 작성자가 코드 표시로 쓴 백틱이 카드에도 그대로 나왔다 — 문서 본문에서는 `<code>` 가 되지만
* 카드에서는 그냥 문자다. 홈·탐색·검색이 같은 텍스트를 쓰므로 세 곳에서 같이 보였다.
*
* <p>카드에서 코드 스타일을 살리지 않는 이유는 카드가 훑어보는 자리이기 때문이다. 한 줄 안에
* 배경색 조각이 여럿 끼면 제목보다 그쪽이 먼저 눈에 든다. 문단 줄바꿈도 공백으로 접는다 —
* 어차피 세 줄에서 잘리므로 줄을 지켜 봐야 잘리는 위치만 어긋난다.
*/
export function cardSummary(text: string | null | undefined): string {
if (!text) return "";
return text.replace(/`/gu, "").replace(/\s+/gu, " ").trim();
}