(wrapper: HTMLElement, code: HTMLElement)
| 106 | } |
| 107 | |
| 108 | function ensureCodeBlockSummary(wrapper: HTMLElement, code: HTMLElement): void { |
| 109 | let summary = wrapper.querySelector<HTMLElement>(`.${CODE_BLOCK_SUMMARY_CLASS}`) |
| 110 | if (!summary) { |
| 111 | summary = code.ownerDocument.createElement('div') |
| 112 | summary.className = CODE_BLOCK_SUMMARY_CLASS |
| 113 | wrapper.insertBefore(summary, wrapper.querySelector('pre')?.nextSibling ?? null) |
| 114 | } |
| 115 | summary.textContent = summarizeCodeBlock(code) |
| 116 | } |
| 117 | |
| 118 | function summarizeCodeBlock(code: HTMLElement): string { |
| 119 | const lineCount = countCodeLines(code.textContent ?? '') |
no test coverage detected