Skip to content

Conversation

@dereuromark
Copy link
Contributor

@dereuromark dereuromark commented Jan 14, 2026

Summary

Implements table rowspan and colspan support using ^ and < markers as proposed in jgm/djot#368

Syntax

  • ^ in a cell means it's spanned from the cell above (rowspan)
  • < in a cell means it's spanned from the cell to the left (colspan)

Both markers point toward their source cell, making the syntax consistent:

  • < points left ← toward the spanning cell
  • ^ points up ↑ toward the spanning cell

Rowspan Example

| Category | Item   | Price |
|----------|--------|-------|
| Fruits   | Apple  | $1    |
| ^        | Banana | $0.50 |
| ^        | Orange | $0.75 |
| Veggies  | Carrot | $0.30 |

Renders "Fruits" with rowspan="3".

Colspan Example

| Header   | <      |
|----------|--------|
| A        | B      |

Renders "Header" with colspan="2".

Combined Example

| A     | <     |
|-------|-------|
| 1     | 2     |
| ^     | 3     |

Renders:

  • "A" with colspan="2"
  • "1" with rowspan="2"

Features

  • Rowspan via ^ marker (cell spanned from above)
  • Colspan via < marker (cell spanned from left)
  • Works with cell and row attributes ({.class})
  • Preserves alignment from separator row
  • Handles complex combinations of rowspan and colspan
  • Multiple consecutive spans supported
  • Literal < in content (e.g., a < b) not treated as marker

Related

Implements cell spanning syntax for tables based on discussion in
jgm/djot#368

Syntax:
- `^` in a cell means it's spanned from the cell above (rowspan)
- `>` in a cell means it's spanned from the cell to the left (colspan)

Example:
| Category | Item   | Price |
|----------|--------|-------|
| Fruits   | Apple  | $1    |
| ^        | Banana | $0.50 |
| ^        | Orange | $0.75 |

This renders "Fruits" with rowspan=3.

Example with colspan:
| Header   | >      |
|----------|--------|
| A        | B      |

This renders "Header" with colspan=2.

Features:
- Rowspan via ^ marker
- Colspan via > marker
- Works with cell and row attributes
- Preserves alignment
- Handles complex combinations of rowspan and colspan
@codecov
Copy link

codecov bot commented Jan 14, 2026

Codecov Report

❌ Patch coverage is 92.00000% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.43%. Comparing base (6c0ff92) to head (abd5bdd).

Files with missing lines Patch % Lines
src/Parser/BlockParser.php 92.52% 8 Missing ⚠️
src/Node/Block/TableCell.php 75.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #66      +/-   ##
============================================
- Coverage     93.48%   93.43%   -0.05%     
- Complexity     1956     1995      +39     
============================================
  Files            74       74              
  Lines          5247     5363     +116     
============================================
+ Hits           4905     5011     +106     
- Misses          342      352      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dereuromark dereuromark added extra beyond standard/specs RFC labels Jan 14, 2026
The < marker now points toward the source cell (to the left),
consistent with ^ pointing up toward its source cell.

Also added additional test cases:
- Combined colspan and rowspan on same cell
- Multiple colspan groups in same row
- Rowspan across multiple columns
- Literal < in cell content (not treated as marker)
@dereuromark dereuromark changed the title Add table rowspan and colspan support via ^ and > markers Add table rowspan and colspan support via ^ and < markers Jan 15, 2026
@dereuromark dereuromark marked this pull request as draft January 15, 2026 02:23
@dereuromark
Copy link
Contributor Author

Closing in favor of #67

@dereuromark dereuromark deleted the feature/table-rowspan-colspan branch January 16, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extra beyond standard/specs RFC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants