import { Root } from 'mdast'; import { Transformer } from 'unified'; type ExternalImageOptions = { /** * timeout for fetching remote images (in milliseconds) */ timeout?: number; } | boolean; interface RemarkImageOptions { /** * Directory or base URL to resolve absolute image paths */ publicDir?: string; /** * Preferred placeholder type, only available with `useImport` + local images. * * @defaultValue 'blur' */ placeholder?: 'blur' | 'none'; /** * Define how to handle errors when fetching image size. * * - `error` (default): throw an error. * - `ignore`: do absolutely nothing (Next.js Image component may complain). * - `hide`: remove that image element. * * @defaultValue 'error' */ onError?: 'error' | 'hide' | 'ignore' | ((error: Error) => void); /** * Import images in the file, and let bundlers handle it. * * ```tsx * import MyImage from "./public/img.png"; * * * ``` * * When disabled, `placeholder` will be ignored. * * @defaultValue true */ useImport?: boolean; /** * Fetch image size of external URLs * * @defaultValue true */ external?: ExternalImageOptions; } /** * Turn images into Next.js Image compatible usage. */ declare function remarkImage({ placeholder, external, useImport, onError, publicDir, }?: RemarkImageOptions): Transformer; export { type RemarkImageOptions, remarkImage };