mirror of
https://github.com/xoofx/markdig.git
synced 2026-11-17 18:00:55 +00:00
Copyedit the grid table extension documentation
This commit is contained in:
@@ -4,7 +4,8 @@ This section describes the different extensions supported:
|
||||
|
||||
## Grid Table
|
||||
|
||||
A grid table allows to have multiple lines per cells and allows to span cells over multiple columns. The following shows a simple grid table
|
||||
A grid table allows having multiple lines per cells and allows spanning cells over multiple columns.
|
||||
The following shows a simple grid table:
|
||||
|
||||
```
|
||||
+---------+---------+
|
||||
@@ -25,17 +26,20 @@ A grid table allows to have multiple lines per cells and allows to span cells ov
|
||||
```
|
||||
|
||||
**Rule #1**
|
||||
The first line of a grid table must a **row separator**. It must start with the column separator character `+` used to separate columns in a row separator. Each column separator is:
|
||||
- starting by optional spaces
|
||||
- followed by an optional `:` to specify left align, followed by optional spaces
|
||||
- followed by a sequence of at least one `-` character, followed by optional spaces
|
||||
- followed by an optional `:` to specify right align (or center align if left align is also defined)
|
||||
- ending by optional spaces
|
||||
The first line of a grid table must be a **row separator**.
|
||||
It must start with the column separator character `+` used to separate columns in a row separator.
|
||||
|
||||
The first row separator must be followed by a *regular row*. A regular row must start with the character `|` that is starting at the same position than the column separator `+` of the first row separator.
|
||||
Each column separator:
|
||||
- starts with optional spaces
|
||||
- followed by an optional `:` to specify left align, followed by optional spaces
|
||||
- followed by a sequence of one or more `-` characters, followed by optional spaces
|
||||
- followed by an optional `:` to specify right align (or center align if left align is also defined)
|
||||
- ends with optional spaces
|
||||
|
||||
The first row separator must be followed by a *regular row*.
|
||||
A regular row must start with a `|` character starting at the same position as the column separator `+` of the first row separator.
|
||||
|
||||
The following is a valid row separator
|
||||
The following is a valid row separator:
|
||||
|
||||
```````````````````````````````` example
|
||||
+---------+---------+
|
||||
@@ -53,8 +57,8 @@ The following is a valid row separator
|
||||
</table>
|
||||
````````````````````````````````
|
||||
|
||||
The following is not a valid row separator:
|
||||
|
||||
The following is not a valid row separator
|
||||
```````````````````````````````` example
|
||||
|-----xxx----+---------+
|
||||
| This is | not a table
|
||||
@@ -64,7 +68,8 @@ The following is not a valid row separator
|
||||
````````````````````````````````
|
||||
|
||||
**Rule #2**
|
||||
A regular row can continue a previous regular row when column separator `|` are positioned at the same position than the previous line. If they are positioned at the same location, the column may span over multiple columns:
|
||||
A regular row can continue a previous regular row when the column separators `|` are positioned at the same position as those of the previous line.
|
||||
If they are positioned at the same location, the column may span over multiple columns:
|
||||
|
||||
```````````````````````````````` example
|
||||
+---------+---------+---------+
|
||||
@@ -134,15 +139,13 @@ The last column separator `|` may be omitted:
|
||||
</table>
|
||||
````````````````````````````````
|
||||
|
||||
The respective width of the columns are calculated from the ratio between the total size of the first table row without counting the `+`: `+----+--------+----+` would be divided between:
|
||||
The respective widths of the columns are calculated from the ratio between the total size of the first table row without counting the `+`: `+----+--------+----+` would be divided between:
|
||||
|
||||
Total size is : 16
|
||||
- `----` → 4 characters
|
||||
- `--------` → 8 characters
|
||||
- `----` → 4 characters
|
||||
|
||||
- `----` -> 4
|
||||
- `--------` -> 8
|
||||
- `----` -> 4
|
||||
|
||||
So the width would be 4/16 = 25%, 8/16 = 50%, 4/16 = 25%
|
||||
The total size is 16 characters, so the widths would be 4/16 = 25%, 8/16 = 50%, and 4/16 = 25%.
|
||||
|
||||
```````````````````````````````` example
|
||||
+----+--------+----+
|
||||
@@ -165,7 +168,6 @@ So the width would be 4/16 = 25%, 8/16 = 50%, 4/16 = 25%
|
||||
|
||||
Alignment might be specified on the first row using the character `:`:
|
||||
|
||||
|
||||
```````````````````````````````` example
|
||||
+-----+:---:+-----+
|
||||
| A | B | C |
|
||||
@@ -220,7 +222,7 @@ D</td>
|
||||
</table>
|
||||
````````````````````````````````
|
||||
|
||||
A grid table may have cells with both colspan and rowspan:
|
||||
A grid table may have cells with both `colspan` and `rowspan`:
|
||||
|
||||
```````````````````````````````` example
|
||||
+---+---+---+
|
||||
@@ -276,7 +278,6 @@ A grid table may not have irregularly shaped cells:
|
||||
|
||||
An empty `+` on a line should result in a simple empty list output:
|
||||
|
||||
|
||||
```````````````````````````````` example
|
||||
+
|
||||
.
|
||||
|
||||
Reference in New Issue
Block a user