docs: function contents(map, tight) {
      var minDepth = Infinity;
      var index = -1;
      var length = map.length;
      var table;
  
      /*
       * Find minimum depth.
       */
  
      while (++index < length) {
          if (map[index].depth < minDepth) {
              minDepth = map[index].depth;
          }
      }
  
      /*
       * Normalize depth.
       */
  
      index = -1;
  
      while (++index < length) {
          map[index].depth -= minDepth - 1;
      }
  
      /*
       * Construct the main list.
       */
  
      table = list();
  
      /*
       * Add TOC to list.
       */
  
      index = -1;
  
      while (++index < length) {
          insert(map[index], table, tight);
      }
  
      return table;
  }