Skip to content

Comments

feat: support custom table styles from style layout#472

Merged
k1LoW merged 4 commits intomainfrom
table-style
Dec 17, 2025
Merged

feat: support custom table styles from style layout#472
k1LoW merged 4 commits intomainfrom
table-style

Conversation

@k1LoW
Copy link
Owner

@k1LoW k1LoW commented Dec 14, 2025

Summary

Add support for custom table styles from the style layout. Users can now customize table appearance by placing a 2x2 table in the style layout.

Features

CleanShot 2025-12-16 at 1  16 17@2x

Cell Styles

Each cell in the 2x2 table defines styles for different regions of Markdown tables:

1st column Other columns
Header row [0,0] [0,1]
Data rows [1,0] [1,1]

Extracted properties:

  • Background color
  • Text style (bold, italic, font, color, etc.)
  • Text alignment (horizontal: left/center/right, vertical: top/middle/bottom)

Border Styles

Border styles are mapped as follows:

2x2 Table Border Applied To
[0,0] Top/Left Outer borders (top/bottom/left/right of entire table)
[0,0] Right/Bottom Header row, 1st column inner borders
[0,1] Right/Bottom Header row, 2nd+ columns inner borders
[1,0] Right/Bottom Data rows, 1st column inner borders
[1,1] Right/Bottom Data rows, 2nd+ columns inner borders

Transparent borders (Alpha=0) are also supported.

Changes

  • table_style.go: Added TableBorderStyle struct, extractBorderStyle(), and alignment extraction
  • table.go: Added applyTableBorderStyles(), prepareBorderProperties(), and alignment application
  • README.md: Added documentation for table style customization
  • Updated golden test images

@k1LoW k1LoW self-assigned this Dec 14, 2025
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Extract table cell styles (background, text style) from a 2x2 table
in the "style" layout and apply them when creating new tables.
@github-actions

This comment has been minimized.

Extract border styles from 2x2 table in the "style" layout and apply them
to markdown tables. The 2x2 table cells map to different table regions:

- [0,0] Top/Left → outer borders (top/bottom/left/right)
- [0,0] Right/Bottom → header row, 1st column inner borders
- [0,1] Right/Bottom → header row, 2nd+ columns inner borders
- [1,0] Right/Bottom → data rows, 1st column inner borders
- [1,1] Right/Bottom → data rows, 2nd+ columns inner borders

Also supports transparent borders (Alpha=0) by using ForceSendFields.
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@k1LoW k1LoW marked this pull request as ready for review December 15, 2025 15:38
@k1LoW k1LoW requested a review from Copilot December 15, 2025 15:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

Code Metrics Report

main (abcfb83) #472 (871242c) +/-
Coverage 32.3% 33.2% +0.9%
Code to Test Ratio 1:0.8 1:0.9 +0.0
Test Execution Time 10s 10s 0s
Details
  |                     | main (abcfb83) | #472 (871242c) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          32.3% |          33.2% | +0.9% |
  |   Files             |             30 |             31 |    +1 |
  |   Lines             |           3190 |           3382 |  +192 |
+ |   Covered           |           1031 |           1126 |   +95 |
+ | Code to Test Ratio  |          1:0.8 |          1:0.9 |  +0.0 |
  |   Code              |           6550 |           6985 |  +435 |
+ |   Test              |           5796 |           6453 |  +657 |
  | Test Execution Time |            10s |            10s |    0s |

Code coverage of files in pull request scope (7.4% → 20.1%)

Files Coverage +/- Status
deck.go 2.1% -0.1% modified
md/table.go 86.6% -0.9% modified
table.go 4.2% +4.2% modified
table_style.go 97.7% +97.7% added

Reported by octocov

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@k1LoW k1LoW merged commit c4676f8 into main Dec 17, 2025
13 checks passed
@k1LoW k1LoW deleted the table-style branch December 17, 2025 13:39
@github-actions github-actions bot mentioned this pull request Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant