From f2a60658cfe208594f33e8f250e53d5f26ef8d08 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 31 Jan 2026 12:02:23 -0500 Subject: [PATCH] Document xterm HTML structure dependency in trimHtmlOutput Add warning about dependency on xterm's HTML format and the risk if xterm changes it. Suggest filing an upstream issue for a native trimEmpty option. --- src/terminal.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/terminal.ts b/src/terminal.ts index 154d6f8..87e3394 100644 --- a/src/terminal.ts +++ b/src/terminal.ts @@ -46,7 +46,16 @@ export function serializeAsHTML(session: TerminalSession): string { /** * Trim empty trailing rows and trailing whitespace from xterm HTML output. * - * Structure:
...
...
+ * WARNING: This function depends on xterm's specific HTML structure from serializeAsHTML(). + * If xterm changes their HTML format, this will need updating. Consider filing an issue + * with xterm to add a native trimEmpty option. + * + * Current structure expected: + * - Outer:
+ * - Rows: 
content
+ * - Empty cells:   or plain spaces + * + * Full structure:
...
...
* Each row is:
content
*/ function trimHtmlOutput(html: string): string {