markdownCodeLineCount function

int markdownCodeLineCount(
  1. String source
)

Implementation

int markdownCodeLineCount(String source) {
  if (source.isEmpty) return 1;
  var lines = 1;
  for (var index = 0; index < source.length; index += 1) {
    if (source.codeUnitAt(index) == 0x0a) lines += 1;
  }
  return lines;
}