Tables are a widely used item and would be nice to have in the core feature set. Reading through all the replies, I did not see any mention of a style I have encountered with Atlassian products. I find this to be simpler and easier to read. It allows for header styles to be used for any cell and reduces the typing. This is my modified version to include alignment functionality and column spanning.
Rules:
- Tables must be surrounded by blank lines
- Pipes initiate a table cell until another separate pipe is encountered or white space (including new lines)
- Cell modifiers follow directly after the
|
and before the first white space. - A space or tab must separate a pipe and its modifiers from the content.
``
- Format: |m - single pipe starts a cell followed directly by its modifiers
- (m)odifiers:
-
|
- make cell a header -
<
- left align cell -
=
- center align cell -
>
- right align cell -
#
- number of cells to span
-
``
||< th left aligned ||= th center aligned ||> th right aligned
|< td left aligned |= td center aligned |> td right aligned
|| th |<2 td with a cell span of 2 left aligned
| td ||2 th with a cell span of 2
| |2 blank cells require a space between the pipes when there are multiple columns or just the pipes when alone.
|3
||3
If you are one who likes everything aligned, then it supports that as well by trimming.
||< th left aligned ||= th center aligned ||> th right aligned
|< td left aligned |= td center aligned |> td right aligned
|| th |<2 td with a cell span of 2 left aligned
| td ||2 th with a cell span of 2
| |2 blank cells require a space between the pipes when there are multiple columns or just the pipes when alone.
|3
||3
I like this because it does not require extra spacing, dashes, or lines, but has support for advanced table formatting if one likes. And the parser just has to identify the pipe and any trailing modifiers till the next white space (including line feeds) character.
Example Output:
<table>
<tr>
<th align="left">th left aligned</th>
<th align="center">th center aligned</th>
<th align="right">th right aligned</th>
</tr>
<tr>
<td align="left">td left aligned</td>
<td align="center">td center aligned</td>
<td align="right">td right aligned</td>
</tr>
<tr>
<th>th</th>
<td align="left" colspan="2">td with a cell span of 2 left aligned</td>
</tr>
<tr>
<td></td>
<th colspan="2">th with cell span of 2</th>
</tr>
<tr>
<td></td>
<td colspan="2">blank cells require a space between the pipes when there are mu ltiple columns or just the pipes when alone.</td>
</tr>
<tr>
<td colspan="3"></td>
</tr>
<tr>
<th colspan="3"></th>
</tr>
</table>
Anyway, just wanted to contribute my thought for others to see.