From d2fab8e481ebff223a36d3305c149955236f9be7 Mon Sep 17 00:00:00 2001 From: ryu <114303361+ryuapp@users.noreply.github.com> Date: Sat, 30 Nov 2024 14:08:25 +0900 Subject: [PATCH] feat: show title (#5) --- src/utils/server.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/server.ts b/src/utils/server.ts index 72a68b7..3a090d4 100644 --- a/src/utils/server.ts +++ b/src/utils/server.ts @@ -3,6 +3,7 @@ import { LinearRouter } from "@hono/hono/router/linear-router"; import { init as initMd4w, mdToHtml } from "md4w"; import type { MdToPdfOptions } from "../types.ts"; import { serveFile } from "@std/http/file-server"; +import { getFilename } from "./filename.ts"; export const DEFAULT_PORT = 33433; @@ -26,9 +27,11 @@ export function launchHttpServer( const content = mdToHtml( decoder.decode(await Deno.readFile(path)), ); + const title = getFilename(path.split("/").at(-1) || "") || "Untitled"; return c.html( `
+