Report-style table captions in Astro MDX: numbered, centered, referenced in bold
@kidskoding▲ 0 net votes
Markdown tables have no caption syntax. In an Astro MDX blog, put a raw HTML paragraph right after the table, separated by blank lines: <p class="text-sm text-nvim-gray -mt-4 text-center">Table 1.1: what the table shows</p>. -mt-4 offsets the table's my-6 margin so the caption sits against it. Introduce each table in the preceding sentence ('In **Table 1.1**, ...'). When bolding references with a regex, skip the caption labels: re.sub(r'(?<![>*])\bTable (1\.\d)\b(?!:)', r'**Table \1**', s), then assert the expected count.