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
feat(svg_to_pptx): add --merge-paragraphs for editable paragraph text frames
hugohe35fc622545ebd
diff --git a/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py b/skills/ppt-master/scripts/svg_finalize/flatten_tspan.pyindex 585b5dca..eb6bcd9f 100644--- a/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py+++ b/skills/ppt-master/scripts/svg_finalize/flatten_tspan.py@@ -173,8 +173,182 @@ def copy_text_attrs(dst_el.set("{http://www.w3.org/XML/1998/namespace}space", xml_space)-def flatten_text_with_tspans(tree: ET.ElementTree) -> bool:- """Flatten multi-line tspan text into independent text nodes when needed."""+PARAGRAPH_MARK_ATTR = "data-paragraph-line-height"+PARAGRAPH_SPACE_BEFORE_ATTR = "data-paragraph-space-before"+# Marks a line-break tspan as a SOFT break inside the current paragraph+# (SVG used dy to simulate text wrapping; the downstream converter should+# merge its runs into the previous <a:p> rather than start a new one).+PARAGRAPH_SOFT_BREAK_ATTR = "data-paragraph-soft-break"++# Tolerance for detecting "base line-height" vs "paragraph gap": dy values+# within ±DY_TOLERANCE_PX of each other are considered the same line-height.+DY_TOLERANCE_PX = 0.5+# Cap on dy / base ratio. Anything beyond this (e.g. a 5x gap) is rejected+# as a real section break that shouldn't merge into one text frame.+MAX_DY_MULTIPLIER = 3.0+++def _tspan_has_positional_descendant(tspan: ET.Element) -> bool:+ """Return True if any nested tspan inside this one carries x/y/dy."""+ for child in list(tspan):+ if child.tag != f"{{{SVG_NS}}}tspan":+ continue+ for k in ("x", "y", "dy"):+ if child.get(k) is not None:+ return True+ if _tspan_has_positional_descendant(child):+ return True+ return False+++def _classify_paragraph_block(+ text_el: ET.Element,+ is_svg_tag,+ is_new_line_tspan,+) -> tuple[float, list[float], list[bool]] | None:+ """Detect a mergeable paragraph block.++ Returns ``(base_line_height_px, extra_space_before_px_per_line,+ is_soft_break_per_line)`` if the children form a mergeable paragraph.+ Each list has one entry per direct-child tspan (line):++ - extra_space_before_px_per_line[i]: extra px above base line-height,+ used as <a:spcBef> on the downstream <a:p>. First entry is 0.+ - is_soft_break_per_line[i]: True if this line should merge into the+ previous <a:p> (SVG dy was simulating word-wrap); False if it starts+ a fresh <a:p>. First entry is always False (paragraph head).++ Conditions (all must hold):+ - No leading text directly under <text>.+ - Every direct child is a <tspan>.+ - Every direct-child tspan is a new-line tspan.+ - First line-break tspan has dy == 0 (or no dy).+ - All subsequent line-break tspans use positive dy (no <y>).+ - dy values cluster around a single minimum "base line-height";+ any larger dy must be ≤ MAX_DY_MULTIPLIER × base. Anything larger+ is treated as a section break and rejected.+ - Every line-break tspan that sets x repeats the parent <text>'s x.+ - No nested tspan inside any line carries x/y/dy.+ """+ base_x = parse_first_number(get_attr(text_el, "x"))+ if (text_el.text or "").strip():+ return None++ direct_tspans = [c for c in list(text_el) if is_svg_tag(c, "tspan")]+ direct_children_all = [c for c in list(text_el)]+ if len(direct_tspans) < 2:+ return None+ if len(direct_tspans) != len(direct_children_all):+ return None++ # First pass: validate per-line structural rules and collect dy values.+ dy_values: list[float] = [] # one per line (0 for first)+ for idx, tspan in enumerate(direct_tspans):+ if not is_new_line_tspan(tspan):+ return None++ t_y = get_attr(tspan, "y")+ if t_y is not None:+ return None++ t_x_raw = get_attr(tspan, "x")+ if t_x_raw is not None:+ t_x = parse_first_number(t_x_raw)+ if base_x is None or t_x is None or abs(t_x - base_x) > 1e-6:+ return None++ t_dy_raw = get_attr(tspan, "dy")+ t_dy = parse_first_number(t_dy_raw) if t_dy_raw is not None else None++ if idx == 0:+ if t_dy is not None and abs(t_dy) > 1e-6:+ return None+ dy_values.append(0.0)+ else:+ if t_dy is None or t_dy <= 0:+ return None+ dy_values.append(t_dy)++ if _tspan_has_positional_descendant(tspan):+ return None++ # Second pass: pick the base line-height as the minimum positive dy and+ # express each line's dy as base + extra space-before.+ positive_dys = [d for d in dy_values[1:] if d > 0]+ if not positive_dys:+ return None+ base = min(positive_dys)++ extras: list[float] = [0.0] # first line never has space-before+ soft_breaks: list[bool] = [False] # first line starts a paragraph+ for d in dy_values[1:]:+ if d + DY_TOLERANCE_PX < base:+ return None # below base — line overlap, not a paragraph+ if d > base * MAX_DY_MULTIPLIER + DY_TOLERANCE_PX:+ return None # gap too large — treat as section break+ extra = d - base+ if extra < 0:+ extra = 0.0+ # dy at the base line-height = soft break (SVG was simulating wrap);+ # dy strictly greater than base = hard paragraph break.+ is_soft = abs(extra) <= DY_TOLERANCE_PX+ extras.append(0.0 if is_soft else extra)+ soft_breaks.append(is_soft)++ return base, extras, soft_breaks+++def _emit_mergeable_paragraph(+ text_el: ET.Element,+ base_dy: float,+ extras: list[float],+ soft_breaks: list[bool],+) -> None:+ """Rewrite text_el in place so it stays a single <text> with paragraph rows.++ The base line-height goes on the parent <text> via PARAGRAPH_MARK_ATTR.+ Each direct-child tspan is normalized: x/y/dy stripped; inline-run+ styling and nested tspans are preserved. Per-tspan attrs:+ - PARAGRAPH_SOFT_BREAK_ATTR="1" on tspans that should be appended to+ the previous <a:p> downstream (SVG used dy to simulate wrap)+ - PARAGRAPH_SPACE_BEFORE_ATTR on tspans that open a new paragraph+ with an extra gap (omitted when 0)+ """+ text_el.set(PARAGRAPH_MARK_ATTR, format_number(base_dy))++ extras_iter = iter(extras)+ soft_iter = iter(soft_breaks)+ for tspan in list(text_el):+ if tspan.tag != f"{{{SVG_NS}}}tspan":+ continue+ for k in ("x", "y", "dy"):+ if k in tspan.attrib:+ del tspan.attrib[k]+ try:+ extra = next(extras_iter)+ soft = next(soft_iter)+ except StopIteration:+ extra = 0.0+ soft = False+ if soft:+ tspan.set(PARAGRAPH_SOFT_BREAK_ATTR, "1")+ elif extra > 1e-6:+ tspan.set(PARAGRAPH_SPACE_BEFORE_ATTR, format_number(extra))+++def flatten_text_with_tspans(+ tree: ET.ElementTree,+ merge_paragraphs: bool = False,+) -> bool:+ """Flatten multi-line tspan text into independent text nodes when needed.++ When ``merge_paragraphs`` is True, mergeable paragraph blocks (same x,+ dy clustered around one base line-height) are kept as a single <text>+ so downstream conversion emits one editable PowerPoint text frame+ with multiple <a:p>. Default False preserves the original behavior:+ every line-break tspan becomes its own <text>, matching the SVG's+ pixel-fidelity contract.+ """root = tree.getroot()parent_map = {c: p for p in root.iter() for c in p}changed = False@@ -224,6 +398,21 @@ def flatten_text_with_tspans(tree: ET.ElementTree) -> bool:if not needs_flatten:continue+ # Paragraph fast-path (opt-in via merge_paragraphs=True): if the+ # children form a mergeable paragraph (same x, dy clustered around+ # one base line-height with optional paragraph gaps, no nested+ # positional tspans), keep as one <text> and let the downstream+ # converter emit multiple <a:p> runs. When disabled, every tspan+ # gets its own independent <text> so the SVG's exact line layout+ # is preserved in PowerPoint.+ if merge_paragraphs:+ paragraph = _classify_paragraph_block(text_el, is_svg_tag, is_new_line_tspan)+ if paragraph is not None:+ base_dy, extras, soft_breaks = paragraph+ _emit_mergeable_paragraph(text_el, base_dy, extras, soft_breaks)+ changed = True+ continue+base_x = parse_first_number(get_attr(text_el, "x")) or 0.0base_y = parse_first_number(get_attr(text_el, "y")) or 0.0cur_x, cur_y = base_x, base_y@@ -377,7 +566,11 @@ def _create_text_element_from_line(return ne-def process_svg_file(src_path: str, dst_path: str) -> bool:+def process_svg_file(+ src_path: str,+ dst_path: str,+ merge_paragraphs: bool = False,+) -> bool:"""Flatten eligible tspan lines in one SVG file."""try:tree = ET.parse(src_path)@@ -385,7 +578,7 @@ def process_svg_file(src_path: str, dst_path: str) -> bool:print(f"[WARN] Failed to parse {src_path}: {e}")return False- changed = flatten_text_with_tspans(tree)+ changed = flatten_text_with_tspans(tree, merge_paragraphs=merge_paragraphs)# Ensure destination directory existsos.makedirs(os.path.dirname(dst_path), exist_ok=True)@@ -454,6 +647,17 @@ def main() -> None:action="store_true",help="Run in interactive prompt mode to input paths",)+ parser.add_argument(+ "--merge-paragraphs",+ action="store_true",+ default=False,+ help=(+ "Opt-in: merge mergeable paragraph blocks (same x, dy clustered "+ "around one base line-height) into a single <text> annotated for "+ "downstream multi-<a:p> conversion. Default off — every line-break "+ "tspan becomes its own <text>, preserving SVG pixel fidelity."+ ),+ )args = parser.parse_args()@@ -484,7 +688,7 @@ def main() -> None:src = os.path.join(root, f)dst = os.path.join(out_base, rel_root, f) if rel_root != "." else os.path.join(out_base, f)total += 1- changed = process_svg_file(src, dst)+ changed = process_svg_file(src, dst, merge_paragraphs=args.merge_paragraphs)if changed:changed_count += 1print(f"Processed {total} SVG(s). With <tspan> flattened: {changed_count}.")@@ -493,7 +697,7 @@ def main() -> None:src = inpif out_base is None:out_base = _compute_default_out_base(src)- changed = process_svg_file(src, out_base)+ changed = process_svg_file(src, out_base, merge_paragraphs=args.merge_paragraphs)print(f"Written: {out_base} (flattened: {changed})")diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_context.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_context.pyindex dc459fc6..cc132fb8 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_context.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_context.py@@ -46,6 +46,10 @@ class ConvertContext:# Top-level <g id="..."> groups, recorded as (shape_id, svg_id) in z-order.# Used by the PPTX builder to emit per-element entrance timing.anim_targets: list = field(default_factory=list)+ # Opt-in flag (default off): merge mergeable paragraph blocks into one+ # editable text frame with multiple <a:p>. Off preserves the original+ # one-line-per-textbox behavior and the SVG's exact pixel layout.+ merge_paragraphs: bool = Falsedef next_id(self) -> int:"""Allocate the next shape ID."""@@ -145,6 +149,7 @@ class ConvertContext:depth=self.depth + 1,# anim_targets is intentionally a fresh list on the child;# only the root-level context's list is read by the builder.+ merge_paragraphs=self.merge_paragraphs,)def sync_from_child(self, child_ctx: ConvertContext) -> None:diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.pyindex f662b9b5..09d13fed 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_converter.py@@ -391,6 +391,7 @@ def convert_svg_to_slide_shapes(svg_path: Path,slide_num: int = 1,verbose: bool = False,+ merge_paragraphs: bool = False,) -> tuple[str, dict[str, bytes], list[dict[str, str]], list]:"""Convert an SVG file to a complete DrawingML slide XML.@@ -398,6 +399,10 @@ def convert_svg_to_slide_shapes(svg_path: Path to the SVG file.slide_num: Slide number (for naming).verbose: Print progress info.+ merge_paragraphs: Opt-in. When True, mergeable paragraph blocks+ (same x, dy clustered around one base line-height) become a+ single editable text frame with multiple <a:p>. Default False+ preserves the SVG's exact line layout (one textbox per line).Returns:(slide_xml, media_files, rel_entries, anim_targets) where:@@ -429,8 +434,10 @@ def convert_svg_to_slide_shapes(# and an x-anchored tspan would render in the wrong column. finalize_svg# does the same flattening on disk; doing it here keeps native pptx output# correct when reading raw svg_output/.+ # merge_paragraphs (opt-in) additionally folds mergeable paragraph blocks+ # into a single annotated <text> for downstream multi-<a:p> conversion.from .tspan_flattener import flatten_positional_tspans- if flatten_positional_tspans(tree) and verbose:+ if flatten_positional_tspans(tree, merge_paragraphs=merge_paragraphs) and verbose:print(' Flattened positional <tspan> into independent <text>')unsupported = _collect_unsupported_visuals(root)@@ -442,7 +449,12 @@ def convert_svg_to_slide_shapes()defs = collect_defs(root)- ctx = ConvertContext(defs=defs, slide_num=slide_num, svg_dir=Path(svg_path).parent)+ ctx = ConvertContext(+ defs=defs,+ slide_num=slide_num,+ svg_dir=Path(svg_path).parent,+ merge_paragraphs=merge_paragraphs,+ )shapes: list[str] = []converted = 0diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.pyindex 3167131d..c6cc9210 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py@@ -1043,7 +1043,66 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:'stroke_width': stroke_width,'stroke_opacity': stroke_opacity,}- runs = _build_text_runs(elem, parent_attrs)++ # Paragraph mode: flatten_tspan marks <text> with data-paragraph-line-height+ # when its direct-child tspans form a mergeable paragraph (same x, dy+ # clustered around one base line-height). Each direct tspan becomes one+ # <a:p> so the paragraph survives as a single editable text frame.+ # Per-line data-paragraph-space-before encodes paragraph gaps (extra dy+ # above the base line-height) for the corresponding <a:p>.+ # Paragraph mode is opt-in via ctx.merge_paragraphs. When off, ignore+ # any data-paragraph-* markers and fall through to the original+ # one-text-per-tspan path so the SVG's pixel layout is preserved.+ line_height_attr = elem.get('data-paragraph-line-height') if ctx.merge_paragraphs else None+ line_height_px = _f(line_height_attr) if line_height_attr is not None else None+ paragraph_runs: list[list[dict[str, Any]]] | None = None+ paragraph_space_before: list[float] = []+ # Per-tspan widths (visual lines as the deck author drew them) regardless+ # of how many merge into one <a:p>; used to size the textbox so PowerPoint+ # has room to wrap text to the SVG's original line widths.+ visual_line_widths: list[float] = []+ if line_height_px is not None and line_height_px > 0:+ preserve_space = _preserves_space(elem)+ paragraph_runs = []+ for child in elem:+ if child.tag != f'{{{SVG_NS}}}tspan':+ continue+ line_runs = _collect_tspan_runs(child, parent_attrs, preserve_space)+ if line_runs and not preserve_space:+ line_runs[0]['text'] = line_runs[0]['text'].lstrip(' ')+ line_runs[-1]['text'] = line_runs[-1]['text'].rstrip(' ')+ line_runs = [r for r in line_runs if r['text']]+ if not line_runs:+ continue+ visual_line_widths.append(+ estimate_text_width(+ ''.join(r['text'] for r in line_runs),+ font_size,+ font_weight,+ )+ )+ soft_break = child.get('data-paragraph-soft-break') == '1'+ if soft_break and paragraph_runs:+ # Append to the previous paragraph. Ensure a space joins the+ # two segments (SVG used a dy line-break, not punctuation).+ prev = paragraph_runs[-1]+ if prev and not prev[-1]['text'].endswith(' ') \+ and not line_runs[0]['text'].startswith(' '):+ prev[-1] = {**prev[-1], 'text': prev[-1]['text'] + ' '}+ prev.extend(line_runs)+ else:+ paragraph_runs.append(line_runs)+ sb_attr = child.get('data-paragraph-space-before')+ paragraph_space_before.append(_f(sb_attr) if sb_attr else 0.0)+ if not paragraph_runs:+ paragraph_runs = None+ paragraph_space_before = []+ visual_line_widths = []++ if paragraph_runs is not None:+ runs = [r for line in paragraph_runs for r in line]+ else:+ runs = _build_text_runs(elem, parent_attrs)if not runs:return None@@ -1053,8 +1112,24 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:return None# Estimate text dimensions- text_width = estimate_text_width(full_text, font_size, font_weight) * 1.15- text_height = font_size * 1.5+ if paragraph_runs is not None:+ # Use the WIDEST visual line (per-tspan as the deck author drew it),+ # not the joined-up paragraph: soft-broken paragraphs concatenate+ # many lines into one <a:p>, and measuring the joined string would+ # blow the textbox past the canvas. The 1.05 safety factor covers+ # PowerPoint's slightly different font metrics.+ text_width = max(visual_line_widths) * 1.05 if visual_line_widths else 0.0+ # Total height assumes the visual line count from the SVG source;+ # if PowerPoint wraps to more or fewer lines after the user resizes,+ # the user resizes the height accordingly.+ text_height = (+ line_height_px * (len(visual_line_widths) - 1)+ + sum(paragraph_space_before)+ + font_size * 1.5+ )+ else:+ text_width = estimate_text_width(full_text, font_size, font_weight) * 1.15+ text_height = font_size * 1.5padding = font_size * 0.1# Adjust position based on text-anchor@@ -1126,12 +1201,48 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:shape_id = ctx.next_id()rot_attr = f' rot="{text_rot}"' if text_rot else ''- runs_xml = '\n'.join(_build_run_xml(r, fonts, ctx, text_effect_xml) for r in runs)+ if paragraph_runs is not None:+ # SVG dy(px) -> hundredths-of-a-point: dy_pt = dy_px * 0.75, then x100.+ line_spc_val = round(line_height_px * FONT_PX_TO_HUNDREDTHS_PT)+ ln_spc_xml = f'<a:lnSpc><a:spcPts val="{line_spc_val}"/></a:lnSpc>'+ paragraph_xml_chunks = []+ for line, extra_px in zip(paragraph_runs, paragraph_space_before):+ spc_bef_xml = ''+ if extra_px > 0:+ spc_bef_val = round(extra_px * FONT_PX_TO_HUNDREDTHS_PT)+ spc_bef_xml = f'<a:spcBef><a:spcPts val="{spc_bef_val}"/></a:spcBef>'+ runs_inner = '\n'.join(_build_run_xml(r, fonts, ctx, text_effect_xml) for r in line)+ paragraph_xml_chunks.append(+ f'<a:p>\n<a:pPr algn="{algn}">{ln_spc_xml}{spc_bef_xml}</a:pPr>\n'+ f'{runs_inner}\n</a:p>'+ )+ paragraphs_xml = '\n'.join(paragraph_xml_chunks)+ else:+ runs_xml = '\n'.join(_build_run_xml(r, fonts, ctx, text_effect_xml) for r in runs)+ paragraphs_xml = f'<a:p>\n<a:pPr algn="{algn}"/>\n{runs_xml}\n</a:p>'+off_x = px_to_emu(box_x)off_y = px_to_emu(box_y)ext_cx = px_to_emu(box_w)ext_cy = px_to_emu(box_h)+ # Paragraph mode: wrap="square" so text reflows when the user resizes,+ # but NO spAutoFit — otherwise PowerPoint expands the frame to fit a+ # long joined-up <a:p> on one line, blowing past the canvas. The cx we+ # write below (longest SVG line × 1.05) is the design target width;+ # PowerPoint wraps long paragraphs inside this width.+ # Single-line text keeps wrap="none" + spAutoFit for tight fidelity.+ if paragraph_runs is not None:+ body_pr_xml = (+ '<a:bodyPr wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" '+ 'anchor="t" anchorCtr="0"/>'+ )+ else:+ body_pr_xml = (+ '<a:bodyPr wrap="none" lIns="0" tIns="0" rIns="0" bIns="0" '+ 'anchor="t" anchorCtr="0">\n<a:spAutoFit/>\n</a:bodyPr>'+ )+return ShapeResult(xml=f'''<p:sp><p:nvSpPr><p:cNvPr id="{shape_id}" name="TextBox {shape_id}"/>@@ -1146,14 +1257,9 @@ def convert_text(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:{shape_effect_xml}</p:spPr><p:txBody>-<a:bodyPr wrap="none" lIns="0" tIns="0" rIns="0" bIns="0" anchor="t" anchorCtr="0">-<a:spAutoFit/>-</a:bodyPr>+{body_pr_xml}<a:lstStyle/>-<a:p>-<a:pPr algn="{algn}"/>-{runs_xml}-</a:p>+{paragraphs_xml}</p:txBody></p:sp>''', bounds_emu=(off_x, off_y, off_x + ext_cx, off_y + ext_cy))diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.pyindex e0417c8c..a9ab7f83 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py@@ -306,6 +306,7 @@ def create_pptx_with_native_svg(narration_padding: float = 0.5,cache_dir: Path | None = None,workers: int | None = None,+ merge_paragraphs: bool = False,) -> bool:"""Create a PPTX file with native SVG.@@ -456,6 +457,7 @@ def create_pptx_with_native_svg(slide_xml, media_files_dict, rel_entries, anim_targets = (convert_svg_to_slide_shapes(svg_path, slide_num=slide_num, verbose=verbose,+ merge_paragraphs=merge_paragraphs,))slide_transition, slide_transition_duration, slide_auto_advance = (diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_cli.pyindex 51baab31..5725de59 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_cli.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_cli.py@@ -151,6 +151,13 @@ Recorded narration:help='Only generate one version: native (editable shapes) or legacy (SVG image)')mode_group.add_argument('--native', action='store_true', default=False,help='(Deprecated, now default) Convert SVG to native DrawingML shapes')+ parser.add_argument('--merge-paragraphs', action='store_true', default=False,+ help='Opt-in: merge mergeable paragraph blocks (same x, dy clustered '+ 'around one base line-height) into a single editable text frame '+ 'with multiple <a:p>. Improves editability of paragraph text in '+ 'PowerPoint (one textbox per paragraph instead of per line) at '+ 'the cost of strict SVG line layout fidelity — PowerPoint re-wraps '+ 'merged paragraphs to fit the box width. Off by default.')parser.add_argument('--svg-snapshot', action='store_true', default=False,help='Also emit the SVG-rendered snapshot pptx alongside the native pptx in exports/ ''(named <project>_<ts>_svg.pptx). Off by default — the native pptx is the '@@ -487,6 +494,7 @@ Recorded narration:narration_padding=args.narration_padding,cache_dir=cache_dir,workers=args.workers,+ merge_paragraphs=args.merge_paragraphs,)success = Truediff --git a/skills/ppt-master/scripts/svg_to_pptx/tspan_flattener.py b/skills/ppt-master/scripts/svg_to_pptx/tspan_flattener.pyindex 88de495b..45b6d1f5 100644--- a/skills/ppt-master/scripts/svg_to_pptx/tspan_flattener.py+++ b/skills/ppt-master/scripts/svg_to_pptx/tspan_flattener.py@@ -28,11 +28,16 @@ from pathlib import Pathfrom xml.etree import ElementTree as ET-def flatten_positional_tspans(tree: ET.ElementTree) -> bool:+def flatten_positional_tspans(+ tree: ET.ElementTree,+ merge_paragraphs: bool = False,+) -> bool:"""Flatten positional ``<tspan>`` elements into independent ``<text>``.Delegates to ``svg_finalize.flatten_tspan.flatten_text_with_tspans`` so- the in-memory transform exactly matches the on-disk one.+ the in-memory transform exactly matches the on-disk one. When+ ``merge_paragraphs`` is True, mergeable paragraph blocks are preserved+ as a single <text> for downstream multi-<a:p> conversion.Returns True if any tspan was rewritten."""@@ -40,4 +45,4 @@ def flatten_positional_tspans(tree: ET.ElementTree) -> bool:if str(scripts_dir) not in sys.path:sys.path.insert(0, str(scripts_dir))from svg_finalize.flatten_tspan import flatten_text_with_tspans # type: ignore- return flatten_text_with_tspans(tree)+ return flatten_text_with_tspans(tree, merge_paragraphs=merge_paragraphs)