@liustack/pagepress 0.4.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 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,6 +88,10 @@ 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
91
95
 
92
96
  ## 🖼️ Examples
93
97
 
@@ -101,9 +105,20 @@ pagepress shot -i https://example.com -o screenshot.png
101
105
  |:---:|:---:|
102
106
  | ![Poster](examples/shot-poster.png) | ![Banner](examples/shot-banner.png) |
103
107
 
108
+ | Twitter/X Card (1200×675) | YouTube Thumbnail (1280×720) |
109
+ |:---:|:---:|
110
+ | ![Twitter Card](examples/shot-twitter.png) | ![YouTube Thumbnail](examples/shot-youtube.png) |
111
+
112
+ | Xiaohongshu Cover (1080×1440) | WeChat Cover (900×383) |
113
+ |:---:|:---:|
114
+ | ![Xiaohongshu Cover](examples/shot-xiaohongshu.png) | ![WeChat Cover](examples/shot-wechat.png) |
115
+
104
116
  ## 🤖 AI Agent Integration
105
117
 
106
- This project includes a detailed [SKILL.md](skills/pagepress/SKILL.md) to help AI Agents (such as Claude, ChatGPT) understand how to use this tool.
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)
107
122
 
108
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").
109
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,6 +86,10 @@ 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) - 微信公众号封面
89
93
 
90
94
  ## 🖼️ 示例
91
95
 
@@ -99,11 +103,22 @@ pagepress shot -i https://example.com -o screenshot.png
99
103
  |:---:|:---:|
100
104
  | ![海报](examples/shot-poster.png) | ![横幅](examples/shot-banner.png) |
101
105
 
106
+ | Twitter/X 卡片 (1200×675) | YouTube 缩略图 (1280×720) |
107
+ |:---:|:---:|
108
+ | ![Twitter 卡片](examples/shot-twitter.png) | ![YouTube 缩略图](examples/shot-youtube.png) |
109
+
110
+ | 小红书封面 (1080×1440) | 微信公众号封面 (900×383) |
111
+ |:---:|:---:|
112
+ | ![小红书封面](examples/shot-xiaohongshu.png) | ![微信公众号封面](examples/shot-wechat.png) |
113
+
102
114
  ## 🤖 AI Agent 集成
103
115
 
104
- 本项目包含详细的 [SKILL.md](skills/pagepress/SKILL.md),旨在帮助 AI Agent(如 Claude, ChatGPT)理解如何使用此工具。
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 卡片、信息图、海报、横幅、网页截图)
105
120
 
106
- Agent 可以根据用户的自然语言指令(如“生成一张海报”、“把这个文档转成 PDF”)自动选择合适的命令和参数。
121
+ Agent 可以根据用户的自然语言指令(如"生成一张海报"、"把这个文档转成 PDF")自动选择合适的命令和参数。
107
122
 
108
123
  ## 📄 License
109
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@liustack/pagepress",
3
- "version": "0.4.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": {