* @param {string} fileName * @param {string} text
(fileName, text)
| 70 | * @param {string} text |
| 71 | */ |
| 72 | function checkForImproperlyIndentedFencedCodeBlocks(fileName, text) { |
| 73 | var lines = text.split(/\r?\n/g); |
| 74 | var numErrors = 0; |
| 75 | |
| 76 | for (var i = 0; i < lines.length; i++) { |
| 77 | var line = lines[i]; |
| 78 | var codeBlockMatch = line.match(/^(\s*)```\S+/); |
| 79 | |
| 80 | if (codeBlockMatch) { |
| 81 | var startingColumn = codeBlockMatch[1].length; |
| 82 | if (startingColumn === 0 || startingColumn === getCorrectStartingColumnForLine(lines, i)) { |
| 83 | continue; |
| 84 | } |
| 85 | |
| 86 | numErrors++; |
| 87 | console.log(fileName + ": " + |
| 88 | i + 1 + ": A fenced code block following a list item must be indented to the first non-whitespace character of the list item.") |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return numErrors; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * @param {string[]} line |
no test coverage detected