Skip to main content

split_table_row_cells

Function split_table_row_cells 

Source
pub fn split_table_row_cells(line: &str) -> Vec<&str>
Expand description

Split a GFM table row into its cells, honoring backslash-escaped pipes. One optional leading and one optional trailing unescaped | are stripped (the GFM leading/trailing pipe), then the remainder is split on each unescaped |. Cells are returned untrimmed (callers trim). An escaped \| stays inside its cell. Shared by the recognition gate (cell counting) and the projector (cell rendering) so the two never disagree on where a cell begins.

GFM counts pipes without honoring code spans — a | inside `…` still splits a cell — so this deliberately does not track backticks. That is what makes | + “a|b” + | y | fail the header/delimiter cell-count match and stay prose (verified against roxygen2).