`, with a title or without. Comark's `autoUnwrap` only does that in list items and blockquotes.
```ts
figure({ unwrap: true });
```
## Examples
### What becomes a figure
An image with a title becomes a figure when it stands alone in its paragraph:
- at the top of the page
- in a list item
- in a blockquote
- in a definition
- in a `::component`, next to other blocks
The caption is plain text, as a title is.
### Inside a component
The plugin leaves alone a `::component` that holds only the image, and an inline `:component[]` alone on its line. Add another block to the component, and its image becomes a figure.
### Alt text and captions
Screen readers read both, so don't repeat one in the other. Alt text says what the image shows, and the caption says why it's there:
```md

```
### Size block images apart
With `unwrap: true`, an image alone in its paragraph renders as a bare ``, with no `
`. Size those apart from images in a sentence with `.prose > img`. ### Styling Browsers indent a figure by 40px on each side. To set it flush with the text, with a small, muted caption: ```css figure { margin: 1.5em 0; } figcaption { margin-top: 0.5em; font-size: 0.875em; color: #6b7280; } ``` ### With comark-zoom With [comark-zoom](/zoom), a figure's image zooms like any other, in either plugin order. ## API ### Options Pass options under `figure` in `comarkUi()`, or to `figure()` alone. | Option | Default | Description | | --- | --- | --- | | `unwrap` | `false` | `true` also lifts every image that stands alone in its paragraph out of the `
`, with a title or without. | ### Package comark-ui installs and registers `comark-figure`. To use it alone, install it and register the plugin: ```sh pnpm add comark @comark/html comark-figure ``` ```ts import { parseMarkdown } from "comark"; import figure from "comark-figure"; const document = await parseMarkdown(markdown, { plugins: [figure()], }); ```