@liustack/pagepress 2.0.0 → 3.0.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/README.md CHANGED
@@ -1,21 +1,30 @@
1
1
  # PagePress
2
2
 
3
- Generate one-page visual reports, dashboards, and infographics from HTML powered by Playwright + Chromium.
3
+ A CLI toolkit for AI agents to render local Markdown files into high-quality PDF documents.
4
4
 
5
5
  中文说明请见:[README.zh-CN.md](README.zh-CN.md)
6
6
 
7
7
  ## Features
8
8
 
9
- - HTML PNG screenshot pipeline
10
- - Custom viewport dimensions (`--width`, `--height`)
11
- - High-DPI output via `--scale` (up to 4x)
12
- - Local HTML file input only (`.html`)
13
- - Deterministic output via Playwright + Chromium
9
+ - PDF-only command surface (`pagepress`)
10
+ - Local Markdown file input only (`.md`)
11
+ - Built-in Markdown templates: `default`, `github`, `magazine`
12
+ - Built-in Mermaid rendering for Markdown code blocks
13
+ - Deterministic output via Playwright + Chromium print engine
14
14
 
15
15
  ## Installation
16
16
 
17
+ Requires Node.js 18+.
18
+
19
+ Install the CLI globally:
20
+
17
21
  ```bash
18
22
  npm install -g @liustack/pagepress
23
+ ```
24
+
25
+ Then install the Chromium browser used for PDF rendering:
26
+
27
+ ```bash
19
28
  npx playwright install chromium
20
29
  ```
21
30
 
@@ -25,38 +34,47 @@ Or run with `npx`:
25
34
  npx @liustack/pagepress [options]
26
35
  ```
27
36
 
28
- ## Usage
37
+ `pagepress` renders PDFs through Playwright + Chromium, so the browser install step is required even if you use `npx`.
38
+
39
+ Or install as an **Agent Skill** — tell any AI coding tool that supports agent skills (Claude Code, Codex, OpenCode, Cursor, Antigravity, etc.):
40
+
41
+ ```text
42
+ Install the skill from liustack/pagepress
43
+ ```
44
+
45
+ Or use the `skills` CLI directly:
29
46
 
30
47
  ```bash
31
- # Generate infographic (default 1200×630 @2x)
32
- pagepress -i report.html -o report.png
48
+ npx skills add liustack/pagepress --skill pagepress
49
+ ```
33
50
 
34
- # Custom dimensions for a tall infographic
35
- pagepress -i report.html -o report.png -w 1080 -h 1920
51
+ To check for updates later:
36
52
 
37
- # High-DPI poster
38
- pagepress -i poster.html -o poster.png -w 1200 -h 1500 --scale 3
53
+ ```bash
54
+ pagepress check-update
55
+ pagepress self-update
39
56
  ```
40
57
 
41
- ## HTML Requirements
58
+ If `check-update` cannot reach the registry, it returns `checked: false` and you can continue using the local CLI.
42
59
 
43
- Your HTML must include a `<div id="container">` — PagePress clips the screenshot to this element's bounding box.
60
+ ## Usage
44
61
 
45
- ```html
46
- <body>
47
- <div id="container">
48
- <!-- your content here -->
49
- </div>
50
- </body>
62
+ ```bash
63
+ # Markdown to PDF
64
+ pagepress -i document.md -o output.pdf --template default
51
65
  ```
52
66
 
67
+ ## Templates
68
+
69
+ - `default` - Clean minimalist style
70
+ - `github` - GitHub style
71
+ - `magazine` - magazine layout
72
+
53
73
  ## Options
54
74
 
55
- - `-i, --input <path>` input HTML file path
56
- - `-o, --output <path>` output PNG file path
57
- - `-w, --width <pixels>` viewport width (default: 1200)
58
- - `-h, --height <pixels>` viewport height (default: 630)
59
- - `--scale <number>` device scale factor, 1-4 (default: 2)
75
+ - `-i, --input <path>` input Markdown file path
76
+ - `-o, --output <path>` output PDF file path
77
+ - `-t, --template <name>` template for Markdown input (default: `default`)
60
78
  - `--wait-until <state>` `load | domcontentloaded | networkidle`
61
79
  - `--timeout <ms>` timeout in milliseconds
62
80
  - `--safe` disable external network requests and JavaScript execution
package/README.zh-CN.md CHANGED
@@ -1,19 +1,28 @@
1
1
  # PagePress
2
2
 
3
- HTML 生成单页可视化报告、仪表盘和信息图 基于 Playwright + Chromium
3
+ 面向 AI Agent PDF 渲染 CLI,可将本地 Markdown 文件输出为高质量 PDF
4
4
 
5
5
  ## 特性
6
6
 
7
- - HTML PNG 截图管线
8
- - 自定义视口尺寸(`--width`、`--height`)
9
- - DPI 输出,支持最高 4 倍缩放(`--scale`)
10
- - 仅支持本地 HTML 文件输入(`.html`)
11
- - 基于 Playwright + Chromium 的稳定渲染引擎
7
+ - 专注 PDF 输出(仅 `pagepress`)
8
+ - 仅支持本地 Markdown 文件输入(`.md`)
9
+ - 内置 Markdown 模板:`default`、`github`、`magazine`
10
+ - 支持 Mermaid 代码块渲染
11
+ - 基于 Playwright + Chromium 的稳定打印引擎
12
12
 
13
13
  ## 安装
14
14
 
15
+ 需要 Node.js 18+。
16
+
17
+ 全局安装 CLI:
18
+
15
19
  ```bash
16
20
  npm install -g @liustack/pagepress
21
+ ```
22
+
23
+ 然后安装 PDF 渲染所需的 Chromium 浏览器:
24
+
25
+ ```bash
17
26
  npx playwright install chromium
18
27
  ```
19
28
 
@@ -23,38 +32,47 @@ npx playwright install chromium
23
32
  npx @liustack/pagepress [options]
24
33
  ```
25
34
 
26
- ## 用法
35
+ `pagepress` 基于 Playwright + Chromium 导出 PDF,所以即使使用 `npx`,浏览器安装这一步也仍然需要。
36
+
37
+ 也可以作为 **Agent Skill** 安装,在任何支持 Agent Skill 的 AI 编程工具(Claude Code、Codex、OpenCode、Cursor、Antigravity 等)中输入:
38
+
39
+ ```text
40
+ 帮我安装这个 skill:liustack/pagepress
41
+ ```
42
+
43
+ 或使用 `skills` CLI 直接安装:
27
44
 
28
45
  ```bash
29
- # 生成信息图(默认 1200×630 @2x)
30
- pagepress -i report.html -o report.png
46
+ npx skills add liustack/pagepress --skill pagepress
47
+ ```
31
48
 
32
- # 自定义尺寸的长信息图
33
- pagepress -i report.html -o report.png -w 1080 -h 1920
49
+ 后续如需检查或升级版本:
34
50
 
35
- # 高 DPI 海报
36
- pagepress -i poster.html -o poster.png -w 1200 -h 1500 --scale 3
51
+ ```bash
52
+ pagepress check-update
53
+ pagepress self-update
37
54
  ```
38
55
 
39
- ## HTML 要求
56
+ 如果 `check-update` 无法连接 registry,会返回 `checked: false`,此时可继续使用本地 CLI。
40
57
 
41
- HTML 中必须包含 `<div id="container">` — PagePress 会根据该元素的边界框裁剪截图。
58
+ ## 用法
42
59
 
43
- ```html
44
- <body>
45
- <div id="container">
46
- <!-- 你的内容 -->
47
- </div>
48
- </body>
60
+ ```bash
61
+ # Markdown 转 PDF
62
+ pagepress -i document.md -o output.pdf --template default
49
63
  ```
50
64
 
65
+ ## 模板
66
+
67
+ - `default` - 简洁风格
68
+ - `github` - GitHub 风格
69
+ - `magazine` - 杂志排版
70
+
51
71
  ## 参数
52
72
 
53
- - `-i, --input <path>` 输入 HTML 路径
54
- - `-o, --output <path>` 输出 PNG 路径
55
- - `-w, --width <pixels>` 视口宽度(默认: 1200)
56
- - `-h, --height <pixels>` 视口高度(默认: 630)
57
- - `--scale <number>` 设备缩放因子,1-4(默认: 2)
73
+ - `-i, --input <path>` 输入 Markdown 路径
74
+ - `-o, --output <path>` 输出 PDF 路径
75
+ - `-t, --template <name>` Markdown 模板(默认 `default`)
58
76
  - `--wait-until <state>` `load | domcontentloaded | networkidle`
59
77
  - `--timeout <ms>` 超时时间(毫秒)
60
78
  - `--safe` 禁用外部网络请求和 JavaScript 执行