code: function resolveInRoot(root) {
      var input, result;
      var args = Array.prototype.slice.call(arguments, 1);
  
      input = args
          .reduce(function(current, p) {
              // Handle path relative to book root ("/README.md")
              if (p[0] == '/' || p[0] == '\\') return p.slice(1);
  
              return current? path.join(current, p) : path.normalize(p);
          }, '');
  
      result = path.resolve(root, input);
  
      if (!isInRoot(root, result)) {
          throw new error.FileOutOfScopeError({
              filename: result,
              root: root
          });
      }
  
      return result;
  }
docs: Resolve paths in a specific folder Throw error if file is outside this folder