Markdig supports two kinds of tables: pipe tables (GitHub-style) and grid tables (Pandoc-style).
Enable with .UsePipeTables() (included in UseAdvancedExtensions()).
Columns are separated by |. A header row is separated from the body by a line of dashes:
| Name | Language | Stars |
|----------|----------|-------|
| Markdig | C# | 4.5k |
| cmark | C | 1.6k |
| markdown-it | JavaScript | 18k |
| Name | Language | Stars |
|---|---|---|
| Markdig | C# | 4.5k |
| cmark | C | 1.6k |
| markdown-it | JavaScript | 18k |
Use colons in the separator row to control alignment:
| Left | Center | Right |
|:-------|:-------:|-------:|
| one | two | three |
| four | five | six |
| Left | Center | Right |
|---|---|---|
| one | two | three |
| four | five | six |
The outer pipes are optional:
Name | Language
-----|--------
Markdig | C#
cmark | C
| Name | Language |
|---|---|
| Markdig | C# |
| cmark | C |
Cells support inline Markdown — emphasis, code, links, etc.:
| Feature | Status |
|---------------|---------------|
| **Bold** | ~~removed~~ |
| `code` | [link](#) |
| Feature | Status |
|---|---|
| Bold | |
code |
link |
Use \| to include a literal pipe inside a cell:
| Expression | Result |
|-------------|--------|
| `a \| b` | a or b |
UsePipeTables accepts a PipeTableOptions object:
var pipeline = new MarkdownPipelineBuilder()
.UsePipeTables(new PipeTableOptions
{
UseHeaderForColumnCount = true // GFM-compatible column counting
})
.Build();
Enable with .UseGridTables() (included in UseAdvancedExtensions()).
Grid tables use +, -, and | characters to draw a grid. They support multi-line cells, column spanning, and richer content than pipe tables.
+-----------+-----------+
| Header 1 | Header 2 |
+===========+===========+
| Cell 1 | Cell 2 |
+-----------+-----------+
| Cell 3 | Cell 4 |
+-----------+-----------+
| Header 1 | Header 2 |
|---|---|
| Cell 1 | Cell 2 |
| Cell 3 | Cell 4 |
Grid table cells can contain multiple lines and block-level content:
+-----------+-------------------+
| Name | Description |
+===========+===================+
| Markdig | A fast, powerful |
| | Markdown parser. |
+-----------+-------------------+
| cmark | The C reference |
| | implementation. |
+-----------+-------------------+
| Name | Description |
|---|---|
| Markdig | A fast, powerful Markdown parser. |
| cmark | The C reference implementation. |
Use a continuous line (without + separators) to span columns:
+-------+-------+
| A | B |
+=======+=======+
| Cell spanning |
+-------+-------+
| A | B |
|---|---|
| Cell spanning | |
Use = instead of - for the header separator line (+===+===+).