Skip to content

Commit

Permalink
feat: show title (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuapp authored Nov 30, 2024
1 parent b63a91b commit d2fab8e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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(
`<html>
<head>
<title>${title}</title>
<style>${css}</style>
</head>
<body>
Expand Down

0 comments on commit d2fab8e

Please sign in to comment.