Commit d06fda6
Changed files (1)
src
plugins
src/plugins/rehype-extract-image.ts
@@ -3,6 +3,7 @@ import { visit } from "unist-util-visit";
import { SITE_CONFIG } from "@/config.js";
import { extractImage } from "@/integrations/extract-image.js";
import { getBase64ImageInfo } from "../utils/image.js";
+import { url } from "@/utils/url.js";
export const rehypeExtractImage: RehypePlugin = () => (tree) => {
visit(tree, "element", (node) => {
@@ -11,7 +12,9 @@ export const rehypeExtractImage: RehypePlugin = () => (tree) => {
if (typeof src === "string") {
const imageInfo = getBase64ImageInfo(src);
if (imageInfo) {
- node.properties.src = `/${extractImage({ dir: SITE_CONFIG.assetDir }).api.dir}/${imageInfo.filename}`;
+ node.properties.src = url(
+ `/${extractImage({ dir: SITE_CONFIG.assetDir }).api.dir}/${imageInfo.filename}`,
+ );
}
}
}