MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / serializeColWidthsComment

Function serializeColWidthsComment

packages/app-core/src/lib/markdown-table.ts:240–246  ·  view source on GitHub ↗
(
  widths: ReadonlyArray<number | null> | undefined
)

Source from the content-addressed store, hash-verified

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). */
240export function serializeColWidthsComment(
241 widths: ReadonlyArray<number | null> | undefined
242): string | null {
243 if (!widths || !widths.some((w) => typeof w === 'number' && w > 0)) return null
244 const parts = widths.map((w) => (typeof w === 'number' && w > 0 ? String(Math.round(w)) : 'auto'))
245 return `<!-- zen:cols=${parts.join(',')} -->`
246}
247
248// ---------------------------------------------------------------------------
249// Structural operations — all return a new table, never mutate the input.

Callers 2

serializeTableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected