pub fn split_table_row(line: &str) -> Vec<String>Expand description
Split one row of a table into its cell texts.
Cells are separated by unescaped pipes; a leading and a trailing pipe are both optional and may differ from row to row, so they are stripped before the split rather than producing empty cells at the ends. A trailing pipe is only a delimiter if it is itself unescaped, which is why the backslash run before it is counted.
\| is resolved to a literal | here, as the extension requires
(“include a pipe in a cell’s content by escaping it, including inside
other inline spans”). Doing it at split time is the whole point: the
inline phase never sees the backslash, so a code span in the cell yields
a real pipe, which no amount of unescaping after inline parsing could
produce. Every other backslash escape is left exactly as written for the
inline phase to handle in the usual way, so no cell text is unescaped
twice.
Scanning skips the byte after any backslash, so \\ cannot shield the
pipe that follows it: a\\|b is two cells, the first holding a\\.
A row of nothing but whitespace has no cells at all, which is how a header candidate that is really empty fails the cell-count test instead of matching a one-column delimiter row.