From 12e8343068b906f8b2afddc5569968a8a91fa5b0 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 29 Apr 2024 06:24:24 +0200 Subject: Adding upstream version 2.1.0. Signed-off-by: Daniel Baumann --- tests/test_port/fixtures/tables.md | 896 +++++++++++++++++++++++++++++++++++++ 1 file changed, 896 insertions(+) create mode 100644 tests/test_port/fixtures/tables.md (limited to 'tests/test_port/fixtures/tables.md') diff --git a/tests/test_port/fixtures/tables.md b/tests/test_port/fixtures/tables.md new file mode 100644 index 0000000..cf83708 --- /dev/null +++ b/tests/test_port/fixtures/tables.md @@ -0,0 +1,896 @@ +Simple: +. +| Heading 1 | Heading 2 +| --------- | --------- +| Cell 1 | Cell 2 +| Cell 3 | Cell 4 +. + + + + + + + + + + + + + + + + + +
Heading 1Heading 2
Cell 1Cell 2
Cell 3Cell 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 1Header 2Header 3Header 4
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 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 1Header 2Header 3Header 4
Cell 1Cell 2Cell 3Cell 4
Cell 5Cell 6Cell 7Cell 8
+. + + +Nested tables inside blockquotes: +. +> foo|foo +> ---|--- +> bar|bar +baz|baz +. +
+ + + + + + + + + + + + + +
foofoo
barbar
+
+

baz|baz

+. + + +Minimal one-column: +. +| foo +|---- +| test2 +. + + + + + + + + + + + +
foo
test2
+. + + +This is parsed as one big table: +. +- foo|foo +---|--- +bar|bar +. + + + + + + + + + + + + + +
- foofoo
barbar
+. + + +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 | +. + + + + + + + + + + + + + +
foobar
bazquux
+. + + +Should terminate paragraph: +. +paragraph +foo|foo +---|--- +bar|bar +. +

paragraph

+ + + + + + + + + + + + + +
foofoo
barbar
+. + + +Table no longer terminated via row without "|" symbol: +. +foo|foo +---|--- +paragraph +. + + + + + + + + + + + + + +
foofoo
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` | Cell 4 +. + + + + + + + + + + + + + + + + + +
Heading 1Heading 2
Cell|1Cell 2
`Cell3`
+. + +Unclosed backticks don't count +. +| Heading 1 | Heading 2 +| --------- | --------- +| Cell 1 | Cell 2 +| `Cell 3| Cell 4 +. + + + + + + + + + + + + + + + + + +
Heading 1Heading 2
Cell 1Cell 2
`Cell 3Cell 4
+. + +Another complicated backticks case +. +| Heading 1 | Heading 2 +| --------- | --------- +| Cell 1 | Cell 2 +| \\\`|\\\` +. + + + + + + + + + + + + + + + + + +
Heading 1Heading 2
Cell 1Cell 2
\`\`
+. + +`\` in tables should not count as escaped backtick +. +# | 1 | 2 +--|--|-- +x | `\` | `x` +. + + + + + + + + + + + + + + + +
#12
x\x
+. + +Tables should handle escaped backticks +. +# | 1 | 2 +--|--|-- +x | \`\` | `x` +. + + + + + + + + + + + + + + + +
#12
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 | 5 | 6 | +. + + + + + + + + + + + + + +
12
34
+. + + +An amount of rows might be different across the table #2: +. +| 1 | 2 | 3 | 4 | +| :-----: | :-----: | :-----: | :-----: | +| 5 | 6 | +. + + + + + + + + + + + + + + + + + +
1234
56
+. + + +Allow one-column tables (issue #171): +. +| foo | +:-----: +| bar | +. + + + + + + + + + + + +
foo
bar
+. + + +Allow indented tables (issue #325): +. + | Col1a | Col2a | + | ----- | ----- | + | Col1b | Col2b | +. + + + + + + + + + + + + + +
Col1aCol2a
Col1bCol2b
+. + + +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 | +. + + + + + + + +
Col1aCol2a
+
| Col1b | Col2b |
+
+. + + +Allow tables with empty body: +. + | Col1a | Col2a | + | ----- | ----- | +. + + + + + + + +
Col1aCol2a
+. + + +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 1Heading 2
Cell 1Cell 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 1Heading 2
Cell 1Cell 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 | +. + +. + +Table without any columns is not a table, #724 +. +| +| +| +. +

| +| +|

+. + +GFM 4.10 Tables (extension), Example 198 +. +| foo | bar | +| --- | --- | +| baz | bim | +. + + + + + + + + + + + + + +
foobar
bazbim
+. + +GFM 4.10 Tables (extension), Example 199 +. +| abc | defghi | +:-: | -----------: +bar | baz +. + + + + + + + + + + + + + +
abcdefghi
barbaz
+. + +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 +. + + + + + + + + + + + + + +
abcdef
barbaz
+
+

bar

+
+. + +GFM 4.10 Tables (extension), Example 202 +. +| abc | def | +| --- | --- | +| bar | baz | +bar + +bar +. + + + + + + + + + + + + + + + + + +
abcdef
barbaz
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 | boo | +. + + + + + + + + + + + + + + + + + +
abcdef
bar
barbaz
+. + +GFM 4.10 Tables (extension), Example 205 +. +| abc | def | +| --- | --- | +. + + + + + + + +
abcdef
+. + +A list takes precedence in case of ambiguity +. +a | b +- | - +1 | 2 +. +

a | b

+ +. -- cgit v1.2.3