code: function(str, pre, codeLines, start) {
      return str.split(/\n/).reduce((a, seg, i, arr) => {
        var line = i == arr.length - 1 && seg.length == 0 ? '' : pre + seg;
        if (line) {
          if (codeLines) {
            var codeLine = codeLines[start + i];
            if (codeLine.comment)
              line += codeLine.comment;
          }
          line += '\n';
        }
        return a + line;
      }, '');
    }
docs: Adds pre to the beginning of each line in str (except trailing newline). Optional codeLines, start to restore comments.