fix(export): escape backslashes in tag table cells

A backslash right before a pipe, as in the tag name a\|b, turned the escaped
pipe into "\|": the table splitter reads "\\" as an escaped backslash and the
pipe as a column separator, shifting the row. Cells now escape '\' before '|'.
Recorded in PLAN 5.8.
This commit is contained in:
doyaGu committed 2026-10-03 08:20:23 -04:00
1 parent b6e8e07d78
commit 9277e2a331
3 files changed
+29 -4

No files matched your search

@@ -204,6 +204,29 @@ public class MarkdownExporterTests
}
}
[TestMethod]
public void TagTableCellsEscapeBackslashesSoAPipeAfterOneStaysEscaped()
{
CultureInfo? original = Resources.Culture;
try
{
Resources.Culture = new CultureInfo("en");
var tag = new TagModel(1, @"a\|b", RgbColor.Parse("#112233"), @"C:\temp\");
string markdown = MarkdownExporter.Export(
"W",
[new ColumnModel(1, "C", string.Empty, 1, 1)],
[],
[(tag, 0L)],
ExportedAt);
StringAssert.Contains(markdown, @"| a\\\|b | #112233 | C:\\temp\\ | 0 |");
}
finally
{
Resources.Culture = original;
}
}
[TestMethod]
[DataRow("plain", "`plain`")]
[DataRow("a`b", "``a`b``")]