Skip to content

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(svg-quality): detect fragmented prose text frames

hugohe33d7101a73ba5
diff --git a/skills/ppt-master/references/executor-base.md b/skills/ppt-master/references/executor-base.md
index 2cbe6c7d..604e65f0 100644
--- a/skills/ppt-master/references/executor-base.md
+++ b/skills/ppt-master/references/executor-base.md
@@ -59,7 +59,7 @@ The §IX wording and sourced facts remain authoritative. Do not rewrite, drop, o
**Per-block expression**: render each `design_spec.md §IX Content` block in its written texture — a full-sentence block as wrapped prose, a fragment/label block as bullets/keywords. **Never split a full-sentence block into a bullet list** — splitting loses the information that the block was continuous reasoning, not a set of parallel points; not because a bullet lays out easier, and not because an inherited template slot is shaped as a list. If a block carries no clear texture, infer the mode from its wording and the page layout.
-- **Prose render recipe**: use one `<text>` per paragraph. For wrapped lines, follow [`shared-standards-core.md`](./shared-standards-core.md) §4.2: sibling positioned `<tspan>` lines repeat the parent's exact `x`, effective font size, and one positive relative `dy`. Use roughly 1.4–1.5× line height for dense/small body and 1.6–2.0× for large or breathing text; keep the locked body size.
+- **Hard rule — one paragraph, one text frame**: use one `<text>` per prose paragraph, never one sibling `<text>` per visual line. Keep the first line as direct text; each later wrap is a direct `<tspan>` that repeats the parent `x`, keeps its effective font size, and uses one positive relative `dy`. An all-`<tspan>` form may start with `dy="0"`. Line height: 1.4–1.5× for dense/small body, 1.6–2.0× for large/breathing text.
- **Template precedence**: when an inherited template slot is a bullet list but the §IX block is prose, the prose wins — widen or reflow the container to hold the paragraph, or drop that card; do not pour the sentence back into the list slot.
- **Mode precedence**: the locked mode shapes voice / register, not §IX's authored titles or page order. When a `§IX` title is a user-authored topic label, keep it — do not upgrade it to an assertion just because the mode (e.g. `pyramid`) favors them; mode title-tendencies apply only to AI-drafted titles.
diff --git a/skills/ppt-master/references/shared-standards-core.md b/skills/ppt-master/references/shared-standards-core.md
index 6b0fba73..4a6603a6 100644
--- a/skills/ppt-master/references/shared-standards-core.md
+++ b/skills/ppt-master/references/shared-standards-core.md
@@ -571,7 +571,7 @@ These forms are needed only when the stated PPT behavior matters:
| Desired behavior | Required form |
|---|---|
-| One editable PPT text frame with mixed inline formatting | Put the logical line in one `<text>` with non-positional `<tspan>` children. A `<tspan>` with `x`/`y`/`dy` starts a new positioned line. Evenly `dy`-stacked lines that repeat the parent `<text>`'s `x` stay in one frame: equal effective `font-size` may flow in the current paragraph, while a font-size change, list marker, or accepted larger gap starts a new paragraph. An unmergeable gap or mismatched `x` flattens to separate frames. Separate `<text>` elements stay valid when separate frames are intended. |
+| One editable PPT text frame with mixed inline formatting or wrapped prose | Keep one logical paragraph in one `<text>`. Use non-positional `<tspan>` children for inline runs. Keep the first wrapped line as direct text and put each later line in a direct positioned `<tspan>` that repeats the parent `x` and uses positive relative `dy`; an all-`<tspan>` form may start with `dy="0"`. Same-size, evenly stacked lines flow in the current paragraph; a font-size change, list marker, or larger accepted gap starts another paragraph in that frame. Sibling `<text>` elements are forbidden as line breaks for one paragraph; they remain valid for semantically independent frames. |
| Stable object grouping or object-level animation anchor | Wrap the intended object in `<g id="...">`. Content grouping is **mandatory** per §4.3 — a top-level `<g id>` is also the animation anchor; it is not an optional convenience. |
| Native PowerPoint background promotion | Outside structured mode, the first eligible visual layer may be a direct full-canvas `<rect>` or one inside a simple single-child group. Its fill must have a registered native mapping (solid, linear/radial gradient, or preset pattern), and it must have no transform, filter, clip, rounding, or visible stroke. Export writes the fill as Slide `p:bg`; image elements remain pictures. Structured routes use the narrower explicit solid-background ownership contract in [`pptx-structure-interface.md`](./pptx-structure-interface.md). |
| Free-design / brand-only PowerPoint structure | Use `pptx_structure.mode: flat`. Keep every represented object Slide-local; export materializes one clean project-owned Master plus one Blank Layout from the current lock, removes stock content placeholders/Layout inventory, and retains only the standard date/footer/slide-number capability hooks. Do not author Master/Layout identities, layers, or placeholder slots. |
diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.py
index b1d04fe3..944fbaaa 100644
--- a/skills/ppt-master/scripts/svg_quality_checker.py
+++ b/skills/ppt-master/scripts/svg_quality_checker.py
@@ -442,6 +442,15 @@ _NON_VISUAL_SVG_TAGS = frozenset({
_BOUNDS_ATTR = 'data-pptx-bounds'
_BOUNDS_OVERFLOW_TOLERANCE = 1.0
_BOUNDS_OVERFLOW_ERROR_RATIO = 0.05
+_PARAGRAPH_LINE_GAP_MIN_RATIO = 0.9
+_PARAGRAPH_LINE_GAP_MAX_RATIO = 2.05
+_PARAGRAPH_LINE_X_TOLERANCE = 0.5
+_PARAGRAPH_LINE_MIN_TOTAL_CHARS = 12
+_PARAGRAPH_LINE_MIN_LONGEST_CHARS = 8
+_PARAGRAPH_LINE_TERMINATOR_RE = re.compile(r'[.!?。!?;;]["\'”’))]*$')
+_PARAGRAPH_LIST_MARKER_RE = re.compile(
+ r'^\s*(?:[•·・▪◦‣]\s*|[-–—*]\s+|\d+[.)、]\s+|[((]\d+[))]\s*)\S+'
+)
_LEGACY_PPTX_ATTRIBUTE_RENAMES = {
'data-pptx-module-bounds': _BOUNDS_ATTR,
'data-pptx-placeholder-bounds': _BOUNDS_ATTR,
@@ -2511,6 +2520,7 @@ class SVGQualityChecker:
self._check_module_bounds_contract(root, result)
self._check_text_output_geometry(root, result)
self._check_root_module_text_bounds(root, result)
+ self._check_fragmented_paragraph_text(root, result)
self._check_unmergeable_leading_text(root, result)
@classmethod
@@ -3393,6 +3403,179 @@ class SVGQualityChecker:
f"be normalized for PPT paragraph merging ({sample}{suffix})"
)
+ def _check_fragmented_paragraph_text(
+ self,
+ root: ET.Element,
+ result: Dict,
+ ) -> None:
+ """Warn on high-confidence prose lines split into sibling text frames."""
+ helpers = (
+ _parse_project_geometry_length,
+ _resolve_project_font_sizes,
+ )
+ if any(helper is None for helper in helpers):
+ return
+ try:
+ font_sizes = _resolve_project_font_sizes(root)
+ except ValueError:
+ return
+
+ parent_by_id = {
+ id(child): parent
+ for parent in root.iter()
+ for child in list(parent)
+ }
+ unchanged_groups = self._unchanged_txbody_group_ids(root)
+ style_properties = (
+ 'fill',
+ 'fill-opacity',
+ 'font-family',
+ 'font-style',
+ 'font-weight',
+ 'letter-spacing',
+ 'opacity',
+ 'stroke',
+ 'stroke-opacity',
+ 'stroke-width',
+ 'text-decoration',
+ )
+
+ def line_record(element: ET.Element) -> Dict | None:
+ if (
+ _local_name(element) != 'text'
+ or list(element)
+ or element.get('x') is None
+ or element.get('y') is None
+ or any(element.get(name) is not None for name in ('dx', 'dy'))
+ or element.get('transform') is not None
+ or self._is_hidden_element(element, parent_by_id)
+ or self._has_ancestor_id(
+ element,
+ parent_by_id,
+ unchanged_groups,
+ )
+ ):
+ return None
+ text = (element.text or '').strip()
+ compact_text = re.sub(r'\s+', '', text)
+ if (
+ not compact_text
+ or ('{{' in text and '}}' in text)
+ or _PARAGRAPH_LIST_MARKER_RE.match(text)
+ ):
+ return None
+ anchor = (
+ _effective_presentation_value(
+ element,
+ 'text-anchor',
+ parent_by_id,
+ )
+ or 'start'
+ ).strip().lower()
+ if anchor != 'start':
+ return None
+ try:
+ x = _parse_project_geometry_length(element.get('x'), 'x')
+ y = _parse_project_geometry_length(element.get('y'), 'y')
+ font_size = float(font_sizes[id(element)])
+ except (KeyError, TypeError, ValueError):
+ return None
+ if font_size <= 0:
+ return None
+ style = tuple(
+ (
+ _effective_presentation_value(
+ element,
+ name,
+ parent_by_id,
+ )
+ or ''
+ ).strip().lower()
+ for name in style_properties
+ )
+ return {
+ 'chars': len(compact_text),
+ 'font_size': font_size,
+ 'style': style,
+ 'text': text,
+ 'x': x,
+ 'y': y,
+ }
+
+ suspects: List[str] = []
+ for group in list(root):
+ if (
+ _local_name(group) != 'g'
+ or self._is_hidden_element(group, parent_by_id)
+ ):
+ continue
+ current_run: List[Dict] = []
+
+ def flush_run() -> None:
+ if len(current_run) < 2:
+ return
+ total_chars = sum(line['chars'] for line in current_run)
+ longest_line = max(line['chars'] for line in current_run)
+ if (
+ total_chars < _PARAGRAPH_LINE_MIN_TOTAL_CHARS
+ or longest_line < _PARAGRAPH_LINE_MIN_LONGEST_CHARS
+ ):
+ return
+ first = current_run[0]
+ last = current_run[-1]
+ suspects.append(
+ f'{_element_label(group)} x={first["x"]:.1f}, '
+ f'y={first["y"]:.1f}..{last["y"]:.1f}, '
+ f'{len(current_run)} lines'
+ )
+
+ for child in list(group):
+ line = line_record(child)
+ if line is None:
+ flush_run()
+ current_run = []
+ continue
+ if current_run:
+ previous = current_run[-1]
+ line_gap = line['y'] - previous['y']
+ same_frame = (
+ abs(line['x'] - previous['x'])
+ <= _PARAGRAPH_LINE_X_TOLERANCE
+ and line['style'] == previous['style']
+ and math.isclose(
+ line['font_size'],
+ previous['font_size'],
+ rel_tol=0.0,
+ abs_tol=1e-6,
+ )
+ and line_gap
+ >= line['font_size'] * _PARAGRAPH_LINE_GAP_MIN_RATIO
+ and line_gap
+ <= line['font_size'] * _PARAGRAPH_LINE_GAP_MAX_RATIO
+ and not _PARAGRAPH_LINE_TERMINATOR_RE.search(
+ previous['text']
+ )
+ )
+ if not same_frame:
+ flush_run()
+ current_run = []
+ current_run.append(line)
+ flush_run()
+
+ if not suspects:
+ return
+ sample = '; '.join(suspects[:3])
+ suffix = '' if len(suspects) <= 3 else f'; +{len(suspects) - 3} more'
+ result['warnings'].append(
+ f'Detected {len(suspects)} paragraph-like line run(s) split '
+ f'across sibling <text> elements ({sample}{suffix}). If each run '
+ 'is one prose paragraph, combine it into one <text>: keep its '
+ 'first line as direct text and use direct <tspan> children with '
+ 'the parent x and positive relative dy values for later lines. '
+ 'An all-<tspan> form may start with dy="0". Keep semantically '
+ 'independent text frames separate.'
+ )
+
@staticmethod
def _is_tspan(elem: ET.Element) -> bool:
return elem.tag == f'{{{SVG_NS}}}tspan'
diff --git a/skills/ppt-master/workflows/generate-pptx.md b/skills/ppt-master/workflows/generate-pptx.md
index 82ab38ce..ca594e0c 100644
--- a/skills/ppt-master/workflows/generate-pptx.md
+++ b/skills/ppt-master/workflows/generate-pptx.md
@@ -417,6 +417,7 @@ python3 ${SKILL_DIR}/scripts/svg_quality_checker.py <project_path> --stage final
- [x] Live preview started before the first SVG and kept available at the reported URL
- [x] P01 gate passed; remaining pages authored without checker calls
- [x] All SVGs generated to svg_output/
+- [x] Every wrapped prose paragraph uses one `<text>` frame with `<tspan>` line breaks
- [x] svg_quality_checker.py passed (0 errors)
- [x] Speaker notes generated at notes/total.md
```