Public
Back
Version 30
3/5/2024
/** @jsxImportSource npm:hono/jsx **/
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
import { gfm } from "https://esm.town/v/pomdtr/gfm";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { Hono } from "npm:hono";
import { HTTPException } from "npm:hono/http-exception";
export function blobEditor(key: string) {
const router = new Hono();
router.get("/", async (c) => {
if (key.endsWith(".md")) {
const markdown = await readBlob(key);
return c.html(gfm(markdown, { title: key, favicon: "✏️" }));
}
const text = await readBlob(key);
return c.text(text);
});
router.get("/edit", async (c) => {
const text = readBlob(key);
return c.html(
<html>
<head>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
/>
</head>
<body>
<header>
<nav>
<li>
<a href="/">Blob Editor</a>
</li>
pomdtr-blob_editor.web.val.run
Updated: April 18, 2024