fix(#5641): keep table boundary scoped to spaces

This commit is contained in:
Rod Boev committed 2026-07-05 16:39:54 -04:00
1 parent 1075d6e3a1
commit c83ccf069a
2 files changed
+2 -1

No files matched your search

+1 -1
View File
@@ -6148,7 +6148,7 @@ function renderMd(raw){
// Tables: | col | col | header row followed by | --- | --- | separator then data rows // Tables: | col | col | header row followed by | --- | --- | separator then data rows
// NOTE: table pass runs BEFORE outer link pass so [label](url) in table cells // NOTE: table pass runs BEFORE outer link pass so [label](url) in table cells
// is handled by inlineMd() only — prevents double-linking. // is handled by inlineMd() only — prevents double-linking.
s=s.replace(/((?:^[ \t]{0,3}\|.+\|[ \t]*\n?)+)/gm,block=>{ s=s.replace(/((?:^ {0,3}\|.+\|[ \t]*\n?)+)/gm,block=>{
const rows=block.trim().split('\n').filter(r=>r.trim()); const rows=block.trim().split('\n').filter(r=>r.trim());
if(rows.length<2)return block; if(rows.length<2)return block;
const isSep=r=>/^\|[\s|:-]+\|$/.test(r.trim()); const isSep=r=>/^\|[\s|:-]+\|$/.test(r.trim());
+1
View File
@@ -31,6 +31,7 @@ def test_table_rows_with_edge_whitespace_still_render_as_table(driver_path, src)
out = _render(driver_path, src) out = _render(driver_path, src)
assert "<table><thead>" in out assert "<table><thead>" in out
assert "<td>1</td>" in out assert "<td>1</td>" in out
assert "<p>" not in out
def test_four_space_indented_table_like_block_stays_outside_table(driver_path): def test_four_space_indented_table_like_block_stays_outside_table(driver_path):