Creating hierarchical tables in markdown -
i want build complex table this:
| thing | more important | here | |------------|----------------|---------| | |a1 | b |d | c | |------------|----------------|---------| | 1 |2 | 1 |2 | |
is possible using gf-markdown?
no, not possible gfm, however, possible raw html.
the spec github flavored markdown here. not appear there support such table construct. notably, following stated:
the header row must match delimiter row in number of cells. if not, table not recognized...
the remainder of table’s rows may vary in number of cells. if there number of cells fewer number of cells in header row, empty cells inserted. if there greater, excess ignored.
that being case, table provided interpreted this:
| thing | more important | here | |------------|----------------|---------| | | a1 | b | | 1 | 2 | 1 |
that is, last 2 cells in each row ignored. if may remember that:
cells in 1 column don’t need match length, though it’s easier read if are. likewise, use of leading , trailing pipes may inconsistent.
therefore, because table understood human reader, parser doesn't recognize columns nicely aligned. counts number of cells , ignores actual alignment.
as aside, while converting table (for example above) noticed included "deliminator row" between each row of table. "deliminator row" should between header row , first data row.
that doesn't mean it's not possible create such table. original markdown syntax rules state:
for markup not covered markdown’s syntax, use html itself.
of course, gfm disallows various raw html tags security reasons. however, tables
not on list. therefore, should able create raw html table in whatever structure want.
<table> <thead> <tr> <th colspan="2">some thing</th> <th colspan="2">more important</th> <th>up here</th> </tr> </thead> <tbody> <tr> <td>a</td> <td>a1</td> <td>b</td> <td>d</td> <td>c</td> </tr> <tr> <td>1</td> <td>2</td> <td>1</td> <td>2</td> <td></td> </tr> </tbody> </table>
you can see example of table in gist (see raw markdown here). i've included non-working original example comparison.
Comments
Post a Comment