Function escape_md_cell
pub fn escape_md_cell(s: &str) -> Cow<'_, str>Expand description
Escape a string for safe inclusion inside a GFM table cell.
Per the GFM spec, an unescaped | inside a cell ends the cell —
every subsequent character on the line lands in the next column,
so a single stray pipe in a path / author name / commit message
silently corrupts the entire row’s column alignment. The escape is
a leading backslash on the pipe character.
Newlines and carriage returns inside a cell are GFM-unsupported
entirely (the table row terminates at the line break), so they get
replaced with the visual ↵ glyph to preserve the cell boundary
rather than break the row.
Returns Cow::Borrowed for the common case (no escape needed) so
the happy path is allocation-free. The borrow checker thread-of-
life this preserves matters here — every analysis emits hundreds
to thousands of rows and the markdown emitter is a hot path for
the $GITHUB_STEP_SUMMARY flow.