in tools/common.js [69:85]
function replaceImagesPath(replaceDir, from = "images", to = "images") {
const regex = new RegExp(`../${from}`, "g");
for (const fileName of fs.readdirSync(replaceDir)) {
const filePath = path.resolve(replaceDir, fileName);
if (fs.statSync(filePath).isDirectory()) {
replaceImagesPath(filePath, from, to);
} else if (filePath.endsWith(".md") || filePath.endsWith(".mdx")) {
console.log(
` ---> Replace images path form ${regex} to ${to} in ${filePath}`
);
let content = fs.readFileSync(filePath, "utf-8");
content = content.replace(regex, to);
content = content.replace(new RegExp(`(\\.)${to}`, "g"), `.io/${to}`);
fs.writeFileSync(filePath, content);
}
}
}