Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderer.image = function(src, title, alt) {
const curPath = window.location.pathname.replace(/(.*\/).*/, '$1');
const subbedPath = curPath.replace('docs', 'static/docs');
const resolvedSrc = path.resolve(subbedPath, src);
const finalSrc = window.location.origin + resolvedSrc;
log.debug(
`src: ${src}, curPath: ${curPath}, subbedPath: ${subbedPath}, resolvedSrc: ${resolvedSrc} \nResolved image to load: ${finalSrc}`
);
console.log(title);
let res = '
const isRoot = (path) => Path.resolve('/', path) === '/'
function getFileURI(from, to) {
if (typeof from === 'undefined') {
from = location.pathname
}
return location.origin + path.resolve(from, to)
}
const safePath = (path) => Path.resolve('/', path)
recurseRoutes(matchInfo.route.children, (route, depth) => {
if (route.handler == 'key') {
var relativePath = shrinkPath(route.handler.getPath(), depth);
dependencies.push({
refPath: resolve('/', path, relativePath).substr(1),
valueKey: route.path.replace(route.parent.path, '').substr(1)
})
}
}, depth - 1);
if (dependencies.length === 0)
recurseRoutes(matchInfo.route.children, (route) => {
if (route.handler == 'key') {
var relativePath = shrinkPath(route.handler.getPath(), depth);
dependencies.push({
refPath: resolve('/', path, relativePath).substr(1),
valueKey: route.path.replace(route.parent.path, '').substr(1)
})
}
});
if (dependencies.length === 0)
function supportRelativeURL(file, url) {
if (!file) return url;
var dir = path.dirname(file);
var match = /^\w+:\/\/[^\/]*/.exec(dir);
var protocol = match ? match[0] : '';
return protocol + path.resolve(dir.slice(protocol.length), url);
}