in docs.js [28:53]
function readDirSync(path, docInfo, replaceMarkdownText) {
const pa = fs.readdirSync(path);
pa.forEach(function (ele) {
const filePath = path + "/" + ele
const info = fs.statSync(filePath);
if (info.isDirectory()) {
readDirSync(filePath, docInfo, replaceMarkdownText);
return;
}
if (isImage(ele)) {
const {docName, version} = docInfo;
const imgName = `${docName}_${version}_${ele}`;
fs.copyFile(filePath, './static/images/' + imgName, function (err) {
if (err) {
throw err
}
});
return;
}
const reg = /\.md/gi;
const shouldFormat = reg.test(filePath);
if (shouldFormat) {
readFile(filePath, docInfo, replaceMarkdownText);
}
});
}