()
| 335 | } |
| 336 | |
| 337 | async function renderCurrentFileContent(): Promise<void> { |
| 338 | if (!currentFilePath) return; |
| 339 | |
| 340 | updateViewButtons(); |
| 341 | |
| 342 | if (!currentFileContent) { |
| 343 | renderPlainText( |
| 344 | "Failed to load file content. Click the button below to view on GitHub." |
| 345 | ); |
| 346 | return; |
| 347 | } |
| 348 | |
| 349 | if (isMarkdownFile(currentFilePath) && currentViewMode === "rendered") { |
| 350 | const container = ensureDivContent("modal-rendered-content"); |
| 351 | if (!container) return; |
| 352 | |
| 353 | const [{ marked }, { default: fm }] = await Promise.all([ |
| 354 | import("marked"), |
| 355 | import("front-matter"), |
| 356 | ]); |
| 357 | const { body: markdownBody } = fm<string>(currentFileContent); |
| 358 | container.innerHTML = marked(markdownBody, { async: false }); |
| 359 | } else { |
| 360 | await renderHighlightedCode(currentFileContent, currentFilePath); |
| 361 | } |
| 362 | |
| 363 | const modalBody = getModalBody(); |
| 364 | if (modalBody) { |
| 365 | modalBody.scrollTop = 0; |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | async function configureSkillFileSwitcher(filePath: string): Promise<void> { |
| 370 | const switcher = document.getElementById("modal-file-switcher"); |
no test coverage detected