mdview supports tables in a limited way: it can recognize table syntax, and it displays the table as an unstyled code block. Therefore, if the original table text is aligned, the output table will look aligned.
Of course, inside the table block all characteristics of a code block apply, for instance, _
, *
, and +++
represent themselves, no smart quote replacement, and so on.
TEST aligned table...
| Qty | Food |
| --- | ------ |
| 1 | mango |
| 12 | eggs |
RESULT aligned table: “Qty/Food”, underlines, “1/mango”, “12/eggs”
TEST aligned table, H3 before...
| Qty | Food |
| --- | ------ |
| 1 | mango |
| 12 | eggs |
RESULT heading “H3”; aligned table: “Qty/Food”, underlines, “1/mango”, “12/eggs”
TEST aligned table, two lines after...
| Qty | Food |
| --- | ------ |
| 1 | mango |
| 12 | eggs |
line 1 line 2
RESULT aligned table: “Qty/Food”, underlines, “1/mango”, “12/eggs”; paragraph “line 1 line 2”
TEST minimal table...
| Qty | Food |
| --- | ------ |
line 1
RESULT aligned table: “Qty/Food” (with underlines); paragraph “line 1”
TEST not table 1...
| Qty | Food | line 1
RESULT paragraph “| Qty | Food | line 1” — underlines are required
TEST not table 2...
| Qty | Food | | — | — | line 1
RESULT paragraph “| Qty | Food | | — | — | line 1” — at least 3 dashes are required
TEST alignment markers (understood but ignored)...
| Qty | Food | Life |
| ---: | :----- | :---:|
| 1 | mango | 5d |
| 12 | eggs | 1w |
RESULT aligned table: “Qty/Food/Life”, underlines, “1/mango/5d”, “12/eggs/1w”
TEST misaligned table...
| Qty | Food |
| --- | --- |
| 1 | mango |
| 12 | eggs |
RESULT misaligned table: “Qty/Food”, underlines, “1/mango”, “12/eggs” — “misaligned is what misaligned does” :()
TEST no left bar ...
Qty | Food | Life |
---: | :----- | :---:|
1 | mango | 5d |
12 | eggs | 1w |
TEST no right bar ...
| Qty | Food | Life
| ---: | :----- | :---:
| 1 | mango | 5d
| 12 | eggs | 1w
TEST no side bars ...
Qty | Food | Life
--- | ------ | ----
1 | mango | 5d
12 | eggs | 1w
RESULT aligned table: “Qty/Food/Life”, underlines, “1/mango/5d”, “12/eggs/1w”
TEST formatting is not applied ...
_Qty_ | **Food** | +++Life+++
--- | ------ | ----
`1` | mango | 5d
12 | eggs | 1w
RESULT aligned table (no formatting): “Qty/Food/Life”, underlines, “1/mango/5d”, “12/eggs/1w”
TEST table, GFM code block before ...
code block
| Qty | Food |
| --- | ------ |
line 1
RESULT two code blocks, paragraph “line 1”
TEST table, code block before, GFM code block after ...
<-- 4 Spaces code block line 1
<-- Tab code block line 2
| Qty | Food |
| --- | ------ |
code block
line 1
RESULT three code blocks, paragraph “line 1”
TEST table, code block after ...
| Qty | Food |
| --- | ------ |
<-- 4 Spaces code block line 1
<-- Tab code block line 2
line 1
RESULT two code blocks, paragraph “line 1”