( content: string, filePath: string )
| 289 | } |
| 290 | |
| 291 | async function renderHighlightedCode( |
| 292 | content: string, |
| 293 | filePath: string |
| 294 | ): Promise<void> { |
| 295 | try { |
| 296 | const { codeToHtml } = await import("shiki"); |
| 297 | const container = ensureDivContent("modal-code-content"); |
| 298 | if (!container) return; |
| 299 | |
| 300 | container.innerHTML = await codeToHtml(content, { |
| 301 | lang: getLanguageForFile(filePath), |
| 302 | themes: { |
| 303 | light: "github-light", |
| 304 | dark: "github-dark", |
| 305 | }, |
| 306 | }); |
| 307 | } catch { |
| 308 | renderPlainText(content); |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | function updateViewButtons(): void { |
| 313 | const renderBtn = document.getElementById("render-btn"); |
no test coverage detected