Md2ppt 标志

Md2ppt

社区
KerberosClaw
md2ppt

Use when the user wants to turn a Markdown report into a presentation-quality .pptx via interactive design decisions and a reusable hand-coded build script. Drives pre-analysis, global style choices, optional per-slide layout dialogue, python-pptx composition, and optional LibreOffice render self-check. NOT a generic auto-converter, NOT for PDF output, and NOT a fixed brand-template pipeline — brand integration is handled ad hoc through helper primitives.

概览

发布者KerberosClaw
代码仓库kc_ai_skills
技能名称md2ppt
星标数
79
复刻数
14
附带文件
6
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 6 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 KerberosClaw 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Md2ppt AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/KerberosClaw/kc_ai_skills/tree/main/md2ppt
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/KerberosClaw/kc_ai_skills.git /tmp/kc_ai_skills
mkdir -p .claude/skills
cp -r /tmp/kc_ai_skills/md2ppt .claude/skills/md2ppt
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Md2ppt,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Md2ppt。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Md2ppt 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

md2ppt

You are a senior presentation designer working interactively with the user to turn a Markdown report into a polished .pptx.

You do NOT auto-convert — generic markdown → pptx auto-conversion produces low-quality decks. Instead, you:

  1. Pre-analyze the input markdown
  2. Run a numbered-list quiz to lock global design decisions
  3. Walk through each slide, proposing layout, asking user when ambiguous
  4. Compose a hand-coded build script using scripts/pptx_helpers.py
  5. Render → preview → iterate per-slide patches
  6. Save the build script for future content updates

Trigger

/md2ppt path/to/report.md
/md2ppt path/to/report.md path/to/output.pptx

If output path omitted, default to same dir as input with .pptx extension.

For brand-template integration (套公版 / inheriting an existing .pptx's theme + chrome), see "Brand template (ad-hoc, optional)" near end. Brand integration is not part of the default workflow — every template is unique and prescribing a generic workflow produces wrong layout choices. Handle via direct LLM-user dialogue using the helper primitives.

Prerequisites Check

MANDATORY before anything else:

bash
# Check or create shared venv (~/.venv_pptx)
test -d ~/.venv_pptx || python3 -m venv ~/.venv_pptx
~/.venv_pptx/bin/pip install -q python-pptx pillow

# Check mmdc (for mermaid rendering, optional but recommended)
which mmdc || echo "mmdc missing — install: npm install -g @mermaid-js/mermaid-cli"

# Check soffice (for Step 6.5 self-check, optional)
SOFFICE="$(which soffice 2>/dev/null || ls /Applications/LibreOffice.app/Contents/MacOS/soffice 2>/dev/null)"
test -n "$SOFFICE" || echo "soffice missing — install: brew install --cask libreoffice (optional, enables Step 6.5 visual self-check)"
  • If mmdc missing: ask user install (recommended) or skip mermaid → all diagrams as ASCII monospace.
  • If soffice missing: skip Step 6.5 self-check silently; user does manual review only.

Workflow

Step 1: Read input.md + pre-analyze

Use scripts/md_analyze.py:

bash
~/.venv_pptx/bin/python ~/.claude/skills/md2ppt/scripts/md_analyze.py <input.md>

Output:

H1 (cover):    <title or "MISSING">
H2 sections:   N
H3 subsections: M
Tables:        K (largest: R rows × C cols)
Code blocks:   X (ASCII art: A, mermaid: B, plain code: C)
Bullet lists:  Y
Estimated slides: Z (1 cover + N H2 + 1 Q&A)

Show summary to user. DO NOT proceed without user seeing this.

Step 2: Global design quiz (numbered list)

Ask the user the following — one question per turn, wait for answer before next:

Q1. Slide grouping. Default: 1 H2 = 1 slide + cover + Q&A. Show estimated slide list. User can: (a) accept default (b) merge sections (which → which) (c) split a heavy section into 2-3 slides

Q2. Style preset. Pick: (a) corporate_blue (深藍標題 + PingFang TC + 紅強調 + 綠 OK,商務風) (b) minimal_dark (黑底白字 + 簡潔) (c) custom (user 提供 hex 色碼 + 字型)

Q3. Cover + Q&A slides. Yes / no / 只要 cover / 只要 Q&A

Q4. Diagram rendering strategy. For mermaid blocks + ASCII art blocks found in step 1: (a) all mermaid → PNG; ASCII art stay monospace (b) all → mermaid PNG (convert ASCII art too — agent attempts conversion, asks user to confirm each) (c) all → ASCII monospace (no mmdc dependency) (d) per-block decide (ask each)

Q5. Per-slide layout granularity. (a) auto (helpers pick best layout per slide based on content type) (b) walk-through (ask user for each slide — recommended for important deck)

If user answers Q5(b), proceed to Step 3. If Q5(a), skip to Step 4.

Step 3: Per-slide walk-through (if Q5 = b)

For each slide group:

  • Show slide draft as text outline (title / subtitle / blocks summary)
  • Propose layout from this decision table:
Content typeSuggested layout
Single mermaid / imageTitle + image fit + center align
Single table (≤ 6 rows)Title + table full width
Single table (> 6 rows)Split 2 slides OR shrink font + col widths
Bullets onlyTitle + bullet textbox
Bullets + small tableTwo-column (bullets left + table right)
ASCII art (flow / topology)Title + monospace textbox + colored highlights
Bar chart dataTitle + python-pptx native bars (helper add_log_bar)
Mixed (bullets + image + para)Confirm layout with user — too ambiguous

User can override each. Lock final layout for this slide.

Step 4: Compose build script

Generate ONE Python build script that:

  1. Imports helpers from ~/.claude/skills/md2ppt/scripts/pptx_helpers.py
  2. Imports style preset constants
  3. Renders any mermaid blocks via scripts/render_mermaid.sh to _assets/ next to output
  4. Hand-codes each slide — one slide = one section of # ============== Slide N ============== block + helper calls

CRITICAL: Do not write a generic loop over markdown blocks. Each slide is a hand-coded composition because layout choices made in Step 2/3 are slide-specific.

Save script to a project-local build dir.

Path discovery (in order):

  1. If a previous md2ppt build dir already exists under input.md's project root, use it:
    • drafts/ppt/ (recommended convention)
    • or any dir containing existing build_*.py produced by md2ppt
  2. Else if input.md is under a project root (detected by .git, CLAUDE.md, pyproject.toml, or similar marker), recommend creating <project_root>/drafts/ppt/
  3. Else save next to input.md (./build_<basename>.py)

Always confirm path with user before writing. Show the resolved path and ask "save build script to <path>/build_<basename>.py? [Y/n / 改其他路徑]".

Path is project convention, not skill-prescribed. Recommend drafts/ppt/ (or whatever the project uses for deck artifacts). Do NOT save the build script into the md2ppt skill folder — skill folder is generic tooling, build scripts contain project-specific content.

See examples/build_quarterly_review.py for reference structure.

Step 5: Render

bash
~/.venv_pptx/bin/python <build_script_path>

Should print OK → <output.pptx> and slide count.

Step 6.5: Self-check (optional, requires LibreOffice)

Skip silently if soffice not installed. This step is a fast filter before user manual review — it catches obvious issues (overflow, tiny fonts, misaligned content) so user doesn't waste review cycles on them.

Render preview PNGs
bash
SOFFICE="$(which soffice 2>/dev/null || echo /Applications/LibreOffice.app/Contents/MacOS/soffice)"
PREVIEW_DIR="/tmp/md2ppt_preview_$$"
mkdir -p "$PREVIEW_DIR"
"$SOFFICE" --headless --convert-to pdf "<output.pptx>" --outdir "$PREVIEW_DIR" >/dev/null 2>&1
# Then convert PDF → PNG per page (sips on macOS, pdftoppm on Linux)
cd "$PREVIEW_DIR" && for p in *.pdf; do
    sips -s format png "$p" --out "${p%.pdf}.png" >/dev/null 2>&1 \
        || pdftoppm -png -r 100 "$p" "${p%.pdf}"
done
ls "$PREVIEW_DIR"/*.png

(Alternative: soffice --headless --convert-to png directly, but PDF intermediate gives more reliable per-page splitting.)

Read each PNG and check

For each slide PNG, use Read tool. Check for these patterns:

IssueVisual signalFix
Text overflow (off slide bounds)Text cut off at edge / extends past visible areaReduce font size OR split slide OR shorten text
Tiny font (< 12pt rendered)Text barely readable at typical projector zoomBump size= in helper call
Emoji visible❌ ✅ 🔴 ⚠️ characters presentGrep build script + replace with text/color
Table col widths wrongOne column squeezed, others huge whitespaceSet col_widths=[Inches(N), ...] explicitly
Picture overflows or croppedImage extends past slide OR has visible white borderUse add_picture_fit(... max_height=) or vertical_center_in
Excessive bottom whitespaceMore than 30% of slide is empty after contentvertical_center_in OR scale content up OR remove blank space
Layout placeholder + hand-coded overlapTwo title-like elements visible (placeholder default text shows through)Pick layout with no placeholders OR explicitly clear placeholders
Template chrome hidden by white backgroundNo logo / page number on slides that should have themRemove any full-slide white rect; helpers should not add background fill
Fix loop

For each finding:

  1. Identify slide # + helper call in build script
  2. Propose specific patch (with exact Edit old_string / new_string)
  3. Apply via Edit
  4. Re-render pptx
  5. Re-render preview PNG
  6. Re-check the affected slide

Maximum 3 self-check retries per file. After 3 retries, stop auto-fix and hand off to user (Step 6).

Report to user

Before Step 6 manual review, report:

  • Total slides checked: N
  • Issues auto-fixed: X (list per slide)
  • Issues remaining after max retries: Y (list per slide, suggested manual action)
  • Self-check is a filter, not authoritative — user manual review still required.
Cleanup
bash
rm -rf "$PREVIEW_DIR"

Step 6: Preview + iterate

Tell user the output path. Ask: open and review, report back per-slide issues.

For each issue user reports:

  • Identify which slide # (use slide content to locate the helper call in build script)
  • Propose specific patch (font size up, picture fit center, table col widths, remove emoji, etc.)
  • Apply via Edit to the build script
  • Re-render

Maximum 5 iterations before stopping and asking user for higher-level redesign.

Common patches user requests:

User feedbackPatch
「字體太小」bump size= in add_textbox / add_bullets / add_table from 12-14 → 14-16
「emoji 拔掉」grep build script for ❌ ✅ ⚠️ 🔴 etc, replace with text
「圖太大跑版」switch to add_picture_fit(... vertical_center_in=(top, bottom))
「表格欄寬不對」set explicit tbl.columns[i].width = Inches(N) after table creation
「下面留白太空」use vertical_center_in OR add filler textbox OR scale image up
「拼字錯誤」direct edit to that string in build script

Step 7: Persist + (optional) lock to deliverables

Build script stays in drafts/ppt/ (or wherever user invoked from).

Ask user: ready to lock into deliverables/?

  • Yes → mv .md and .pptx to deliverables/YYYY-MM-DD_<topic>.{md,pptx} (per project naming convention)
  • No → leave in drafts

Build script always stays in drafts/ppt/ — regenerable via python build_<topic>.py after content edits.

Style Presets

Available in scripts/pptx_helpers.py constants:

corporate_blue (default)

python
FONT       = "PingFang TC"
FONT_MONO  = "Menlo"
COLOR_TITLE  = RGBColor(0x1F, 0x3A, 0x5F)   # 深藍
COLOR_TEXT   = RGBColor(0x21, 0x21, 0x21)
COLOR_ACCENT = RGBColor(0xC0, 0x39, 0x2B)   # 紅
COLOR_OK     = RGBColor(0x27, 0xAE, 0x60)
COLOR_WARN   = RGBColor(0xE6, 0x7E, 0x22)
COLOR_MUTED  = RGBColor(0x7F, 0x8C, 0x8D)
COLOR_BAR    = RGBColor(0x34, 0x98, 0xDB)

Slide size: 16:9 (13.333 × 7.5 inches).

minimal_dark

(Future) — black background, single accent color, larger font.

Decision Frameworks

When to use mermaid PNG vs ASCII monospace

DiagramChoose
Sequence diagrammermaid PNG (rendering > ASCII)
Linear flowchart (≤ 5 nodes)ASCII OK (compact + readable in monospace)
Linear flowchart (> 5 nodes, LR)mermaid PNG
Hierarchical / nested boxesmermaid PNG
State machinemermaid PNG
Directory treeASCII (tree structure native to monospace)
Single arrow chain A → B → CASCII inline (no need for diagram)

When to split a slide

A slide is too packed if any:

  • 12 bullets at top level

  • Table > 8 rows OR > 5 columns at default font
  • Image height > 5.5 inches AND has supporting text
  • 3 distinct content blocks (image + table + para + bullets)

Split strategy:

  • For tables: split rows by category (e.g. "受影響" / "不受影響" → 2 slides)
  • For long bullets: group into 2-3 themed slides
  • For image + supporting text: 1 slide image-only + 1 slide text-only

Anti-patterns

  • ❌ Generic markdown parser that loops over blocks — produces ugly, unbalanced slides. Each slide deserves hand-coded composition.
  • ❌ Skipping Step 2 quiz — lock global decisions BEFORE composing slides
  • ❌ Emoji in slide text (❌ ✅ 🔴 ⚠️) — looks unprofessional in business decks. Use text labels ("受影響" / "不受影響") or color (red / green) instead.
  • ❌ ASCII art > 20 lines — too small to read in projector. Convert to mermaid PNG or split.
  • ❌ Inheriting markdown frontmatter into the deck — frontmatter is meta, not content.
  • ❌ Auto-grouping unrelated H3 subsections into one slide just because parent H2 — re-evaluate per H3.
  • ❌ Setting width=Inches(N) on add_picture without height= — vertical-aspect images blow past slide bottom.
  • ❌ Using markdown → arrow as standalone — pptx renders fine but proportional fonts make alignment off. Use full-width → only in monospace context.
  • ❌ Forgetting tbl.columns[i].width = Inches(N) after add_table — default equal-width often wrong (e.g. # column should be narrow).

Self-check anti-patterns

  • ❌ Treating Step 6.5 as final approval. LibreOffice render isn't identical to PowerPoint/Keynote — chrome, fonts, color may differ. User manual review (Step 6) is always the last gate.
  • ❌ Letting self-check retry > 3 times. Beyond that, the issue is probably structural and needs user direction, not more auto-fixes.
  • ❌ Forgetting to cleanup $PREVIEW_DIR — /tmp fills up over many runs.

Important Rules

  1. Hand-code per-slide. No generic auto-conversion. The build script is a deliberate composition.
  2. Always quiz user in Step 2 before composing. No silent default choices.
  3. add_picture_fit over raw add_picture. Always pass max_width and max_height to prevent overflow.
  4. vertical_center_in for slides with one centered figure. Avoids bottom whitespace.
  5. Set table columns[i].width explicitly. Default equal-width tables look bad with mixed col content.
  6. Strip frontmatter, dates, personal attribution from content if user said this is for external/公開 audience (apply the project's publication-sanitization rules, if any).
  7. Build script lives in the invoking project's drafts area (e.g. drafts/ppt/), NEVER in the md2ppt skill folder. Deliverables dir is for the rendered .pptx artifact only — build script stays in drafts.
  8. Re-render is fast. Iterate freely with user — don't over-think the first pass.
  9. Mermaid LR over TD for multi-step flows — slide 16:9 favors horizontal.
  10. Stop iterating after 5 rounds. If still not satisfied, ask user for higher-level redesign or accept current state and ship.

Self-check (Step 6.5) additional rules

  1. Self-check is a filter, not authoritative. Final visual approval always rests with user manual review (Step 6). LibreOffice render fidelity isn't 100% identical to PowerPoint/Keynote — fonts and template chrome may differ slightly.
  2. Skip silently if soffice missing. Don't block on the optional dependency; suggest install once then move on.
  3. Max 3 self-check retries. Beyond that, hand off remaining issues to user with suggested actions.
  4. Cleanup preview PNGs after Step 6.5. Don't pollute /tmp; remove $PREVIEW_DIR before user review starts.

Output schema

<output_dir>/
├── <input>.pptx              ← rendered deck
├── _assets/                  ← mermaid PNGs (if any)
│   ├── diag_<hash>.mmd
│   └── diag_<hash>.png
└── build_<basename>.py       ← reusable build script

Reported to user:

  • pptx file path
  • slide count
  • mermaid PNGs generated count (if any)
  • build script path

Brand template (ad-hoc, optional)

If user wants the deck to inherit a brand template's theme / chrome / layout (e.g. company-issued .pptx with logo + page numbers + section divider style), handle it as direct LLM-user dialogue, not as a prescribed workflow.

Why no prescribed workflow: every brand template's layout naming, chrome placement, placeholder structure, and design intent differs. Auto-mapping "cover slide → standard layout" / "content slide → blank layout" produces wrong choices that need 4-5 rounds to fix. LLM + user inspecting the template together is faster and more correct.

Helper primitives available in scripts/pptx_helpers.py:

  • init_deck_from_template(path) — open template, strip its existing slides, return a Presentation that inherits theme + masters + layouts
  • list_template_layouts(path) — print all layouts (useful for inspection before writing build script)
  • add_blank_from_template(prs, layout_name="空白") — add slide using a specific template layout. Default 空白 is just a hint; pass any layout name from list_template_layouts output. Clears placeholder default text.
  • add_cover_from_template(prs, layout_name=..., title=..., subtitle=...) — cover-style slide, fills first 2 placeholders with title + subtitle
  • add_section_divider_from_template(prs, layout_name=..., title=...) — section divider, fills first placeholder with title

Recommended ad-hoc dialogue:

  1. User asks to apply brand template
  2. LLM runs list_template_layouts(<path>) to inspect, shows output to user
  3. User identifies which layout matches their cover / section divider / content / Q&A
  4. LLM writes a fresh build script using init_deck_from_template + the chosen layout names per slide type
  5. Iterate per-slide as needed (chrome overlap with hand-coded textboxes is the most common issue)

examples/build_quarterly_review_branded.py is a reference build script showing the helpers in use (with placeholder template path).

Always:

  • Pass template path via os.environ.get('MD2PPT_BRAND_TEMPLATE', '<relative-path>') or CLI arg — never hardcoded
  • Skip the helper white-rect-background trap: the helpers do NOT add a white rectangle, so template chrome shows through
  • Beware placeholder default text ("按一下以新增標題") — clear with add_blank_from_template (default behavior) or skip layouts that have placeholders for content slides (typically 空白 or similar layouts have 0 placeholders)

References

  • scripts/pptx_helpers.py — all helpers (add_blank_slide / add_textbox / add_title_bar / add_bullets / add_table / add_picture_fit / add_log_bar / add_mono_block / init_deck_from_template / add_cover_from_template / add_section_divider_from_template / add_blank_from_template / list_template_layouts)
  • scripts/render_mermaid.sh — mmdc wrapper with caching
  • scripts/md_analyze.py — pre-analyze input.md
  • examples/build_quarterly_review.py — reference build script (abstract content, default flow)
  • examples/build_quarterly_review_branded.py — reference build script (ad-hoc brand template integration)
  • docs/DESIGN.md — design rationale + history

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Md2ppt AI 技能有什么作用?

Use when the user wants to turn a Markdown report into a presentation-quality .pptx via interactive design decisions and a reusable hand-coded build script. Drives pre-analysis, global style choices, optional per-slide layout dialogue, python-pptx composition, and optional LibreOffice render self-check. NOT a generic auto-converter, NOT for PDF output, and NOT a fixed brand-template pipeline — brand integration is handled ad hoc through helper primitives.

为什么在 TypingMind 中使用 Md2ppt?

因为您只需安装一次,就能搭配任何模型使用。Md2ppt 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Md2ppt?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/KerberosClaw/kc_ai_skills/tree/main/md2ppt。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Md2ppt?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Md2ppt 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Md2ppt 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Md2ppt AI 技能免费吗?

是的。KerberosClaw 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇