kai-html-export
Export any HTML file to PPTX or PNG using a headless browser, or publish it to a public URL. PPTX and PNG export need no Node.js; the optional share helper uses Cloudflare Pages by default and Vercel as a fallback. In hosted cloud sandboxes, automatic sharing is disabled and the helper prints manual-share guidance instead of starting a deploy flow.
Commands
| Command | What it does |
|---|
| INLINECODE0 | Export HTML presentation to PPTX (auto-detects slides) |
| INLINECODE1 |
Explicit PPTX export |
|
/kai-html-export --png [file.html] | Full-page screenshot to PNG |
|
/kai-html-export --png --scale 2 [file.html] | 2× resolution screenshot |
|
python3 <skill-path>/scripts/share-html.py [file.html|folder] | Publish HTML to a public URL (Cloudflare default) |
|
python3 <skill-path>/scripts/share-html.py --provider vercel [file.html|folder] | Publish HTML to a public URL with Vercel |
If no file is specified, use the most recently modified .html file in the current directory.
Export to PPTX
Run the bundled script:
CODEBLOCK0
Export Modes
--mode image (default):
- - Pixel-perfect screenshots of each slide
- Visual fidelity: ⭐⭐⭐⭐⭐
- Editability: ❌ None (text is rasterized)
- Best for: archiving, sharing final presentations
--mode native (new):
- - Editable text, shapes, and tables
- Visual fidelity: ⭐⭐⭐ (simplified gradients, no shadows)
- Editability: ✅ Full text editing
- Best for: collaborative editing, content reuse
Supported in native mode:
- - Text (h1-h6, p): font size, color, bold, alignment
- Lists (ul, ol): bullet points
- Tables: editable cells
- Shapes (div with solid background): rectangles
- Images: native insertion
Not supported in native mode (fall back to image):
- - CSS gradients → solid color approximation
- Box shadows → omitted
- Custom web fonts → system fonts
- SVG graphics → rasterize to PNG
Export to PNG
Run the bundled script:
CODEBLOCK1
- - Captures the full page at the specified width
- INLINECODE9 produces a 2× retina-quality image
- Useful for sharing reports or single-page HTML as images
Share HTML to a public URL
Run the bundled helper:
CODEBLOCK2
- - Accepts either a single HTML file or a folder containing INLINECODE10
- Copies common relative assets automatically when starting from a single file
- Uses Cloudflare Pages by default and keeps Vercel as an optional fallback
- Cloudflare is the recommended default for China-facing links
- Automatic sharing is disabled in hosted cloud sandboxes; the helper tells the user to share manually from a local machine instead
- Cloudflare requires
wrangler login before first local use - Vercel requires
npx vercel login before first local use
Dependencies
| Package | Purpose | Install |
|---|
| INLINECODE13 | Headless browser screenshots | INLINECODE14 |
| INLINECODE15 |
Assemble screenshots into PPTX |
pip install python-pptx |
| Node.js + Wrangler / Vercel CLI | Optional live URL publishing |
wrangler login or
npx vercel login |
No browser download needed if Chrome, Edge, or Brave is already installed. URL publishing is optional and separate from export.
QA Process
After every native-mode export, assume something looks wrong until proven otherwise:
- 1. Preview grid — the export automatically saves
{name}-preview.png with thumbnails of slide 1, ~1/3, ~2/3, and last. Open it immediately: INLINECODE20 - Structural check — if slide count mismatches or any slide is unreadable, the script prints
⚠ warnings - Open PPTX — for image issues or layout problems, open the PPTX in Keynote/PowerPoint to verify the render
- Re-export — if visual quality is wrong, diagnose the root cause in the HTML before re-running
Works with any HTML
Designed to work with output from:
- - kai-slide-creator — HTML presentations with
.slide elements - kai-report-creator — Single-page HTML reports
- Any self-contained HTML file
kai-html-export
使用无头浏览器将任意HTML文件导出为PPTX或PNG,或将其发布到公开URL。PPTX和PNG导出无需Node.js;可选的分享助手默认使用Cloudflare Pages,并以Vercel作为备用方案。在托管的云沙箱环境中,自动分享功能被禁用,助手会打印手动分享指引,而非启动部署流程。
命令
| 命令 | 功能 |
|---|
| /kai-html-export [file.html] | 将HTML演示文稿导出为PPTX(自动检测幻灯片) |
| /kai-html-export --pptx [file.html] |
显式导出为PPTX |
| /kai-html-export --png [file.html] | 全页截图导出为PNG |
| /kai-html-export --png --scale 2 [file.html] | 2倍分辨率截图 |
| python3
/scripts/share-html.py [file.html|folder] | 将HTML发布到公开URL(默认使用Cloudflare) |
| python3 /scripts/share-html.py --provider vercel [file.html|folder] | 使用Vercel将HTML发布到公开URL |
如果未指定文件,则使用当前目录中最近修改的.html文件。
导出为PPTX
运行捆绑脚本:
bash
python3 /scripts/export-pptx.py [output.pptx] [--mode image|native] [--width 1440] [--height 900]
导出模式
--mode image(默认):
- - 每张幻灯片的像素级完美截图
- 视觉保真度:⭐⭐⭐⭐⭐
- 可编辑性:❌ 无(文本被栅格化)
- 最佳用途:存档、分享最终演示文稿
--mode native(新增):
- - 可编辑的文本、形状和表格
- 视觉保真度:⭐⭐⭐(简化渐变,无阴影)
- 可编辑性:✅ 完全文本编辑
- 最佳用途:协作编辑、内容复用
原生模式支持:
- - 文本(h1-h6, p):字号、颜色、加粗、对齐
- 列表(ul, ol):项目符号
- 表格:可编辑单元格
- 形状(带纯色背景的div):矩形
- 图片:原生插入
原生模式不支持(回退为图片):
- - CSS渐变 → 近似纯色
- 盒阴影 → 省略
- 自定义网页字体 → 系统字体
- SVG图形 → 栅格化为PNG
导出为PNG
运行捆绑脚本:
bash
python3 /scripts/screenshot.py [output.png] [--width 1440] [--scale 2]
- - 按指定宽度捕获全页
- --scale 2 生成2倍视网膜质量图片
- 适用于将报告或单页HTML作为图片分享
将HTML分享到公开URL
运行捆绑助手:
bash
python3 /scripts/share-html.py
python3 /scripts/share-html.py --provider vercel
- - 接受单个HTML文件或包含index.html的文件夹
- 从单个文件开始时自动复制常见的相对资源
- 默认使用Cloudflare Pages,并将Vercel作为可选备用方案
- Cloudflare是面向中国链接的推荐默认选项
- 在托管的云沙箱环境中禁用自动分享;助手会告知用户改为从本地机器手动分享
- Cloudflare首次本地使用前需要运行wrangler login
- Vercel首次本地使用前需要运行npx vercel login
依赖项
| 包 | 用途 | 安装 |
|---|
| playwright | 无头浏览器截图 | pip install playwright |
| python-pptx |
将截图组装为PPTX | pip install python-pptx |
| Node.js + Wrangler / Vercel CLI | 可选的实时URL发布 | wrangler login 或 npx vercel login |
如果已安装Chrome、Edge或Brave,则无需下载浏览器。URL发布是可选的,与导出功能分离。
QA流程
每次原生模式导出后,默认假设存在问题,直到验证无误:
- 1. 预览网格 — 导出会自动保存包含第1张、约1/3处、约2/3处和最后一张幻灯片缩略图的{name}-preview.png。立即打开:open {name}-preview.png
- 结构检查 — 如果幻灯片数量不匹配或任何幻灯片无法读取,脚本会打印⚠警告
- 打开PPTX — 对于图片问题或布局问题,在Keynote/PowerPoint中打开PPTX以验证渲染效果
- 重新导出 — 如果视觉质量有问题,在重新运行前先在HTML中诊断根本原因
适用于任何HTML
设计用于处理以下工具的输出:
- - kai-slide-creator — 包含.slide元素的HTML演示文稿
- kai-report-creator — 单页HTML报告
- 任何自包含的HTML文件