The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 18:30 UTC
fix(mobile): block HTML in a Markdown table cell no longer splits the row (#35535)
Julius Marminge committed
Nov 12, 2026 at 11:58 UTC
773b3c9b307a9cba2666a3dd6e131e0135bdb01a
2 files changed
+26
-3
apps/mobile/src/lib/markdownDocument.ts
+4
-3
@@ -226,12 +226,13 @@ function htmlTagMarkdown(
226
const alt = (attribute(tag, "alt") ?? "").replace(/[\\[\]&]/g, "\\$&");
227
return `})`;
228
}
229
+ // A raw newline would end the table row; both parsers decode this reference to one inside the cell.
230
+ const cellBreak = " ";
231
// A blank line inside an open link label would end the paragraph before its "]".
230
- const blockBreak = anchors.open === 0 ? "\n\n" : " ";
232
+ const blockBreak = anchors.open > 0 ? " " : options.inTableCell ? cellBreak : "\n\n";
233
if (/^<summary\b/i.test(tag)) return `${blockBreak}**`;
234
if (/^<\/summary\s*>/i.test(tag)) return `**${blockBreak}`;
233
- // A raw newline would end the table row; both parsers decode this reference to one inside the cell.
234
- if (/^<br\b/i.test(tag)) return options.inTableCell ? " " : " \n";
235
+ if (/^<br\b/i.test(tag)) return options.inTableCell ? cellBreak : " \n";
236
if (/^<\/?(?:p|div|details)\b/i.test(tag)) return blockBreak;
237
return "";
238
}
apps/mobile/src/lib/markdownHtml.test.ts
+22
@@ -108,6 +108,28 @@ describe("HTML in native Markdown", () => {
108
]);
109
});
110
111
+ it.each([
112
+ "one<p>two</p>",
113
+ "one<div>two</div>",
114
+ "one<summary>two</summary>",
115
+ "<p>one</p><p>two</p>",
116
+ ])("keeps a table row intact when a cell contains block HTML: %s", async (cell) => {
117
+ const native = await parseMarkdown(
118
+ markdownForNativeRendering(
119
+ `| A | B |\n| - | - |\n| ${cell} | x |`,
120
+ ENRICHED_INLINE_FILE_LINK_REGEX,
121
+ ),
122
+ );
123
+ const text = (node: { content?: string; children?: unknown[] }): string =>
124
+ (node.content ?? "") +
125
+ (node.children ?? []).map((child) => text(child as typeof node)).join("");
126
+ expect(native.children).toHaveLength(1);
127
+ expect(native.children?.[0]?.children?.[1]?.children?.[0]?.children?.map(text)).toEqual([
128
+ expect.stringMatching(/one\s*two/),
129
+ "x",
130
+ ]);
131
+ });
132
+
133
it("keeps a table row intact when an anchor href contains a pipe", () => {
134
const document = parseMarkdownDocument(
135
"| Preview | Logs |\n| - | - |\n| <a href='https://example.com/?a=1|2'>Open</a> | done |",