Skip to main content
10 of 10
Commonmark migration

Table parser, code golf

Input

|===========|=============|==============|
|Left align |  Right align| Center align |
|===========|=============|==============|
|This       |         This|     This     |
|-----------|-------------|--------------|
|                column                  |
|-----------|-------------|--------------|
|will       |                            |
|-----------|          will be           |
|be         |                            |
|-----------|-------------|--------------|
|left       |        right|    center    |
|-----------|-------------|--------------|
|aligned    |      aligned|   aligned    |
|-----------|-------------|--------------|
|and can be |    vertical-|              |
|multilined | align middle|  as default but a bit long line |
|with <br>  |             |              |
|-----------|-------------|--------------|

Output should be valid HTML. And I am thinking of following requirement specs.

  • alignments (left, right, middle)
  • border thickness (normal -, |, bold, =,||)
  • with table headers or without
  • rowspans, colspans
  • multiline & vertical-align is always middle

What do you think?

YOU
  • 5k
  • 14
  • 8