AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
fix: PPTX read-back keeps soft line breaks; page types match whole words; beautify keeps run emphasis
hugohe3c71d9e738088
diff --git a/skills/ppt-master/scripts/beautify_inventory.py b/skills/ppt-master/scripts/beautify_inventory.pyindex 658cae12..3c4b00af 100644--- a/skills/ppt-master/scripts/beautify_inventory.py+++ b/skills/ppt-master/scripts/beautify_inventory.py@@ -173,6 +173,12 @@ def _summary_view(inventory: dict) -> dict:"slide_index": slide.get("slide_index"),"page_type": slide.get("page_type"),"text_block_count": len(slide.get("text_blocks", [])),+ # Blocks include empty and decorative frames; the non-space+ # character count is the density signal.+ "text_char_count": sum(+ len("".join(str(block.get("text") or "").split()))+ for block in slide.get("text_blocks", [])+ ),"table_count": len(slide.get("tables", [])),"chart_count": len(slide.get("charts", [])),"diagram_count": len(slide.get("diagrams", [])),diff --git a/skills/ppt-master/scripts/pptx_ooxml/analyzer.py b/skills/ppt-master/scripts/pptx_ooxml/analyzer.pyindex 776e4b41..578bad49 100644--- a/skills/ppt-master/scripts/pptx_ooxml/analyzer.py+++ b/skills/ppt-master/scripts/pptx_ooxml/analyzer.py@@ -2,6 +2,7 @@from __future__ import annotations+import reimport zipfilefrom pathlib import Pathfrom typing import Any@@ -175,16 +176,26 @@ def _text_metrics(container: ET.Element, paragraph_count: int) -> dict[str, Any]}-def _classify_page_type(index: int, total: int, text: str, slots: list[dict[str, Any]]) -> str:+def _has_keyword(text: str, keywords: tuple[str, ...]) -> bool:+ """Match Latin keywords as whole words and CJK keywords across line breaks."""normalized = text.lower()+ compact = re.sub(r"\s+", "", normalized) # vertical "目\n录" still reads 目录+ return any(+ re.search(rf"(?<![a-z]){re.escape(keyword)}(?![a-z])", normalized)+ if keyword.isascii() else keyword in compact+ for keyword in keywords+ )+++def _classify_page_type(index: int, total: int, text: str, slots: list[dict[str, Any]]) -> str:if index == 1:return "cover_candidate"- if index == total or any(keyword in normalized for keyword in THANKS_KEYWORDS):+ if index == total or _has_keyword(text, THANKS_KEYWORDS):return "ending_candidate"- if any(keyword in normalized for keyword in TOC_KEYWORDS):+ if _has_keyword(text, TOC_KEYWORDS):return "toc_candidate"# Body prose mentions "部分"/"part" too; only a short page reads as a divider.- if len(text) <= 120 and any(keyword in normalized for keyword in CHAPTER_KEYWORDS):+ if len(text) <= 120 and _has_keyword(text, CHAPTER_KEYWORDS):return "chapter_candidate"if len(slots) <= 2 and len(text) <= 80:return "chapter_candidate"diff --git a/skills/ppt-master/scripts/source_to_md/ppt_to_md.py b/skills/ppt-master/scripts/source_to_md/ppt_to_md.pyindex 56192d6d..1a5f0f50 100644--- a/skills/ppt-master/scripts/source_to_md/ppt_to_md.py+++ b/skills/ppt-master/scripts/source_to_md/ppt_to_md.py@@ -63,6 +63,7 @@ if not _HELP_REQUESTED:from pptx.enum.action import PP_ACTIONfrom pptx.enum.shapes import MSO_SHAPE_TYPEfrom pptx.oxml.ns import qn+ from pptx.text.text import _Runexcept ImportError:print("[ERROR] python-pptx not installed. Run: pip install python-pptx", file=sys.stderr)sys.exit(1)@@ -302,7 +303,15 @@ def _paragraph_to_markdown(parts.append(f"{lead}[{display}]({current_url}){trail}")has_run_hyperlink = False- for run in paragraph.runs:+ for child in paragraph._p:+ tag = child.tag.rsplit("}", 1)[-1] if isinstance(child.tag, str) else ""+ if tag == "br":+ # A soft line break inside the paragraph; python-pptx's runs skip it.+ current_text += "\n"+ continue+ if tag != "r":+ continue+ run = _Run(child, paragraph)url = _run_url(run, shape)if url:has_run_hyperlink = Truediff --git a/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py b/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.pyindex 32b9d44d..55223e58 100644--- a/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py+++ b/skills/ppt-master/scripts/tests/test_dogfood_leaves_fixes.py@@ -26,6 +26,7 @@ if str(BACKEND_DIR) not in sys.path:import pdf_to_md # noqa: E402import doc_to_md # noqa: E402+import ppt_to_md # noqa: E402import web_to_md # noqa: E402from svg_to_pptx.drawingml.converter import convert_svg_to_slide_shapes # noqa: E402from svg_to_pptx.drawingml.utils import project_filter_errors # noqa: E402@@ -397,6 +398,25 @@ class DocxIntakeTests(unittest.TestCase):self.assertIn("[^2]: Theatre closed until Winter 2026.", markdown)+class BeautifyReadbackTests(unittest.TestCase):+ def test_toc_and_chapter_keywords_match_whole_words(self) -> None:+ toc = "吉林省自然资源厅 Department of Natural Resources\n目\n录\n出台背景\n政策依据"+ self.assertEqual(_classify_page_type(2, 20, toc, [{}] * 8), "toc_candidate")+ prose = "Quality assurance for the aquarium sector " * 4+ self.assertEqual(_classify_page_type(5, 20, prose, [{}] * 4), "content_candidate")++ def test_soft_line_break_survives_readback(self) -> None:+ from pptx import Presentation+ from pptx.util import Inches++ deck = Presentation()+ slide = deck.slides.add_slide(deck.slide_layouts[6])+ box = slide.shapes.add_textbox(Inches(1), Inches(1), Inches(4), Inches(1))+ box.text_frame.text = "Section one\vOverall duties" # \v writes <a:br/>+ markdown = ppt_to_md.text_frame_to_markdown(box.text_frame, box)+ self.assertIn("Section one\nOverall duties", markdown)++class SlideSizeTypeTests(unittest.TestCase):def test_standard_ratios_keep_their_token(self) -> None:self.assertEqual(_slide_size_type(12192000, 6858000), "screen16x9")diff --git a/skills/ppt-master/workflows/profiles/beautify-pptx.md b/skills/ppt-master/workflows/profiles/beautify-pptx.mdindex 20a445c6..543743c1 100644--- a/skills/ppt-master/workflows/profiles/beautify-pptx.md+++ b/skills/ppt-master/workflows/profiles/beautify-pptx.md@@ -16,7 +16,7 @@ description: Generate profile for 1:1, content-faithful re-layout of an existingExisting `.pptx` + beautify intent ("把这份 PPT 美化一下" / "make this deck look better"), re-layout intent ("重新排版这份 PPT,内容别动"), or paste-back intent ("重排后我要把元素贴回原来的模板").-**Hard rule — content is frozen**: every source text string is preserved exactly (no add / remove / reword / reorder); freedom lives only in layout, hierarchy, spacing, and rhythm.+**Hard rule — content is frozen**: every source text string is preserved exactly (no add / remove / reword / reorder); freedom lives only in layout, hierarchy, spacing, and rhythm. Run-level emphasis (words the source colors or bolds) is hierarchy to keep: the same words stand out, restyled in the effective palette.**Hard rule — not a patch, not a fill**: this regenerates a native deck through the selected runtime; it never edits the source in place, is not Edit Native PPTX, and never parses a third-party template for text-only substitution (the rejected #53 direction). It is the inverse of a `replication_mode: mirror` template ([`executor-structured.md`](../../references/executor-structured.md) §1.1), which keeps layout and edits text. When the authoritative input is a raster page roster whose visible layout must be preserved, activate the Quick-only [`image-to-pptx.md`](./image-to-pptx.md) instead; the two fidelity profiles never compose.@@ -50,7 +50,7 @@ python3 ${SKILL_DIR}/scripts/project_manager.py import-sources <project_path> <s**Hard rule — regenerate visuals, do not carry them over**: charts / tables / images are rebuilt from their data in the effective style, never spliced byte-for-byte; data values are frozen, only rendering is the deck's own; pictures are reused but re-laid-out. A user who wants an original element verbatim copies it across themselves.-**Optional source-SVG visual reference**: when the deck has complex vector decoration or a visual language colors/fonts cannot capture, build a read-only reference package for understanding style, not a carry-over path:+**Optional source-SVG visual reference**: when the deck has complex vector decoration, run-level emphasis (`sources/<stem>.md` and the inventory carry no run styles), or a visual language colors/fonts cannot capture, build a read-only reference package for understanding style, not a carry-over path:```bashpython3 ${SKILL_DIR}/scripts/pptx_to_svg.py <project_path>/sources/<source.pptx> -o <project_path>/analysis/source_svg_import@@ -65,7 +65,7 @@ Use the cleaned `svg-flat/slide_*.svg` pages and `svg-flat_vector_asset_inventorpython3 ${SKILL_DIR}/scripts/beautify_inventory.py <project_path>/analysis/<stem>.slide_library.json --images <project_path>/images/image_manifest.json -o <project_path>/analysis/beautify_inventory.json```-Omit `--images` when no pictures were extracted. It joins `text_blocks`, `tables`, `charts`, `diagrams` (SmartArt nodes + hierarchy + source layout), and `images` (bound through `image_manifest` `occurrences[].slide_index`, with geometry and `usage_count`) per slide with frozen values inlined, and emits empty `ignored` and `needs_confirmation` arrays to fill with judgment: `ignored` — hidden slides/shapes, master-only text, full-slide template-skin or fully covered pictures, image crop/opacity/rotation/mask; `needs_confirmation` — unreadable SmartArt, combo / dual-axis / waterfall charts, merged-cell or multi-header tables, density outliers (overcrowded or near-empty). SmartArt keeps its wording and relationships and is redrawn as ordinary editable shapes, never regenerated natively.+Omit `--images` when no pictures were extracted. It joins `text_blocks`, `tables`, `charts`, `diagrams` (SmartArt nodes + hierarchy + source layout), and `images` (bound through `image_manifest` `occurrences[].slide_index`, with geometry and `usage_count`) per slide with frozen values inlined, and emits empty `ignored` and `needs_confirmation` arrays to fill with judgment: `ignored` — hidden slides/shapes, master-only text, full-slide template-skin or fully covered pictures, image crop/opacity/rotation/mask; `needs_confirmation` — unreadable SmartArt, combo / dual-axis / waterfall charts, merged-cell or multi-header tables, density outliers (overcrowded or near-empty; `--summary` counts each page's `text_char_count`). SmartArt keeps its wording and relationships and is redrawn as ordinary editable shapes, never regenerated natively.**Mandatory — bounded inventory reads**: the complete inventory is the validation ledger, not the authoring prompt. Read `beautify_inventory.py <inventory> --summary`, then `--page <N>`, adding `--with-geometry` only for structural ambiguity; never bulk-read either complete file during authoring.