← 返回
未分类

html-to-pptx-converter

Convert structured HTML/CSS slide content into native, editable PowerPoint (.pptx) presentations using PptxGenJS and Python parsing.
Nan
未分类 community v0.0.1 1 版本 99632.4 Key: 无需
★ 1
Stars
📥 251
下载
💾 51
安装
1
版本
#latest

概述

HTML to PPTX Converter Skill

This skill provides a pipeline for transforming web-based slide decks (HTML/CSS) into professional, native PowerPoint files. It uses a hybrid approach: Python for content extraction (BeautifulSoup) and Node.js (PptxGenJS) for layout reconstruction.

Prerequisites

# Python dependencies
pip install beautifulsoup4 lxml

# Node.js dependencies
npm install -g pptxgenjs

Workflow

1. Structure Analysis (Python)

Parse the HTML to extract semantic slide data (titles, bullet points, metrics, tables, and layouts).

from bs4 import BeautifulSoup
import json

def parse_slides(html_path):
    soup = BeautifulSoup(open(html_path), 'lxml')
    slides = []
    for div in soup.find_all('div', class_='slide'):
        # Extract based on classes like 'cover-slide', 'content-box', 'two-column'
        # Return a structured JSON list
        pass
    return slides

2. Layout Mapping (JavaScript)

Map the extracted JSON data to PptxGenJS objects using a 10" x 5.625" coordinate system.

const pptxgen = require("pptxgenjs");
let pres = new pptxgen();

// Define a consistent color palette
const COLORS = { PRIMARY: "0F3460", ACCENT: "00D4FF", TEXT: "FFFFFF" };

// Iterate through parsed data and add slides
data.forEach(item => {
    let slide = pres.addSlide();
    // Use slide.addText, slide.addShape, slide.addTable based on item.type
});

pres.writeFile({ fileName: "output.pptx" });

Design Principles

  • Native Elements: Always use addShape and addText instead of screenshots to ensure the PPT is editable.
  • Metric Boxes: For data-heavy slides, use large font-size text boxes inside colored rectangles to highlight key numbers.
  • Grid Systems: Map HTML grid or flex layouts to manual X/Y coordinates (e.g., Two-column = X:0.5 and X:5.2).
  • Branding: Sync PPT background colors with the HTML background-color or linear-gradient equivalent.

Pitfalls & Tips

  • Hex Colors: PptxGenJS requires hex codes WITHOUT the # prefix (e.g., 00D4FF).
  • Font Support: Default to "Microsoft YaHei" or "Arial" for cross-platform compatibility.
  • Table Height: Tables don't auto-calculate height for the next element; manually increment currentY based on row count.

版本历史

共 1 个版本

  • v0.0.1 Initial release 当前
    2026-04-14 15:49 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,376 📥 320,195
ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,078 📥 808,672
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 676 📥 325,263