(file: string, anchor: string)
| 109 | } |
| 110 | |
| 111 | async function resolveCodeExample(file: string, anchor: string): Promise<string[]> { |
| 112 | const output: string[] = []; |
| 113 | const lines = await readLines(file); |
| 114 | let row = 0; |
| 115 | while (row < lines.length) { |
| 116 | const line = lines[row++]; |
| 117 | const match = /^(\s*)\/\/ <docs anchor="(.*)">/.exec(line); |
| 118 | if (match && match[2] == anchor) { |
| 119 | while (row < lines.length) { |
| 120 | const offset = match[1].length; |
| 121 | const line2 = lines[row++].slice(offset); |
| 122 | const match2 = /\/\/ <\/docs>/.exec(line2); |
| 123 | if (match2) { |
| 124 | break; |
| 125 | } |
| 126 | output.push(line2); |
| 127 | } |
| 128 | } |
| 129 | } |
| 130 | return output; |
| 131 | } |
| 132 | |
| 133 | const LINE_WIDTH = 95; |
| 134 |
no test coverage detected
searching dependent graphs…