Skip to content

feat: SVG renderer for worksheet visual output#27

Merged
Nebu1eto merged 2 commits into
mainfrom
dev/phase-d-renderer
Feb 10, 2026
Merged

feat: SVG renderer for worksheet visual output#27
Nebu1eto merged 2 commits into
mainfrom
dev/phase-d-renderer

Conversation

@Nebu1eto

Copy link
Copy Markdown
Owner

Summary

  • Add render module in sheetkit-core that generates SVG from worksheet data (cell values, column widths, row heights, fonts, fills, borders, alignment, gridlines, headers)
  • Expose Workbook.renderToSvg() method in both Rust facade and Node.js (napi-rs + TypeScript wrapper)
  • Fix parse_style_color in napi conversions to accept raw ARGB/RGB hex strings (e.g. "FFFFFF00")
  • Add EN and KO rendering guide documentation with feature list and known limitations

Test plan

  • 29 Rust unit tests covering: valid SVG output, cell text, headers, gridlines, custom widths/heights, range rendering, empty sheets, bold/italic/underline/strikethrough, fills, font colors, alignment, borders, XML escaping, scale, shared strings
  • 12 Node.js integration tests covering: valid SVG, cell text, gridlines toggle, headers toggle, sub-range, scale factor, error handling, bold style, fill colors
  • cargo build --workspace passes
  • cargo test --workspace passes (1300+ tests)
  • cargo clippy --workspace passes (no warnings)
  • cargo fmt --check passes
  • pnpm build passes (napi + typecheck + tsdown)
  • pnpm test passes (265 tests)

Generated with Claude Code

@Nebu1eto Nebu1eto left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review finding (blocking): RGB values that already include a leading # can become invalid ##RRGGBB in SVG output.

Relevant path: crates/sheetkit-core/src/render.rs (style_color_to_hex). Combined with accepted inputs in packages/sheetkit/src/conversions.rs (parse_style_color accepts #RRGGBB), this can generate invalid color attributes.

Please normalize colors before rendering (strip leading # or handle it explicitly).

@Nebu1eto Nebu1eto left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Detailed review notes (blocking):

Renderer foundation is solid, but there is an SVG color correctness bug.

Blocking concern:

  • parse_style_color accepts #RRGGBB input, while style_color_to_hex blindly prepends #.
  • This can emit invalid values like ##RRGGBB in SVG attributes.

Relevant areas:

  • crates/sheetkit-core/src/render.rs (style_color_to_hex)
  • packages/sheetkit/src/conversions.rs (parse_style_color)

Additional issues worth fixing in this PR:

  • If both underline and strikethrough are true, text-decoration is emitted twice; output should be merged into one valid value.
  • Validate scale > 0 to avoid invalid/negative dimensions.

Please add direct tests for these rendering edge cases.

Base automatically changed from dev/phase-d-fidelity to main February 10, 2026 07:51
Nebu1eto and others added 2 commits February 10, 2026 17:47
Implement render module that generates SVG from worksheet data including
cell values, column widths, row heights, cell styles (fonts, fills,
borders, alignment), gridlines, and row/column headers. Expose via
Workbook.renderToSvg() in both Rust and Node.js APIs.

- 29 Rust unit tests covering all rendering features
- 12 Node.js integration tests for the renderToSvg binding
- Fix parse_style_color to accept raw ARGB/RGB hex strings
- EN/KO rendering guide documentation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Nebu1eto
Nebu1eto force-pushed the dev/phase-d-renderer branch from 849a9f3 to b90ffa1 Compare February 10, 2026 08:47
@Nebu1eto
Nebu1eto merged commit 68a9c64 into main Feb 10, 2026
2 of 3 checks passed
@Nebu1eto
Nebu1eto deleted the dev/phase-d-renderer branch February 10, 2026 08:47
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.

1 participant