html2md
html2md copied to clipboard
Table formatting not working
Hi, I was testing this library to see if it was applicable to my use case, but table formatting seems to be broken:
Here's my input:
<!DOCTYPE html>
<html>
<head>
<title>Dummy Table</title>
<style>
table {
width: 60%;
border-collapse: collapse;
margin: 20px auto;
}
th, td {
border: 1px solid #ccc;
padding: 8px 12px;
text-align: center;
}
th {
background-color: #f4f4f4;
}
</style>
</head>
<body>
<h2 style="text-align: center;">Sample HTML Table</h2>
<a href="https://example.com">Link</a>
<table>
<thead>
<tr>
<th>ID</th>
<th>Name</th>
<th>Email</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Alice</td>
<td>[email protected]</td>
<td>Active</td>
</tr>
<tr>
<td>2</td>
<td>Bob</td>
<td>[email protected]</td>
<td>Inactive</td>
</tr>
<tr>
<td>3</td>
<td>Charlie</td>
<td>[email protected]</td>
<td>Pending</td>
</tr>
</tbody>
</table>
</body>
</html>
And the generated output:
$ html2md -p test.html
Dummy Table
=============
## Sample HTML Table
[Link](https://example.com)
| |
||----|---------|---------------------|----------|
| - | - | - | - |
| |
| | 1 | Alice | [email protected] | Active | |
| | 2 | Bob | [email protected] | Inactive | |
| | 3 | Charlie | [email protected] | Pending | |
This is not how markdown tables should look. Any advice?
Yep that's not how it should look like. I'll look into it
Uhm so yeah, I completely forgot about it, are you still looking forward to a fix?