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

Function renderHighlightedCode

website/src/scripts/modal.ts:291–310  ·  view source on GitHub ↗
(
  content: string,
  filePath: string
)

Source from the content-addressed store, hash-verified

289}
290
291async 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
312function updateViewButtons(): void {
313 const renderBtn = document.getElementById("render-btn");

Callers 1

renderCurrentFileContentFunction · 0.85

Calls 3

ensureDivContentFunction · 0.85
getLanguageForFileFunction · 0.85
renderPlainTextFunction · 0.85

Tested by

no test coverage detected