A Quarto filter extension that enables colspan and rowspan in Markdown tables.
Installing
quarto add herosi/table-cell-merge
This will install the extension under the _extensions subdirectory.
If you're using version control, you will want to check in this directory.
Using
-
Add the following line to your
.qmdfile or_quarto.yamlto enable the extension.filters: - { at: post-quarto, path: table-cell-merge }
Note: The extension must be loaded using the format shown above. Otherwise, it will not work with
tbl-colwidths. -
Add a line like the following after the table.
: {tbl-merge="[1:2:col:2, 2:1:row:3]"}
tbl-mergeformat:[row:col:direction:span, ...]
| Key | Type | Value |
|---|---|---|
| row | integer | 1-based row index (header rows first, then body rows) |
| col | integer | 1-based column index |
| direction | string | col (for colspan) or row (for rowspan) |
| span | integer | number of cells to merge (>= 2) |
Notes
- The contents of merged cells are ignored; only the content of the leading cell is preserved.
- When
colspanandrowspanare specified together, the cells are merged into a rectangular region (following the HTMLcolspan/rowspanbehavior).
Example
Here is the source code for a minimal example: example.qmd. View an example presentation at example.html.