0f8a797b7ada11091d4e5e6b09f74f4495b8da3a
- extractRuns(): recursive DOM walker to extract inline formatting (bold, italic, color, fontSize, fontFamily) from strong/em/span - Element data now includes 'runs' array alongside flat text - PPTX generation: rich text uses pptxgenjs run array format, plain text keeps original single-style logic - Added bounds constraints to prevent textbox overflow - Verified: 14 slides from dashi-deck, 10 from simple, 54 rich text elements detected Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
html2pptx
HTML to editable PPTX export engine.
将 HTML 演示文稿导出为文字可编辑、布局可还原的 PPTX 文件。
原理
HTML 文件 → HTTP 服务 → Chrome headless 渲染 → DOM 遍历提取位置/样式 → pptxgenjs 生成 PPTX
依赖
- Node.js 18+
- Chrome / Chromium / Edge(用于渲染页面)
使用
# 安装
npm install
# 导出
node bin/html2pptx input.html output.pptx
核心依赖
| 包 | 用途 |
|---|---|
| playwright | 控制 Chrome headless 渲染页面 |
| pptxgenjs | 生成 PPTX 文件 |
| http-server | 本地静态文件服务(可选) |
License
MIT
Languages
JavaScript
93.6%
CSS
3.4%
HTML
3%