Skip to content

Latest commit

 

History

History
896 lines (829 loc) · 10.4 KB

tables.md

File metadata and controls

896 lines (829 loc) · 10.4 KB

Simple: .

Heading 1 Heading 2
Cell 1 Cell 2
Cell 3 Cell 4
.
Heading 1 Heading 2
Cell 1 Cell 2
Cell 3 Cell 4
.

Column alignment: .

Header 1 Header 2 Header 3 Header 4
Cell 1 Cell 2 Cell 3 Cell 4
Cell 5 Cell 6 Cell 7 Cell 8
.
Header 1 Header 2 Header 3 Header 4
Cell 1 Cell 2 Cell 3 Cell 4
Cell 5 Cell 6 Cell 7 Cell 8
.

Nested emphases: .

Header 1 Header 2 Header 3 Header 4
Cell 1 Cell 2 Cell 3 Cell 4
Cell 5 Cell 6 Cell 7 Cell 8
.
Header 1 Header 2 Header 3 Header 4
Cell 1 Cell 2 Cell 3 Cell 4
Cell 5 Cell 6 Cell 7 Cell 8
.

Nested tables inside blockquotes: .

foo foo
bar bar

baz|baz .

foo foo
bar bar

baz|baz

.

Minimal one-column: .

foo
test2
.
foo
test2
.

This is parsed as one big table: .

  • foo|foo ---|--- bar|bar .
- foo foo
bar bar
.

Second line should not contain symbols except "-", ":", "|" and " ": . foo|foo -----|-----s bar|bar .

foo|foo -----|-----s bar|bar

.

Second line should contain "|" symbol: . foo|foo -----:----- bar|bar .

foo|foo -----:----- bar|bar

.

Second line should not have empty columns in the middle: . foo|foo -----||----- bar|bar .

foo|foo -----||----- bar|bar

.

Wrong alignment symbol position: . foo|foo -----|-::- bar|bar .

foo|foo -----|-::- bar|bar

.

Title line should contain "|" symbol: . foo -----|----- bar|bar .

foo -----|----- bar|bar

.

Allow tabs as a separator on 2nd line .

foo bar
baz quux
.
foo bar
baz quux
.

Should terminate paragraph: . paragraph

foo foo
bar bar
.

paragraph

foo foo
bar bar
.

Table no longer terminated via row without "|" symbol: .

foo foo
paragraph
.
foo foo
paragraph
.

Delimiter escaping (deprecated): . | Heading 1 \\| Heading 2 | --------- | --------- | Cell|1|| Cell|2 | Cell\|3 \| Cell|4 .

| Heading 1 \\| Heading 2 | --------- | --------- | Cell|1|| Cell|2 | Cell\|3 \| Cell|4

.

Pipes inside backticks DO split cells, unless \ escaped: .

Heading 1 Heading 2
Cell|1 Cell 2
`Cell 3`
.
Heading 1 Heading 2
Cell|1 Cell 2
`Cell 3`
.

Unclosed backticks don't count .

Heading 1 Heading 2
Cell 1 Cell 2
`Cell 3 Cell 4
.
Heading 1 Heading 2
Cell 1 Cell 2
`Cell 3 Cell 4
.

Another complicated backticks case .

Heading 1 Heading 2
Cell 1 Cell 2
\` \`
.
Heading 1 Heading 2
Cell 1 Cell 2
\` \`
.

\ in tables should not count as escaped backtick .

| 1 | 2

--|--|-- x | \ | x .

# 1 2
x \ x
.

Tables should handle escaped backticks .

| 1 | 2

--|--|-- x | `` | x .

# 1 2
x `` x
.

An amount of rows might be different across table (issue #171), but header and alignment rows must be equal (#697): .

1 2
3 4
.
1 2
3 4
.

An amount of rows might be different across the table #2: .

1 2 3 4
5 6
.
1 2 3 4
5 6
.

Allow one-column tables (issue #171): .

foo
bar
.
foo
bar
.

Allow indented tables (issue #325): .

Col1a Col2a
Col1b Col2b
.
Col1a Col2a
Col1b Col2b
.

Tables should not be indented more than 4 spaces (1st line): .

Col1a Col2a
Col1b Col2b
.
| Col1a | Col2a |

| ----- | ----- | | Col1b | Col2b |

.

Tables should not be indented more than 4 spaces (2nd line): . | Col1a | Col2a | | ----- | ----- | | Col1b | Col2b | .

| Col1a | Col2a | | ----- | ----- | | Col1b | Col2b |

.

Tables should not be indented more than 4 spaces (3rd line): .

Col1a Col2a
| Col1b | Col2b |

.

Col1a Col2a
| Col1b | Col2b |
.

Allow tables with empty body: .

Col1a Col2a
.
Col1a Col2a
.

Align row should be at least as large as any actual rows: . Col1a | Col1b | Col1c ----- | ----- Col2a | Col2b | Col2c .

Col1a | Col1b | Col1c ----- | ----- Col2a | Col2b | Col2c

.

Escaped pipes inside backticks don't split cells: .

Heading 1 Heading 2
Cell 1 Cell 2
Cell 3| Cell 4
.
Heading 1 Heading 2
Cell 1 Cell 2
Cell 3| Cell 4
.

Escape before escaped Pipes inside backticks don't split cells: .

Heading 1 Heading 2
Cell 1 Cell 2
Cell 3\| Cell 4
.
Heading 1 Heading 2
Cell 1 Cell 2
Cell 3\| Cell 4
.

Regression test for #721, table in a list indented with tabs: .

  • Level 1

    • Level 2

      Column 1 Column 2
      abcdefgh ijklmnop

.

  • Level 1

    • Level 2

      Column 1 Column 2
      abcdefgh ijklmnop
.

Table without any columns is not a table, #724 . | | | .

| | |

.

GFM 4.10 Tables (extension), Example 198 .

foo bar
baz bim
.
foo bar
baz bim
.

GFM 4.10 Tables (extension), Example 199 .

abc defghi
bar baz
.
abc defghi
bar baz
.

GFM 4.10 Tables (extension), Example 200 .

f|oo
b | az
b | im
.
f|oo
b | az
b | im
.

GFM 4.10 Tables (extension), Example 201 .

abc def
bar baz

bar .

abc def
bar baz

bar

.

GFM 4.10 Tables (extension), Example 202 .

abc def
bar baz
bar

bar .

abc def
bar baz
bar

bar

.

GFM 4.10 Tables (extension), Example 203 . | abc | def | | --- | | bar | .

| abc | def | | --- | | bar |

.

GFM 4.10 Tables (extension), Example 204 .

abc def
bar
bar baz
.
abc def
bar
bar baz
.

GFM 4.10 Tables (extension), Example 205 .

abc def
.
abc def
.

A list takes precedence in case of ambiguity . a | b

  • | - 1 | 2 .

a | b

  • | - 1 | 2
.