This commit is contained in:
eric
2026-03-12 00:34:50 -05:00
parent 0c2ccadb6b
commit 5caf970c7e
26 changed files with 1528 additions and 288 deletions

View File

@@ -1,7 +1,8 @@
import { readFileSync } from "fs";
import path from "path";
import { parseEbookMarkdown } from "../lib/ebook";
import EbookClient from "./EbookClient";
import { parseEbookMarkdown, estimateReadingMinutes } from "@/lib/content/ebook";
import { EbookViewer } from "@/app/components/content/EbookViewer";
import { EBOOK_CONFIG } from "@/config/content.config";
export const metadata = {
title: "电子书 | 数字游民",
@@ -12,6 +13,11 @@ export default function EbookPage() {
const mdPath = path.join(process.cwd(), "app/data/ebook.md");
const source = readFileSync(mdPath, "utf-8");
const data = parseEbookMarkdown(source);
const textLen = data.chunks.reduce((s, c) => s + c.html.replace(/<[^>]+>/g, "").length, 0);
const config = {
...EBOOK_CONFIG,
estimatedMinutes: estimateReadingMinutes(textLen),
};
return <EbookClient data={data} title="数字游民" backHref="/" />;
return <EbookViewer data={data} config={config} />;
}