pptx by sickn33/antigravity-awesome-skills
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill pptx用户可能会要求您创建、编辑或分析 .pptx 文件的内容。.pptx 文件本质上是一个包含 XML 文件和其他资源的 ZIP 归档文件,您可以读取或编辑这些内容。针对不同的任务,您可以使用不同的工具和工作流程。
如果只需要读取演示文稿的文本内容,应将文档转换为 markdown 格式:
# 将文档转换为 markdown
python -m markitdown path-to-file.pptx
对于以下功能,您需要原始 XML 访问权限:注释、演讲者备注、幻灯片版式、动画、设计元素和复杂格式。对于任何这些功能,您都需要解包演示文稿并读取其原始 XML 内容。
python ooxml/scripts/unpack.py <office_file> <output_dir>
注意:unpack.py 脚本位于项目根目录的相对路径 skills/pptx/ooxml/scripts/unpack.py。如果此路径下不存在该脚本,请使用 find . -name "unpack.py" 来定位它。
ppt/presentation.xml - 主演示文稿元数据和幻灯片引用广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
ppt/slides/slide{N}.xml - 单个幻灯片内容(slide1.xml、slide2.xml 等)ppt/notesSlides/notesSlide{N}.xml - 每张幻灯片的演讲者备注ppt/comments/modernComment_*.xml - 特定幻灯片的评论ppt/slideLayouts/ - 幻灯片版式模板ppt/slideMasters/ - 母版幻灯片模板ppt/theme/ - 主题和样式信息ppt/media/ - 图像和其他媒体文件当需要模仿示例设计时:始终首先使用以下方法分析演示文稿的字体和颜色:
ppt/theme/theme1.xml 中的颜色 (<a:clrScheme>) 和字体 (<a:fontScheme>)ppt/slides/slide1.xml 中的实际字体使用 (<a:rPr>) 和颜色<a:solidFill>, <a:srgbClr>) 和字体引用从头开始创建新的 PowerPoint 演示文稿时,请使用 html2pptx 工作流程,将 HTML 幻灯片转换为具有精确定位的 PowerPoint。
关键:在创建任何演示文稿之前,请分析内容并选择合适的设计元素:
要求:
创造性地选择颜色:
示例调色板(使用这些来激发创造力——选择一个、调整它或创建您自己的):
几何图案:
边框与框架处理:
字体处理:
图表与数据样式:
布局创新:
背景处理:
创建包含图表或表格的幻灯片时:
html2pptx.md。阅读此文件时切勿设置任何范围限制。 在继续创建演示文稿之前,请阅读完整的文件内容以了解详细语法、关键格式规则和最佳实践。<p>、<h1>-<h6>、<ul>、<ol>class="placeholder"(渲染为灰色背景以便查看)html2pptx.js 库创建并运行一个 JavaScript 文件,将 HTML 幻灯片转换为 PowerPoint 并保存演示文稿
html2pptx() 函数处理每个 HTML 文件pptx.writeFile() 保存演示文稿python scripts/thumbnail.py output.pptx workspace/thumbnails --cols 4当编辑现有 PowerPoint 演示文稿中的幻灯片时,您需要使用原始的 Office Open XML (OOXML) 格式。这涉及解包 .pptx 文件、编辑 XML 内容并重新打包。
ooxml.md(约 500 行)。阅读此文件时切勿设置任何范围限制。 在任何演示文稿编辑之前,请阅读完整的文件内容以获取有关 OOXML 结构和编辑工作流程的详细指导。python ooxml/scripts/unpack.py <office_file> <output_dir>ppt/slides/slide{N}.xml 和相关文件)python ooxml/scripts/validate.py <dir> --original <file>python ooxml/scripts/pack.py <input_directory> <office_file>当您需要创建一个遵循现有模板设计的演示文稿时,您需要先复制并重新排列模板幻灯片,然后替换占位符内容。
提取模板文本并创建视觉缩略图网格:
python -m markitdown template.pptx > template-content.mdtemplate-content.md:完整阅读该文件以了解模板演示文稿的内容。阅读此文件时切勿设置任何范围限制。python scripts/thumbnail.py template.pptx分析模板并将清单保存到文件:
视觉分析:查看缩略图网格以了解幻灯片布局、设计模式和视觉结构
在 template-inventory.md 创建并保存一个模板清单文件,包含:
总幻灯片数:[count] 重要提示:幻灯片索引从 0 开始(第一张幻灯片 = 0,最后一张幻灯片 = count-1)
使用缩略图网格:参考视觉缩略图来识别:
此清单文件是下一步选择合适模板的必需文件
基于模板清单创建演示文稿大纲:
查看步骤 2 中的可用模板。
为第一张幻灯片选择一个介绍或标题模板。这应该是首批模板之一。
为其他幻灯片选择安全的、基于文本的布局。
关键:使布局结构与实际内容匹配:
在选择布局之前,计算您实际的内容片段数量
验证所选布局中的每个占位符都将填充有意义的内容
为每个内容部分选择代表最佳布局的一个选项。
保存 outline.md,其中包含利用可用设计的内容和模板映射
示例模板映射:
template_mapping = [ 0, # 使用幻灯片 0(标题/封面) 34, # 使用幻灯片 34(B1:标题和正文) 34, # 再次使用幻灯片 34(为第二个 B1 复制) 50, # 使用幻灯片 50(E1:引用) 54, # 使用幻灯片 54(F2:结束语 + 文本) ]
使用 rearrange.py 复制、重新排序和删除幻灯片:
使用 scripts/rearrange.py 脚本创建一个具有所需顺序幻灯片的新演示文稿:
python scripts/rearrange.py template.pptx working.pptx 0,34,34,50,52
该脚本自动处理重复幻灯片的复制、未使用幻灯片的删除和重新排序
幻灯片索引从 0 开始(第一张幻灯片是 0,第二张是 1,依此类推)
同一幻灯片索引可以出现多次以复制该幻灯片
使用 inventory.py 脚本提取所有文本:
运行清单提取:
python scripts/inventory.py working.pptx text-inventory.json
读取 text-inventory.json:完整阅读 text-inventory.json 文件以了解所有形状及其属性。阅读此文件时切勿设置任何范围限制。
清单 JSON 结构:
{ "slide-0": { "shape-0": { "placeholder_type": "TITLE", // 或 null 表示非占位符 "left": 1.5, // 位置(英寸) "top": 2.0, "width": 7.5, "height": 1.2, "paragraphs": [ { "text": "Paragraph text", // 可选属性(仅当非默认值时包含): "bullet": true, // 检测到显式项目符号 "level": 0, // 仅当 bullet 为 true 时包含 "alignment": "CENTER", // CENTER, RIGHT(非 LEFT) "space_before": 10.0, // 段落前间距(点) "space_after": 6.0, // 段落后间距(点) "line_spacing": 22.4, // 行间距(点) "font_name": "Arial", // 来自第一个运行 "font_size": 14.0, // 点 "bold": true, "italic": false, "underline": false, "color": "FF0000" // RGB 颜色 } ] } } }
关键特性:
default_font_size(点)(如果可用)基于上一步的文本清单,生成替换文本并将数据保存到 JSON 文件:
"bullet": true 时,不要设置 alignment 属性"bold": true"bullet": true, "level": 0(当 bullet 为 true 时,level 是必需的)显示正确格式的示例 paragraphs 字段:
"paragraphs": [
{
"text": "New presentation title text",
"alignment": "CENTER",
"bold": true
},
{
"text": "Section Header",
"bold": true
},
{
"text": "First bullet point without bullet symbol",
"bullet": true,
"level": 0
},
{
"text": "Red colored text",
"color": "FF0000"
},
{
"text": "Theme colored text",
"theme_color": "DARK_1"
},
{
"text": "Regular paragraph text without special formatting"
}
]
未在替换 JSON 中列出的形状会自动被清除:
{
"slide-0": {
"shape-0": {
"paragraphs": [...] // 此形状获得新文本
}
// 清单中的 shape-1 和 shape-2 将自动被清除
}
}
演示文稿的常见格式模式:
"bullet": true, "level": 0使用 replace.py 脚本应用替换
python scripts/replace.py working.pptx replacement-text.json output.pptx
该脚本将:
示例验证错误:
ERROR: Invalid shapes in replacement JSON:
- Shape 'shape-99' not found on 'slide-0'. Available shapes: shape-0, shape-1, shape-4
- Slide 'slide-999' not found in inventory
ERROR: Replacement text made overflow worse in these shapes:
- slide-0/shape-2: overflow worsened by 1.25" (was 0.00", now 1.25")
要为 PowerPoint 幻灯片创建视觉缩略图网格以便快速分析和参考:
python scripts/thumbnail.py template.pptx [output_prefix]
特性:
thumbnails.jpg(或用于大型演示文稿的 thumbnails-1.jpg、thumbnails-2.jpg 等)python scripts/thumbnail.py template.pptx my-grid
workspace/my-grid)--cols 4(范围:3-6,影响每网格幻灯片数)使用场景:
示例:
# 基本用法
python scripts/thumbnail.py presentation.pptx
# 组合选项:自定义名称、列数
python scripts/thumbnail.py template.pptx analysis --cols 4
为了视觉分析 PowerPoint 幻灯片,使用两步过程将其转换为图像:
将 PPTX 转换为 PDF:
soffice --headless --convert-to pdf template.pptx
将 PDF 页面转换为 JPEG 图像:
pdftoppm -jpeg -r 150 template.pdf slide
这将创建像 slide-1.jpg、slide-2.jpg 等文件。
选项:
-r 150:设置分辨率为 150 DPI(根据质量/大小平衡进行调整)-jpeg:输出 JPEG 格式(如果喜欢 PNG,请使用 -png)-f N:要转换的起始页(例如,-f 2 从第 2 页开始)-l N:要转换的结束页(例如,-l 5 在第 5 页停止)slide:输出文件的前缀特定范围的示例:
pdftoppm -jpeg -r 150 -f 2 -l 5 template.pdf slide # 仅转换第 2-5 页
重要:为 PPTX 操作生成代码时:
必需的依赖项(应该已经安装):
pip install "markitdown[pptx]"(用于从演示文稿中提取文本)npm install -g pptxgenjs(用于通过 html2pptx 创建演示文稿)npm install -g playwright(用于 html2pptx 中的 HTML 渲染)npm install -g react-icons react react-dom(用于图标)npm install -g sharp(用于 SVG 栅格化和图像处理)sudo apt-get install libreoffice(用于 PDF 转换)sudo apt-get install poppler-utils(用于 pdftoppm 将 PDF 转换为图像)pip install defusedxml(用于安全 XML 解析)每周安装次数
273
仓库
GitHub Stars
27.4K
首次出现
Jan 19, 2026
安全审计
安装于
claude-code217
opencode212
gemini-cli202
antigravity177
codex166
cursor145
A user may ask you to create, edit, or analyze the contents of a .pptx file. A .pptx file is essentially a ZIP archive containing XML files and other resources that you can read or edit. You have different tools and workflows available for different tasks.
If you just need to read the text contents of a presentation, you should convert the document to markdown:
# Convert document to markdown
python -m markitdown path-to-file.pptx
You need raw XML access for: comments, speaker notes, slide layouts, animations, design elements, and complex formatting. For any of these features, you'll need to unpack a presentation and read its raw XML contents.
python ooxml/scripts/unpack.py <office_file> <output_dir>
Note : The unpack.py script is located at skills/pptx/ooxml/scripts/unpack.py relative to the project root. If the script doesn't exist at this path, use find . -name "unpack.py" to locate it.
ppt/presentation.xml - Main presentation metadata and slide referencesppt/slides/slide{N}.xml - Individual slide contents (slide1.xml, slide2.xml, etc.)ppt/notesSlides/notesSlide{N}.xml - Speaker notes for each slideppt/comments/modernComment_*.xml - Comments for specific slidesppt/slideLayouts/ - Layout templates for slidesppt/slideMasters/ - Master slide templatesppt/theme/ - Theme and styling informationppt/media/ - Images and other media filesWhen given an example design to emulate : Always analyze the presentation's typography and colors first using the methods below:
ppt/theme/theme1.xml for colors (<a:clrScheme>) and fonts (<a:fontScheme>)ppt/slides/slide1.xml for actual font usage (<a:rPr>) and colors<a:solidFill>, <a:srgbClr>) and font references across all XML filesWhen creating a new PowerPoint presentation from scratch, use the html2pptx workflow to convert HTML slides to PowerPoint with accurate positioning.
CRITICAL : Before creating any presentation, analyze the content and choose appropriate design elements:
Requirements :
Choosing colors creatively :
Example color palettes (use these to spark creativity - choose one, adapt it, or create your own):
Geometric Patterns :
Border & Frame Treatments:
Typography Treatments :
Chart & Data Styling:
Layout Innovations :
Background Treatments :
When creating slides with charts or tables:
html2pptx.md completely from start to finish. NEVER set any range limits when reading this file. Read the full file content for detailed syntax, critical formatting rules, and best practices before proceeding with presentation creation.<p>, <h1>-<h6>, <ul>, <ol> for all text contentclass="placeholder" for areas where charts/tables will be added (render with gray background for visibility)When edit slides in an existing PowerPoint presentation, you need to work with the raw Office Open XML (OOXML) format. This involves unpacking the .pptx file, editing the XML content, and repacking it.
ooxml.md (~500 lines) completely from start to finish. NEVER set any range limits when reading this file. Read the full file content for detailed guidance on OOXML structure and editing workflows before any presentation editing.python ooxml/scripts/unpack.py <office_file> <output_dir>ppt/slides/slide{N}.xml and related files)python ooxml/scripts/validate.py <dir> --original <file>python ooxml/scripts/pack.py <input_directory> <office_file>When you need to create a presentation that follows an existing template's design, you'll need to duplicate and re-arrange template slides before then replacing placeholder context.
Extract template text AND create visual thumbnail grid :
python -m markitdown template.pptx > template-content.mdtemplate-content.md: Read the entire file to understand the contents of the template presentation. NEVER set any range limits when reading this file.python scripts/thumbnail.py template.pptxAnalyze template and save inventory to a file :
Visual Analysis : Review thumbnail grid(s) to understand slide layouts, design patterns, and visual structure
Create and save a template inventory file at template-inventory.md containing:
# Template Inventory Analysis
**Total Slides: [count]**
**IMPORTANT: Slides are 0-indexed (first slide = 0, last slide = count-1)**
## [Category Name]
- Slide 0: [Layout code if available] - Description/purpose
- Slide 1: [Layout code] - Description/purpose
- Slide 2: [Layout code] - Description/purpose
[... EVERY slide must be listed individually with its index ...]
Example paragraphs field showing proper formatting:
"paragraphs": [
{
"text": "New presentation title text",
"alignment": "CENTER",
"bold": true
},
{
"text": "Section Header",
"bold": true
},
{
"text": "First bullet point without bullet symbol",
"bullet": true,
"level": 0
},
{
"text": "Red colored text",
"color": "FF0000"
},
{
"text": "Theme colored text",
"theme_color": "DARK_1"
},
{
"text": "Regular paragraph text without special formatting"
}
]
Shapes not listed in the replacement JSON are automatically cleared :
{
"slide-0": {
"shape-0": {
"paragraphs": [...] // This shape gets new text
}
// shape-1 and shape-2 from inventory will be cleared automatically
}
}
Common formatting patterns for presentations :
* Title slides: Bold text, sometimes centered
* Section headers within slides: Bold text
* Bullet lists: Each item needs `"bullet": true, "level": 0`
* Body text: Usually no special properties needed
* Quotes: May have special alignment or font properties
7. Apply replacements using thereplace.py script
python scripts/replace.py working.pptx replacement-text.json output.pptx
The script will:
* First extract the inventory of ALL text shapes using functions from inventory.py
* Validate that all shapes in the replacement JSON exist in the inventory
* Clear text from ALL shapes identified in the inventory
* Apply new text only to shapes with "paragraphs" defined in the replacement JSON
* Preserve formatting by applying paragraph properties from the JSON
* Handle bullets, alignment, font properties, and colors automatically
* Save the updated presentation
Example validation errors:
ERROR: Invalid shapes in replacement JSON:
- Shape 'shape-99' not found on 'slide-0'. Available shapes: shape-0, shape-1, shape-4
- Slide 'slide-999' not found in inventory
ERROR: Replacement text made overflow worse in these shapes:
- slide-0/shape-2: overflow worsened by 1.25" (was 0.00", now 1.25")
To create visual thumbnail grids of PowerPoint slides for quick analysis and reference:
python scripts/thumbnail.py template.pptx [output_prefix]
Features :
thumbnails.jpg (or thumbnails-1.jpg, thumbnails-2.jpg, etc. for large decks)python scripts/thumbnail.py template.pptx my-grid
workspace/my-grid)--cols 4 (range: 3-6, affects slides per grid)Use cases :
Examples :
# Basic usage
python scripts/thumbnail.py presentation.pptx
# Combine options: custom name, columns
python scripts/thumbnail.py template.pptx analysis --cols 4
To visually analyze PowerPoint slides, convert them to images using a two-step process:
Convert PPTX to PDF :
soffice --headless --convert-to pdf template.pptx
Convert PDF pages to JPEG images :
pdftoppm -jpeg -r 150 template.pdf slide
This creates files like slide-1.jpg, slide-2.jpg, etc.
Options:
-r 150: Sets resolution to 150 DPI (adjust for quality/size balance)-jpeg: Output JPEG format (use -png for PNG if preferred)-f N: First page to convert (e.g., -f 2 starts from page 2)-l N: Last page to convert (e.g., -l 5 stops at page 5)slide: Prefix for output filesExample for specific range:
pdftoppm -jpeg -r 150 -f 2 -l 5 template.pdf slide # Converts only pages 2-5
IMPORTANT : When generating code for PPTX operations:
Required dependencies (should already be installed):
pip install "markitdown[pptx]" (for text extraction from presentations)npm install -g pptxgenjs (for creating presentations via html2pptx)npm install -g playwright (for HTML rendering in html2pptx)npm install -g react-icons react react-dom (for icons)npm install -g sharp (for SVG rasterization and image processing)sudo apt-get install libreoffice (for PDF conversion)sudo apt-get install poppler-utils (for pdftoppm to convert PDF to images)Weekly Installs
273
Repository
GitHub Stars
27.4K
First Seen
Jan 19, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
claude-code217
opencode212
gemini-cli202
antigravity177
codex166
cursor145
xdrop 文件传输脚本:Bun 环境下安全上传下载工具,支持加密分享
20,700 周安装
bullet: truelevelspace_before、space_after 和 line_spacing(点)(仅当设置时包含)color(例如,"FF0000"),主题颜色使用 theme_color(例如,"DARK_1")"alignment": "CENTER")"font_size": 14.0、"font_name": "Lora")"color": "FF0000",主题颜色使用 "theme_color": "DARK_1"replacement-text.jsonhtml2pptx.js library to convert HTML slides to PowerPoint and save the presentation
html2pptx() function to process each HTML filepptx.writeFile()python scripts/thumbnail.py output.pptx workspace/thumbnails --cols 4Using the thumbnail grid : Reference the visual thumbnails to identify:
This inventory file is REQUIRED for selecting appropriate templates in the next step
Create presentation outline based on template inventory :
Review available templates from step 2.
Choose an intro or title template for the first slide. This should be one of the first templates.
Choose safe, text-based layouts for the other slides.
CRITICAL: Match layout structure to actual content :
Count your actual content pieces BEFORE selecting the layout
Verify each placeholder in the chosen layout will be filled with meaningful content
Select one option representing the best layout for each content section.
Save outline.md with content AND template mapping that leverages available designs
Example template mapping:
# Template slides to use (0-based indexing)
# WARNING: Verify indices are within range! Template with 73 slides has indices 0-72
# Mapping: slide numbers from outline -> template slide indices
template_mapping = [
0, # Use slide 0 (Title/Cover)
34, # Use slide 34 (B1: Title and body)
34, # Use slide 34 again (duplicate for second B1)
50, # Use slide 50 (E1: Quote)
54, # Use slide 54 (F2: Closing + Text)
]
Duplicate, reorder, and delete slides usingrearrange.py:
Use the scripts/rearrange.py script to create a new presentation with slides in the desired order:
python scripts/rearrange.py template.pptx working.pptx 0,34,34,50,52
The script handles duplicating repeated slides, deleting unused slides, and reordering automatically
Slide indices are 0-based (first slide is 0, second is 1, etc.)
The same slide index can appear multiple times to duplicate that slide
Extract ALL text using theinventory.py script:
Run inventory extraction :
python scripts/inventory.py working.pptx text-inventory.json
Read text-inventory.json : Read the entire text-inventory.json file to understand all shapes and their properties. NEVER set any range limits when reading this file.
The inventory JSON structure:
{
"slide-0": {
"shape-0": {
"placeholder_type": "TITLE", // or null for non-placeholders
"left": 1.5, // position in inches
"top": 2.0,
"width": 7.5,
"height": 1.2,
"paragraphs": [
{
"text": "Paragraph text",
// Optional properties (only included when non-default):
"bullet": true, // explicit bullet detected
"level": 0, // only included when bullet is true
"alignment": "CENTER", // CENTER, RIGHT (not LEFT)
"space_before": 10.0, // space before paragraph in points
"space_after": 6.0, // space after paragraph in points
"line_spacing": 22.4, // line spacing in points
"font_name": "Arial", // from first run
"font_size": 14.0, // in points
"bold": true,
"italic": false,
"underline": false,
"color": "FF0000" // RGB color
}
]
}
}
}
Key features:
default_font_size in points extracted from layout placeholders (when available)bullet: true, level is always included (even if 0)space_before, space_after, and line_spacing in points (only included when set)color for RGB (e.g., "FF0000"), for theme colors (e.g., "DARK_1")Generate replacement text and save the data to a JSON file Based on the text inventory from the previous step:
alignment property on when "bullet": true"bold": true"bullet": true, "level": 0 (level is required when bullet is true)"alignment": "CENTER" for centered text)"font_size": 14.0, "font_name": "Lora")"color": "FF0000" for RGB or "theme_color": "DARK_1" for theme colorsreplacement-text.jsonpip install defusedxml (for secure XML parsing)theme_color