Files
2026-03-12 00:34:50 -05:00

24 lines
908 B
TypeScript

import { readFileSync } from "fs";
import path from "path";
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: "电子书 | 数字游民",
description: "数字游民:地理套利与自动化杠杆,低成本工作室、云手机、无人直播、出海掘金。",
};
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 <EbookViewer data={data} config={config} />;
}