When a table's rows sit directly under <table> (not in <thead> or <tbody>), a <caption> or <colgroup> before them drops the | --- | line under the header. Without it the output isn't a Markdown table anymore, just lines of pipes. JDK 8 and 11 Javadoc summary tables are built this way.
A <tfoot> row has the opposite problem. It gets its own empty header and | --- | line in the middle of the table.
Repro on main (945314a, markdownify 1.2.3):
from markitdown.converters import HtmlConverter
c = HtmlConverter()
print(c.convert_string(
"<table><caption>Stock</caption><tr><th>Name</th><th>Qty</th></tr>"
"<tr><td>Apple</td><td>3</td></tr></table>").markdown)
print(c.convert_string(
"<table><thead><tr><th>Item</th><th>Cost</th></tr></thead>"
"<tbody><tr><td>A</td><td>1</td></tr></tbody>"
"<tfoot><tr><td>Total</td><td>1</td></tr></tfoot></table>").markdown)
What I get:
Stock
| Name | Qty |
| Apple | 3 |
| Item | Cost |
| --- | --- |
| A | 1 |
| | |
| --- | --- |
| Total | 1 |
I expected | --- | --- | under the first header, the same as without the caption. The footer should just be the last row, | Total | 1 |.
When a table's rows sit directly under
<table>(not in<thead>or<tbody>), a<caption>or<colgroup>before them drops the| --- |line under the header. Without it the output isn't a Markdown table anymore, just lines of pipes. JDK 8 and 11 Javadoc summary tables are built this way.A
<tfoot>row has the opposite problem. It gets its own empty header and| --- |line in the middle of the table.Repro on main (945314a, markdownify 1.2.3):
What I get:
I expected
| --- | --- |under the first header, the same as without the caption. The footer should just be the last row,| Total | 1 |.