Open
Description
Description
When using .printhtml() method on a table, it doesnt work correctly for titles.
It inserts <td>
elements into <th>
elements, treating <th>
as <tr>
and <td>
as <th>
.
Current solution around this is to treat table headers as just a row as those seem to get printed just fine.
Example snippet:
let mut out = File::create("table.html").unwrap();
let mut table = table!(["Value 1", "Value 2"], ["Value three", "Value four"]);
table.set_titles(row!["Title 1", "Title 2"]);
table.print_html(&mut out);
it renders the below table as such in HTML:
<table>
<th>
<td style="text-align: left;">Title 1</td>
<td style="text-align: left;">Title 2</td>
</th>
<!-- ... data rows -->
</table>
The correct way for table headers would be:
<table>
<tr>
<th style="text-align: left;">Title 1</th>
<th style="text-align: left;">Title 2</th>
</tr>
<tr>
<!-- ... data rows -->
</table>
Chrome based browsers try their best to render this and they somehow get it, but it is skewed because of the empty <th>
element:
Metadata
Metadata
Assignees
Labels
No labels