Skip to content

Tables: Implement cell spanning (colspan/rowspan) #276

@nlopes

Description

@nlopes

Problem

Table cell spanning syntax is not implemented. AsciiDoc supports colspan and rowspan via special syntax in table cells.

AsciiDoc syntax

[cols="3*"]
|===
| Cell 1 | Cell 2 | Cell 3

2+| Spans 2 columns | Cell 6

.2+| Spans 2 rows
| Cell 8
| Cell 9

| Cell 10
| Cell 11
|===
  • 2+| = colspan of 2
  • .2+| = rowspan of 2
  • 2.3+| = colspan of 2, rowspan of 3

Current behavior

Spanning syntax is treated as literal content or causes parsing issues.

Implementation requirements

1. AST changes (acdc-parser/src/model/tables.rs)

Add span fields to TableColumn:

pub struct TableColumn {
    pub content: Vec<Block>,
    pub colspan: usize,  // NEW: default 1
    pub rowspan: usize,  // NEW: default 1
}

2. Parser changes (acdc-parser/src/grammar/)

  • Parse span prefixes before cell content: (\d+)?(\.\d+)?\+
  • Validate spans don't exceed table boundaries
  • Handle interaction with column specifiers

3. HTML renderer (converters/html/src/table.rs)

  • Emit colspan and rowspan attributes on <td>/<th> elements
  • Skip cells that are "covered" by a spanning cell from a previous row

Workaround

Use separate rows/columns instead of spanning.

Priority

High - affects complex table layouts, common use case.

References

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