fumadocs-epub 1.2.3 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { LoaderConfig, LoaderOutput } from "fumadocs-core/source";
2
- //#region src/types.d.ts
3
2
  interface EpubConfig<Config extends LoaderConfig = LoaderConfig> {
4
3
  /** Book title */
5
4
  title: string;
@@ -30,14 +29,10 @@ interface EpubExportOptions<Config extends LoaderConfig = LoaderConfig> extends
30
29
  /** function to get page Markdown content */
31
30
  getMarkdown?: (page: Config['page']) => string | undefined | Promise<string | undefined>;
32
31
  }
33
- //#endregion
34
- //#region src/default-styles.d.ts
35
32
  /**
36
33
  * Minimal, readable CSS stylesheet suitable for e-readers.
37
34
  */
38
35
  export declare const defaultEpubStyles = "\nbody {\n font-family: Georgia, serif;\n font-size: 1em;\n line-height: 1.6;\n margin: 1em;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: Georgia, serif;\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n page-break-after: avoid;\n}\n\nh1 { font-size: 1.5em; }\nh2 { font-size: 1.3em; }\nh3 { font-size: 1.15em; }\n\npre, code {\n font-family: \"Consolas\", \"Monaco\", \"Courier New\", monospace;\n font-size: 0.9em;\n}\n\npre {\n background: #f5f5f5;\n padding: 1em;\n overflow-x: auto;\n page-break-inside: avoid;\n}\n\ncode {\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n}\n\npre code {\n background: none;\n padding: 0;\n}\n\nimg {\n max-width: 100%;\n height: auto;\n}\n\nblockquote {\n margin: 1em 0;\n padding-left: 1em;\n border-left: 4px solid #ccc;\n color: #555;\n}\n\ntable {\n border-collapse: collapse;\n width: 100%;\n page-break-inside: avoid;\n}\n\nth, td {\n border: 1px solid #ddd;\n padding: 0.5em;\n}\n\nth {\n background: #f5f5f5;\n}\n\np {\n margin: 0.75em 0;\n}\n\nul, ol {\n margin: 0.75em 0;\n padding-left: 1.5em;\n}\n\na {\n color: #0066cc;\n}\n";
39
- //#endregion
40
- //#region src/index.d.ts
41
36
  export interface EpubExportAPI {
42
37
  GET: (request: Request) => Promise<Response>;
43
38
  }
@@ -84,6 +79,5 @@ export declare function createEpubExportAPI<C extends LoaderConfig>(options: Epu
84
79
  * ```
85
80
  */
86
81
  export declare function exportEpub<C extends LoaderConfig>(options: EpubExportOptions<C>): Promise<Buffer>;
87
- //#endregion
88
82
  export type { EpubConfig, EpubExportOptions };
89
83
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/default-styles.ts","../src/index.ts"],"mappings":";;UAEiB,WAAW,eAAe,eAAe;;EAExD;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB,MAAM;;EAEtB,gBAAgB,MAAM;;EAEtB;;EAEA;;UAGe,kBACf,eAAe,eAAe,sBACtB,WAAW;;EAEnB,QAAQ,aAAa,iBAAiB,QAAQ,aAAa;;EAE3D,eAAe,MAAM,wCAAwC;;;;;;;qBC9BlD;;;iBCSI;EACf,MAAM,SAAS,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;wBAqBrB,oBAAoB,UAAU,cAC5C,SAAS,kBAAkB;EACzB;;EAEA;IAED;;;;;;;;;;;;;;;;;;;;wBAyEmB,WAAW,UAAU,cACzC,SAAS,kBAAkB,KAC1B,QAAQ"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/types.ts","../src/default-styles.ts","../src/index.ts"],"mappings":";UAEiB,WAAW,eAAe,eAAe;;EAExD;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,gBAAgB,MAAM;;EAEtB,gBAAgB,MAAM;;EAEtB;;EAEA;;UAGe,kBACf,eAAe,eAAe,sBACtB,WAAW;;EAEnB,QAAQ,aAAa,iBAAiB,QAAQ,aAAa;;EAE3D,eAAe,MAAM,wCAAwC;;;;;qBC9BlD;iBCSI;EACf,MAAM,SAAS,YAAY,QAAQ;;;;;;;;;;;;;;;;;;;;wBAqBrB,oBAAoB,UAAU,cAC5C,SAAS,kBAAkB;EACzB;;EAEA;IAED;;;;;;;;;;;;;;;;;;;;wBAyEmB,WAAW,UAAU,cACzC,SAAS,kBAAkB,KAC1B,QAAQ"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import epub from "epub-gen-memory";
1
+ import { EPub } from "epub-gen-memory";
2
2
  import path from "node:path";
3
3
  import { pathToFileURL } from "node:url";
4
4
  import { flattenTree } from "fumadocs-core/page-tree";
@@ -7,7 +7,7 @@ import remarkRehype from "remark-rehype";
7
7
  import rehypeStringify from "rehype-stringify";
8
8
  import { remark } from "remark";
9
9
  import fs from "node:fs";
10
- //#region src/toc-builder.ts
10
+ // src/toc-builder.ts
11
11
  /**
12
12
  * Get pages in the order they appear in the page tree (navigation order).
13
13
  * Uses flattenTree to traverse the tree depth-first, resolving each Item to a page.
@@ -23,8 +23,7 @@ function getPagesInTreeOrder(pageTree, getNodePage) {
23
23
  }
24
24
  return pages;
25
25
  }
26
- //#endregion
27
- //#region src/image-resolver.ts
26
+ // src/image-resolver.ts
28
27
  /**
29
28
  * Resolve image src to file:// URL for epub-gen-memory to embed.
30
29
  * Handles relative paths (resolved from page dir), absolute paths, and remote URLs.
@@ -41,8 +40,7 @@ function resolveImageSrc(src, pageDir, publicDir) {
41
40
  const resolved = path.resolve(pageDir, src);
42
41
  if (fs.existsSync(resolved)) return pathToFileURL(resolved).href;
43
42
  }
44
- //#endregion
45
- //#region src/markdown-to-html.ts
43
+ // src/markdown-to-html.ts
46
44
  const processor = remark().use(remarkGfm).use(remarkResolveImg).use(remarkRehype, { allowDangerousHtml: true }).use(rehypeStringify, { allowDangerousHtml: true });
47
45
  function remarkResolveImg() {
48
46
  return (tree, file) => {
@@ -78,8 +76,7 @@ async function markdownToHtml(markdown, pageDir, publicDir) {
78
76
  });
79
77
  return String(result);
80
78
  }
81
- //#endregion
82
- //#region src/default-styles.ts
79
+ // src/default-styles.ts
83
80
  /**
84
81
  * Minimal, readable CSS stylesheet suitable for e-readers.
85
82
  */
@@ -164,8 +161,7 @@ a {
164
161
  color: #0066cc;
165
162
  }
166
163
  `;
167
- //#endregion
168
- //#region src/index.ts
164
+ // src/index.ts
169
165
  /**
170
166
  * A route handler that exports the docs as an EPUB file.
171
167
  *
@@ -272,7 +268,7 @@ async function exportEpub(options) {
272
268
  lang: language,
273
269
  publisher,
274
270
  cover: resolveCoverPath(cover, cwd, publicDir) ?? cover,
275
- css: css ?? defaultEpubStyles,
271
+ css: css ?? "\nbody {\n font-family: Georgia, serif;\n font-size: 1em;\n line-height: 1.6;\n margin: 1em;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: Georgia, serif;\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n page-break-after: avoid;\n}\n\nh1 { font-size: 1.5em; }\nh2 { font-size: 1.3em; }\nh3 { font-size: 1.15em; }\n\npre, code {\n font-family: \"Consolas\", \"Monaco\", \"Courier New\", monospace;\n font-size: 0.9em;\n}\n\npre {\n background: #f5f5f5;\n padding: 1em;\n overflow-x: auto;\n page-break-inside: avoid;\n}\n\ncode {\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n}\n\npre code {\n background: none;\n padding: 0;\n}\n\nimg {\n max-width: 100%;\n height: auto;\n}\n\nblockquote {\n margin: 1em 0;\n padding-left: 1em;\n border-left: 4px solid #ccc;\n color: #555;\n}\n\ntable {\n border-collapse: collapse;\n width: 100%;\n page-break-inside: avoid;\n}\n\nth, td {\n border: 1px solid #ddd;\n padding: 0.5em;\n}\n\nth {\n background: #f5f5f5;\n}\n\np {\n margin: 0.75em 0;\n}\n\nul, ol {\n margin: 0.75em 0;\n padding-left: 1.5em;\n}\n\na {\n color: #0066cc;\n}\n",
276
272
  prependChapterTitles: true,
277
273
  numberChaptersInTOC: true,
278
274
  tocTitle: "Table of Contents"
@@ -281,7 +277,7 @@ async function exportEpub(options) {
281
277
  title: ch.title,
282
278
  content: ch.content
283
279
  }));
284
- const buffer = await epub(epubOptions, content);
280
+ const buffer = await new EPub(epubOptions, content).genEpub();
285
281
  if (outputPath) {
286
282
  const fs = await import("node:fs/promises");
287
283
  await fs.mkdir(path.dirname(outputPath), { recursive: true });
@@ -289,7 +285,6 @@ async function exportEpub(options) {
289
285
  }
290
286
  return buffer;
291
287
  }
292
- //#endregion
293
288
  export { createEpubExportAPI, defaultEpubStyles, exportEpub };
294
289
 
295
290
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/toc-builder.ts","../src/image-resolver.ts","../src/markdown-to-html.ts","../src/default-styles.ts","../src/index.ts"],"sourcesContent":["import type * as PageTree from 'fumadocs-core/page-tree';\nimport { flattenTree } from 'fumadocs-core/page-tree';\n\n/**\n * Get pages in the order they appear in the page tree (navigation order).\n * Uses flattenTree to traverse the tree depth-first, resolving each Item to a page.\n */\nexport function getPagesInTreeOrder<Page>(\n pageTree: PageTree.Root,\n getNodePage: (node: PageTree.Item) => Page | undefined,\n): Page[] {\n const mainItems = flattenTree(pageTree.children);\n const fallbackItems = pageTree.fallback ? flattenTree(pageTree.fallback.children) : [];\n const items = [...mainItems, ...fallbackItems];\n const pages: Page[] = [];\n\n for (const item of items) {\n const page = getNodePage(item);\n if (page) {\n pages.push(page);\n }\n }\n\n return pages;\n}\n","import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport fs from 'node:fs';\n\n/**\n * Resolve image src to file:// URL for epub-gen-memory to embed.\n * Handles relative paths (resolved from page dir), absolute paths, and remote URLs.\n */\nexport function resolveImageSrc(\n src: string,\n pageDir: string,\n publicDir: string,\n): string | undefined {\n // Already a file:// URL\n if (src.startsWith('file://')) {\n return src;\n }\n\n // Remote URL - epub-gen-memory can fetch these\n if (src.startsWith('http://') || src.startsWith('https://')) {\n return src;\n }\n\n // Data URL - pass through\n if (src.startsWith('data:')) {\n return src;\n }\n\n // Protocol-relative URL (//cdn.example.com/...) - normalize to https:\n if (src.startsWith('//')) {\n return `https:${src}`;\n }\n\n // Absolute path starting with / - could be from public dir\n if (src.startsWith('/')) {\n const resolved = path.join(publicDir, src.slice(1));\n if (fs.existsSync(resolved)) return pathToFileURL(resolved).href;\n }\n // Relative path or others - resolve from page directory\n const resolved = path.resolve(pageDir, src);\n if (fs.existsSync(resolved)) return pathToFileURL(resolved).href;\n}\n","import type { Transformer } from 'unified';\nimport remarkGfm from 'remark-gfm';\nimport remarkRehype from 'remark-rehype';\nimport rehypeStringify from 'rehype-stringify';\nimport type { Root, RootContent } from 'mdast';\nimport { remark } from 'remark';\nimport { resolveImageSrc } from './image-resolver';\n\nconst processor = remark()\n .use(remarkGfm)\n .use(remarkResolveImg)\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeStringify, { allowDangerousHtml: true });\n\ndeclare module 'vfile' {\n export interface DataMap {\n pageDir: string;\n publicDir: string;\n }\n}\n\nfunction remarkResolveImg(): Transformer<Root, Root> {\n return (tree, file) => {\n const { pageDir, publicDir } = file.data;\n if (!pageDir || !publicDir) return;\n\n const visit = (parent: Root | RootContent) => {\n if (!('children' in parent)) return;\n for (let i = 0; i < parent.children.length; i++) {\n const node = parent.children[i];\n if (node.type !== 'image') {\n visit(node);\n continue;\n }\n\n const resolved = resolveImageSrc(node.url, pageDir, publicDir);\n if (resolved) node.url = resolved;\n else parent.children.splice(i--, 1);\n }\n };\n visit(tree);\n };\n}\n\n/**\n * Convert markdown string to HTML suitable for EPUB chapters.\n * Uses unified pipeline: remark-parse -> remark-gfm -> remark-rehype -> rehype-stringify\n */\nexport async function markdownToHtml(\n markdown: string,\n pageDir: string,\n publicDir: string,\n): Promise<string> {\n const result = await processor.process({\n value: markdown,\n data: {\n pageDir,\n publicDir,\n },\n });\n return String(result);\n}\n","/**\n * Minimal, readable CSS stylesheet suitable for e-readers.\n */\nexport const defaultEpubStyles = `\nbody {\n font-family: Georgia, serif;\n font-size: 1em;\n line-height: 1.6;\n margin: 1em;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: Georgia, serif;\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n page-break-after: avoid;\n}\n\nh1 { font-size: 1.5em; }\nh2 { font-size: 1.3em; }\nh3 { font-size: 1.15em; }\n\npre, code {\n font-family: \"Consolas\", \"Monaco\", \"Courier New\", monospace;\n font-size: 0.9em;\n}\n\npre {\n background: #f5f5f5;\n padding: 1em;\n overflow-x: auto;\n page-break-inside: avoid;\n}\n\ncode {\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n}\n\npre code {\n background: none;\n padding: 0;\n}\n\nimg {\n max-width: 100%;\n height: auto;\n}\n\nblockquote {\n margin: 1em 0;\n padding-left: 1em;\n border-left: 4px solid #ccc;\n color: #555;\n}\n\ntable {\n border-collapse: collapse;\n width: 100%;\n page-break-inside: avoid;\n}\n\nth, td {\n border: 1px solid #ddd;\n padding: 0.5em;\n}\n\nth {\n background: #f5f5f5;\n}\n\np {\n margin: 0.75em 0;\n}\n\nul, ol {\n margin: 0.75em 0;\n padding-left: 1.5em;\n}\n\na {\n color: #0066cc;\n}\n`;\n","import epub, { type Options } from 'epub-gen-memory';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { LoaderConfig, Page } from 'fumadocs-core/source';\nimport { getPagesInTreeOrder } from './toc-builder';\nimport { markdownToHtml } from './markdown-to-html';\nimport { defaultEpubStyles } from './default-styles';\nimport type { EpubExportOptions } from './types';\n\nexport { defaultEpubStyles } from './default-styles';\nexport type { EpubConfig, EpubExportOptions } from './types';\n\nexport interface EpubExportAPI {\n GET: (request: Request) => Promise<Response>;\n}\n\n/**\n * A route handler that exports the docs as an EPUB file.\n *\n * The route is guarded by `secret`: it is rejected entirely when the secret is unset (e.g. a missing\n * environment variable), otherwise the request must carry `Authorization: Bearer <secret>`.\n *\n * @example\n * ```ts\n * import { createEpubExportAPI } from 'fumadocs-epub';\n * import { source } from '@/lib/source';\n *\n * export const { GET } = createEpubExportAPI({\n * source,\n * title: 'Documentation',\n * secret: process.env.EXPORT_SECRET,\n * });\n * ```\n */\nexport function createEpubExportAPI<C extends LoaderConfig>(\n options: EpubExportOptions<C> & {\n secret: string | undefined;\n /** @defaultValue 'docs.epub' */\n filename?: string;\n },\n): EpubExportAPI {\n const { secret, filename = 'docs.epub', ...rest } = options;\n\n return {\n async GET(request) {\n if (!secret) return new Response('the export secret is not configured.', { status: 503 });\n const auth = request.headers.get('authorization');\n if (auth?.replace(/^Bearer\\s+/i, '') !== secret)\n return new Response('Unauthorized', { status: auth ? 403 : 401 });\n\n const buffer = await exportEpub(rest as EpubExportOptions<C>);\n\n return new Response(new Uint8Array(buffer), {\n headers: {\n 'Content-Type': 'application/epub+zip',\n 'Content-Disposition': `attachment; filename=\"${filename}\"`,\n },\n });\n },\n };\n}\n\n/**\n * Get page directory for resolving relative image paths\n */\nfunction getPageDir(page: Page, cwd: string): string {\n if (page.absolutePath) {\n return path.dirname(page.absolutePath);\n }\n return path.resolve(cwd, path.dirname(page.path));\n}\n\n/**\n * Resolve cover image path - support file://, http(s)://, /public/..., or relative\n */\nfunction resolveCoverPath(\n cover: string | undefined,\n cwd: string,\n publicDir?: string,\n): string | undefined {\n if (!cover) return undefined;\n if (cover.startsWith('file://') || cover.startsWith('http://') || cover.startsWith('https://'))\n return cover;\n if (cover.startsWith('/')) {\n const base = publicDir ?? path.join(cwd, 'public');\n return pathToFileUrl(path.join(base, cover.slice(1)));\n }\n return pathToFileUrl(path.resolve(cwd, cover));\n}\n\nfunction pathToFileUrl(filePath: string): string {\n return pathToFileURL(filePath).href;\n}\n\n/**\n * Export Fumadocs documentation to EPUB format.\n *\n * @param options - Export configuration with source and epub config\n * @returns Promise resolving to the EPUB file as a Buffer\n *\n * @example\n * ```ts\n * import { exportEpub } from 'fumadocs-epub';\n * import { source } from '@/lib/source';\n *\n * const buffer = await exportEpub({\n * source,\n * title: 'My Documentation',\n * author: 'My Team',\n * cover: '/cover.png',\n * });\n * ```\n */\nexport async function exportEpub<C extends LoaderConfig>(\n options: EpubExportOptions<C>,\n): Promise<Buffer> {\n const cwd = process.cwd();\n const {\n source: input,\n getMarkdown = async (page) => {\n try {\n return await (page.data as { getText: (type: string) => Promise<string> }).getText('raw');\n } catch {\n console.warn(\n `Failed to get processed markdown for page \"${page.absolutePath ?? page.path}\", please specify the \"getMarkdown\" option.`,\n );\n }\n },\n title,\n author = 'anonymous',\n description,\n language = 'en',\n publisher = 'anonymous',\n cover,\n outputPath,\n includePages,\n excludePages,\n css,\n publicDir = path.resolve('public'),\n } = options;\n\n const source = typeof input === 'function' ? await input() : input;\n // Get pages in tree order (navigation order)\n const pageTree = source.getPageTree();\n const orderedPages = getPagesInTreeOrder(pageTree, (node) => source.getNodePage?.(node)).filter(\n (p): p is Page => p != null,\n );\n\n // Fallback to getPages() if tree order yields no pages (e.g. i18n)\n const pages = orderedPages.length > 0 ? orderedPages : source.getPages();\n\n // Filter pages\n const filteredPages = pages.filter((page) => {\n if (includePages && !includePages(page)) return false;\n if (excludePages && excludePages(page)) return false;\n return true;\n });\n\n const chapters: { title: string; content: string }[] = [];\n\n for (const page of filteredPages) {\n const markdown = await getMarkdown(page);\n if (!markdown) continue;\n\n const pageDir = getPageDir(page, cwd);\n const html = await markdownToHtml(markdown, pageDir, publicDir);\n const pageTitle = page.data.title ?? page.slugs[page.slugs.length - 1] ?? 'Untitled';\n\n chapters.push({\n title: pageTitle,\n content: html,\n });\n }\n\n const epubOptions: Options = {\n title,\n author: Array.isArray(author) ? author : [author],\n description,\n lang: language,\n publisher,\n cover: resolveCoverPath(cover, cwd, publicDir) ?? cover,\n css: css ?? defaultEpubStyles,\n prependChapterTitles: true,\n numberChaptersInTOC: true,\n tocTitle: 'Table of Contents',\n };\n\n const content = chapters.map((ch) => ({\n title: ch.title,\n content: ch.content,\n }));\n\n const buffer = await epub(epubOptions, content);\n\n if (outputPath) {\n const fs = await import('node:fs/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AS;EAC3C,IAAI,gBAAgB,CAAC,aAAa,IAAI,GAAG,OAAO;EAChD,IAAI,gBAAgB,aAAa,IAAI,GAAG,OAAO;EAC/C,OAAO;CACT,CAAC;CAED,MAAM,WAAiD,CAAC;CAExD,KAAK,MAAM,QAAQ,eAAe;EAChC,MAAM,WAAW,MAAM,YAAY,IAAI;EACvC,IAAI,CAAC,UAAU;EAGf,MAAM,OAAO,MAAM,eAAe,UADlB,WAAW,MAAM,GACW,GAAS,SAAS;EAC9D,MAAM,YAAY,KAAK,KAAK,SAAS,KAAK,MAAM,KAAK,MAAM,SAAS,MAAM;EAE1E,SAAS,KAAK;GACZ,OAAO;GACP,SAAS;EACX,CAAC;CACH;CAEA,MAAM,cAAuB;EAC3B;EACA,QAAQ,MAAM,QAAQ,MAAM,IAAI,SAAS,CAAC,MAAM;EAChD;EACA,MAAM;EACN;EACA,OAAO,iBAAiB,OAAO,KAAK,SAAS,KAAK;EAClD,KAAK,OAAO;EACZ,sBAAsB;EACtB,qBAAqB;EACrB,UAAU;CACZ;CAEA,MAAM,UAAU,SAAS,KAAK,QAAQ;EACpC,OAAO,GAAG;EACV,SAAS,GAAG;CACd,EAAE;CAEF,MAAM,SAAS,MAAM,KAAK,aAAa,OAAO;CAE9C,IAAI,YAAY;EACd,MAAM,KAAK,MAAM,OAAO;EACxB,MAAM,GAAG,MAAM,KAAK,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;EAC5D,MAAM,GAAG,UAAU,YAAY,MAAM;CACvC;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/toc-builder.ts","../src/image-resolver.ts","../src/markdown-to-html.ts","../src/default-styles.ts","../src/index.ts"],"sourcesContent":["import type * as PageTree from 'fumadocs-core/page-tree';\nimport { flattenTree } from 'fumadocs-core/page-tree';\n\n/**\n * Get pages in the order they appear in the page tree (navigation order).\n * Uses flattenTree to traverse the tree depth-first, resolving each Item to a page.\n */\nexport function getPagesInTreeOrder<Page>(\n pageTree: PageTree.Root,\n getNodePage: (node: PageTree.Item) => Page | undefined,\n): Page[] {\n const mainItems = flattenTree(pageTree.children);\n const fallbackItems = pageTree.fallback ? flattenTree(pageTree.fallback.children) : [];\n const items = [...mainItems, ...fallbackItems];\n const pages: Page[] = [];\n\n for (const item of items) {\n const page = getNodePage(item);\n if (page) {\n pages.push(page);\n }\n }\n\n return pages;\n}\n","import path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport fs from 'node:fs';\n\n/**\n * Resolve image src to file:// URL for epub-gen-memory to embed.\n * Handles relative paths (resolved from page dir), absolute paths, and remote URLs.\n */\nexport function resolveImageSrc(\n src: string,\n pageDir: string,\n publicDir: string,\n): string | undefined {\n // Already a file:// URL\n if (src.startsWith('file://')) {\n return src;\n }\n\n // Remote URL - epub-gen-memory can fetch these\n if (src.startsWith('http://') || src.startsWith('https://')) {\n return src;\n }\n\n // Data URL - pass through\n if (src.startsWith('data:')) {\n return src;\n }\n\n // Protocol-relative URL (//cdn.example.com/...) - normalize to https:\n if (src.startsWith('//')) {\n return `https:${src}`;\n }\n\n // Absolute path starting with / - could be from public dir\n if (src.startsWith('/')) {\n const resolved = path.join(publicDir, src.slice(1));\n if (fs.existsSync(resolved)) return pathToFileURL(resolved).href;\n }\n // Relative path or others - resolve from page directory\n const resolved = path.resolve(pageDir, src);\n if (fs.existsSync(resolved)) return pathToFileURL(resolved).href;\n}\n","import type { Transformer } from 'unified';\nimport remarkGfm from 'remark-gfm';\nimport remarkRehype from 'remark-rehype';\nimport rehypeStringify from 'rehype-stringify';\nimport type { Root, RootContent } from 'mdast';\nimport { remark } from 'remark';\nimport { resolveImageSrc } from './image-resolver';\n\nconst processor = remark()\n .use(remarkGfm)\n .use(remarkResolveImg)\n .use(remarkRehype, { allowDangerousHtml: true })\n .use(rehypeStringify, { allowDangerousHtml: true });\n\ndeclare module 'vfile' {\n export interface DataMap {\n pageDir: string;\n publicDir: string;\n }\n}\n\nfunction remarkResolveImg(): Transformer<Root, Root> {\n return (tree, file) => {\n const { pageDir, publicDir } = file.data;\n if (!pageDir || !publicDir) return;\n\n const visit = (parent: Root | RootContent) => {\n if (!('children' in parent)) return;\n for (let i = 0; i < parent.children.length; i++) {\n const node = parent.children[i];\n if (node.type !== 'image') {\n visit(node);\n continue;\n }\n\n const resolved = resolveImageSrc(node.url, pageDir, publicDir);\n if (resolved) node.url = resolved;\n else parent.children.splice(i--, 1);\n }\n };\n visit(tree);\n };\n}\n\n/**\n * Convert markdown string to HTML suitable for EPUB chapters.\n * Uses unified pipeline: remark-parse -> remark-gfm -> remark-rehype -> rehype-stringify\n */\nexport async function markdownToHtml(\n markdown: string,\n pageDir: string,\n publicDir: string,\n): Promise<string> {\n const result = await processor.process({\n value: markdown,\n data: {\n pageDir,\n publicDir,\n },\n });\n return String(result);\n}\n","/**\n * Minimal, readable CSS stylesheet suitable for e-readers.\n */\nexport const defaultEpubStyles = `\nbody {\n font-family: Georgia, serif;\n font-size: 1em;\n line-height: 1.6;\n margin: 1em;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-family: Georgia, serif;\n margin-top: 1.5em;\n margin-bottom: 0.5em;\n page-break-after: avoid;\n}\n\nh1 { font-size: 1.5em; }\nh2 { font-size: 1.3em; }\nh3 { font-size: 1.15em; }\n\npre, code {\n font-family: \"Consolas\", \"Monaco\", \"Courier New\", monospace;\n font-size: 0.9em;\n}\n\npre {\n background: #f5f5f5;\n padding: 1em;\n overflow-x: auto;\n page-break-inside: avoid;\n}\n\ncode {\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n}\n\npre code {\n background: none;\n padding: 0;\n}\n\nimg {\n max-width: 100%;\n height: auto;\n}\n\nblockquote {\n margin: 1em 0;\n padding-left: 1em;\n border-left: 4px solid #ccc;\n color: #555;\n}\n\ntable {\n border-collapse: collapse;\n width: 100%;\n page-break-inside: avoid;\n}\n\nth, td {\n border: 1px solid #ddd;\n padding: 0.5em;\n}\n\nth {\n background: #f5f5f5;\n}\n\np {\n margin: 0.75em 0;\n}\n\nul, ol {\n margin: 0.75em 0;\n padding-left: 1.5em;\n}\n\na {\n color: #0066cc;\n}\n`;\n","import { EPub, type Options } from 'epub-gen-memory';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { LoaderConfig, Page } from 'fumadocs-core/source';\nimport { getPagesInTreeOrder } from './toc-builder';\nimport { markdownToHtml } from './markdown-to-html';\nimport { defaultEpubStyles } from './default-styles';\nimport type { EpubExportOptions } from './types';\n\nexport { defaultEpubStyles } from './default-styles';\nexport type { EpubConfig, EpubExportOptions } from './types';\n\nexport interface EpubExportAPI {\n GET: (request: Request) => Promise<Response>;\n}\n\n/**\n * A route handler that exports the docs as an EPUB file.\n *\n * The route is guarded by `secret`: it is rejected entirely when the secret is unset (e.g. a missing\n * environment variable), otherwise the request must carry `Authorization: Bearer <secret>`.\n *\n * @example\n * ```ts\n * import { createEpubExportAPI } from 'fumadocs-epub';\n * import { source } from '@/lib/source';\n *\n * export const { GET } = createEpubExportAPI({\n * source,\n * title: 'Documentation',\n * secret: process.env.EXPORT_SECRET,\n * });\n * ```\n */\nexport function createEpubExportAPI<C extends LoaderConfig>(\n options: EpubExportOptions<C> & {\n secret: string | undefined;\n /** @defaultValue 'docs.epub' */\n filename?: string;\n },\n): EpubExportAPI {\n const { secret, filename = 'docs.epub', ...rest } = options;\n\n return {\n async GET(request) {\n if (!secret) return new Response('the export secret is not configured.', { status: 503 });\n const auth = request.headers.get('authorization');\n if (auth?.replace(/^Bearer\\s+/i, '') !== secret)\n return new Response('Unauthorized', { status: auth ? 403 : 401 });\n\n const buffer = await exportEpub(rest as EpubExportOptions<C>);\n\n return new Response(new Uint8Array(buffer), {\n headers: {\n 'Content-Type': 'application/epub+zip',\n 'Content-Disposition': `attachment; filename=\"${filename}\"`,\n },\n });\n },\n };\n}\n\n/**\n * Get page directory for resolving relative image paths\n */\nfunction getPageDir(page: Page, cwd: string): string {\n if (page.absolutePath) {\n return path.dirname(page.absolutePath);\n }\n return path.resolve(cwd, path.dirname(page.path));\n}\n\n/**\n * Resolve cover image path - support file://, http(s)://, /public/..., or relative\n */\nfunction resolveCoverPath(\n cover: string | undefined,\n cwd: string,\n publicDir?: string,\n): string | undefined {\n if (!cover) return undefined;\n if (cover.startsWith('file://') || cover.startsWith('http://') || cover.startsWith('https://'))\n return cover;\n if (cover.startsWith('/')) {\n const base = publicDir ?? path.join(cwd, 'public');\n return pathToFileUrl(path.join(base, cover.slice(1)));\n }\n return pathToFileUrl(path.resolve(cwd, cover));\n}\n\nfunction pathToFileUrl(filePath: string): string {\n return pathToFileURL(filePath).href;\n}\n\n/**\n * Export Fumadocs documentation to EPUB format.\n *\n * @param options - Export configuration with source and epub config\n * @returns Promise resolving to the EPUB file as a Buffer\n *\n * @example\n * ```ts\n * import { exportEpub } from 'fumadocs-epub';\n * import { source } from '@/lib/source';\n *\n * const buffer = await exportEpub({\n * source,\n * title: 'My Documentation',\n * author: 'My Team',\n * cover: '/cover.png',\n * });\n * ```\n */\nexport async function exportEpub<C extends LoaderConfig>(\n options: EpubExportOptions<C>,\n): Promise<Buffer> {\n const cwd = process.cwd();\n const {\n source: input,\n getMarkdown = async (page) => {\n try {\n return await (page.data as { getText: (type: string) => Promise<string> }).getText('raw');\n } catch {\n console.warn(\n `Failed to get processed markdown for page \"${page.absolutePath ?? page.path}\", please specify the \"getMarkdown\" option.`,\n );\n }\n },\n title,\n author = 'anonymous',\n description,\n language = 'en',\n publisher = 'anonymous',\n cover,\n outputPath,\n includePages,\n excludePages,\n css,\n publicDir = path.resolve('public'),\n } = options;\n\n const source = typeof input === 'function' ? await input() : input;\n // Get pages in tree order (navigation order)\n const pageTree = source.getPageTree();\n const orderedPages = getPagesInTreeOrder(pageTree, (node) => source.getNodePage?.(node)).filter(\n (p): p is Page => p != null,\n );\n\n // Fallback to getPages() if tree order yields no pages (e.g. i18n)\n const pages = orderedPages.length > 0 ? orderedPages : source.getPages();\n\n // Filter pages\n const filteredPages = pages.filter((page) => {\n if (includePages && !includePages(page)) return false;\n if (excludePages && excludePages(page)) return false;\n return true;\n });\n\n const chapters: { title: string; content: string }[] = [];\n\n for (const page of filteredPages) {\n const markdown = await getMarkdown(page);\n if (!markdown) continue;\n\n const pageDir = getPageDir(page, cwd);\n const html = await markdownToHtml(markdown, pageDir, publicDir);\n const pageTitle = page.data.title ?? page.slugs[page.slugs.length - 1] ?? 'Untitled';\n\n chapters.push({\n title: pageTitle,\n content: html,\n });\n }\n\n const epubOptions: Options = {\n title,\n author: Array.isArray(author) ? author : [author],\n description,\n lang: language,\n publisher,\n cover: resolveCoverPath(cover, cwd, publicDir) ?? cover,\n css: css ?? defaultEpubStyles,\n prependChapterTitles: true,\n numberChaptersInTOC: true,\n tocTitle: 'Table of Contents',\n };\n\n const content = chapters.map((ch) => ({\n title: ch.title,\n content: ch.content,\n }));\n\n // the named export, Node.js gives `module.exports` as the default export of CommonJS\n const buffer = await new EPub(epubOptions, content).genEpub();\n\n if (outputPath) {\n const fs = await import('node:fs/promises');\n await fs.mkdir(path.dirname(outputPath), { recursive: true });\n await fs.writeFile(outputPath, buffer);\n }\n return buffer;\n}\n"],"mappings":";;;;;;;;;;;;;;AAOA,SAAgB,oBACd,UACA,aACQ;CACR,MAAM,YAAY,YAAY,SAAS,QAAQ;CAC/C,MAAM,gBAAgB,SAAS,WAAW,YAAY,SAAS,SAAS,QAAQ,IAAI,CAAC;CACrF,MAAM,QAAQ,CAAC,GAAG,WAAW,GAAG,aAAa;CAC7C,MAAM,QAAgB,CAAC;CAEvB,KAAK,MAAM,QAAQ,OAAO;EACxB,MAAM,OAAO,YAAY,IAAI;EAC7B,IAAI,MACF,MAAM,KAAK,IAAI;CAEnB;CAEA,OAAO;AACT;;;;;;AChBA,SAAgB,gBACd,KACA,SACA,WACoB;CAEpB,IAAI,IAAI,WAAW,SAAS,GAC1B,OAAO;CAIT,IAAI,IAAI,WAAW,SAAS,KAAK,IAAI,WAAW,UAAU,GACxD,OAAO;CAIT,IAAI,IAAI,W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B,qBAAqB;EACrB,UAAU;CACZ;CAEA,MAAM,UAAU,SAAS,KAAK,QAAQ;EACpC,OAAO,GAAG;EACV,SAAS,GAAG;CACd,EAAE;CAGF,MAAM,SAAS,MAAM,IAAI,KAAK,aAAa,OAAO,CAAC,CAAC,QAAQ;CAE5D,IAAI,YAAY;EACd,MAAM,KAAK,MAAM,OAAO;EACxB,MAAM,GAAG,MAAM,KAAK,QAAQ,UAAU,GAAG,EAAE,WAAW,KAAK,CAAC;EAC5D,MAAM,GAAG,UAAU,YAAY,MAAM;CACvC;CACA,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-epub",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "EPUB export for Fumadocs documentation",
5
5
  "keywords": [
6
6
  "documentation",
@@ -41,11 +41,11 @@
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/mdast": "^4.0.4",
44
- "@types/node": "26.6.4",
45
- "fumadocs-core": "16.17.0",
44
+ "@types/node": "26.6.5",
45
+ "fumadocs-core": "16.17.9",
46
46
  "rimraf": "^6.0.0",
47
47
  "tsconfig": "0.0.0",
48
- "tsdown": "0.23.0",
48
+ "tsdown": "0.23.1",
49
49
  "typescript": "^7.0.2",
50
50
  "vfile": "^6.0.3"
51
51
  },