Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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