Skip to content

Commit f4c5f6a

Browse files
committed
fix: strengthen DC inline and table typography
1 parent 71e2a83 commit f4c5f6a

3 files changed

Lines changed: 22 additions & 3 deletions

File tree

src/lib/dc/export-document.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,8 @@ function applyMarks(
682682
"background-color": context.inlineCodeBackground ?? palette.inlineCodeBackground,
683683
color: context.inlineCodeText ?? palette.inlineCodeText,
684684
"font-family": safeInlineCodeFontFamily(),
685-
"font-size": "0.92em",
685+
"font-size": ".92em",
686+
"font-weight": 700,
686687
padding: "1px 4px",
687688
"border-radius": "4px",
688689
});
@@ -940,7 +941,10 @@ function renderDataTable(node: JSONContent, options: DcExportOptions): string {
940941
border: `1px solid ${tableBorder}`,
941942
"background-color": isHeader ? headerBackground : cellBackground,
942943
color: isHeader ? palette.heading : undefined,
944+
"font-family": safeProseFontFamily(options.bodyFontFamily),
945+
"font-size": safeBodyFontSize(options),
943946
"font-weight": isHeader ? 700 : undefined,
947+
"line-height": 1.62,
944948
"text-align": "left",
945949
"vertical-align": "top",
946950
"word-break": "keep-all",

src/routes/+page.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5600,6 +5600,7 @@
56005600
Menlo,
56015601
Monaco,
56025602
monospace;
5603+
font-weight: 700;
56035604
padding: 1px 4px;
56045605
}
56055606

tests/unit/export-document.test.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,20 @@ describe("exportDocumentToDcHtml", () => {
7979
expect(html).toContain("설정 항목");
8080
expect(html).toContain("자동 밝기 또는 40% 이하");
8181
expect(html).toContain("백그라운드 소모 감소");
82+
expect(html).toMatch(
83+
new RegExp(
84+
`<th style="padding:8px 10px;border:1px solid #[0-9a-f]{6};background-color:#[0-9a-f]{6};color:#[0-9a-f]{6};font-family:${escapeRegExp(
85+
expectedDefaultDcProseFontFamily,
86+
)};font-size:17px;font-weight:700;line-height:1\\.62;text-align:left;vertical-align:top;word-break:keep-all;overflow-wrap:break-word">설정 항목</th>`,
87+
),
88+
);
89+
expect(html).toMatch(
90+
new RegExp(
91+
`<td style="padding:9px 10px;border:1px solid #[0-9a-f]{6};background-color:#[0-9a-f]{6};font-family:${escapeRegExp(
92+
expectedDefaultDcProseFontFamily,
93+
)};font-size:17px;line-height:1\\.62;text-align:left;vertical-align:top;word-break:keep-all;overflow-wrap:break-word">자동 밝기 또는 40% 이하</td>`,
94+
),
95+
);
8296
});
8397

8498
it("keeps prose font styles after markdown-authored data tables", async () => {
@@ -94,7 +108,7 @@ describe("exportDocumentToDcHtml", () => {
94108
);
95109

96110
const html = await exportDocumentToDcHtml(document, exportOptions);
97-
const afterTableHtml = html.slice(Math.max(0, html.indexOf("map") - 240));
111+
const afterTableHtml = html.slice(Math.max(0, html.indexOf("map") - 300));
98112

99113
expect(afterTableHtml).toContain(
100114
`font-family:${expectedDefaultDcProseFontFamily};font-size:17px`,
@@ -290,7 +304,7 @@ describe("exportDocumentToDcHtml", () => {
290304
new RegExp(
291305
`<code style="background-color:#[0-9a-f]{6};color:#[0-9a-f]{6};font-family:${escapeRegExp(
292306
safeDcInlineCodeFontFamily(),
293-
)};font-size:0\\.92em;padding:1px 4px;border-radius:4px">LLM 가이드</code>`,
307+
)};font-size:\\.92em;font-weight:700;padding:1px 4px;border-radius:4px">LLM 가이드</code>`,
294308
),
295309
);
296310
expect(html).toContain("TIP");

0 commit comments

Comments
 (0)