lib/utils/location.js
function toAbsolute(_href, dir, outdir) {
    if (isExternal(_href) || isDataURI(_href)) {
        return _href;
    }

    outdir = outdir == undefined? dir : outdir;

    _href = normalize(_href);
    dir = normalize(dir);
    outdir = normalize(outdir);

    // Path "_href" inside the base folder
    var hrefInRoot = normalize(path.join(dir, _href));
    if (_href[0] == '/') {
        hrefInRoot = normalize(_href.slice(1));
    }

    // Make it relative to output
    _href = path.relative(outdir, hrefInRoot);

    // Normalize windows paths
    _href = normalize(_href);

    return _href;
}
function toAbsolute(_href, dir, outdir) {
    if (isExternal(_href) || isDataURI(_href)) {
        return _href;
    }

    outdir = outdir == undefined? dir : outdir;

    _href = normalize(_href);
    dir = normalize(dir);
    outdir = normalize(outdir);

    // Path "_href" inside the base folder
    var hrefInRoot = normalize(path.join(dir, _href));
    if (_href[0] == '/') {
        hrefInRoot = normalize(_href.slice(1));
    }

    // Make it relative to output
    _href = path.relative(outdir, hrefInRoot);

    // Normalize windows paths
    _href = normalize(_href);

    return _href;
}
function toAbsolute ( _href , dir , outdir ) { if ( isExternal ( _href ) || isDataURI ( _href ) ) { return _href ; } outdir = outdir == undefined ? dir : outdir ; _href = normalize ( _href ) ; dir = normalize ( dir ) ; outdir = normalize ( outdir ) ; // Path "_href" inside the base folder var hrefInRoot = normalize ( path . join ( dir , _href ) ) ; if ( _href [ 0 ] == '/' ) { hrefInRoot = normalize ( _href . slice ( 1 ) ) ; } // Make it relative to output _href = path . relative ( outdir , hrefInRoot ) ; // Normalize windows paths _href = normalize ( _href ) ; return _href ; }
Convert a relative path to absolute

@param {String} href
@param {String} dir: directory parent of the file currently in rendering process
@param {String} outdir: directory parent from the html output
@return {String}
Convert a relative path to absolute