mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
5fc843e175
* feat(makemarkdown.table): support non-strict tables change to support non strict html tables. currently html tables require both 'thead' and 'tbody' to be set. since there are many tables out there that dont meet these requirements, i added support for most common tables. all of the following tables will now work (the last one, is the only version that is currently working): <table><tr><td>t 0 - missing thead/tbody</td></tr></table> <table><tr><td>t 1 - missing thead/tbody</td></tr><tr><td>t 1 body</td></tr></table> <table><thead><tr><th>t 2 - thead only</th></tr></thead></table> <table><thead><tr><td>t 3 - thead with td</td></tr></thead></table> <table><tbody><tr><td>t 4 - tbody only</td></tr></tbody></table> <table><thead><tr><th>t 5 - both thead and tbody</th></tr></thead><tbody><tr><td>t 5</td></tr></tbody></table> i thought this feature should be made optional in case you only want to support fully compliant tables. but then i realized, that the options are only passed to the markdown subparsers, not the html ones. and since this does not break anything (all tests pass), its ok, i guess... Closes #687 * refactor: code refactor and added tests Co-authored-by: Estevão Soares dos Santos <estevao.santos@gmail.com>
40 lines
895 B
HTML
40 lines
895 B
HTML
<table>
|
|
<caption>some table</caption>
|
|
<colgroup>
|
|
<col span="2" style="background-color:red">
|
|
<col style="background-color:yellow">
|
|
</colgroup>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">head 1</th>
|
|
<th scope="col">head 2</th>
|
|
<th scope="col">head 3</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr>
|
|
<td>row 1: col 1</td>
|
|
<td>row 1: col 2</td>
|
|
<td>row 1: col 3</td>
|
|
</tr>
|
|
<tr>
|
|
<td>row 2: col 1</td>
|
|
<td>row 2: col 2</td>
|
|
<td>row 2: col 3</td>
|
|
</tr>
|
|
</tbody>
|
|
<tfoot>
|
|
<tr>
|
|
<td>footer 1</td>
|
|
<td>footer 2</td>
|
|
<td>footer 3</td>
|
|
</tr>
|
|
<tr>
|
|
<td>footer 4</td>
|
|
<td>footer 5</td>
|
|
<td>footer 6</td>
|
|
</tr>
|
|
</tfoot>
|
|
</table>
|
|
|