import Link from "../Link"; export type GistProps = { id: string; file?: string; }; const Gist = async ({ id, file }: GistProps) => { const iframeId = `gist-${id}${file ? `-${file}` : ""}`; const scriptUrl = `https://gist.github.com/${id}.js${file ? `?file=${file}` : ""}`; const scriptResponse = await fetch(scriptUrl); if (!scriptResponse.ok) { console.warn(`[gist] failed to fetch js:`, scriptResponse.statusText); return (
Failed to load gist.{" "} Try opening it manually?
); } const script = await scriptResponse.text(); // https://github.com/tleunen/react-gist/blob/master/src/index.js#L29 const iframeHtml = `