dist/marky-marked.js
function indentHandler(string, selectionRange, type) {
  const start = startOfLine(string, selectionRange[0]);
  const end = endOfLine(string, selectionRange[1]);
  const lines = splitLines(string.substring(start, end));
  const newLines = [];

  lines.forEach(line => {
    const fourSpaces = '    ';
    let newLine;
    if (type === 'out') {
      newLine = line.indexOf(fourSpaces, 0) === 0 ? line.substring(fourSpaces.length, line.length) : line.substring(line.search(/[~*`_[!#>-]|[a-zA-Z0-9]|\r|\n|$/gm), line.length);
      return newLines.push(newLine);
    }
    newLine = fourSpaces + line.substring(0, line.length);
    return newLines.push(newLine);
  });

  const joined = newLines.join('\r\n');
  const value = string.substring(0, start) + newLines.join('\r\n') + string.substring(end, string.length);
  return { value, range: [start, start + joined.replace(/\n/gm, '').length] };
}
function indentHandler(string, selectionRange, type) {
  const start = startOfLine(string, selectionRange[0]);
  const end = endOfLine(string, selectionRange[1]);
  const lines = splitLines(string.substring(start, end));
  const newLines = [];

  lines.forEach(line => {
    const fourSpaces = '    ';
    let newLine;
    if (type === 'out') {
      newLine = line.indexOf(fourSpaces, 0) === 0 ? line.substring(fourSpaces.length, line.length) : line.substring(line.search(/[~*`_[!#>-]|[a-zA-Z0-9]|\r|\n|$/gm), line.length);
      return newLines.push(newLine);
    }
    newLine = fourSpaces + line.substring(0, line.length);
    return newLines.push(newLine);
  });

  const joined = newLines.join('\r\n');
  const value = string.substring(0, start) + newLines.join('\r\n') + string.substring(end, string.length);
  return { value, range: [start, start + joined.replace(/\n/gm, '').length] };
}
Handles adding/removing indentation to groups of lines
@param   {String} string         the entire string to use
@param   {Number[]}  selectionRange the starting and ending positions to wrap
@param   {String} type           in or out
@returns {Object} the new string, the updated selectionRange