|
|
@ -67,10 +67,12 @@ export async function createMarkdownToVueRenderFn(
|
|
|
|
const relativePath = slash(path.relative(srcDir, file))
|
|
|
|
const relativePath = slash(path.relative(srcDir, file))
|
|
|
|
const cacheKey = JSON.stringify({ src, file })
|
|
|
|
const cacheKey = JSON.stringify({ src, file })
|
|
|
|
|
|
|
|
|
|
|
|
const cached = cache.get(cacheKey)
|
|
|
|
if (isBuild || options.cache !== false) {
|
|
|
|
if (cached) {
|
|
|
|
const cached = cache.get(cacheKey)
|
|
|
|
debug(`[cache hit] ${relativePath}`)
|
|
|
|
if (cached) {
|
|
|
|
return cached
|
|
|
|
debug(`[cache hit] ${relativePath}`)
|
|
|
|
|
|
|
|
return cached
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const start = Date.now()
|
|
|
|
const start = Date.now()
|
|
|
@ -125,7 +127,8 @@ export async function createMarkdownToVueRenderFn(
|
|
|
|
const env: MarkdownEnv = {
|
|
|
|
const env: MarkdownEnv = {
|
|
|
|
path: file,
|
|
|
|
path: file,
|
|
|
|
relativePath,
|
|
|
|
relativePath,
|
|
|
|
cleanUrls
|
|
|
|
cleanUrls,
|
|
|
|
|
|
|
|
includes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const html = md.render(src, env)
|
|
|
|
const html = md.render(src, env)
|
|
|
|
const {
|
|
|
|
const {
|
|
|
@ -243,7 +246,9 @@ export async function createMarkdownToVueRenderFn(
|
|
|
|
deadLinks,
|
|
|
|
deadLinks,
|
|
|
|
includes
|
|
|
|
includes
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cache.set(cacheKey, result)
|
|
|
|
if (isBuild || options.cache !== false) {
|
|
|
|
|
|
|
|
cache.set(cacheKey, result)
|
|
|
|
|
|
|
|
}
|
|
|
|
return result
|
|
|
|
return result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|