(code: HTMLElement)
| 129 | } |
| 130 | |
| 131 | function codeLanguageLabel(code: HTMLElement): string { |
| 132 | const classes = Array.from(code.classList) |
| 133 | const language = classes |
| 134 | .find((className) => className.startsWith('language-')) |
| 135 | ?.slice('language-'.length) |
| 136 | .trim() |
| 137 | if (!language) return 'Code block' |
| 138 | return `${language.toUpperCase()} code block` |
| 139 | } |
| 140 | |
| 141 | function applyCodeBlockFoldState(block: HTMLElement, folded: boolean): void { |
| 142 | block.setAttribute(CODE_BLOCK_FOLDED_ATTR, folded ? 'true' : 'false') |
no outgoing calls
no test coverage detected