Basics
A fenced code block with the class table holds a table as CSV. The first row is the header:
| Planet | Moons | Rings |
|---|---|---|
| Earth | 1 | No |
| Jupiter | 95 | Yes |
| Saturn | 146 | Yes |
A YAML block at the top of the code block sets the options. Here, caption and alignment: one letter per column among L, R, C and D (left, right, centre, default), and the columns left out are default:
| Planet | Moons | Rings |
|---|---|---|
| Jupiter | 95 | Yes |
| Saturn | 146 | Yes |
| Uranus | 28 | Yes |
| Neptune | 16 | Yes |
With header: false, every row is in the body:
| Mercury | 0 |
|---|---|
| Venus | 0 |
A cell with a comma, a quote or a line break is quoted with double quotes, and a double quote inside it is doubled:
| Planet | Note |
|---|---|
| Earth | Third from the Sun, and has "Moon" for a moon |
| Mars | Named after the god of war |
alignment-cells aligns cells one by one, a line per row, and again what is left out is default:
| Planet | Moons |
|---|---|
| Mars | 2 |
| Earth | 1 |
Source
This page is made from the Markdown below. The second tab is what pandoc -F pantable -t markdown writes for it, each table as a pandoc table; the third converts those tables back to code blocks with pantable2csvx.
---
title: Basics
---
A fenced code block with the class `table` holds a table as CSV. The
first row is the header:
```table
Planet,Moons,Rings
Earth,1,No
Jupiter,95,Yes
Saturn,146,Yes
```
A YAML block at the top of the code block sets the options. Here,
`caption` and `alignment`: one letter per column among `L`, `R`, `C`
and `D` (left, right, centre, default), and the columns left out are
default:
```table
---
caption: The outer planets
alignment: LRC
---
Planet,Moons,Rings
Jupiter,95,Yes
Saturn,146,Yes
Uranus,28,Yes
Neptune,16,Yes
```
With `header: false`, every row is in the body:
```table
---
header: false
---
Mercury,0
Venus,0
```
A cell with a comma, a quote or a line break is quoted with double
quotes, and a double quote inside it is doubled:
```table
Planet,Note
Earth,"Third from the Sun, and has ""Moon"" for a moon"
Mars,"Named after the god of war"
```
`alignment-cells` aligns cells one by one, a line per row, and again
what is left out is default:
```table
---
alignment-cells: |
CC
LR
---
Planet,Moons
Mars,2
Earth,1
```A fenced code block with the class `table` holds a table as CSV. The
first row is the header:
Planet Moons Rings
--------- ------- -------
Earth 1 No
Jupiter 95 Yes
Saturn 146 Yes
:
A YAML block at the top of the code block sets the options. Here,
`caption` and `alignment`: one letter per column among `L`, `R`, `C` and
`D` (left, right, centre, default), and the columns left out are
default:
Planet Moons Rings
--------- ------- -------
Jupiter 95 Yes
Saturn 146 Yes
Uranus 28 Yes
Neptune 16 Yes
: The outer planets
With `header: false`, every row is in the body:
Mercury 0
--------- ---
Venus 0
:
A cell with a comma, a quote or a line break is quoted with double
quotes, and a double quote inside it is doubled:
Planet Note
-------- -------------------------------------------------
Earth Third from the Sun, and has \"Moon\" for a moon
Mars Named after the god of war
:
`alignment-cells` aligns cells one by one, a line per row, and again
what is left out is default:
Planet Moons
-------- -------
Mars 2
Earth 1
:A fenced code block with the class `table` holds a table as CSV. The
first row is the header:
``` table
---
fancy-table: true
markdown: true
...
===,Planet,Moons,Rings
,Earth,1,No
,Jupiter,95,Yes
___,Saturn,146,Yes
```
A YAML block at the top of the code block sets the options. Here,
`caption` and `alignment`: one letter per column among `L`, `R`, `C` and
`D` (left, right, centre, default), and the columns left out are
default:
``` table
---
alignment: LRC
caption: The outer planets
fancy-table: true
markdown: true
...
===,Planet,Moons,Rings
,Jupiter,95,Yes
,Saturn,146,Yes
,Uranus,28,Yes
___,Neptune,16,Yes
```
With `header: false`, every row is in the body:
``` table
---
fancy-table: true
markdown: true
...
===,Mercury,0
___,Venus,0
```
A cell with a comma, a quote or a line break is quoted with double
quotes, and a double quote inside it is doubled:
``` table
---
fancy-table: true
markdown: true
...
===,Planet,Note
,Earth,"Third from the Sun, and has \""Moon\"" for a moon"
___,Mars,Named after the god of war
```
`alignment-cells` aligns cells one by one, a line per row, and again
what is left out is default:
``` table
---
alignment-cells: 'CC
LR'
fancy-table: true
markdown: true
...
===,Planet,Moons
,Mars,2
___,Earth,1
```