tobiasah / mkdocs-caption

MkDocs plugin to add captions and easy element numbering
MIT License
3 stars 2 forks source link

Table captions are shown within the table body #11

Closed Didymograptus closed 5 months ago

Didymograptus commented 5 months ago

Using material for mkdocs and the captions plugin (no options)

Problem:

The caption text is included within the table body.

The html source file generated by the plugin shows the caption tag to be within the table tag.

tobiasah commented 5 months ago

Hey, thanks for raising this issue.

I have some problems following your description.

As far as I see it, the plugin adds a caption to a table with the <caption> tag.

E.g. like this

<table id="_table-1">
<caption style="caption-side:bottom">Table 1: Table caption</caption><thead>
<tr>
<th>My</th>
<th>Table</th>
</tr>
</thead>
<tbody>
<tr>
<td>Has</td>
<td>A Caption</td>
</tr>
<tr>
<td>Which Makes</td>
<td>It Fancy</td>
</tr>
</tbody>
</table>

As far as I know, this is the right behaviour. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption

Am I missing something?

Didymograptus commented 5 months ago

The html should be

<caption style="caption-side:bottom">Table 1: Table caption</caption><thead>
<table id="_table-1">

(outside the the table tag)

not

<table id="_table-1">
<caption style="caption-side:bottom">Table 1: Table caption</caption><thead>

(inside the table tag)

tobiasah commented 5 months ago

Where is this specified? Don't get me wrong, I am happy to change this, but I have never seen the caption tag outside of the table tag ...

The official reference states it should be inside the table tag

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/caption

Didymograptus commented 5 months ago

I've done some more testing.

I was using mkdocs material theme and saw this: (caption within table)

image

I swapped over to readthedocs theme and now see this: (caption outside of table)

image

So it seems that the problem is with the material theme.

Apologies for any confusion.

tobiasah commented 5 months ago

I am closing this for now. If you have any other issues or question using this plugin feel free to reach out