1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { gfm } from "https://esm.town/v/pomdtr/gfm";
import { fetchText } from "https://esm.town/v/stevekrouse/fetchText?v=6";
import { html } from "https://esm.town/v/stevekrouse/html?v=5";
export default async function(req: Request) {
const { pathname } = new URL(req.url);
const [_, owner, id] = pathname.split("/");
if (!owner || !id) {
return new Response("Invalid Request", {
status: 400,
});
}
const content = await fetchText(`https://gist.github.com/${owner}/${id}/raw`);
return html(await gfm(content));
}