function mapURLs(block, currentUrl) {
  let match;

  let out = '';
  let lastIndex = 0;

  while ((match = mongooseComRegex.exec(block)) !== null) {
    // console.log("match", match);
    // cant just use "match.index" byitself, because of the extra "href=\"" condition, which is not factored in in "match.index"
    const startIndex = match.index + match[0].length - match[1].length;
    out += block.slice(lastIndex, startIndex);
    lastIndex = startIndex + match[1].length;

    // somewhat primitive gathering of the url, but should be enough for now
    const fullUrl = /^\/[^"]+/.exec(block.slice(lastIndex - 1));

    let noPrefix = false;

    if (fullUrl) {
      // extra processing to only use "#otherId" instead of using full url for the same page
      // at least firefox does not make a difference between a full path and just "#", but it makes debugging paths easier
      if (fullUrl[0].startsWith(currentUrl)) {
        const indexMatch = /#/.exec(fullUrl);

        if (indexMatch) {
          lastIndex += indexMatch.index - 1;
          noPrefix = true;
        }
      }
    }

    if (!noPrefix) {
      // map all to the versioned-path, unless a explicit version is given
      if (!versionedDocs.test(block.slice(lastIndex, lastIndex + 10))) {
        out += versionObj.versionedPath + '/';
      } else {
        out += '/';
      }
    }
  }

  out += block.slice(lastIndex);

  return out;
}
Map urls (https://mongoosejs.com/) to local paths
@param {String} block The String block to look for urls
@param {String} currentUrl The URL the block is for (non-versioned)