Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

Render Gist

Usage

Go to a gist page, and replace gist.github.com by pomdtr-renderGist.web.val.run

Example: https://pomdtr-renderGist.web.val.run/probonopd/9feb7c20257af5dd915e3a9f2d1f2277

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));
}
pomdtr-rendergist.web.val.run
December 1, 2023