Closed mmcky closed 6 years ago
Doing a bit of research suggests that many markdown
parsers do not support tables without a header. This is the main reason the first table fails in this set of tests.
https://stackoverflow.com/questions/17536216/create-table-without-header-in-markdown
If Jupyter is using Github Flavoured Markdown then this might not be a valid test.
The alternative would be to add a blank header to trigger the parser to render the table
| | |
|-------|-------|
| C1 | C2 |
| a | b |
| c | d |
which would render like this in the notebook with a single solid black line:
It is convenient to conform to the markdown
as closely as possible in my view as the generated output is more easily editable within the notebook.
Another option would be to switch to using html
tables which seems to be the rst2ipynb
approach
<table style="width:19%;">
<colgroup>
<col width="9%" />
<col width="9%" />
</colgroup>
<tbody>
<tr class="odd">
<td>C1</td>
<td>C2</td>
</tr>
<tr class="even">
<td>a</td>
<td>b</td>
</tr>
<tr class="odd">
<td>c</td>
<td>d</td>
</tr>
</tbody>
</table>
would render
C1 | C2 |
a | b |
c | d |
I think html
based tables would make editing very difficult. Perhaps the best solution is not to support tables without headers.
Taken a survey and given this extension is about generating notebooks -- the opinion seems to be the best strategy is to support the RST
specification as fully as we can. Therefore we should probably allow for both html
and markdown
generated tables as an option in the config file. If a user chooses markdown
table output then for cases that aren't supported in markdown we would insert an html
table. html
generated tables should be the default
output option for all tables to ensure they are rendered in the same style.
I will merge this as is. The extension currently supports construction of relatively simple markdown
tables. html
support will be tracked by issue #53 and #54
This is an expanded set of test tables from
rst2ipynb
. It includes various table syntaxsimple tables
,grid tables
and tables build bycsv-table
andlist-table
directives.Status: Currently fails for the simplest grid table case from the
docutils
specification of RSTget's migrated as:
which looks like