← 返回 Skills 市场
Html2pptx Complete
作者
IIustrator
· GitHub ↗
· v1.0.0
· MIT-0
63
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install html2pptx-complete
功能描述
HTML 转 PPTX 完整工作流 — 自动内嵌外部 CSS,使用 pptxgenjs 解析 HTML 结构,生成可编辑 PPTX,保留文字、布局、样式
使用说明 (SKILL.md)
html2pptx-complete — HTML 转 PPTX 完整工作流
三步流程
HTML (带外部 CSS)
↓ [步骤 1: CSS 内嵌]
HTML (内嵌 CSS)
↓ [步骤 2: pptxgenjs 解析]
PPTX (可编辑)
↓ [步骤 3: 导出]
最终文件
快速开始
安装依赖
cd /Users/panda/.openclaw/workspace/skills/html2pptx-complete
# Python 依赖(CSS 内嵌)
pip3 install -r requirements-python.txt
# Node.js 依赖(PPTX 生成)
npm install
基本使用
# 一键转换
node scripts/convert.js input.html output.pptx
# 或分步执行
# 步骤 1: CSS 内嵌
python3 scripts/embed-css.py input.html embedded.html
# 步骤 2: PPTX 生成
node scripts/generate-pptx.js embedded.html output.pptx
步骤 1: CSS 内嵌
功能
- 🔍 查找所有
\x3Clink rel="stylesheet">标签 - 📄 读取 CSS 文件内容
- 🔗 替换为
\x3Cstyle>CSS 内容\x3C/style> - 🗑️ 移除外部 CSS 引用
- ✅ 保证 HTML 可独立运行
支持的 CSS
| 类型 | 支持度 | 说明 |
|---|---|---|
| 本地相对路径 | ✅ | href="style.css" |
| 本地绝对路径 | ✅ | href="/path/to/style.css" |
| 远程 URL | ⚠️ 跳过 | href="https://..." |
| CSS 变量 | ✅ | 完整解析 |
| 渐变/动画 | ✅ | 保留原始代码 |
示例
转换前:
\x3Chead>
\x3Clink rel="stylesheet" href="style.css">
\x3Clink rel="stylesheet" href="theme.css">
\x3C/head>
转换后:
\x3Chead>
\x3Cstyle>
/* style.css 内容 */
/* theme.css 内容 */
\x3C/style>
\x3C/head>
步骤 2: pptxgenjs 解析
解析规则
| HTML 结构 | PPTX 映射 | 说明 |
|---|---|---|
section.slide |
新幻灯片 | 每张 slide 一页 |
\x3Ch1> |
标题文本框 | 幻灯片标题 |
\x3Ch2>-\x3Ch6> |
小标题 | 层级递减字号 |
\x3Cp> |
正文文本框 | 保留段落 |
\x3Cul>, \x3Col> |
列表 | 保留项目符号 |
\x3Cimg> |
图片 | 支持路径/URL/Base64 |
\x3Cdiv> |
容器/文本框 | 根据内容判断 |
| CSS 样式 | PPTX 属性 | 颜色/字体/大小/对齐 |
样式转换
| CSS 属性 | PPTX 映射 | 支持度 |
|---|---|---|
color |
文字颜色 | ✅ |
background-color |
填充色 | ✅ |
font-size |
字号 | ✅ px→pt |
font-weight: bold |
粗体 | ✅ |
font-style: italic |
斜体 | ✅ |
text-align |
对齐方式 | ✅ |
border |
边框 | ⚠️ 简化 |
border-radius |
圆角 | ⚠️ 部分 |
box-shadow |
阴影 | ❌ |
linear-gradient |
渐变填充 | ⚠️ 简化 |
分页规则
优先级:
section.slide结构(最高优先级)\x3Ch1>标题(备选方案)- 整个文档作为单页(无上述结构时)
步骤 3: 导出
输出格式
| 属性 | 值 |
|---|---|
| 格式 | PPTX (Office Open XML) |
| 比例 | 16:9 宽屏 |
| 可编辑性 | ✅ 文字/形状可编辑 |
| 文件大小 | 50-200KB(取决于内容) |
兼容性
- ✅ PowerPoint 2010+
- ✅ Keynote
- ✅ Google Slides
- ✅ LibreOffice Impress
使用示例
示例 1: html-ppt 生成的 HTML
# 输入:html-ppt 生成的多页 HTML
node scripts/convert.js my-deck/index.html my-deck.pptx
# 输出:包含所有 slide 的 PPTX
示例 2: 带外部 CSS 的 HTML
# 输入:引用多个 CSS 文件的 HTML
node scripts/convert.js presentation.html presentation.pptx
# 自动:
# 1. 嵌入 style.css, theme.css
# 2. 解析 slide 结构
# 3. 生成可编辑 PPTX
示例 3: 单页 HTML 文档
# 输入:普通 HTML 文档
node scripts/convert.js document.html document.pptx
# 输出:按 h1 标题分页的 PPTX
核心脚本
scripts/embed-css.py (步骤 1)
#!/usr/bin/env python3
"""CSS 内嵌脚本"""
import re
from pathlib import Path
from bs4 import BeautifulSoup
def embed_css(html_path, output_path=None):
# 读取 HTML
# 查找 \x3Clink> 标签
# 读取 CSS 文件
# 替换为 \x3Cstyle>
# 保存
pass
scripts/generate-pptx.js (步骤 2-3)
#!/usr/bin/env node
/**
* PPTX 生成脚本
* 使用 pptxgenjs 解析 HTML 并生成 PPTX
*/
const PptxGenJS = require('pptxgenjs');
const cheerio = require('cheerio');
async function generate(htmlPath, outputPath) {
// 读取 HTML
// 解析 slide 结构
// 应用 CSS 样式
// 创建 PPTX
// 导出文件
}
scripts/convert.js (一键执行)
#!/usr/bin/env node
/**
* 完整工作流脚本
* 步骤 1: CSS 内嵌 (Python)
* 步骤 2: PPTX 生成 (Node.js)
* 步骤 3: 导出文件
*/
async function convert(htmlPath, outputPath) {
// 调用 embed-css.py
// 调用 generate-pptx.js
// 清理临时文件
}
文件结构
html2pptx-complete/
├── SKILL.md (本文档)
├── README.md (快速入门)
├── package.json (Node.js 依赖)
├── requirements-python.txt (Python 依赖)
├── scripts/
│ ├── convert.js (一键转换)
│ ├── embed-css.py (CSS 内嵌)
│ └── generate-pptx.js (PPTX 生成)
├── refs/
│ └── pptxgenjs-mapping.md (样式映射表)
└── examples/
├── demo.html (示例 HTML)
├── demo.css (示例 CSS)
└── demo_converted.pptx (输出示例)
与现有技能对比
| 特性 | html2pptx-complete | html2pptx-shape |
|---|---|---|
| CSS 内嵌 | ✅ 自动 | ✅ 自动 |
| 核心库 | pptxgenjs (JS) | python-pptx |
| 环境 | Node.js + Python | Python |
| 样式保留 | ⚠️ 基础 + 部分 CSS | ✅ 完整 CSS |
| 布局还原 | ⚠️ 简化 | ✅ 精确 |
| 分页规则 | section.slide / h1 | section.slide |
| 适用场景 | 通用 HTML | html-ppt 生成 |
适用场景
✅ 推荐
- 📄 html-ppt 生成的 HTML 转 PPTX
- 📊 带外部 CSS 的 HTML 文档
- 📝 需要快速转换的通用 HTML
- 🎨 对样式要求不极端的场景
⚠️ 不推荐
- 🖼️ 复杂渐变/阴影效果(用 html-to-pptx 截图版)
- 🎭 精确像素级还原(用 html2pptx-shape)
- 📐 CSS Grid/Flex 复杂布局(可能简化)
依赖安装
# Python 依赖
pip3 install beautifulsoup4 cssutils requests
# Node.js 依赖
npm install pptxgenjs cheerio
常见问题
Q1: CSS 文件找不到?
检查:
- 路径是否正确(相对/绝对)
- 文件是否存在
- 权限是否允许读取
解决:
- 使用绝对路径
- 或将 CSS 文件放到 HTML 同目录
Q2: 样式丢失?
原因:
- pptxgenjs 不支持某些 CSS 属性
- 复杂选择器未解析
解决:
- 使用内联样式
style="..." - 或简化 CSS 选择器
Q3: 图片无法显示?
检查:
- 图片路径是否正确
- 网络 URL 是否可访问
- Base64 格式是否正确
更新日志
v1.0.0 (2026-04-17)
- ✅ 初始版本
- ✅ CSS 自动内嵌
- ✅ pptxgenjs 解析
- ✅ section.slide/h1 分页
- ✅ 基础样式映射
License
MIT
Author
老 6 🎯
安全使用建议
This skill appears to do exactly what it claims: embed local CSS and convert HTML to editable PPTX using local Python and Node scripts. Things to consider before installing: (1) it will install npm and pip packages—review those packages if you require vetted dependencies; (2) scripts run child processes and read/write files in the directories you provide—run in a directory you control and avoid passing sensitive-system HTML; (3) remote image URLs in <img src> may be fetched/embedded by pptxgenjs—if that is a concern, ensure images are local or sanitize the HTML first; (4) test in an isolated environment if you want extra caution.
功能分析
Type: OpenClaw Skill
Name: html2pptx-complete
Version: 1.0.0
The skill bundle contains significant security vulnerabilities that could be exploited, although no clear evidence of intentional malice was found. Specifically, `scripts/convert.js` uses `execSync` to execute shell commands with arguments derived from input paths, which poses a shell injection risk if filenames are not strictly controlled. Furthermore, `scripts/embed-css.py` resolves and reads local files based on `<link>` tags in the input HTML without path sanitization, enabling an arbitrary local file read (LFI) vulnerability. These flaws allow a user to potentially execute unauthorized commands or exfiltrate sensitive local files by providing a specially crafted HTML file.
能力评估
Purpose & Capability
Name/description match the code and SKILL.md: scripts embed local CSS, parse HTML with cheerio/pptxgenjs and emit PPTX. Declared Python/Node deps align with package.json and requirements-python.txt.
Instruction Scope
Runtime instructions and scripts operate on local files (HTML, CSS, images) as expected. The embed-css step explicitly skips remote CSS; the generator will include images referenced by <img src>, which may be local paths or remote URLs (pptxgenjs can embed images from URLs). The workflow invokes local Python and Node scripts via execSync—expected for a multi-language tool, but worth noting because it runs child processes and reads/writes files in the caller's filesystem.
Install Mechanism
There is no remote download/install spec in the skill bundle. Dependencies are standard pip and npm packages (beautifulsoup4, cssutils, requests, pptxgenjs, cheerio) declared in SKILL.md, requirements and package.json—no obscure external URLs or archive extracts.
Credentials
The skill declares no required environment variables, and the code does not read credentials or unrelated environment/config paths. Filesystem access is limited to input HTML/CSS/images and writing generated PPTX/temporary files, which is proportional to the conversion task.
Persistence & Privilege
The skill does not request always:true and does not modify other skills or global agent configuration. It runs as-invoked and cleans up its temporary file when possible.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install html2pptx-complete - 安装完成后,直接呼叫该 Skill 的名称或使用
/html2pptx-complete触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
html2pptx-complete v1.0.0
- 首发版本,提供 HTML 到 PPTX 的完整转换流程
- 自动内嵌外部 CSS 文件,支持基础与部分复杂样式
- 基于 pptxgenjs 解析 HTML 结构并生成可编辑 PPTX 文件
- 支持 section.slide/h1 分页规则
- 保留常见文本、标题、列表、图片等结构及样式属性
元数据
常见问题
Html2pptx Complete 是什么?
HTML 转 PPTX 完整工作流 — 自动内嵌外部 CSS,使用 pptxgenjs 解析 HTML 结构,生成可编辑 PPTX,保留文字、布局、样式. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 63 次。
如何安装 Html2pptx Complete?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install html2pptx-complete」即可一键安装,无需额外配置。
Html2pptx Complete 是免费的吗?
是的,Html2pptx Complete 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Html2pptx Complete 支持哪些平台?
Html2pptx Complete 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Html2pptx Complete?
由 IIustrator(@iiustrator)开发并维护,当前版本 v1.0.0。
推荐 Skills