Skip to content

Commit 077eef1

Browse files
committed
fix(formatters): don't run cell values through markdown parser in writeTable
Cell values from column value() functions are already pre-formatted with ANSI codes (chalk) and terminal hyperlinks (OSC 8). Running them through renderInlineMarkdown() caused marked.lexer() to parse URLs inside OSC 8 hyperlink sequences as markdown autolinks, rendering them as visible 'text (url)' and blowing up column widths.
1 parent e9c2e3f commit 077eef1

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/lib/formatters/table.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
*/
1111

1212
import type { Writer } from "../../types/index.js";
13-
import {
14-
escapeMarkdownCell,
15-
isPlainOutput,
16-
renderInlineMarkdown,
17-
} from "./markdown.js";
13+
import { escapeMarkdownCell, isPlainOutput } from "./markdown.js";
1814
import { type Alignment, renderTextTable } from "./text-table.js";
1915

2016
/**
@@ -75,9 +71,7 @@ export function writeTable<T>(
7571
}
7672

7773
const headers = columns.map((c) => c.header);
78-
const rows = items.map((item) =>
79-
columns.map((c) => renderInlineMarkdown(c.value(item)))
80-
);
74+
const rows = items.map((item) => columns.map((c) => c.value(item)));
8175
const alignments: Alignment[] = columns.map((c) => c.align ?? "left");
8276

8377
stdout.write(renderTextTable(headers, rows, { alignments }));

0 commit comments

Comments
 (0)