Extended Table Markup ▦▤▥
The first significant changes to the table syntax are already available in version 6.2.1.
1. Introduction
Introduce a flexible markup for data tables. Any kind of tables allowed by HTML5 can be created using this markup, from the most basic examples (e.g. simple rows of cells) to complex tables with full support for accessibility options.
Backport and adaption of WikkaWiki Table Markup. Requires evaluation and changes, not all features are reasonable to implement.
2. Implementation Notes
2.1. HTML5 Table Cell Attributes
HTML5 table cells, defined by the <td> element, support several attributes for controlling layout, accessibility, and relationships with header cells. Many presentational attributes from earlier HTML versions are now deprecated in favor of CSS.
2.1.1. Core Supported Attributes
These attributes are valid in HTML5 and should be used for modern web development:
-
colspan: Specifies how many columns a cell should span.- Example:
<td colspan="2">makes the cell span two columns.
- Example:
-
rowspan: Specifies how many rows a cell should span.- Example:
<td rowspan="3">makes the cell span three rows.
- Example:
-
headers: Associates a data cell with one or more header cells (<th>) by referencing theiridvalues. This improves accessibility for screen readers.- Example:
<td headers="header1 header2">.
- Example:
2.1.2. Deprecated Attributes (Use CSS Instead)
The following attributes are obsolete in HTML5. Their functionality should be achieved using CSS:
-
align→text-alignormargin -
valign→vertical-align -
bgcolor→background-color -
width→width -
height→height -
nowrap→white-space: nowrap
2.1.3. Global Attributes
The <td> element also supports all global HTML attributes, such as class, id, style, data-*, and aria-* attributes for styling, scripting, and enhanced accessibility.
2.2. Considerations
- use WackoWiki parameter pattern used by actions and formatters
-
(x=1 y=name)
-
-
^conflicts with^^superscript^^or^Cin cell content- The table cell separator is of utmost importance and should never conflict with other wiki markups.
- I like the use of the caret
^(CIRCUMFLEX ACCENT) here, maybe there is a simple workaround to mitigate the conflict with other syntax.-
(?<!\^)\^(?!\^)ensures the^is not preceded or followed by another^, matches only isolated^characters
-
- use of full parameter names
- e.g.
id=tbl1_headerorrowspan=2
- e.g.
- support only indirect inline CSS (see Wrappers around formatters)
- add parameter
width=and supportpxas well as% -
align=parameter issues and CSS shortcomings with dynamic tables-
td:nth-child(2) { text-align: center; }is delightful for static tables
-
- mainly a sanitization and validation issue
-
<td class="[ ' class ' ][ ' bgcolor ' ][ ' align ' ]" style="width: [ ' width ' ];">
- add parameter
- current regex supports quotes like
align="left"orclass="style-1 style-2" - to keep it modest, omit some attributes
-
title -
height -
headers - for full HTML support use
<# HTML here #>
-
- add attributes also to table and caption
- use
table_attr()function to avoid spaghetti code- table: align, bgcolor, class, id, width
- col: bgcolor, class, id, span, width
- caption: align, bgcolor, class, id, side
- cell: align, bgcolor, class, colspan, id, rowspan, scope, width, valign
- table:
#|(align=right)- float (same as
wrapper-CSS classes), class, id
- float (same as
- caption:
?|(side=bottom) Caption |?- id, side (caption-side: top | bottom)
- col:
!|(width=20%) |(width=20%) |(width=40% bgcolor=green) |(width=20% span=2) |!- id, class, span, width, align, valign, bgcolor
- use
- additional attributes are thinkable for
font-size,nowrapand others all translating in adding an additional CSS class tosyle="style1 sytyle2 ..." - add different table styles, default is
usertableordtable, replace table syle via#|(type=mytable) - add a popup for to WikiEdit to create a table with the provided column and rows, as well header and other options
- catch logical errors and mitigate them
- there can be only one caption and only at the top of the table
- error sources
- mistakenly using the wrong attribute name,
rowinstead ofcol - writing the attribute name wrong, leaving out a letter or messing up letters when writing
- data cells in the wrong column (e.g. broken legacy tables) due to missing cell spans
- mistakenly using the wrong attribute name,
2.3. Rational
The parser breaks down the pipe syntax by row and then each cell. The row and cell syntax delimiter | determines each element and process it recursively.
row 1
→ cell 1 → content
→ cell 2 → content
row 2
→ cell 1 → content
→ cell 2 → content
To avoid syntax conflicts, the delimiter | is always on the inside.
#| ?| Fruit production in 2026 |? *| | Apples | Pears |* ^| Mary | 300Kg | 320Kg || ^| John | 400Kg | 630Kg || |#
2.4. Syntax
| Character | Name | Alias names | Unicode | Wikipedia |
|---|---|---|---|---|
| |
Pipe | vertical bar, vertical line | U+007C | wikipedia:Vertical_bar |
^ |
Caret | circumflex accent | U+005E | wikipedia:Caret |
| Syntax | Notes | |
|---|---|---|
| Start | #| |
Besides beginning the table, this is also where the table's class is defined – for example, class="usertable". A table's "class" applies standard WackWiki formatting to that table.#|(class="defaultcenter sticky" align=center) |
| Caption | ?| |? |
Required for accessibility purposes on data tables, and placed only between the table start and the first table row. ?| Caption |? |
| Col | !| |! |
The <col> HTML element defines one or more columns in a column group represented by its parent <colgroup> element. !| |(bgcolor=yellow width=300px span=2) |! |
| Thead | *| |* |
head columns, entire row*| Header 1 | Header 2 |* |
| Header cell | ^| |
Optional. Each header cell starts with a new line and a ^|, or several header cells can be placed consecutively on the same line, separated by a single caret ^. ^| Header | Cell |||| Cell ^ Header || |
| Row | || |
To begin and end a new row of cells, use a double vertical bar ||. || Cell 1 | Cell 2 || |
| Cell | | |
To add a new cell in a row, start each new cell with a single vertical bar |, several cells can be placed consecutively on the same line or a new line, separated by single vertical bar |. |
| Attribute | (attribute=value) |
cell attributes||(colspan=2 rowspan=2) 2x2 | 1x1 || |
| End | |# |
To end the table. |
The table cells as well as the caption are fully editable via wiki syntax.
2.4.1. Attributes
| table | col | caption | cell | |||
|---|---|---|---|---|---|---|
| th | td | |||||
| align | + | – | + | + | + | |
| bgcolor | + | + | + | + | + | |
| class | + | + | + | + | + | |
| colspan | – | – | – | + | + | |
| id | + | + | + | + | + | |
| rowspan | – | – | – | + | + | |
| scope | – | – | – | + | – | |
| side | – | – | + | – | – | |
| span | – | + | – | – | – | |
| type | + | – |
– | – | – | |
| width | + | + | – | + | + | |
| valign | – | – | – | + | + | |
| # | Attribute | Values | Notes |
|---|---|---|---|
| 1 | align |
center, left, right, justify |
Specifies the horizontal alignment of the data cell or places the table on the center, left or right side, allowing text and inline elements to wrap around it.
To align the data cells in an entire column or table, assign the appropriate CSS selectors using the |
| 2 | bgcolor |
blue, red, green, x11colors |
Defines the background color of the data cell. The value is an HTML color; a color keyword.(bgcolor=green) |
| 3 | class |
class_name |
available CSS selectors
|
| 4 | colspan |
number |
Contains a non-negative integer value that indicates how many columns the data cell spans or extends.||(colspan=2) 2x1 | 1x1 || |
| 5 | id |
id_name |
Defines a unique identifier (ID) which must be unique in the whole document. (id=tbl1_summary) |
| 6 | rowspan |
number |
Contains a non-negative integer value that indicates for how many rows the data cell spans or extends.||(rowspan=2) 1x2 | 1x1 || |
| 7 | scope |
row, col, rowgroup, colgroup |
Optional. Defines the cells that the header (defined in the
|
| 8 | side |
top, bottom |
Specifies on which side of the table the caption should be displayed. ?|(side=bottom) Table Caption |? |
| 9 | span |
number |
Specifies the number of consecutive columns the <col> element spans. !|(span=1) |(span=2) |! |
| 10 | type |
class_name |
Use a different table style, default is usertable or dtable.#|(type=mytable) |
| 11 | valign |
top, middle, bottom |
Specifies the vertical alignment of the data cell. (valign=middle) |
| 12 | width |
number[px|%|em|rem] |
Defines a recommended data cell width. (width=50%) |
- thead / tfoot / tbody
- colgroup / col
- CSS: color, styles, width
- via predefined classes
- Global Attributes: id, class,
title, lang, data-*
2.4.2. Colors
- background colors
- table header
- row highlighting
- subtle background colors
- web-safe color
| green | blue |
| yellow | red |
2.4.3. Linebreaks
2.4.4. Spaces
|| cell ||
||(pattern) cell ||
| Pattern | Output | Note |
|---|---|---|
() |
() | |
(hello) |
(hello) | |
(pattern=value) |
matches valid cell attribute pattern | |
(pattern = value) |
matches valid cell attribute pattern | |
text |
text | |
␣text |
text | ignores heading space |
␣␣text |
text |
text indention (<div class="indent"></div>) |
␣␣␣␣text |
text |
text indention |
(align=right) text |
text | |
(align=justify) text |
HTML preserves all whitespace in the source code as text nodes in the DOM, but CSS applies a default whitespace processing algorithm that collapses multiple spaces, tabs, and line breaks into a single space. |
2.4.4.1. Table Space Ignored
HTML and CSS whitespace handling explains why browsers ignore leading spaces in table cells. HTML preserves all whitespace in the source code as text nodes in the DOM, but CSS applies a default whitespace processing algorithm that collapses multiple spaces, tabs, and line breaks into a single space. This behavior is consistent across all inline content, including table cells.
When you have leading spaces in a <td> element, such as <td> Hello</td>, the browser processes the whitespace as follows:
- Leading and trailing whitespace (spaces, tabs, line breaks) before and after text is ignored in rendering.
- Consecutive whitespace characters (spaces, tabs, line feeds) are collapsed into a single space.
- Only the first space between words is preserved; extra spaces are discarded.
This is not a bug—it's by design. The goal is to ensure readable text formatting without requiring developers to worry about code indentation affecting the displayed layout. For example, the following HTML:
<td> Hello World!</td>
is rendered as:
Hello World!
with only a single space between "Hello" and "World!".
2.4.4.2. Solutions to preserve spacing
If you need to display multiple spaces (e.g., for monospaced text or formatting), use one of these methods:
- Use
white-space: prein CSS to preserve all whitespace:
td { white-space: pre; }
- Use non-breaking spaces (
) to force visible spacing:
<td> Hello</td>
- Wrap text in a
<pre>tag if you want to preserve all formatting exactly as written.
This behavior applies uniformly across modern browsers and is part of the standard HTML and CSS specification.
2.5. Issues
- CSS specificity prevents
bgcolorin<th>cells-
.usertable th { background-color: #eee; } - highlight color for hovering above a table row
-
- Currently, there is no way to apply a style to a table row using wiki syntax.
- It is not possible to align the text of an entire column via the
<col>element but possible via CSS selectors for the<table>element, you must usestyle=“text-align: center;”ortd:nth-child(4)for a specific column; otherwise, the user must apply the style to each individual cell (and who wanna do this?).- table
#|(class="defaultcenter col4right")-
.col4right td:nth-child(4) {text-align: right;} -
.defaultcenter {text-align: center;}
-
- CSS selectors
-
default[left|center|right|top|middle|bottom] -
colN[left|center|right|top|middle|bottom]N stands for the column number
-
- table
- As soon as you start defining multiple attributes cell by cell using wiki syntax in a large table with many columns and rows, it quickly becomes counterproductive, especially if you do this over and over again.
- possible solutions:
- inline HTML
- content templates
- keep it simple
- possible solutions:
- Should it use the same attribute name
alignfor the table alignment and the cell text alignment?-
.table-[center|left|right] -
.text-[center|left|right|justify]
-
2.6. JavaScript features
- sortable tables
- table search
- column highlighting
2.7. Backwards Compatibility
The old colspan behaviour is not compatible with the new colspan or rowspan attributes, it would add a colspan where it not belongs.
It once expanded omitted cells at the end of a table row for the last cell to fit the previous rows columns.
By removing this behaviour, existing col spans will default to their original colspan which is 1. Just add the new colspan=Number attribute to the cell to restore the intended colspan.
<?php
// removed legacy colspan behaviour
if ( ($i == $count)
&& ($this->cols <> 0)
&& ($count < $this->cols))
{
$colspan = ' colspan="' . ($this->cols - $count + 1) . '"';
} 2.8. Sanitization & Validation
- Discards attributes not on a whitelist for the given element.
2.9. Documentation
- update Table section in Text Formatting page
- add Table Markup Guide (draft)
2.10. Resources
- https://developer.mozilla.org/[...]nt/HTML_table_basics
- https://developer.mozilla.org/[...]rence/Elements/table
- https://html.spec.whatwg.org/m[...]ml#the-table-element
- https://alistapart.com/article/web-typography-tables/
- https://css-tricks.com/complete-guide-table-element/
3. Examples
#| || ^ Heading 1 ^ Heading 2 || ^| Heading 3 | Row 1 Col 2 | Row 1 Col 3 || ^| Heading 4 | no colspan | || ^| Heading 5 | Row 3 Col 2 | Row 3 Col 3 || |#
| Heading 1 | Heading 2 | |
|---|---|---|
| Heading 3 | Row 1 Col 2 | Row 1 Col 3 |
| Heading 4 | no colspan | |
| Heading 5 | Row 3 Col 2 | Row 3 Col 3 |
#| ?| Fruit production in the last **two** years |? *| |(colspan=2) Apples |(colspan=2) Pears |* *| | 2025 | 2026 | 2025 | 2026 |* ^| Mary | 300Kg | 320Kg | 400kg | 280Kg || ^| John | 400Kg | 630Kg | 210Kg | 300Kg || |#
| Apples | Pears | |||
|---|---|---|---|---|
| 2025 | 2026 | 2025 | 2026 | |
| Mary | 300Kg | 320Kg | 400kg | 280Kg |
| John | 400Kg | 630Kg | 210Kg | 300Kg |
#| ||(align=left width=50%) left |(rowspan=3 valign=top) top |(rowspan=3 valign=middle) middle |(rowspan=3 valign=bottom) bottom || ||(align=center) center || ||(align=right) right || |#
| left | top | middle | bottom |
| center | |||
| right |
#| ||(rowspan=2) 2 lines | line 1 || || line 2 || ||(colspan=2) line 3, 2 columns broad || |#
| 2 lines | line 1 |
| line 2 | |
| line 3, 2 columns broad | |
#| ^|(colspan=2 rowspan=2) 2x2 |(colspan=2) 2x1 |(rowspan=2) 1x2 || ||(rowspan=2) 1x2 | 1x1 || || 1x1 | 1x1 |(colspan=2) 2x1 || |#
| 2x2 | 2x1 | 1x2 | ||
|---|---|---|---|---|
| 1x2 | 1x1 | |||
| 1x1 | 1x1 | 2x1 | ||
| 1 | 1 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| 2 | 2 | 4 | |||||||
| 3 | 3 | 6 | 9 | ||||||
| 4 | 4 | 8 | 12 | 16 | |||||
| 5 | 5 | 10 | 15 | 20 | 25 | ||||
| 6 | 6 | 12 | 18 | 24 | 30 | 36 | |||
| 7 | 7 | 14 | 21 | 28 | 35 | 42 | 49 | ||
| 8 | 8 | 16 | 24 | 32 | 40 | 48 | 56 | 64 | |
| 9 | 9 | 18 | 27 | 36 | 45 | 54 | 63 | 72 | 81 |
| × | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
4. Feedback
Please provide feedback.
Files
| col4alignment.css | 7.1 KiB | 03/28/2026 10:44 |