MCPcopy
hub / github.com/github/awesome-copilot / renderCurrentFileContent

Function renderCurrentFileContent

website/src/scripts/modal.ts:337–367  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

335}
336
337async 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
369async function configureSkillFileSwitcher(filePath: string): Promise<void> {
370 const switcher = document.getElementById("modal-file-switcher");

Callers 2

setupModalFunction · 0.85
openFileModalFunction · 0.85

Calls 6

updateViewButtonsFunction · 0.85
renderPlainTextFunction · 0.85
isMarkdownFileFunction · 0.85
ensureDivContentFunction · 0.85
renderHighlightedCodeFunction · 0.85
getModalBodyFunction · 0.85

Tested by

no test coverage detected