/** * Image asset mapping and relative-image-URL rewriting for generated markdown. */ /** * Scan `{outDir}/assets/images/` and build a reverse-lookup map used to * rewrite relative image references to their hashed build-output URLs. * * Bundlers (webpack / Rspack) output images as `{original-name}-{hash}.{ext}`. * We strip the trailing `-{hex}` portion to recover the original basename and * use it as the lookup key. When two images share the same basename but have * different content (different hashes) both entries are kept so a later * byte-comparison step can disambiguate them. * * @param outDir - Docusaurus build output directory (e.g., `/build`) * @returns Map from original-basename (e.g., `diagram.png`) to one or more * site-root-relative hashed paths (e.g., `/assets/images/diagram-abc.png`) */ export declare function buildImageAssetMap(outDir: string): Promise>; /** * Rewrite relative image references in markdown content to absolute URLs * pointing to the hashed build output in `assets/images/`. * * Handles: * - Markdown images: `![alt](./img/foo.png)` * - HTML img tags: `` (both quote styles) * * Resolution strategy: * 1. Extract the basename from the relative path (e.g., `foo.png`). * 2. Look it up in `imageAssetMap` (built by `buildImageAssetMap`). * 3. One candidate → rewrite immediately. * 4. Multiple candidates → read source file bytes and compare against each * candidate to find the exact match. Falls back to keeping the original * path if the source file cannot be read. * 5. Zero candidates → keep the original path as-is (static/ images, etc.). * * @param content - Cleaned markdown content to process * @param sourceFilePath - Absolute path of the source `.md` file (used to * resolve relative image paths and for byte comparison) * @param imageAssetMap - Lookup map built by `buildImageAssetMap` * @param siteUrl - Site base URL used to build absolute image URLs * @param outDir - Build output directory (needed for byte comparison) * @returns Content with rewritten image URLs */ export declare function rewriteRelativeImageUrls(content: string, sourceFilePath: string, imageAssetMap: Map, siteUrl: string, outDir: string): Promise;