(line: string)
| 225 | /** Parse a `<!-- zen:cols=… -->` width-hint line into per-column pixel widths |
| 226 | * (`null` = auto). Returns null if the line isn't a zen:cols comment. */ |
| 227 | export function parseColWidthsComment(line: string): Array<number | null> | null { |
| 228 | const m = COLS_COMMENT_RE.exec(line) |
| 229 | if (!m) return null |
| 230 | return (m[1] ?? '').split(',').map((part) => { |
| 231 | const t = part.trim().toLowerCase() |
| 232 | if (t === '' || t === 'auto') return null |
| 233 | const n = Number.parseInt(t, 10) |
| 234 | return Number.isFinite(n) && n > 0 ? n : null |
| 235 | }) |
| 236 | } |
| 237 | |
| 238 | /** Serialize per-column widths to a `<!-- zen:cols=… -->` line, or null when no |
| 239 | * column has an explicit width (so an un-resized table emits no comment). */ |
no outgoing calls
no test coverage detected