Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion readme_renderer/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"img": ["src", "width", "height", "alt", "align", "class"],
"span": ["class"],
"th": ["align"],
"td": ["align"],
"td": ["align", "colspan", "rowspan"],
"div": ["align", "class"],
"h1": ["align"],
"h2": ["align"],
Expand Down
62 changes: 62 additions & 0 deletions tests/fixtures/test_rst_tables.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<table>
<colgroup>
<col>
<col>
<col>
<col>
</colgroup>
<thead>
<tr><th>Header row, column 1
(header rows optional)</th>
<th>Header 2</th>
<th>Header 3</th>
<th>Header 4</th>
</tr>
</thead>
<tbody>
<tr><td>body row 1, column 1</td>
<td>column 2</td>
<td>column 3</td>
<td>column 4</td>
</tr>
<tr><td>body row 2</td>
<td colspan="3">Cells may span columns.</td>
</tr>
<tr><td>body row 3</td>
<td rowspan="2">Cells may
span rows.</td>
<td colspan="2" rowspan="2"><ul>
<li>Table cells</li>
<li>contain</li>
<li>body elements.</li>
</ul>
</td>
</tr>
<tr><td>body row 4</td>
</tr>
</tbody>
</table>
<table>
<colgroup>
<col>
<col>
</colgroup>
<thead>
<tr><th>title1</th>
<th>title2</th>
</tr>
</thead>
<tbody>
<tr><td>col1</td>
<td>col2</td>
</tr>
<tr><td rowspan="2">mutirow</td>
<td>cell1</td>
</tr>
<tr><td>cell2</td>
</tr>
<tr><td>singlerow</td>
<td>cell3</td>
</tr>
</tbody>
</table>
28 changes: 28 additions & 0 deletions tests/fixtures/test_rst_tables.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.. Example from https://docutils.sourceforge.io/docs/ref/rst/restructuredtext.html#tables

+------------------------+------------+----------+----------+
| Header row, column 1 | Header 2 | Header 3 | Header 4 |
| (header rows optional) | | | |
+========================+============+==========+==========+
| body row 1, column 1 | column 2 | column 3 | column 4 |
+------------------------+------------+----------+----------+
| body row 2 | Cells may span columns. |
+------------------------+------------+---------------------+
| body row 3 | Cells may | - Table cells |
+------------------------+ span rows. | - contain |
| body row 4 | | - body elements. |
+------------------------+------------+---------------------+

.. Example from #182

+---------------+---------------+
| title1 | title2 |
+===============+===============+
| col1 | col2 |
+---------------+---------------+
| mutirow | cell1 |
| +---------------+
| | cell2 |
+---------------+---------------+
| singlerow | cell3 |
+---------------+---------------+