2024-11-07 20:57:33 +01:00
|
|
|
import { Meta } from "..";
|
|
|
|
|
import { Document } from "../../../controllers/v1/types";
|
|
|
|
|
|
|
|
|
|
const regex = /(!\[.*?\])\(data:image\/.*?;base64,.*?\)/g;
|
|
|
|
|
|
|
|
|
|
export function removeBase64Images(meta: Meta, document: Document): Document {
|
2024-12-11 19:46:11 -03:00
|
|
|
if (meta.options.removeBase64Images && document.markdown !== undefined) {
|
|
|
|
|
document.markdown = document.markdown.replace(
|
|
|
|
|
regex,
|
|
|
|
|
"$1(<Base64-Image-Removed>)"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
return document;
|
|
|
|
|
}
|