Skip to main content
Module

x/book/mod.ts

A super easy-to-use markdown document preview framework in Deno.
Latest
File
import { Bootstrap, Server } from "./deps.ts";import { tmpl } from "./tmpl.ts";import { meta, getDocument, getSummary, getReadme } from "./docs.ts";
@Bootstrapexport default class {
constructor(app: Server) { app.get("/", async ctx => { const summary = await getSummary(); const content = await getReadme(); return ctx.render(tmpl, { meta, summary, content }); }); app.get("/*", async ctx => { const summary = await getSummary(); const content = await getDocument(decodeURIComponent(ctx.path)); return ctx.render(tmpl, { meta, summary, content }); }); }}