@liustack/pagepress 0.3.0 → 0.5.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 +29 -2
- package/README.zh-CN.md +30 -3
- package/dist/main.js +13 -1
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ A web content rendering toolkit (CLI) designed for **AI Agents**, converting HTM
|
|
|
11
11
|
- **Multiple inputs**: Local HTML, Markdown files, or remote URLs
|
|
12
12
|
- **Rich templates**:
|
|
13
13
|
- **PDF**: Apple style, GitHub style, magazine layout (Magazine)
|
|
14
|
-
- **Image**: OG cards, infographics, posters, banners
|
|
14
|
+
- **Image**: 8 presets — OG cards, infographics, posters, banners, Twitter/X cards, YouTube thumbnails, Xiaohongshu covers, WeChat covers
|
|
15
15
|
- **Brand-aware visuals**: OG / poster / banner outputs are generated based on workspace visual & brand assets (commonly in `assets/`, `public/`, `src/assets/`)
|
|
16
16
|
- **Consistency guarantees**: Deterministic rendering, font waiting, network idle detection, syntax highlighting
|
|
17
17
|
|
|
@@ -88,10 +88,37 @@ pagepress shot -i https://example.com -o screenshot.png
|
|
|
88
88
|
- `infographic` (1080x1350) - Infographic
|
|
89
89
|
- `poster` (1200x1500) - Poster
|
|
90
90
|
- `banner` (1600x900) - Banner
|
|
91
|
+
- `twitter` (1200x675) - Twitter/X card
|
|
92
|
+
- `youtube` (1280x720) - YouTube thumbnail
|
|
93
|
+
- `xiaohongshu` (1080x1440) - Xiaohongshu / RedNote cover
|
|
94
|
+
- `wechat` (900x383) - WeChat Official Account cover
|
|
95
|
+
|
|
96
|
+
## 🖼️ Examples
|
|
97
|
+
|
|
98
|
+
### Image Presets
|
|
99
|
+
|
|
100
|
+
| OG Card (1200×630) | Infographic (1080×1350) |
|
|
101
|
+
|:---:|:---:|
|
|
102
|
+
|  |  |
|
|
103
|
+
|
|
104
|
+
| Poster (1200×1500) | Banner (1600×900) |
|
|
105
|
+
|:---:|:---:|
|
|
106
|
+
|  |  |
|
|
107
|
+
|
|
108
|
+
| Twitter/X Card (1200×675) | YouTube Thumbnail (1280×720) |
|
|
109
|
+
|:---:|:---:|
|
|
110
|
+
|  |  |
|
|
111
|
+
|
|
112
|
+
| Xiaohongshu Cover (1080×1440) | WeChat Cover (900×383) |
|
|
113
|
+
|:---:|:---:|
|
|
114
|
+
|  |  |
|
|
91
115
|
|
|
92
116
|
## 🤖 AI Agent Integration
|
|
93
117
|
|
|
94
|
-
This project includes
|
|
118
|
+
This project includes two skill guides for AI Agents (such as Claude, ChatGPT):
|
|
119
|
+
|
|
120
|
+
- [web-to-pdf/SKILL.md](skills/web-to-pdf/SKILL.md) — PDF generation (Markdown beautification, templates, HTML/URL printing)
|
|
121
|
+
- [web-to-png/SKILL.md](skills/web-to-png/SKILL.md) — PNG generation (OG cards, infographics, posters, banners, screenshots)
|
|
95
122
|
|
|
96
123
|
Agents can automatically choose the appropriate commands and parameters based on natural language instructions (for example, "generate a poster" or "convert this document to PDF").
|
|
97
124
|
|
package/README.zh-CN.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
- **多种输入**:支持本地 HTML、Markdown 文件或远程 URL
|
|
10
10
|
- **丰富模板**:
|
|
11
11
|
- **PDF**: Apple 风格、GitHub 风格、杂志排版 (Magazine)
|
|
12
|
-
- **Image**: OG
|
|
12
|
+
- **Image**: 8 种预设 — OG 卡片、信息图、海报、横幅、Twitter/X 卡片、YouTube 缩略图、小红书封面、微信公众号封面
|
|
13
13
|
- **品牌一致性**:OG/海报/横幅会基于工作区的视觉与品牌资源生成(常见于 `assets/`、`public/`、`src/assets/`)
|
|
14
14
|
- **一致性保障**:确定性渲染、字体等待、网络空闲检测、代码高亮
|
|
15
15
|
|
|
@@ -86,12 +86,39 @@ pagepress shot -i https://example.com -o screenshot.png
|
|
|
86
86
|
- `infographic` (1080×1350) - 信息图
|
|
87
87
|
- `poster` (1200×1500) - 海报
|
|
88
88
|
- `banner` (1600×900) - 横幅
|
|
89
|
+
- `twitter` (1200×675) - Twitter/X 卡片
|
|
90
|
+
- `youtube` (1280×720) - YouTube 缩略图
|
|
91
|
+
- `xiaohongshu` (1080×1440) - 小红书封面
|
|
92
|
+
- `wechat` (900×383) - 微信公众号封面
|
|
93
|
+
|
|
94
|
+
## 🖼️ 示例
|
|
95
|
+
|
|
96
|
+
### 图像预设
|
|
97
|
+
|
|
98
|
+
| OG 卡片 (1200×630) | 信息图 (1080×1350) |
|
|
99
|
+
|:---:|:---:|
|
|
100
|
+
|  |  |
|
|
101
|
+
|
|
102
|
+
| 海报 (1200×1500) | 横幅 (1600×900) |
|
|
103
|
+
|:---:|:---:|
|
|
104
|
+
|  |  |
|
|
105
|
+
|
|
106
|
+
| Twitter/X 卡片 (1200×675) | YouTube 缩略图 (1280×720) |
|
|
107
|
+
|:---:|:---:|
|
|
108
|
+
|  |  |
|
|
109
|
+
|
|
110
|
+
| 小红书封面 (1080×1440) | 微信公众号封面 (900×383) |
|
|
111
|
+
|:---:|:---:|
|
|
112
|
+
|  |  |
|
|
89
113
|
|
|
90
114
|
## 🤖 AI Agent 集成
|
|
91
115
|
|
|
92
|
-
|
|
116
|
+
本项目包含两份 AI Agent 技能指南(适用于 Claude、ChatGPT 等):
|
|
117
|
+
|
|
118
|
+
- [web-to-pdf/SKILL.md](skills/web-to-pdf/SKILL.md) — PDF 生成(Markdown 美化、模板、HTML/URL 打印)
|
|
119
|
+
- [web-to-png/SKILL.md](skills/web-to-png/SKILL.md) — PNG 生成(OG 卡片、信息图、海报、横幅、网页截图)
|
|
93
120
|
|
|
94
|
-
Agent
|
|
121
|
+
Agent 可以根据用户的自然语言指令(如"生成一张海报"、"把这个文档转成 PDF")自动选择合适的命令和参数。
|
|
95
122
|
|
|
96
123
|
## 📄 License
|
|
97
124
|
|
package/dist/main.js
CHANGED
|
@@ -379,6 +379,18 @@ const imagePresets = {
|
|
|
379
379
|
width: 1280,
|
|
380
380
|
height: 720,
|
|
381
381
|
description: "YouTube Thumbnail (1280×720)"
|
|
382
|
+
},
|
|
383
|
+
xiaohongshu: {
|
|
384
|
+
name: "xiaohongshu",
|
|
385
|
+
width: 1080,
|
|
386
|
+
height: 1440,
|
|
387
|
+
description: "Xiaohongshu / RedNote Cover (1080×1440)"
|
|
388
|
+
},
|
|
389
|
+
wechat: {
|
|
390
|
+
name: "wechat",
|
|
391
|
+
width: 900,
|
|
392
|
+
height: 383,
|
|
393
|
+
description: "WeChat Official Account Cover (900×383)"
|
|
382
394
|
}
|
|
383
395
|
};
|
|
384
396
|
function getPreset(name) {
|
|
@@ -498,7 +510,7 @@ async function render(options) {
|
|
|
498
510
|
}
|
|
499
511
|
}
|
|
500
512
|
}
|
|
501
|
-
const command = new Command("shot").description("Capture HTML to PNG image").requiredOption("-i, --input <path>", "Input HTML file path or URL").requiredOption("-o, --output <path>", "Output PNG file path").option("-p, --preset <name>", "Image preset (og, infographic, poster, banner)", "og").option("--width <number>", "Custom width in pixels").option("--height <number>", "Custom height in pixels").option("--scale <number>", "Device scale factor", "2").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) => {
|
|
513
|
+
const command = new Command("shot").description("Capture HTML to PNG image").requiredOption("-i, --input <path>", "Input HTML file path or URL").requiredOption("-o, --output <path>", "Output PNG file path").option("-p, --preset <name>", "Image preset (og, infographic, poster, banner, twitter, youtube, xiaohongshu, wechat)", "og").option("--width <number>", "Custom width in pixels").option("--height <number>", "Custom height in pixels").option("--scale <number>", "Device scale factor", "2").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) => {
|
|
502
514
|
try {
|
|
503
515
|
const timeout = Number.parseInt(options.timeout, 10);
|
|
504
516
|
if (!Number.isFinite(timeout) || timeout < 0) {
|
package/package.json
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liustack/pagepress",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CLI tool to convert web pages and Markdown to PDF and images",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"pagepress": "./dist/main.js"
|
|
8
8
|
},
|
|
9
|
-
"scripts": {
|
|
10
|
-
"dev": "vite build --watch",
|
|
11
|
-
"build": "vite build",
|
|
12
|
-
"typecheck": "tsc --noEmit",
|
|
13
|
-
"prepublishOnly": "pnpm build"
|
|
14
|
-
},
|
|
15
9
|
"files": [
|
|
16
10
|
"dist",
|
|
17
11
|
"src/pdf/templates"
|
|
@@ -64,5 +58,10 @@
|
|
|
64
58
|
"typescript": "^5.9.3",
|
|
65
59
|
"vite": "^6.4.1",
|
|
66
60
|
"vite-plugin-node": "^5.0.1"
|
|
61
|
+
},
|
|
62
|
+
"scripts": {
|
|
63
|
+
"dev": "vite build --watch",
|
|
64
|
+
"build": "vite build",
|
|
65
|
+
"typecheck": "tsc --noEmit"
|
|
67
66
|
}
|
|
68
|
-
}
|
|
67
|
+
}
|