(button: HTMLButtonElement)
| 60 | } |
| 61 | |
| 62 | export function toggleCodeBlockFold(button: HTMLButtonElement): boolean { |
| 63 | const block = button.closest<HTMLElement>(`.${CODE_BLOCK_CLASS}`) |
| 64 | if (!block) return false |
| 65 | |
| 66 | const folded = block.getAttribute(CODE_BLOCK_FOLDED_ATTR) !== 'true' |
| 67 | applyCodeBlockFoldState(block, folded) |
| 68 | persistCodeBlockFoldState(block, folded) |
| 69 | return true |
| 70 | } |
| 71 | |
| 72 | function ensureCodeBlockWrapper(pre: HTMLPreElement): HTMLElement { |
| 73 | const parent = pre.parentElement |
no test coverage detected