From dba6340661be0a4e9b6331e5f6b5be361a5cd8bd Mon Sep 17 00:00:00 2001 From: luandnh Date: Thu, 25 Jun 2026 07:04:33 +0000 Subject: [PATCH] test: add regression test for pipe inside inline code in renderMd tables --- tests/test_renderer_js_behaviour.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_renderer_js_behaviour.py b/tests/test_renderer_js_behaviour.py index 0c63cc6e0..501a4e880 100644 --- a/tests/test_renderer_js_behaviour.py +++ b/tests/test_renderer_js_behaviour.py @@ -242,6 +242,25 @@ class TestCommonLLMShapes: assert "

" not in out + def test_table_pipe_inside_inline_code_is_protected(self, driver_path): + """Pipes inside backtick code in table cells must not create extra columns.""" + src = ( + "| field | expr |\n" + "| --- | --- |\n" + "| set | `updates.model = modelState.model || null` |\n" + ) + out = _render(driver_path, src) + # Must be exactly 2 cells in the data row + assert "field" in out + assert "expr" in out + # The code cell should contain both pipes + assert "" in out + assert "||" in out + # Must NOT split into extra cells + assert out.count("") == 2, ( + f"Expected exactly 2 cells, got {out.count('')}: {out!r}" + ) + def test_strikethrough_outside_quote(self, driver_path): out = _render(driver_path, "This was ~~outdated~~ but is now fine.") assert "outdated" in out