@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 +44 -26
- package/README.zh-CN.md +44 -26
- package/dist/main.js +383 -61
- package/package.json +27 -20
- package/src/templates/default.html +262 -0
- package/src/templates/github.html +326 -0
- package/src/templates/magazine.html +462 -0
package/README.md
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
1
|
# PagePress
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
32
|
-
|
|
48
|
+
npx skills add liustack/pagepress --skill pagepress
|
|
49
|
+
```
|
|
33
50
|
|
|
34
|
-
|
|
35
|
-
pagepress -i report.html -o report.png -w 1080 -h 1920
|
|
51
|
+
To check for updates later:
|
|
36
52
|
|
|
37
|
-
|
|
38
|
-
pagepress -
|
|
53
|
+
```bash
|
|
54
|
+
pagepress check-update
|
|
55
|
+
pagepress self-update
|
|
39
56
|
```
|
|
40
57
|
|
|
41
|
-
|
|
58
|
+
If `check-update` cannot reach the registry, it returns `checked: false` and you can continue using the local CLI.
|
|
42
59
|
|
|
43
|
-
|
|
60
|
+
## Usage
|
|
44
61
|
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
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
|
|
56
|
-
- `-o, --output <path>` output
|
|
57
|
-
- `-
|
|
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
|
-
|
|
3
|
+
面向 AI Agent 的 PDF 渲染 CLI,可将本地 Markdown 文件输出为高质量 PDF。
|
|
4
4
|
|
|
5
5
|
## 特性
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
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
|
-
|
|
30
|
-
|
|
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
|
-
|
|
36
|
-
pagepress -
|
|
51
|
+
```bash
|
|
52
|
+
pagepress check-update
|
|
53
|
+
pagepress self-update
|
|
37
54
|
```
|
|
38
55
|
|
|
39
|
-
|
|
56
|
+
如果 `check-update` 无法连接 registry,会返回 `checked: false`,此时可继续使用本地 CLI。
|
|
40
57
|
|
|
41
|
-
|
|
58
|
+
## 用法
|
|
42
59
|
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
|
|
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>` 输入
|
|
54
|
-
- `-o, --output <path>` 输出
|
|
55
|
-
- `-
|
|
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 执行
|