import type MarkdownIt from "markdown-it";
import { type BlurhashCoreOptions } from "@fuuck/blurest-core";
interface StaticFileMapping {
/**
* Root directory path for static file storage
* e.g.: "./static" or "/var/www/static"
*/
staticDir: string;
/**
* URL path prefix matching rules
* e.g.: ["/images/", "/assets/"] means paths starting with these prefixes will be mapped to staticDir
* If empty array, all relative paths will attempt to be mapped to staticDir
*/
urlPrefixes?: string[];
}
interface AxBlurestPluginOptions extends BlurhashCoreOptions {
/**
* Static file mapping configuration
* Used to handle relative path image resource mapping
*/
staticFileMapping?: StaticFileMapping;
/**
* Emit `loading="lazy" decoding="async"` on rendered `
` tags
* (default true).
*
* Inside `` the fallback `
` is visible only in the
* pre-upgrade / no-JS window: once the custom element upgrades it stops
* rendering, and the component loads the real image itself when it enters
* the viewport. Lazy loading keeps the fallback from eagerly fetching the
* full image during that window (and, without JS, until it nears the
* viewport). On plain fallback `
` tags (no blurhash component) it is
* the usual off-screen bandwidth saving.
*/
lazy?: boolean;
/**
* Forwarded to the core: emit skip/diagnostic logging while rendering
* (skipped files, dimension probe failures). Defaults to `false`, keeping
* renders silent.
*/
verbose?: boolean;
}
/**
* A markdown-it plugin that renders standard image syntax as custom components with blurhash.
*
* @param md MarkdownIt instance
* @param options Plugin configuration options
*/
declare function axBlurestPlugin(md: MarkdownIt, options: AxBlurestPluginOptions): void;
/**
* Cleanup function to properly dispose of resources
* @param md MarkdownIt instance
*/
export declare function cleanupAxBlurest(md: MarkdownIt): boolean;
export default axBlurestPlugin;
export type { AxBlurestPluginOptions, StaticFileMapping };