Remark Image
Make images compatible with Next.js Image Optimization
Usage
Add it to your Remark plugins.
Supported:
- Local Images
- External URLs
- Next.js static imports
How It Works
It transforms your ![image](./test.png)
into Next.js Image usage, and add required props like width
and height
.
By default, it uses Next.js static imports to import local images, which supports the placeholder
option of Next.js Image.
Next.js can handle image imports with its built-in image loader.
Otherwise, it obtains the image size from file-system or HTTP request.
Options
Prop | Type | Default |
---|---|---|
publicDir | string | - |
placeholder | "none" | "blur" | 'blur' |
useImport | boolean | true |
external | boolean | true |
Example: With Imports
Yields:
Example: Without Imports
You can disable Next.js static imports on local images.
Yields:
Last updated on