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

Val readme source viewer

ℹ️ As expected, I'm late to the party 😅 so go ahead and check out @pomdtr's wonderful @pomdtr/cdn val:
https://www.val.town/v/pomdtr/cdn#fetching-the-val-readme

Usage

https://vladimyr-mdviewer.web.val.run/v/<author>/<val>

Bookmarklet: vladimyr/bookmarkletMdViewer

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SPDX-License-Identifier: 0BSD
import { fetchVal } from "https://esm.town/v/vladimyr/fetchVal";
import { serveReadme } from "https://esm.town/v/vladimyr/serveReadme";
import { toHonoHandler } from "https://esm.town/v/vladimyr/toHonoHandler";
import { Hono } from "npm:hono";
import ky from "npm:ky";
const router = new Hono();
router.get("/", toHonoHandler(serveReadme(import.meta.url)));
router.get("/v/:author/:name", async (c) => {
const { author, name } = c.req.param();
const query = c.req.query();
const { readme } = await fetchVal(author, name);
// @see: https://datatracker.ietf.org/doc/html/rfc7763
c.header("content-type", "text/markdown; charset=UTF-8; variant=GFM");
return c.body(readme);
});
export default router.fetch;
vladimyr-mdviewer.web.val.run
March 9, 2024