An experimental Wikipedia/MediaWiki table parser and renderer written in golang.
The GitHub Flavored Markdown Table syntax sometimes cannot express complex tables, or tables with styles, or tables with colspans and rowspans. This parser/goldmark extension enables you depicting tables using Wiki Tables syntax.
import wikitable "github.com/movsb/goldmark-wiki-table"
md := goldmark.New(
goldmark.WithExtensions(wikitable.New()),
)
See test/main.go for more details.
Write them directly in Markdown as paragraph, not in code blocks.
Note: Some styles may not be shown by GitHub.
{|
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}
Orange | Apple |
Bread | Pie |
Butter | Ice cream |
{| class="wikitable" style="color:green; background-color:#ffffcc;" cellpadding="10"
|Orange
|Apple
|-
|Bread
|Pie
|-
|Butter
|Ice cream
|}
Orange | Apple |
Bread | Pie |
Butter | Ice cream |
{| class="wikitable"
!colspan="6"|Shopping List
|-
|rowspan="2"|Bread & Butter
|Pie
|Buns
|Danish
|colspan="2"|Croissant
|-
|Cheese
|colspan="2"|Ice cream
|Butter
|Yogurt
|}
Shopping List | |||||
---|---|---|---|---|---|
Bread & Butter | Pie | Buns | Danish | Croissant | |
Cheese | Ice cream | Butter | Yogurt |
{| class="wikitable"
|+ style="caption-side:bottom; color:#e76700;"|Food complements
|-
! style="color:green" | Fruits
! style="color:red" | Fats
|-
|Orange
|Butter
|-
|Pear
|Pie
|-
|Apple
|Ice cream
|}
Fruits | Fats |
---|---|
Orange | Butter |
Pear | Pie |
Apple | Ice cream |
{|
|+ An example table
|-
! First header
! colspan="2" | Second header
|-
| Upper left
| Upper middle
| rowspan="2" | Right side
|-
| Lower left
| Lower middle
|-
| colspan="3"| Text before a nested table...
{|
|+ A table in a table
| AAA
| BBB
|}
|}
First header | Second header | |||
---|---|---|---|---|
Upper left | Upper middle | Right side | ||
Lower left | Lower middle | |||
Text before a nested table...
A table in a table
|
MIT