Skip to content

fix(formats): CSV cells read as literal values, blank rows kept (#110, #112) - #120

Merged
DWAA1660 merged 4 commits into
AlienTechSoftware:mainfrom
DWAA1660:fix/csv-literal-cells
Nov 12, 2026
Merged

DWAA1660 merged 4 commits into
AlienTechSoftware:mainfrom
DWAA1660:fix/csv-literal-cells

Conversation

@DWAA1660

Copy link
Copy Markdown
Collaborator

What and why

Fixes #110 and #112, both in the CSV reader that GridCraft read-back uses (table_from_gridcraft_csv). They touch the same lines of csv::to_table, so they're one PR in two commits rather than two PRs that would conflict.

#110: cells were read as Markdown. to_table ran every cell through markdown::parse_inline, so a spreadsheet value *literal* became italic literal and [a](b) became a link. Exporting the table again lost the characters. A cell is now one plain Span holding its value as written, or no span for an empty cell, which is the same shape the Markdown table parser gives an empty cell. The page writer already escapes literal text (#92), so these values also survive a page save.

#112: blank rows of a one-column table were dropped. The reader skipped any line whose single cell was blank. That skipped real blank rows too, and every row under them moved up. Now:

  • from_table quotes a blank cell when it's the only cell on its row (""), so the line isn't empty
  • rows_of records whether a line had a quoted cell, and to_table keeps such a line
  • truly empty lines (and whitespace-only unquoted ones, as before) are still skipped, so trailing newlines and the nothing_in_nothing_out cases behave as they did

How it was checked

  • New a_cell_that_looks_like_markdown_is_read_as_it_is_written: four inputs full of Markdown punctuation are read with no marks and written back character for character
  • New a_blank_row_of_a_one_column_table_is_kept: a one-column table with an empty and a whitespace-only row round-trips exactly, and spreadsheet-style "" rows among blank lines read as expected
  • Existing CSV tests unchanged and passing; cargo test -p notecraft-formats: 73 passed
  • GridCraft read-back: gridcraft_csv_read_back_preserves_quoted_cells_and_adds_columns and the UI test a_table_is_read_back_from_the_spreadsheet_beside_the_page pass
  • cargo fmt --all -- --check, cargo clippy -p notecraft-formats --all-targets -- -D warnings: clean

🤖 Generated with Claude Code

DWAA1660 and others added 2 commits November 12, 2026 10:19
`csv::to_table` ran every cell through the inline Markdown parser, so a
spreadsheet value such as `*literal*` came back as an italic `literal`
and `[a](b)` as a link. Writing the table out again lost the characters
(AlienTechSoftware#110). A cell is now one plain span holding its value as written.

Fixes AlienTechSoftware#110

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The CSV reader skipped every line whose one cell was blank, which also
dropped a blank row of a one-column table, so every row under it moved
up (AlienTechSoftware#112). The writer now quotes a blank cell that is alone on its row,
and the reader keeps a line that held a quoted cell. Lines with nothing
on them are still skipped.

Fixes AlienTechSoftware#112

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@DWAA1660
DWAA1660 merged commit 965020f into AlienTechSoftware:main Nov 12, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Reading a GridCraft CSV interprets literal cell values as Markdown and changes their text

2 participants