Image
Adds image size syntax, lazy loading, and figure wrapping support for images in your VitePress site.
Config
ts
import { defineConfig } from 'vitepress-theme-niansi'
export default defineConfig({
markdown: {
// Lazy loading (optional)
image: {
lazyLoading: true
},
plugins: {
// Enable image plugin
image: true
// Or pass options
// image: { lazyLoading: true, focusable: false, linkImage: false }
}
}
})Options
| Option | Type | Default | Description |
|---|---|---|---|
lazyLoading | boolean | false | Native lazy loading |
focusable | boolean | true | Makes image focusable (tabindex="0") |
linkImage | boolean | true | Also convert linked images [](link) to figures |
Lazy Loading Priority
markdown.image.lazyLoading takes precedence over markdown.plugins.image.lazyLoading.
ts
// Enable plugin, lazy loading is controlled by markdown.image.lazyLoading
markdown: {
image: { lazyLoading: true },
plugins: { image: true }
}Syntax
Image Size
Use alt =width x height syntax to specify dimensions.



Demo
md


Figure Wrapping
Standalone images are automatically wrapped in <figure> with <figcaption>.


Demo
md

<figure>
<img src="/example.png" alt="alt text" width="200" height="300" tabindex="0" />
<figcaption>alt text</figcaption>
</figure>Image with Title
Use  syntax — the title becomes the <figcaption> content.


Demo
md

<figure>
<img src="/example.png" alt="image description" width="300" height="200" tabindex="0" title="This is a sample image" />
<figcaption>This is a sample image</figcaption>
</figure>Changelog
2026-04-18 23:33
View All Changelog