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

Improve marker export and arrow template guidance

hugohe39903b82c52b7
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 28d1ab14..37d0fb01 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -39,6 +39,12 @@ The following features are **absolutely forbidden** when generating SVGs — PPT
| Marker child's `fill` **matches** the parent line's `stroke` color | In DrawingML the arrow head inherits the line color — a mismatched marker fill will look wrong on export. |
| `markerWidth` / `markerHeight` roughly in `3–15` range | Mapped to `sm` (<6) / `med` (6–12) / `lg` (>12) size buckets. |
+**Use boundary**:
+
+- Use `marker-start` / `marker-end` only for connector arrows where the line is primary.
+- Do **not** use `marker` for block / chunky / wide solid arrows where the arrow body is the main visual object.
+- For those solid arrows, draw a standalone closed `<path>` / `<polygon>` and reference `templates/charts/chevron_process.svg` or `templates/charts/process_flow.svg`.
+
**Supported DrawingML mapping**:
| SVG Marker Shape | DrawingML Output |
@@ -75,7 +81,7 @@ The following features are **absolutely forbidden** when generating SVGs — PPT
**Mnemonic**: PPT does not recognize rgba, group opacity, or image opacity.
-> Arrows: prefer `marker-end` with a qualifying `<marker>` (see §1.1) — the converter produces native DrawingML arrow heads that auto-rotate. Fall back to manually drawn `<polygon>` triangles only for exotic arrow shapes not covered by the triangle/diamond/oval presets.
+> Arrows: prefer `marker-end` with a qualifying `<marker>` (see §1.1) for connector lines — the converter produces native DrawingML arrow heads that auto-rotate. For block arrows / chunky arrows, use a standalone closed shape instead of `marker`; see `templates/charts/chevron_process.svg` for phase arrows and `templates/charts/process_flow.svg` for mixed flow layouts.
---
@@ -471,7 +477,7 @@ Large-arc flag: 1 (270° > 180°)
### Polygon Arrows on Diagonal Lines
-> **Prefer `marker-end` first** (see §1.1) — the converter produces native DrawingML arrow heads that auto-rotate along the line tangent, eliminating the need for manual vertex math. Use this manual polygon approach only for exotic arrow shapes that cannot be expressed as triangle/diamond/oval presets.
+> For connector lines, prefer `marker-end` / `marker-start` (see §1.1). For chunky / wide solid / non-connector arrows, use standalone polygon or path geometry instead of `marker`.
When using `<polygon>` triangles as arrowheads, arrows on **horizontal or vertical lines** can use simple point offsets. But arrows on **diagonal lines** must have their triangle vertices rotated to match the line direction.
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py
index ddf5e0d5..82372867 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_elements.py
@@ -312,7 +312,13 @@ def convert_circle(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:
# ---------------------------------------------------------------------------
def convert_line(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:
- """Convert SVG <line> to DrawingML custom geometry shape."""
+ """Convert SVG <line> to DrawingML shape.
+
+ Lines with marker-start / marker-end are converted using the 'line' preset
+ geometry (prstGeom prst="line") so that PowerPoint renders native arrow
+ heads (headEnd / tailEnd) correctly. Plain lines (no markers) continue to
+ use custom geometry which is sufficient and avoids flipH/flipV complexity.
+ """
x1 = ctx_x(_f(elem.get('x1')), ctx)
y1 = ctx_y(_f(elem.get('y1')), ctx)
x2 = ctx_x(_f(elem.get('x2')), ctx)
@@ -320,25 +326,6 @@ def convert_line(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:
min_x = min(x1, x2)
min_y = min(y1, y2)
- w = max(abs(x2 - x1), 1)
- h = max(abs(y2 - y1), 1)
-
- w_emu = px_to_emu(w)
- h_emu = px_to_emu(h)
-
- lx1 = px_to_emu(x1 - min_x)
- ly1 = px_to_emu(y1 - min_y)
- lx2 = px_to_emu(x2 - min_x)
- ly2 = px_to_emu(y2 - min_y)
-
- geom = f'''<a:custGeom>
-<a:avLst/><a:gdLst/><a:ahLst/><a:cxnLst/>
-<a:rect l="l" t="t" r="r" b="b"/>
-<a:pathLst><a:path w="{w_emu}" h="{h_emu}">
-<a:moveTo><a:pt x="{lx1}" y="{ly1}"/></a:moveTo>
-<a:lnTo><a:pt x="{lx2}" y="{ly2}"/></a:lnTo>
-</a:path></a:pathLst>
-</a:custGeom>'''
stroke_op = get_stroke_opacity(elem, ctx)
stroke = build_stroke_xml(elem, ctx, stroke_op)
@@ -353,12 +340,97 @@ def convert_line(elem: ET.Element, ctx: ConvertContext) -> ShapeResult | None:
shape_id = ctx.next_id()
off_x = px_to_emu(min_x)
off_y = px_to_emu(min_y)
- return ShapeResult(
- xml=_wrap_shape(
+
+ # Determine if this line carries arrow markers.
+ has_marker = bool(
+ _get_attr(elem, 'marker-start', ctx) or
+ _get_attr(elem, 'marker-end', ctx)
+ )
+
+ if has_marker:
+ # ----------------------------------------------------------------
+ # Preset geometry approach: prstGeom prst="line"
+ # PowerPoint only renders headEnd / tailEnd on lines whose geometry
+ # it can intrinsically understand as a "line" (i.e. preset or
+ # connector shapes). Custom geometry shapes silently ignore
+ # headEnd / tailEnd in most PowerPoint versions.
+ #
+ # The "line" preset draws from (0,0) to (w,h).
+ # headEnd → placed at the start of the line = (x1, y1)
+ # tailEnd → placed at the end of the line = (x2, y2)
+ # We set flipH / flipV so that the preset start/end align with the
+ # original SVG endpoints:
+ # default (no flip) : top-left → bottom-right (x1≤x2, y1≤y2)
+ # flipH : top-right → bottom-left (x1>x2, y1≤y2)
+ # flipV : bottom-left → top-right (x1≤x2, y1>y2)
+ # flipH + flipV : bottom-right → top-left (x1>x2, y1>y2)
+ # ----------------------------------------------------------------
+ w = abs(x2 - x1)
+ h = abs(y2 - y1)
+ # DrawingML requires ext cx/cy ≥ 1 EMU
+ w_emu = px_to_emu(w) if w > 0 else 1
+ h_emu = px_to_emu(h) if h > 0 else 1
+
+ flip_h = x1 > x2
+ flip_v = y1 > y2
+ flip_attr = ''
+ if flip_h and flip_v:
+ flip_attr = ' flipH="1" flipV="1"'
+ elif flip_h:
+ flip_attr = ' flipH="1"'
+ elif flip_v:
+ flip_attr = ' flipV="1"'
+
+ rot_attr = f' rot="{rot}"' if rot else ''
+ xml = (
+ f'<p:sp>'
+ f'<p:nvSpPr>'
+ f'<p:cNvPr id="{shape_id}" name="{_xml_escape(f"Line {shape_id}")}"/>'
+ f'<p:cNvSpPr/><p:nvPr/>'
+ f'</p:nvSpPr>'
+ f'<p:spPr>'
+ f'<a:xfrm{flip_attr}{rot_attr}>'
+ f'<a:off x="{off_x}" y="{off_y}"/>'
+ f'<a:ext cx="{w_emu}" cy="{h_emu}"/>'
+ f'</a:xfrm>'
+ f'<a:prstGeom prst="line"><a:avLst/></a:prstGeom>'
+ f'<a:noFill/>'
+ f'{stroke}'
+ f'</p:spPr>'
+ f'</p:sp>'
+ )
+ else:
+ # ----------------------------------------------------------------
+ # Custom geometry (original behaviour) for plain lines.
+ # ----------------------------------------------------------------
+ w = max(abs(x2 - x1), 1)
+ h = max(abs(y2 - y1), 1)
+ w_emu = px_to_emu(w)
+ h_emu = px_to_emu(h)
+
+ lx1 = px_to_emu(x1 - min_x)
+ ly1 = px_to_emu(y1 - min_y)
+ lx2 = px_to_emu(x2 - min_x)
+ ly2 = px_to_emu(y2 - min_y)
+
+ geom = (
+ f'<a:custGeom>'
+ f'<a:avLst/><a:gdLst/><a:ahLst/><a:cxnLst/>'
+ f'<a:rect l="l" t="t" r="r" b="b"/>'
+ f'<a:pathLst><a:path w="{w_emu}" h="{h_emu}">'
+ f'<a:moveTo><a:pt x="{lx1}" y="{ly1}"/></a:moveTo>'
+ f'<a:lnTo><a:pt x="{lx2}" y="{ly2}"/></a:lnTo>'
+ f'</a:path></a:pathLst>'
+ f'</a:custGeom>'
+ )
+ xml = _wrap_shape(
shape_id, f'Line {shape_id}',
off_x, off_y, w_emu, h_emu,
geom, '<a:noFill/>', stroke, rot=rot,
- ),
+ )
+
+ return ShapeResult(
+ xml=xml,
bounds_emu=(off_x, off_y, off_x + w_emu, off_y + h_emu),
)
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py
index 85bd5b16..cdd9fc1d 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml_styles.py
@@ -247,6 +247,37 @@ def _emit_line_end(
return ''
typ, w_bucket, len_bucket = cls
+
+ # Reclassify size buckets based on markerUnits semantics:
+ #
+ # markerUnits="strokeWidth" (SVG default):
+ # markerWidth IS a ratio to stroke-width, and DrawingML headEnd/tailEnd
+ # also scale proportionally with line width. We should compare the ratio
+ # (markerWidth) directly against ratio-based thresholds — do NOT multiply
+ # by stroke-width, because that double-counts the scaling.
+ # Empirical DrawingML arrow ratios:
+ # sm ≈ 1.5× stroke-width → markerWidth ≤ 2.0
+ # med ≈ 2.5× stroke-width → markerWidth 2.0 – 3.5
+ # lg ≈ 3.5× stroke-width → markerWidth ≥ 3.5
+ #
+ # markerUnits="userSpaceOnUse":
+ # markerWidth/Height are absolute pixel values – keep the existing
+ # absolute-pixel thresholds from _marker_size_buckets (6 / 12).
+ marker_units = marker_elem.get('markerUnits', 'strokeWidth')
+ if marker_units != 'userSpaceOnUse':
+ mw = _f(marker_elem.get('markerWidth'), 3.0)
+ mh = _f(marker_elem.get('markerHeight'), 3.0)
+
+ def _ratio_bucket(v: float) -> str:
+ if v <= 2.0:
+ return 'sm'
+ if v >= 3.5:
+ return 'lg'
+ return 'med'
+
+ w_bucket = _ratio_bucket(mh) # h → perpendicular width
+ len_bucket = _ratio_bucket(mw) # w → length along line
+
dml_tag = 'headEnd' if which == 'head' else 'tailEnd'
return f'<a:{dml_tag} type="{typ}" w="{w_bucket}" len="{len_bucket}"/>'
diff --git a/skills/ppt-master/templates/charts/charts_index.json b/skills/ppt-master/templates/charts/charts_index.json
index 11feb86d..9b84a042 100644
--- a/skills/ppt-master/templates/charts/charts_index.json
+++ b/skills/ppt-master/templates/charts/charts_index.json
@@ -175,8 +175,8 @@
},
"process_flow": {
"label": "Process Flow",
- "summary": "Sequential process steps and stage relationships (3-8 steps)",
- "keywords": ["process", "steps", "flowchart", "methodology"]
+ "summary": "Sequential process steps, connector arrows, and stage relationships (3-8 steps)",
+ "keywords": ["process", "steps", "flowchart", "methodology", "connector arrow", "line arrow", "marker arrow"]
},
"progress_bar_chart": {
"label": "Progress Bar Chart",
@@ -300,8 +300,8 @@
},
"chevron_process": {
"label": "Chevron Process",
- "summary": "Arrow-chain linear phase progression with deliverables (3-6 phases)",
- "keywords": ["chevron", "arrow chain", "phase", "methodology", "implementation"]
+ "summary": "Arrow-chain linear phase progression with chunky stage arrows and deliverables (3-6 phases)",
+ "keywords": ["chevron", "arrow chain", "block arrow", "chunky arrow", "solid arrow", "phase", "methodology", "implementation"]
},
"comparison_columns": {
"label": "Comparison Columns",
diff --git a/skills/ppt-master/templates/charts/chevron_process.svg b/skills/ppt-master/templates/charts/chevron_process.svg
index 876d1e73..775b4492 100644
--- a/skills/ppt-master/templates/charts/chevron_process.svg
+++ b/skills/ppt-master/templates/charts/chevron_process.svg
@@ -1,9 +1,20 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720" width="1280" height="720">
<!--
箭头链流程模板 (Chevron Process)
- 用途: 线性阶段流程、逐步推进、方法论展示
+ 用途: 线性阶段流程、逐步推进、方法论展示、整块阶段箭头参考
适用场景: 销售漏斗阶段、项目阶段、方法论步骤
支持: 5阶段横向箭头 (推荐3-6)
+ 复用建议:
+ - 当页面需要“整块粗箭头”表达阶段推进时,优先参考此模板中的 polygon 箭头结构
+ - 不要用 marker-end 模拟这类宽箭身箭头
+
+ 可复用片段 1: 五边形 chevron(阶段箭头)
+ <polygon points="40,0 220,0 260,48 220,96 40,96 80,48"
+ fill="#6C5CE7"/>
+
+ 可复用片段 2: 带长箭头头部的 block arrow(结论指向)
+ <path d="M60,10 H300 V-36 L470,80 L300,196 V150 H60 Z"
+ fill="#5D96E4" stroke="#3F76C8" stroke-width="4"/>
-->
<defs>
@@ -170,4 +181,4 @@
<!-- 底部注释 -->
<text x="640" y="700" text-anchor="middle" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
font-size="12" fill="#BDC3C7">各阶段可根据企业实际情况灵活调整时长和交付物</text>
-</svg>
\ No newline at end of file
+</svg>
diff --git a/skills/ppt-master/templates/charts/process_flow.svg b/skills/ppt-master/templates/charts/process_flow.svg
index e9b31fb1..d15b67d2 100644
--- a/skills/ppt-master/templates/charts/process_flow.svg
+++ b/skills/ppt-master/templates/charts/process_flow.svg
@@ -8,6 +8,17 @@
- 对比: 不同类型节点视觉区分
- 重复: 统一的卡片样式和连接线
- 亲密性: 相关步骤分组,流程线清晰
+ 复用建议:
+ - 连接线箭头继续使用 marker-end / marker-start
+ - 若某一处需要“实心粗箭头”强调迁移方向,应增加独立闭合 path / polygon,而不是把 marker 放大
+
+ 可复用片段 1: 横向 block arrow(单个强调箭头)
+ <path d="M120,160 H520 V110 L760,280 L520,450 V400 H120 Z"
+ fill="#6FA0E8" stroke="#3F76C8" stroke-width="4"/>
+
+ 可复用片段 2: 紧凑型 block arrow(卡片间迁移强调)
+ <path d="M0,0 H180 V-24 L270,36 L180,96 V72 H0 Z"
+ fill="#A7C4F5" stroke="#4A7FD1" stroke-width="3"/>
-->
<defs>
@@ -330,4 +341,4 @@
fill="#9AA0A6">
<tspan>流程版本: v2.1 | 最后更新: 2025-11-09 | Process Management System</tspan>
</text>
-</svg>
\ No newline at end of file
+</svg>