Skip to content

Consecutive tables aren't captioned #13

@xpqz

Description

@xpqz

If you have multiple tables in succession without anything between, every other table is uncaptioned. To reproduce:

import markdown
from caption import CaptionExtension, TableCaptionExtension

data="""
# Consecutive tables

Table: First

| A | B |
|---|---|
| a | b |

Table: Second

| C | D |
|---|---|
| c | d |
"""

print(markdown.markdown(data, extensions=[
    'tables',
    CaptionExtension(),
    TableCaptionExtension(caption_top=False),
]))

which leaves the second table uncaptioned:

<h1>Consecutive tables</h1>
<table id="_table-1">
<caption style="caption-side:bottom"><span>Table&nbsp;1:</span> First</caption>
<thead>
<tr>
<th>A</th>
<th>B</th>
</tr>
</thead>
<tbody>
<tr>
<td>a</td>
<td>b</td>
</tr>
</tbody>
</table>
<p>Table: Second</p>
<table>
<thead>
<tr>
<th>C</th>
<th>D</th>
</tr>
</thead>
<tbody>
<tr>
<td>c</td>
<td>d</td>
</tr>
</tbody>
</table>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions