pictures, video and diagrams cite and cross-reference @mdsvex/plugin-figures
Figures
Figures: a figure directive around an image or anything else, with its caption
Install
pnpm add -D @mdsvex/plugin-figures@next Turn it on
import { figures } from '@mdsvex/plugin-figures';
mdsvex({ unwrap_images: true, plugins: [figures()] }); What it reads
:::figure[Caption]owns figure
An example
:::figure[The score of a heading](id=fig:score)  :::
:::figure puts what is written inside it, an image, a code block, a table or a diagram, in a <figure> with the bracket text as its <figcaption>. It is the one way to make a figure: a lone image stays an image, unwrapped by unwrap_images.
:::figure[Sales by month](id=fig:sales)

:::The id is optional and stays on the <figure>, as an id you wrote, so one a heading already has fails the build. With unwrap_images an image alone in the figure has no <p>. A figure has no number of its own: a numbering plugin gives it one through plugin data, and the caption then starts with "Figure 3", or is "Figure 3" alone when the figure has no caption. An empty figure warns (empty_figure). figures({ css: false }) leaves the stylesheet out, and a figure from a directives module replaces the plugin's component.