Skip to content

Add CSV/TSV as a first-class DocumentFormat #80

Description

@Mearman

documents.js writes CSV today (odbToCsv) but has no readable CSV input and no csv entry in DocumentFormat. A caller holding .csv bytes has no documents.js path.

Materially simpler than markdown was — one sheet, one row per line, one cell per field, no inline formatting or block structure. Both halves are largely built already:

  • write half exists as buildOdbTableCsv (src/odb/csv.ts, RFC 4180 quoting) — just needs generalising from HsqldbTable rows to a ContentSheet's cells
  • cell re-typing exists as inferCellValue (src/layout/cell-typing.ts), already used by reconstructSpreadsheet for exactly the untyped-text→typed-cell boundary CSV sits on
  • read half is a small RFC 4180 parser feeding the spreadsheet ContentDocument variant odbTablesToSpreadsheetDocument already constructs (src/odb/spreadsheet.ts's tableToSheet is the row→cell template)

Maps to the spreadsheet variant. Once readCsv/writeCsv exist, csvToXlsx/csvToOds/csvToPdf compose from the shared variant the way odsToXlsx/xlsxToPdf already do. Follows the markdown precedent (a non-zip, text-only format with no magic bytes) as a full DocumentFormat member with its own codec entry, bridges, and port edges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions