(file: string, section: string)
| 84 | } |
| 85 | |
| 86 | async function readFileSection(file: string, section: string) { |
| 87 | const lines = await readLines(file); |
| 88 | let sectionStart = '# `' + section + '`'; |
| 89 | let row = 0; |
| 90 | let output: string[] = []; |
| 91 | let inSection = false; |
| 92 | while (row < lines.length) { |
| 93 | const line = lines[row++]; |
| 94 | if (line === sectionStart) { |
| 95 | inSection = true; |
| 96 | } else if (line.startsWith('# ')) { |
| 97 | inSection = false; |
| 98 | } else if (inSection) { |
| 99 | output.push(line); |
| 100 | } |
| 101 | } |
| 102 | while (output.length && output[0] == '') { |
| 103 | output.shift(); |
| 104 | } |
| 105 | while (output.length && output[output.length - 1] == '') { |
| 106 | output.pop(); |
| 107 | } |
| 108 | return output; |
| 109 | } |
| 110 | |
| 111 | async function resolveCodeExample(file: string, anchor: string): Promise<string[]> { |
| 112 | const output: string[] = []; |
no test coverage detected
searching dependent graphs…