@liustack/pagepress 0.8.0 → 0.9.0
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/main.js +3 -2
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Command } from "commander";
|
|
|
3
3
|
import { chromium } from "playwright";
|
|
4
4
|
import * as fs from "fs";
|
|
5
5
|
import * as path from "path";
|
|
6
|
-
import { fileURLToPath } from "url";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "url";
|
|
7
7
|
import { createRequire } from "module";
|
|
8
8
|
import { Renderer, marked } from "marked";
|
|
9
9
|
import matter from "gray-matter";
|
|
@@ -188,6 +188,7 @@ async function render(options) {
|
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
const page = await context.newPage();
|
|
191
|
+
await page.goto(pathToFileURL(inputPath).href, { waitUntil: "domcontentloaded", timeout });
|
|
191
192
|
await page.setContent(htmlContent, { waitUntil, timeout });
|
|
192
193
|
const fontCSS = getFontCSS(template.name);
|
|
193
194
|
if (fontCSS) {
|
|
@@ -317,7 +318,7 @@ async function render(options) {
|
|
|
317
318
|
}
|
|
318
319
|
}
|
|
319
320
|
const program = new Command();
|
|
320
|
-
program.name("pagepress").description("Render local Markdown and HTML files to PDF").version("0.
|
|
321
|
+
program.name("pagepress").description("Render local Markdown and HTML files to PDF").version("0.9.0").requiredOption("-i, --input <path>", "Input Markdown or HTML file path").requiredOption("-o, --output <path>", "Output PDF file path").option("-t, --template <name>", "PDF template (default, github, magazine)", "default").option("--wait-until <state>", "Navigation waitUntil (load, domcontentloaded, networkidle)", "networkidle").option("--timeout <ms>", "Navigation timeout in milliseconds", "30000").option("--safe", "Disable external network requests and JavaScript execution").action(async (options) => {
|
|
321
322
|
try {
|
|
322
323
|
const timeout = Number.parseInt(options.timeout, 10);
|
|
323
324
|
if (!Number.isFinite(timeout) || timeout < 0) {
|