A pure Liquid way to generate fancy tables using extended Markdown Syntax.
For the full guide (usages, etc.), view the project on GitHub.
Table of Contents
Showcase
The following table is written entirely in (extended) Markdown with no HTML!
Check out this fancy table! | ||
---|---|---|
Doe | A deer, a female… | Deer |
Oh wait, this cell spans two columns! Here’s an orange | Two rows! | |
Four… | Bananas forever | |
Oops, forgot one more | ||
Testing | This is HTML bold, not markdown | center |
This row would be center-aligned Hey! How are you? |
Hello, world? |
|
Sponge? | Imagination | ( • ) ( • ) | | |
Thirteen | Some text I will break here, and oh, it also has markdown styling! |
Aaand… the markdown code below:
```table
| Check out this _fancy_ :sparkles: table! \\|
|----------|-----------------------------------------------------------------|-------------|
| Doe | A deer, a female... | Deer |
| Oh wait, \ this cell spans two columns! Here's an orange :tangerine: | Two rows! |
| Four... | Bananas forever :banana: :banana: :banana: | ^^ |
| ^^ | Oops, forgot one more :banana: \ |
| Testing | This is <strong>HTML bold</strong>, not markdown | _center_ |
| This row would be center-aligned \| Hello, |
| ^^ Hey! How are you? :eyes: \| ^^ |
| Sponge? | Imagination :rainbow: | ( • ) ( • ) | :rainbow: | ^^ _world?_ |
| Thirteen | Some text I will break here,<br>and oh, it also has **markdown** styling! \|
```alignment
c LLL Lr LL L LLc cL ll lR
```
Features
Note: For all examples below, where not specified, the markup is wrapped with ```table
as per the usage section above.
1. Headerless Tables
Simply chop off the header line:
Before:
| This | table | looks | quite | ugly |
|-----------|-------|-------|-------|---------|
| Sometimes | you | don't | want | headers |
After:
|-----------|-------|-------|-------|---------|
| Sometimes | you | don't | want | headers |
Result:
Sometimes | you | don’t | want | headers |
2. Column Span and Row Span
Column Span
- Works in table headers and table body
-
Simply “break” the column separator to span multiple columns
| OMG, I span 3 columns! \ \ | |------------------------|------|------| | That's... | very | nice |
-
Breaks don’t have to be aligned to anything
| OMG, I span 3 columns! \\| |------------|------|------| | That's... | very | nice |
-
Non-blank cells will be joined together with a space
| OMG, I \ span \ 3 columns! | |-----------|------|------------| | That's... | very | nice |
The above 3 examples give the same result:
OMG, I span 3 columns! | ||
---|---|---|
That’s… | very | nice |
Row Span
-
Only works for the table body
-
Simply prepend table cells with
^^
|------------------------|---------| | Look, I span two rows! | Looks | | ^^ | pretty! |
Result:
Look, I span two rows! Looks pretty! -
Non-blank cells will be joined together with a line break
|---------------|---------| | Look, I span | Looks | | ^^ two rows! | pretty! |
Result:
Look, I span
two rows!Looks pretty!
3. Individual Cell Alignment
-
Simply add a section under
```alignment
before closing the code block with```
. Specify left, right, or center-aligned usingL
,R
, orC
respectively```table | _For padding_ | _For padding_ | _For padding_ | |---------------|---------------|---------------| | left | center | right | | center | right | left | | right | left | center | ```alignment CCC LCR CRL RLC ```
-
Whitespace and capitalization do not matter
```table | _For padding_ | _For padding_ | _For padding_ | |---------------|---------------|---------------| | left | center | right | | center | right | left | | right | left | center | ```alignment cCClCrCrlrLc ```
The above 2 examples give the same result:
For padding | For padding | For padding |
---|---|---|
left | center | right |
center | right | left |
right | left | center |
Additional styling
Keeping to the spirit of Markdown, in order to not make the syntax too complicated, style-related syntax is limited to table cell alignment only (but you are welcome to request for features in the issue tracker).
Having said that, the file also provides a data-nth-cell
HTML attribute for each table cell (1-indexed), so you can style each individual cell using CSS/JS that way.