Preamble (run first)
_KD_CHECK="kingdee-ppt-update-check"
if ! command -v kingdee-ppt-update-check &>/dev/null; then
_KD_CHECK="$(npm root -g)/kingdee-ppt/bin/kingdee-ppt-update-check"
fi
_UPD=$("$_KD_CHECK" 2>/dev/null || true)
[ -n "$_UPD" ] && echo "$_UPD" || true
If output shows UPGRADE_AVAILABLE <old> <new>: inform user "kingdee-ppt v{new} is available (you're on v{old}). Run kingdee-ppt-upgrade to update." Do NOT auto-upgrade unless user explicitly confirms. Continue with current workflow.
Based on the official Kingdee Group 2026 PPT template, supports HTML interactive presentations and PPTX editable files as two output formats. By default, first build the HTML deck, then deliver or export according to the output format selected by the user. Official background images and Logo are embedded and available with zero configuration.
v7.2: Added HTML editing mode — toggle in the upper right corner + click any text to edit directly + one-click save HTML/PPTX export All components (stat-card/callout/pillar-card/step-card) automatically support contenteditable v7.1: Added Bento Motion style variant — Tailwind v4 + GSAP ScrollTrigger, pure white background + Apple scroll animations, optional style switching Style comparison: Classic (traditional PPT) vs Bento Motion (tech launch) v7.0: HTML-first architecture — integrates huashu-design best practices, HTML is a first-class citizen, PPTX is an optional export Added: html2pptx.js + export_deck_pptx.mjs → true text-box editable PPTX export Added: design direction advisor (recommends 3 style options when requirements are vague) Added: Anti AI-slop rules (no purple gradients/emoji icons/Inter font) v6.0: HTML atomic component system — draws on open-design, abandons fixed layout numbering, adopts a component + grid free combination mode v5.0: HTML output mode → interactive web slides, keyboard navigation, touch swipe, animation effects
HTML style selection (new in v7.1)
Dual-style system: Classic (default) and Bento Motion (optional)
| Dimension | Classic (default) | Bento Motion (tech feel) |
|---|---|---|
| Background | Ice blue background/gradient cover | Pure white #FFFFFF |
| Grid | 12-column proportion system | Bento Grid span (1/2/4 columns) |
| Font size contrast | Title 18-28pt / body 16pt | Hero number 80-160pt / body 14pt |
| Motion | Intersection Observer fade | GSAP ScrollTrigger (Apple-style) |
| Chinese and English | Mainly Chinese | Large bold Chinese + small English accents |
| Graphics | Complex SVG/charts | Simple line-drawn graphics |
| CDN | No external dependencies | Tailwind v4 + GSAP + Font Awesome |
| PPTX export | Supported(html2pptx.js) | Not supported(via PDF) |
| Use cases | Formal reports, leadership, government clients | Product launches, tech audiences, innovation showcases |
Trigger words:
- When the user says "Bento style", "Apple motion", "tech feel", "modern feel" → Bento Motion
- If the content is a tech product/AI/SaaS/developer tool → recommend Bento Motion
- Default → Classic
File reading order (new in v5.1)
Phase 0 开始前必须按顺序读取以下文件:
1. design-tokens.md → 设计变量常量(COLORS/COLOR_SEQ/RADIUS/SHADOWS/SPACING/FONT)
2. layout-schema.md → 版式参数命名规范(bgColor/textColor 统一命名)
3. rhythm-templates.md → 节奏模板(页面组合预设 + 场景匹配)
4. style-guide.md → 视觉规范(品牌色/字体/间距)
5. layout-base.md → 通用辅助函数(loadAsset/addLogo/addFooter/addContentTitle/bentoCard)
6. layout-fixed.md → 固定版式(封面/目录/章节/结尾:版式01-03,10)
7. layout-content.md → 内容版式(要点/数据/对比/流程/图文/时间轴:版式04-09)
8. layout-advanced.md → 高级版式(数据看板/Bento/架构/特性/矩阵/金句/沉浸/焦点:版式11-18)
9. layout-models.md → 思维模型版式(金字塔/PDCA/SWOT/黄金圈/5W1H/SCQA/IPD:版式19-25)
10. layout-special.md → 特殊版式(图标行/半出血/悬浮统计/对比栏:版式26-29 + 速查表)
11. pptx-builder.md → 构建流程规范(资源加载/QA清单)
⚠️ design-tokens.md 和 layout-schema.md 是新增文件,必须最先读取。
⚠️ COLOR_SEQ/阴影工厂定义已迁移至 design-tokens.md,禁止在其他文件重复定义。
⚠️ layout-presets.md 已拆分为 6 个子文件(layout-base/fixed/content/advanced/models/special),按需读取。
HTML-first workflow (v7.0)
Core concept: HTML is the first-class citizen, PPTX is an optional export. First build an HTML deck that can be presented in the browser, then export an editable PPTX as needed.
──────────────────────────────────────────────────
统一流程(Phase F → 0 → 1 → 2 → H → X)
──────────────────────────────────────────────────
Phase F:输出格式选择(⚠️ 用户未明确指定格式时触发)
F.1 → 使用 AskUserQuestion 询问输出格式:
· HTML 交互式演示 — 浏览器演讲、支持动画、可部署 Vercel、可导出 PDF
· PPTX 可编辑文件 — 传统 PowerPoint、可二次编辑、离线演示
F.2 → 若选 HTML → 记住 OUTPUT_FORMAT=html,进入 Phase 0
F.3 → 若选 PPTX → 记住 OUTPUT_FORMAT=pptx,进入 Phase 0
后续 Phase H 须严格遵守 html2pptx.js 4 条硬约束,完成后自动进入 Phase X
F.4 → 用户已明确说「HTML」「网页版」「PPTX」「可编辑PPT」「PowerPoint」→ 跳过此阶段,直接赋值 OUTPUT_FORMAT
Phase 0:内容结构分析(核心引擎)
0.1 → 读取用户内容(文字/大纲/文档)
0.2 → 逐页分析内容特征(要点数量、层级关系、对比关系、数据图表)
0.3 → 匹配思维模型信号(PDCA/SWOT/黄金圈等高置信信号)
0.4 → 推荐最适合版式(每页单独分析,不套场景模板)
0.5 → AI品牌Logo识别(如有AI品牌关键词)
Phase 0.5:设计方向顾问(⚠️ 仅当需求模糊时触发)
0.5.1 → 若用户需求模糊(如"做个PPT介绍我们的产品"),触发顾问模式
0.5.2 → 从 3 种金蝶风格方向推荐选项:
· 风格 A:沉稳专业(深藏青 + 数据卡片 + 金字塔)
· 风格 B:活力创新(品青渐变 + Bento Grid + 时间轴)
· 风格 C:简洁克制(白底 + 要点列表 + 对比栏)
0.5.3 → 用户选择后,进入 Phase 1
Phase 1:大纲+版式推荐
1.1 → 输出大纲,每页标注推荐版式+推荐理由
1.2 → 用户确认/调整版式 → 如需调整,标注新版式
Phase 2:内容脚本
2.1 → 输出内容脚本(含排版指令)
2.2 → 用户确认 → 进入 HTML 生成
Phase H:HTML 生成(v7.0 核心输出)
┌─ H.0 风格选择(新增 v7.1)
│ ├─ 用户说「Bento风格」「Apple动效」「科技感」「现代感」→ 跳转 Phase H.Bento
│ ├─ 内容是科技产品/AI/SaaS/开发者工具 → 推荐 Bento Motion,问用户确认
│ └─ 默认 → Classic 风格(现有流程)
│
┌─ Phase H.Classic(默认流程)
│ H.0 → Read `html-kingdee-preflight.md` → 预检清单
│ H.1 → Read `html-kingdee-template.md` → HTML 结构 + JS 功能
│ H.2 → Read `html-kingdee-style.md` → CSS 品牌色 + 响应式
│ H.3 → Read `html-kingdee-components.md` → 原子组件
│ H.4 → Read `html-kingdee-grids.md` → 网格比例系统
│ H.5 → Read `html-kingdee-typography.md` → 字体配对
│ H.6 → Read `html-kingdee-presets.md` → CSS 版式预设(按需)
│ H.7 → 生成多文件 HTML deck(index.html + slides/*.html)
│ ⚠️ OUTPUT_FORMAT=pptx 时,必须严格遵守 html2pptx.js 4 条硬约束
│ ⚠️ OUTPUT_FORMAT=html 时,可正常使用动画、渐变、背景图
│ H.8 → 浏览器预览 → 用户确认
│ H.9 → 若 OUTPUT_FORMAT=html → 交付 HTML
│ 若 OUTPUT_FORMAT=pptx → 进入 Phase X
│
└─ Phase H.Bento(Bento Motion 风格,v7.1 新增)
H.B0 → Read `html-bento-template.md` → Tailwind v4 + GSAP CDN 骨架
H.B1 → Read `html-bento-components.md` → Bento Grid 卡片 + 勾线图形
H.B2 → Read `html-bento-presets.md` → 10 种 Bento 版式预设
H.B3 → Read `html-bento-motion.md` → GSAP ScrollTrigger 动效库
H.B4 → 生成单文件 HTML deck(全页滚动 + scroll-triggered 动效)
⚠️ Bento Motion 不支持 PPTX 导出(使用 CDN + Tailwind)
⚠️ 若 OUTPUT_FORMAT=pptx → 拒绝并建议改用 Classic 风格
H.B5 → 浏览器预览 → 用户确认 → 交付 HTML
Phase X:PPTX 导出(⚠️ 仅当 OUTPUT_FORMAT=pptx 时执行)
X.1 → 检查 HTML 是否已按 html2pptx.js 4 条硬约束生成
X.2 → 若合规 → 执行 export_deck_pptx.mjs
X.3 → 若未合规 → 列出具体错误项,建议修改 HTML 或改用 PDF
X.4 → 输出 .pptx 文件 → 交付
──────────────────────────────────────────────────
html2pptx.js 4 条硬约束(PPTX 导出必需)
──────────────────────────────────────────────────
1. body 固定 960pt × 540pt(匹配 LAYOUT_WIDE 13.333" × 7.5")
2. 所有文字包在 <p>/<h1>-<h6>/<ul>/<ol> 里(禁止裸文本 div)
3. <p>/<h*> 标签自身不能有 background/border/shadow(放外层 div)
4. 不用 CSS gradient、不用 background-image(用 <img> 标签)
⚠️ 不遵守以上约束的 HTML 无法导出 PPTX,只能交付 HTML 或 PDF。
Phase 0: Content Structure Analysis Engine (Layout Matching Core)
0.1 Content Feature Signal Recognition
Analyze the following signals page by page/paragraph by paragraph to determine the layout:
| Content Feature | Matched Layout | Signal Keywords/Structure |
|---|---|---|
| Single core conclusion + 3 sub-points | Pyramid layout (19) | "Conclusion first", "three pillars", 1+N hierarchical structure |
| 4-cell cycle structure | PDCA layout (20) | Plan/Do/Check/Act |
| 2×2 matrix comparison | SWOT layout (21) | Strengths/Weaknesses/Opportunities/Threats, internal and external dimension comparison |
| Three-layer nested logic | Golden Circle layout (22) | WHY/HOW/WHAT, core mission→method→product |
| Even distribution of 6 elements | 5W1H layout (23) | Who/When/What/Where/Why/How ≥4 items |
| 4-step causal chain | SCQA layout (24) | Situation→Complication→Question→Answer |
| 5-column trend analysis | IPD Five Looks layout (25) | Look at industry/look at customers/look at opportunities/look at competition/look at yourself |
| Display of 2-3 data metrics | Data cards (05) | Percentages, growth rates, numerical comparisons |
| Timeline/milestones | Timeline (09) | Q1→Q2→Q3→Q4, milestones, phase progression |
| Left-right comparison/option comparison | Comparison columns (29) | Option A vs Option B, pros and cons comparison |
| Icons + bullet point list | Icon row (26) | 3-5 key points, each key point has a corresponding icon |
| Large numbers + statistical display | Floating statistics (28) | Emphasis on a single large number, combination of statistical cards |
| Plain text key points ≤5 items | Bullet point list (04) | Concise bullet point list, no special structure |
| Architecture diagram/hierarchical relationships | Architecture diagram (13) | Hierarchical structure, module relationships, technical architecture |
| Single large image + a small amount of text | Half-bleed overlay (27) | Image-dominant, text overlaid on the image |
0.2 Layout Matching Priority Rules
优先级1:思维模型信号明确 → 直接使用模型版式(置信度高)
优先级2:数据/图表信号 → 数据卡片、统计版式
优先级3:对比/时间结构 → 对比栏、时间轴
优先级4:纯要点列表 → 要点列表版式(兜底)
Diversity rules for the same PPT layout:
- The same layout must not be used on 3 adjacent pages
- Plain text bullet point pages must not exceed 2 consecutive pages
- Each page must contain at least one visual element (icon, number, color block, image)
Scenario → Default structure preference
| Scenario | Automatically included pages | Preferred layout combination |
|---|---|---|
| Internal reporting | Content pages only | Bullet point list + data cards + timeline |
| Partner enablement | Cover + content + ending | Architecture illustration + flowchart + comparison page |
| Customer Conference | Full Structure (Cover/Table of Contents/Chapters/Content/Conclusion) | Data Cards + Side-by-Side Text and Images + Chapter Pages + Thinking Models |
| Proposal | Cover + Table of Contents + Content | Comparison Page + Flowchart + Data Cards + PDCA/SWOT |
⚠️ Scenario preference asdefault recommendation, and when the user explicitly specifies a structure, follow the user's requirements.
0.3 Layout Recommendation Output Format
During the outline stage, output the recommended layout and rationale for each page:
第 05 页 推荐版式:[数据卡片05] 理由:包含3个百分比指标,适合卡片展示
第 07 页 推荐版式:[PDCA循环20] 理由:明确出现"计划→执行→检查→改进"四步结构
第 09 页 推荐版式:[对比栏29] 理由:方案A与方案B对比,左右对比布局最优
0.5 AI Brand Logo Recognition (automatically embedded via lobe-icons)
After completing the Phase 0 content structure analysis and before entering Phase 1,scan the full text to identify AI brand/platform/model keywords, and mark the corresponding pages with logo embedding instructions during the content script stage.
⚠️ The mapping table is in
references/ai-brand-logos.md, and this file is read only when AI brand keywords are detected.
0.5.1 Scan Trigger Conditions
Scanning is triggered when any one of the following is met (and read references/ai-brand-logos.md):
- The content contains an AI brand name(e.g., DeepSeek, Tongyi Qianwen, Huawei Cloud, etc.)
- The content contains a large model/AI platform description(e.g., "integrate GPT-4", "call ERNIE Bot", "based on Claude")
- The scenario is "Partner Enablement", "Customer Conference", or "Proposal" and the content involves technical cooperation/ecosystem display
0.5.2 Brand Recognition Mapping Table
📄 The complete mapping table is in
references/ai-brand-logos.md, and common examples are as follows:
| Common Brands | lobe-icons Slug | Color Version |
|---|---|---|
| OpenAI / GPT | openai |
None |
| Claude / Anthropic | claude |
claude-color ✅ |
| DeepSeek | deepseek |
deepseek-color ✅ |
| Huawei Cloud / Pangu | huaweicloud |
huaweicloud-color ✅ |
| Alibaba Cloud / Tongyi | alibabacloud |
alibabacloud-color ✅ |
| ERNIE Bot / Baidu | wenxin |
wenxin-color ✅ |
| MCP Protocol | mcp |
None |
CDN Address: npmmirror (preferred)
https://registry.npmmirror.com/@lobehub/icons-static-svg/latest/files/icons/{slug}.svg
0.5.3 Recognition Result Output (annotated during the outline stage)
Add at the end of each outline page [logo: slug1, slug2] annotation:
第 05 页 [内容-Bento卡片] AI生态合作伙伴 [logo: huawei, alibaba, bytedance]
第 07 页 [内容-要点列表] 多模型接入方案 [logo: openai, claude, deepseek]
第 09 页 [内容-对比页] 模型能力对比 [logo: qwen, wenxin]
0.5.4 Logo Layout Rules
| Scenario | Layout Method | Size |
|---|---|---|
| Bento card page (each card corresponds to one brand) | logo icon in the upper-left corner of the card + text on the right | 0.45" × 0.45" |
| Partner display page (horizontal logo wall) | Evenly distributed in a horizontal row at the bottom, set off by a light gray background | 0.5" × 0.5" |
| Bullet list page (brand identifier at the start of the line) | logo at the start of the line replaces the bullet point | 0.3" × 0.3" |
| Technical architecture diagram (annotate component sources) | Placed closely next to the color block | 0.35" × 0.35" |
| Cover/Chapter Page | ❌ Do not place lobe-icons (to avoid overshadowing the main content) | — |
Color handling rules:
- Dark (primary blue/teal) background cards → use
{slug}-color.pngcolor version, or white monochrome version - Light/white background → use
{slug}.svgoriginal color version - PNG fallback path:
https://registry.npmmirror.com/@lobehub/icons-static-png/latest/files/icons/{slug}.png
0.5.5 Logo Annotation Format in the Content Script
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【第 X 页】版式:[内容-Bento卡片]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
标题:苍穹生态AI伙伴矩阵
卡片列表:
卡片1 [logo: huawei] 华为云
· 盘古大模型 + CodeArts IDE
· 联合开发者竞赛合作方
卡片2 [logo: alibaba] 阿里云
· 通义千问接入苍穹
· 云市场联合运营
卡片3 [logo: deepseek] DeepSeek
· 企业级私有化部署方案
· 财务场景专属模型微调
排版指令:3列等宽卡片,每卡左上角嵌入logo(0.45"),logo下方品牌名12pt灰色
图片:无(全部用lobe-icons)
0.5.6 Execution Limitations and Fallback Handling
| Situation | Handling Method |
|---|---|
| Slug not found in the mapping table | Skip logo, use emoji instead (e.g. 🤖), no errors |
| CDN fetch failed (network timeout) | Automatically switch to backup CDN; if still failing, skip, keep annotation in outline |
| SVG to PNG conversion failed | Directly use PNG CDN URL to fetch fallback |
| Number of logos on a single page > 6 | Merge into a "logo wall" layout, arranged horizontally at the bottom, move text to the title area |
| User says "no logo" / "no icons" | Skip the entire 0.5 phase, do not perform any lobe-icons fetching |
Phase 1: Outline + layout recommendations
1.1 Output outline (each page annotated with recommended layout + rationale)
Output the complete outline,The layout field on each page must be annotated with the recommendation rationale:
──────────────────────────────────────────────────
金蝶PPT大纲 · [主题] · 共 X 页
版式分析:[PDCA × 1页 | 数据卡片 × 2页 | 要点列表 × N页]
──────────────────────────────────────────────────
第 01 页 [封面页] 主标题 / 副标题 / 日期
第 02 页 [目录页] 4个章节导览
第 03 页 [章节分隔 01] 章节名 / 副标题
第 04 页 [SWOT矩阵版式21] 页面标题 理由:明确出现优势/劣势/机会/威胁四要素
第 05 页 [数据卡片05] 页面标题 理由:包含3个百分比指标,适合卡片展示
第 06 页 [章节分隔 02] 章节名
第 07 页 [PDCA循环版式20] 页面标题 理由:计划→执行→检查→改进四步结构
第 08 页 [要点列表04] 页面标题 理由:5条简洁要点,无特殊结构
...
第 XX 页 [结尾页] 多语言致谢
──────────────────────────────────────────────────
1.2 User confirms/adjusts layouts
Use ask_user_input to ask:
问题 标题:"大纲确认" 类型:single_select
选项: 没问题,开始写内容 / 需要调整版式
- Select "No problem" → proceed to Phase 2
- Select "Adjust layout" → user specifies page numbers and new layouts, update the outline
Phase 2: Content script
2.1 Output content script
Thinking model pages must additionally note the model structure, in the following format:
Thinking model page script format:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【第 X 页】版式:[PDCA循环版式]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
标题:2025年度项目复盘
模型结构:
P(计划):年初制定的三大目标
D(执行):实际落地情况,完成率80%
C(检查):发现效率瓶颈在交付环节
A(改进):2026年引入自动化流程
排版指令:4格循环色块(顺时针),中央↻符号
图片:无
IPD Five Looks page script format:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【第 X 页】版式:[IPD五看版式]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
标题:市场全景分析
模型结构:
看行业:企业数字化加速,AI原生应用渗透率 <10%
看客户:核心诉求从降本转向增效,愿为Agent买单
看机会:Skill生态市场规模预计 2026年达2亿
看竞争:友商缺乏元数据治理,在AI准确性上有短板
看自己:苍穹PaaS底座扎实,ISV生态已达2800+
排版指令:5列等宽卡片横排,奇偶列顶部交替主蓝/品青,内容区浅灰蓝底
图片:无
Standard content page script format:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
【第 X 页】版式:[内容-要点列表]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
标题:xxxxxx
正文内容:
• 普通要点(≤30字,18pt普通)
• ★ 重点要点(≤30字,加粗+蓝色/金色强调)
• 普通要点
图片:无 / 图片N → 位置:左侧 / 右侧 / 全页
排版建议:[三列卡片 / 横向流程 / 左右对比 / 纯要点]
Hierarchy annotation rules:
★= key emphasis (20pt bold, blue2971EBor yellowFFB61A)- No marker = normal content (18pt regular, 1.3× line spacing)
[底色块]= thinking model first-level information (brand color background + white bold text)[icon:📊]= specified icon (written in the card/grid annotation line, calladdIconBadgeor directlyaddText)
Icon usage rules (content script phase):
- Thinking model page — each cell has an icon by default (see
style-guide.md § 10.4), in the script you can use[icon:默认]to indicate using the recommended value, or[icon:🎯]to override - Bento card page — main card (dark background) with large icon (28–32pt), secondary cards (light color) with medium icon (24pt)
- Bullet list page — keep icons at the start of lines as consistent as possible (no more than 2 icon types per page), or use no icons at all
- Icon density cap — at most 6 icons per page; no more than 3 icon categories on the same page (to avoid visual noise)
- Color rules — dark background cells (primary blue/cyan) → icons
color: FFFFFF; light background → iconscolor: 2971EB
Content principles:
- ≤5 bullets per page, each bullet ≤30 characters; split the page if exceeded
- Each cell on a thinking model page has ≤3 bullets, core words ≤6 characters bold and centered
- Content must not exceed 70% of the layout, whitespace ≥ 30% (see
style-guide.md § 12) - Text on brand color backgrounds must be white
- Tone is concise and powerful, corporate executive speech style
Layout diversity rules (must be enforced):
- 3 adjacent pages must not use the same layout — rotate each page: number of columns, card/stat/image/text type
- Text-only bullet pages (layout 04) must not appear more than 2 times consecutively — a layout with visual elements must be inserted afterward
- Each page must contain at least one visual element (one of icons, numerical statistics, images, color blocks, or charts)
Alignment rules:
- Paragraph text, bullet lists → left-aligned
- Cover/key message page titles → centered; content page titles → left-aligned
- Do not add an emphasis line below content page titles (except for the brand horizontal line on chapter divider pages)
Spacing rules (consistent throughout the entire deck):
- Minimum left and right page margins: 0.5"
- Spacing between content blocks: choose 0.3" or 0.5" and keep it consistent throughout the entire deck; do not mix
2.2 User Confirmation
"The above is the content script for all X pages, including [N] pages using thinking-model layouts ([list of model names]). If you need changes, tell me the page numbers and the changes, and I will adjust them consistently before generating the file. If there are no issues, please reply 'Start generating'."
Upon receiving "Start generating" → proceed to 2.3 Generate File.
2.3 Generate File
Step 1: Read the files required for the generation stage
Read `layout-presets.md` → 获取版式代码模板
Read `pptx-builder.md` → 获取构建流程规范
If AI品牌logo标注存在 → Read `references/ai-brand-logos.md`
Step 2: Execute the build process
编写 /home/claude/build_pptx.js
↓
node build_pptx.js
↓
soffice PDF → pdftoppm 预览图
↓
视觉 QA(逐张检查,至少一次修复循环)
↓
cp output.pptx /mnt/user-data/outputs/
↓
present_files 交付
Keep the delivery note within 2 lines: "X pages in total, including [cover/chapter/content/ending], of which [N] pages use thinking-model layouts ([model list]), and have passed visual QA."
Specifications for 6 thinking-model layouts
⚠️ For the complete PptxGenJS code, see
layout-presets.md § 版式 19-25; below only the layout principles and color block structures are listed, for reference during the content script stage.
Model A: Pyramid / MECE layout (→ Layout 19)
Structure: top conclusion → middle-level sub-points → bottom-level evidence (three-level hierarchy)
┌────────────────────────────────┐ ← 主蓝 #2971EB,白字,结论一句话(全宽 1/4页高)
│ 核心结论 │
└────────────────────────────────┘
┌──────────┐ ┌──────────┐ ┌──────────┐ ← 黄色 #FFB61A,白字,分论点(三列等宽)
│ 分论点1 │ │ 分论点2 │ │ 分论点3 │
└──────────┘ └──────────┘ └──────────┘
· 论据1 · 论据1 · 论据1 ← 浅灰蓝底 #E7F1FF,深色小字
Brand colors: conclusion = primary blue#2971EB / sub-points = yellow#FFB61A / evidence = light gray-blue#E7F1FF
Model B: PDCA cycle layout (→ Layout 20)
Structure: 4 cells arranged clockwise, with a circular symbol in the center
┌────────┐ ┌────────┐
│ P 计划 │ → │ D 执行 │
└────────┘ └────────┘
↑ ↻ ↓
┌────────┐ ┌────────┐
│ A 改进 │ ← │ C 检查 │
└────────┘ └────────┘
Brand colors: P = primary blue#2971EB / D = cyan#22AAFE / C = yellow#FFB61A / A = purple#966EFF
Model C: SWOT matrix layout (→ Layout 21)
Structure: 2×2 matrix, with horizontal and vertical axes labeling internal/external and favorable/unfavorable dimensions
内部因素 外部因素
优势/机会 ┌──────────────────┐ ┌──────────────────┐
│ S 优势 │ │ O 机会 │
└──────────────────┘ └──────────────────┘
劣势/威胁 ┌──────────────────┐ ┌──────────────────┐
│ W 劣势 │ │ T 威胁 │
└──────────────────┘ └──────────────────┘
Brand colors: S = primary blue#2971EB / O = teal#05C8C8 / W = light gray-blue#E7F1FF(dark text) / T = purple#966EFF
Model D: Golden Circle layout (→ Layout 22)
Structure: three nested ellipses (WHY→HOW→WHAT from inside to outside) + explanation column on the right
左侧(椭圆嵌套): 右侧(说明列):
┌─── WHAT 浅灰 ───────────┐ [WHY蓝] WHY — 为什么做:核心使命
│ ┌─── HOW 品青 ───┐ │ [HOW青] HOW — 怎么做:方法路径
│ │ ┌─ WHY 蓝 ─┐ │ │ [WHAT灰] WHAT — 做什么:产品服务
│ │ └──────────┘ │ │
│ └───────────────┘ │
└─────────────────────────┘
Brand colors: WHY core = primary blue#2971EB / HOW middle layer = cyan#22AAFE / WHAT outer layer = light gray-blue#E7F1FF
Model E: 5W1H six-cell layout (→ Layout 23)
Structure: 2 rows × 3 columns of equal cards, with a blue label at the top + content area
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ WHO 谁 │ │ WHAT 什么 │ │ WHEN 何时 │
├──────────────┤ ├──────────────┤ ├──────────────┤
│ · 内容要点 │ │ · 内容要点 │ │ · 内容要点 │
└──────────────┘ └──────────────┘ └──────────────┘
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ WHERE 何地 │ │ WHY 为何 │ │ HOW 如何 │
├──────────────┤ ├──────────────┤ ├──────────────┤
│ · 内容要点 │ │ · 内容要点 │ │ · 内容要点 │
└──────────────┘ └──────────────┘ └──────────────┘
Brand colors: card top label = primary blue#2971EBwhite text / content area = light gray-blue#E7F1FFdark text
Model F: SCQA four-step process layout (→ Layout 24)
Structure: four-step horizontal arrow flow + bottom content explanation row
[S 场景] → [C 冲突] → [Q 问题] → [A 解决]
浅灰底 品金底 紫色底 主蓝底
↓ ↓ ↓ ↓
说明文字 说明文字 说明文字 说明文字
Brand colors: S = light gray-blue#E7F1FF(dark text) / C = yellow#FFB61A / Q = purple#966EFF / A = primary blue#2971EB
Model G: IPD Five Views layout (→ Layout 25) [New]
Structure: 5 equal-width cards arranged horizontally, with a numbered color block at the top + content area
┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
│ 01 │ │ 02 │ │ 03 │ │ 04 │ │ 05 │
│看行业│ │看客户│ │看机会│ │看竞争│ │看自己│
├──────┤ ├──────┤ ├──────┤ ├──────┤ ├──────┤
│核心 │ │核心 │ │核心 │ │核心 │ │核心 │
│观点 │ │观点 │ │观点 │ │观点 │ │观点 │
│ │ │ │ │ │ │ │ │ │
│支撑 │ │支撑 │ │支撑 │ │支撑 │ │支撑 │
│数据 │ │数据 │ │数据 │ │数据 │ │数据 │
└──────┘ └──────┘ └──────┘ └──────┘ └──────┘
Brand colors: odd-numbered column top blocks = primary blue#2971EB / even-numbered column top blocks = brand cyan#22AAFE / content area = light gray-blue#E7F1FF
Script format:
模型结构:
看行业:[核心观点] + [支撑数据/趋势]
看客户:[核心观点] + [典型诉求/洞察]
看机会:[核心观点] + [市场规模/增速]
看竞争:[核心观点] + [竞品/差异化]
看自己:[核心观点] + [优势/短板]
排版指令:5列等宽,顶部序号+标题色块(交替主蓝/品青),内容区浅灰蓝底
Brand color semantic mapping master table
⚠️ Strict constraint: in the PPTonly the following colors are allowed, and any color not in this list is prohibited (especially red
#E8210A)。
Primary color system
| Brand color | Color value | Semantic role in the thinking model |
|---|---|---|
| Tech blue (primary blue) | #2971EB |
Core conclusion / primary module / WHY / Plan / Strengths / Answer |
| Bright sky blue (brand cyan) | #22AAFE |
Execution process / method layer / HOW / Do / secondary information |
| Section cyan | #00CCFE |
Oversized section page numbers + decorative horizontal lines (dedicated, not for content pages) |
| Deep purple-blue (navy) | #28245F |
High-contrast text blocks / dark emphasis / dark chart backgrounds |
| White | #FFFFFF |
Text on all dark backgrounds |
Auxiliary color system
| Brand color | Color value | Semantic role in the thinking model |
|---|---|---|
| Turquoise cyan | #05C8C8 |
Growth positive / opportunities / Opportunities |
| Lavender purple | #966EFF |
Challenges and conflicts / threats and risks / Act improvements / Question / Threats / Complication |
| Orange-yellow | #FFB61A |
Emphasis elements / improvement tips / WHAT / Check / warning information |
| Dark gray | #373838 |
Body text / annotations on light backgrounds |
| Light gray | #BFBFBF |
Auxiliary explanatory text / secondary annotations / dividers / borders |
| Ice blue | #E7F1FF |
Secondary information background / argument area / Weaknesses / Situation / card background |
Color prohibition list
| Prohibited color | Reason |
|---|---|
❌ Red #E8210A |
not in the official palette; section page decorative horizontal lines must use #00CCFE, red is prohibited |
❌ Old primary blue #1770EA |
has been replaced with official tech blue #2971EB |
❌ Old brand gold #FFC000 / #FFB800 |
has been unified as official orange-yellow #FFB61A |
| ❌ Any color not in the table above | Breaks brand consistency |
Anti AI-slop rules (prohibitions)
Prevent generated content from falling into common AI template pitfalls and ensure the output meets Kingdee enterprise-level standards.
| Issue | ❌ Prohibited | ✅ Correct approach |
|---|---|---|
| Excessive gradients | Full-page gradient backgrounds, rainbow color schemes | Kingdee standard background images or brand color system |
| Empty icons | generic lightbulb/gear/rocket icons | Kingdee brand icons or no icons with plain text |
| English boilerplate | "Think Big" "Innovation" "Future" | Kingdee values: extend conscience, walk the right path, practice the kingly way |
| Meaningless decoration | Abstract waves, dot matrices, geometric shapes | Use only the official bubble circle element |
| Section numbering abuse | 01/02/03/04 but no section content | Use section divider pages only when there are substantive sections |
| Paragraphs too long | A single bullet point exceeds 50 characters | ≤30 characters, ≤5 bullet points per page |
| Empty data | "significantly improved" "substantially increased" with no numbers | Must have specific numbers or a clear source |
| Piling up buzzwords | Overuse of AI Agent, large models, digital transformation | At most 1 technical buzzword per page, paired with a specific scenario |
| False comparison | Old vs. new comparison but no description of differences | Left-right comparison pages must list ≥3 points of difference |
| Empty timeline | Only years, no event descriptions | Each time point must have event + impact |
Kingdee brand knowledge base
| Category | Content |
|---|---|
| Mission | Empower enterprises to achieve the extraordinary |
| Vision | To be the most trusted enterprise management AI platform |
| Values | Extend conscience, walk the right path, practice the kingly way |
| Kingdee Philosophy | Customer-centric, long-term commitment to professionalism; based on strivers, long-term commitment to enlightening the mind and purifying the heart |
| Four Steps | Enlighten the mind and purify the heart (intentions/state and vision) → Way → Virtue (consciousness/language/action) → Matters (results and conditions) |
| IPD Five Looks | Look at industry / look at customers / look at opportunities / look at competition / look at yourself (each item: core viewpoint + supporting data) |
| Project hierarchy | Project director → project manager → team leader (including key responsibilities) → team member |
| IT architecture layers | SaaS layer / PaaS layer / IaaS layer |
| Confidentiality level | ④ Internal public, do not disclose externally |
Common situations handling
| Situation | Handling method |
|---|---|
| User does not specify output format | Trigger Phase F, ask HTML vs PPTX, and after selection proceed to Phase 0 |
| User directly provides complete content | If the format is already clear, proceed directly to Phase 0 content analysis; otherwise go through Phase F first |
| User's need is vague (e.g. "make a PPT introducing a product") | First trigger Phase F to choose format, then trigger Phase 0.5 design direction consultation |
| User explicitly specifies a model | Skip the Phase 0 scan and directly use the specified model layout |
| User says "no thinking model" | Ignore all Phase 0 results and handle according to the standard layout |
| User says "generate directly" / "no confirmation needed" | If the format is not clear, trigger Phase F first; then quick mode: Phase 0+1+2+H merged output, with one confirmation question at the end |
| User only wants the content script, not a file | Stop after completing Phase 2 |
| User says "no cover/ending" | Remember the preference and delete the corresponding pages from the outline |
| More than 4 sections | Suggest merging or setting up an appendix; the table of contents page should have at most 4 chapters |
| Single page has too much content | Split into 2 pages, using transition titles "(1)" and "(2)" |
| More than 4 types of models detected | Keep the main 3 types, downgrade the rest to standard layouts, and note in the outline |
| User uploads an existing .pptx | Extract content and rearrange into a Kingdee-style HTML deck |
| User provides data and requests charts | After collecting data, draw in HTML using CSS/Canvas, and convert to images when exporting PPTX |
| Content contains AI brand/large model keywords | Outline annotation [logo: slug], use lobe-icons SVG in HTML |
| User says "no logo" | Skip logo retrieval, do not call the CDN |
| User asks midway to switch output format | If not yet in Phase H, roll back to Phase F to choose again; if already in Phase H, evaluate the adjustment cost |
| OUTPUT_FORMAT=pptx and the user requests PPTX export | Enter Phase X, execute scripts/export_deck_pptx.mjs |
| User says "editable PPTX"/"want a PPT file" | Set OUTPUT_FORMAT=pptx; Phase H must be executed according to the 4 hard constraints of html2pptx |
| html2pptx export fails | Indicate that the HTML is non-compliant, list the specific errors, and suggest modifying the HTML or outputting PDF |
| OUTPUT_FORMAT=html and the user only wants HTML | Deliver an HTML deck, which can be presented in a browser or deployed to Vercel; skip Phase X |
| User wants PDF | Use Playwright screenshots merged to export PDF (⚠️ animations are lost); does not depend on OUTPUT_FORMAT |
| User says "finished editing"/"save changes" | Prompt the user to click the "Save HTML" button on the HTML page to export |
| User wants to export PPTX after editing | Prompt to save HTML → run CLI command node scripts/export_deck_pptx.mjs |
| User says "no editing feature" | Remove EditController and the editing toolbar UI from the HTML |
Detailed HTML output specification (v7.0)
HTML is a first-class citizen; PPTX is an optional export. This section specifies the generation and export of the HTML deck.
HTML output characteristics
| Characteristic | Description |
|---|---|
| Single file | All CSS/JS is inline, zero dependencies, can be opened directly in a browser |
| Interactive | Keyboard navigation, touch swipe, animation effects, progress bar, navigation dots |
| Responsive | clamp() Font size adapts automatically, perfectly suited for mobile/projectors |
| Brand consistency | Shares the same brand color system, layout logic, and content density specifications with PPTX |
| Shareable | Supports one-click Vercel deployment (online URL) and Playwright PDF export |
Phase H3: HTML generation process
Step 1: Read required files
Read `html-kingdee-template.md` → HTML 结构 + SlidePresentation 类 + 动画触发
Read `html-kingdee-style.md` → CSS 自定义属性 + 视口锁定 + 响应式断点
Read `html-kingdee-presets.md` → 按需加载版式 CSS(只复制使用的版式)
If AI品牌logo标注存在 → 使用 lobe-icons CDN SVG
Step 2: Generate the HTML file
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{演示标题} | 金蝶</title>
<style>
/* 1. CSS 自定义属性(品牌色系) */
/* 2. 视口锁定基础样式 */
/* 3. 响应式断点 */
/* 4. 动画与过渡 */
/* 5. 卡片通用样式 */
/* 6. 品牌色语义映射 */
/* 7. 版式 CSS 类(按需加载) */
</style>
</head>
<body>
<div class="progress-bar"></div>
<div class="nav-dots"></div>
<!-- 幻灯片内容 -->
<script>
/* SlidePresentation 类 */
/* Intersection Observer */
/* 键盘/触摸/滚轮导航 */
</script>
</body>
</html>
Step 3: Browser preview
写入 {主题}.html 文件
↓
本地 HTTP 服务预览(可选)
↓
用户确认 → 交付文件 / 部署 URL
HTML layout class name mapping table
| PPTX layout number | HTML CSS class name | Structure example |
|---|---|---|
| 01 Cover page | .slide-cover |
<section class="slide slide-cover"> |
| 02 Table of contents page | .slide-toc |
<section class="slide slide-toc"> |
| 03 Section Divider | .slide-section |
<section class="slide slide-section"> |
| 04 Key Points List | .slide-bullets |
<section class="slide slide-bullets"> |
| 05 Data Cards | .slide-data-cards |
.data-card-grid + .data-card |
| 11 Data Dashboard | .slide-dashboard |
.dashboard-grid + .dashboard-card |
| 12 Bento Grid | .slide-bento |
.bento-grid + .bento-main + .bento-card |
| 19 Pyramid | .slide-pyramid |
.pyramid-wrapper + .pyramid-top/.middle/.bottom |
| 20 PDCA | .slide-pdca |
.pdca-grid + .pdca-cell + .color-plan/.do/.check/.act |
| 21 SWOT | .slide-swot |
.swot-grid + .swot-cell + .color-strength/.weakness/.opportunity/.threat |
| 22 Golden Circle | .slide-golden |
.golden-wrapper + .golden-circles + .golden-explain |
| 25 IPD Five Looks | .slide-ipd |
.ipd-grid + .ipd-card + .color-view-1/2/3/4/5 |
| 16 Key Quotes | .slide-quote |
<section class="slide slide-quote"> |
| 28 Floating Stats | .slide-floating-stats |
.floating-grid + .floating-stat |
HTML Navigation Features
| Action | Trigger Method |
|---|---|
| Previous Page | ← / ↑ / PageUp |
| Next Page | → / ↓ / PageDown / Space |
| Home | Home |
| End | End |
| Swipe Left (Mobile) | Next Page |
| Swipe Right (Mobile) | Previous Page |
| Mouse Wheel | Next Page/Previous Page (300ms debounce) |
HTML Content Density Specification (consistent with PPTX)
| Slide Type | Maximum Content | Maximum Layout Percentage |
|---|---|---|
| Title Page (Cover) | 1 Title + 1 Subtitle + Meta Information | 50% |
| Content Page | 1 Title + 4–6 Key Points | 70% |
| Feature Grid | 1 Title + up to 6 Cards | 80% |
| Data Dashboard | 3 Number Cards | 75% |
/* CSS 强制留白 */
.slide-content {
padding: clamp(0.3rem, 1vw, 0.5rem);
}
.text-block {
max-width: min(80vw, 800px);
}
HTML Icon Usage (Emoji)
Consistent with the PPTX version, using Microsoft YaHei font to render emoji:
<span class="icon">📊</span> <!-- 数据看板 -->
<span class="icon">⚡</span> <!-- 快速响应 -->
<span class="icon">🤖</span> <!-- AI/智能体 -->
<span class="icon">🚀</span> <!-- 起飞/增长 -->
HTML Sharing and Export (Optional)
Local Preview
python3 -m http.server 8080 --directory .
# 或
npx serve .
Vercel Deployment
vercel --prod
# 输出在线 URL,可分享给他人
PDF Export (⚠️ Animation Effects Lost)
# 使用 Playwright 以 1920×1080 分辨率截图并合并
node scripts/export-pdf.js {主题}.html output.pdf
Common Situations Handling (HTML Mode)
| Situation | Handling Method |
|---|---|
| User says "HTML slides" / "web version PPT" / "interactive presentation" | Automatically select HTML output format |
| User says "traditional PPT" / "PPTX file" | Select PPTX output format |
| User explicitly specifies the output format | Execute as specified by the user |
| User says "no animation" | Remove from HTML .animate-* class, skip animation triggering |
| User says "no navigation dots" | Remove .nav-dots container |
| User says "editable" / "inline editing" | Enable contenteditable, ⚠️ editing state must be cleared before export |
| User requests PDF export | Warn about animation loss, use Playwright screenshots to merge |
| User requests online sharing | Deploy using Vercel CLI, output URL |
| Mobile Preview | Responsive automatic adaptation, touch swipe navigation takes effect |
| User uploads an existing .pptx and requests conversion to HTML | First extract content (Phase 4), then follow the HTML workflow |
HTML Editing Mode (New in v7.2)
HTML output comes with built-in editing functionality: toggle switch in the upper right corner + click any text to edit directly + one-click save and export.
Editing Mode UI
| Element | Function |
|---|---|
| Toggle Switch in the Upper Right Corner | Enable/Disable Editing Mode |
| "Save HTML" button | Clear editing state + export clean HTML file |
| "Export PPTX" button | Prompt to run CLI command to export PPTX |
Automatically editable elements
The following elements are automatically supported after enabling edit mode contenteditable:
| Element type | CSS selector | Description |
|---|---|---|
| Headings | h1, h2, h3, h4, h5, h6 |
All headings are editable |
| Body text | p, li |
Paragraphs and list items are editable |
| Card title | .card-title, .pillar-title, .step-title |
Card title is editable |
| Card description | .pillar-desc, .step-desc |
Card description is editable |
| Statistics numbers | .stat-nb, .stat-label, .stat-note |
Data card content is editable |
| Quote text | .callout-text |
Quote content is editable |
Non-editable elements: number .pillar-ic, .step-nb, logo, background image, navigation UI
Edit mode operation flow
1. 打开 HTML 文件 → 右上角自动显示编辑工具栏
2. 点击 Toggle 开启编辑模式 → 所有文字元素出现蓝色虚线悬停框
3. 点击任意文字 → 进入编辑状态,出现蓝色实线边框
4. 修改内容 → 点击其他位置或 Tab 跳到下一元素
5. 点击「保存 HTML」→ 导出干净的 HTML 文件(无编辑 UI)
6. 如需 PPTX → 点击「导出 PPTX」查看 CLI 命令提示
State clearing checklist on export
| State | Clearing method |
|---|---|
contenteditable attribute |
el.removeAttribute('contenteditable') |
.editable-text class |
el.classList.remove('editable-text') |
.edit-active class |
el.classList.remove('edit-active') |
.edit-toolbar.hidden |
toolbar.classList.add('hidden') |
.nav-hint.show |
navHint.classList.remove('show') |
.nav-dot.active |
dot.classList.remove('active') |
⚠️ CRITICAL: not clearing these states will cause the exported HTML/PPTX to contain editing UI and temporary styles.
Handling after user edits
| User action | Handling method |
|---|---|
| User says "I'm done editing, save it" | Execute the save HTML flow |
| User says "Export PPTX" | Prompt the CLI command; if the HTML has been saved, it can be run directly |
| User says "I made a mistake, restore the original content" | Cannot be restored; recommend regenerating the original HTML |
| User requests layout adjustment after editing | Must go through the Phase H generation flow again; edited content will not be retained |