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

feat(svg-contract): enable all native line-end shapes

hugohe36c22ab381534
diff --git a/docs/powerpoint-svg-mapping.md b/docs/powerpoint-svg-mapping.md
index d24bd3ca..959ffdcb 100644
--- a/docs/powerpoint-svg-mapping.md
+++ b/docs/powerpoint-svg-mapping.md
@@ -87,7 +87,7 @@ Internal identifiers and PowerPoint display names are separate concerns: Master
| Symmetric rounded rectangle | `<rect>` with equal supported corner radii | `a:prstGeom prst="roundRect"` with adjustment | `Native-stable` | Asymmetric corners follow the freeform row |
| Circle or ellipse | `<circle>` or `<ellipse>` | `a:prstGeom prst="ellipse"` | `Native-stable` | Bounds and radii must be finite and positive where required |
| Straight line | `<line>` | Editable line/freeform shape | `Native-normalized` | Browser-only line effects are rejected |
-| Arrowhead line | `<line>` or supported path with registered start/end markers | Native DrawingML line head/tail ends | `Native-normalized`; marker size is approximate | Marker definitions must follow the conditional marker contract |
+| Arrowhead line | `<line>` or supported path with registered triangle, stealth, arrow, diamond, or oval start/end markers | Native DrawingML line head/tail ends | `Native-normalized`; marker size is approximate | Marker definitions must follow the conditional marker contract |
| Native connector | Compact project-authored preset group with connector metadata and direct visible paths | `p:cxnSp` | Imported connectors retain the expanded round-trip evidence needed for source topology | `Native-stable` for the registered preset/connector schema |
| Freeform shape | `<path>` | `p:sp` with `a:custGeom` | Imported custom geometry reconstructs as a path | `Native-normalized`; SVG arcs are converted to cubic segments |
| Polygon | `<polygon>` | Closed custom geometry | `Native-normalized` | Points must be finite and valid |
@@ -157,7 +157,7 @@ preset selection and authoring behavior are documented in
| Outline scaling under transforms | Exact `vector-effect="none"` or `vector-effect="non-scaling-stroke"` | Choice resolved into native line width | `Native-normalized` | Other values are rejected; generated spelling is exact and lowercase |
| Dashed or dotted outline | Registered dash array | Preset or custom DrawingML dash | `Native-normalized` | Unsupported dash semantics are rejected |
| Line cap and join | Registered cap/join values | Native line cap/join properties | `Native-stable` | Only documented values are accepted |
-| Line arrowheads | Registered start/end markers | Native head/tail end properties | `Approximate` for marker size | See the conditional marker contract |
+| Line arrowheads | Registered start/end markers | Native head/tail end properties | `Approximate` for marker size | Only triangle, stealth, arrow, diamond, and oval follow the conditional marker contract |
| Outer shadow | One supported shadow filter graph | Native outer shadow in `a:effectLst` | `Approximate`; one imported shape/connector source `outerShdw` is reconstructed only when its non-zero offset remains classifiable | Zero-offset source shadows and unsupported graph shapes are not silently reclassified |
| Glow | One supported glow filter graph | Native glow in `a:effectLst` | `Approximate`; one imported shape/connector source glow keeps the registered radius conversion | Review when the glow carries semantic emphasis |
| Imported text-run effect | Unchanged `metadata[data-pptx-part="txbody"]` on a logical shape; import-only blocking effect status for inherited Layout/Master list styles plus vertical, relationship-bearing, and table-cell fallback routes | Original slide-local native run effect inside `p:txBody` | `Native-stable` only while the raw slide-local payload remains usable; inherited effects, edits, or fallback routes that would drop a non-empty run `effectLst` / `effectDag` block | Not public authoring syntax; a table-cell run effect also disables the native Table replacement payload |
diff --git a/docs/zh/powerpoint-svg-mapping.md b/docs/zh/powerpoint-svg-mapping.md
index 1bb08719..f1444575 100644
--- a/docs/zh/powerpoint-svg-mapping.md
+++ b/docs/zh/powerpoint-svg-mapping.md
@@ -87,7 +87,7 @@ PowerPoint 意图
| 对称圆角矩形 | 圆角半径相等且受支持的 `<rect>` | `a:prstGeom prst="roundRect"` 加 adjustment | `Native-stable` | 不对称圆角按 freeform 行处理 |
| 圆或椭圆 | `<circle>` 或 `<ellipse>` | `a:prstGeom prst="ellipse"` | `Native-stable` | 需要时,bounds 和 radius 必须有限且为正 |
| 直线 | `<line>` | 可编辑 line/freeform shape | `Native-normalized` | 拒绝浏览器专属 line 效果 |
-| 带箭头的线 | 带已登记起点/终点 marker 的 `<line>` 或受支持 path | 原生 DrawingML 线首/线尾 | `Native-normalized`;marker 大小为近似 | marker 定义必须遵循条件 marker 合同 |
+| 带箭头的线 | 带已登记 triangle、stealth、arrow、diamond 或 oval 起点/终点 marker 的 `<line>` 或受支持 path | 原生 DrawingML 线首/线尾 | `Native-normalized`;marker 大小为近似 | marker 定义必须遵循条件 marker 合同 |
| 原生连接符 | 带 connector metadata 和直接可见 path 的项目创作 compact preset 组 | `p:cxnSp` | 导入 connector 保留源拓扑往返所需的 expanded 证据 | 已登记 preset/connector schema 内为 `Native-stable` |
| 任意多边形 | `<path>` | 带 `a:custGeom` 的 `p:sp` | 导入自定义几何重建为 path | `Native-normalized`;SVG arc 转为三次曲线段 |
| 多边形 | `<polygon>` | 闭合自定义几何 | `Native-normalized` | points 必须有限且合法 |
@@ -152,7 +152,7 @@ PowerPoint 意图
| transform 下的轮廓缩放 | 精确的 `vector-effect="none"` 或 `vector-effect="non-scaling-stroke"` | 选择被解析为原生线宽 | `Native-normalized` | 拒绝其他取值;生成拼法必须精确且为小写 |
| 虚线或点线轮廓 | 已登记 dash array | 预设或自定义 DrawingML dash | `Native-normalized` | 拒绝不支持的 dash 语义 |
| 线端与连接样式 | 已登记 cap/join 值 | 原生 line cap/join 属性 | `Native-stable` | 仅接受文档化取值 |
-| 线条箭头 | 已登记起点/终点 marker | 原生 head/tail end 属性 | marker 大小为 `Approximate` | 见条件 marker 合同 |
+| 线条箭头 | 已登记起点/终点 marker | 原生 head/tail end 属性 | marker 大小为 `Approximate` | 仅 triangle、stealth、arrow、diamond、oval 遵循条件 marker 合同 |
| 外阴影 | 一个受支持 shadow filter 图 | `a:effectLst` 中的原生外阴影 | `Approximate`;仅当非零偏移仍可稳定分类时,才重建单一 shape/connector 来源 `outerShdw` | 零偏移来源阴影和不支持的图结构不会被静默改成其他效果 |
| 发光 | 一个受支持 glow filter 图 | `a:effectLst` 中的原生发光 | `Approximate`;单一 shape/connector 来源发光保持已登记的半径换算 | 发光承载语义强调时需复核 |
| 导入的文字 run 效果 | 逻辑 shape 上未变更的 `metadata[data-pptx-part="txbody"]`;继承自 Layout/Master 的列表样式以及竖排、含关系引用、表格单元格降级路径使用仅限导入的阻塞效果状态 | `p:txBody` 内原始的 slide-local 原生 run 效果 | 仅在原始 slide-local payload 仍可用时为 `Native-stable`;继承效果、编辑或降级路径若会丢失非空 run `effectLst` / `effectDag` 则被阻断 | 不是公开创作语法;表格单元格 run 效果还会禁用原生 Table 替换 payload |
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index ced6b0ee..d2fbc9a6 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -168,15 +168,17 @@ when the referenced marker fits this native-arrow contract:
|---|---|
| Reference | Exact local `url(#id)` to a `<marker>` in `<defs>` |
| Orientation | `orient="auto"` or `orient="auto-start-reverse"`; the latter reverses `marker-start` while behaving like `auto` at `marker-end` |
-| Shape | A 3-vertex `<polygon>` / closed M/L-only path (triangle), 4-vertex `<polygon>` / closed M/L-only path (diamond), or one `<circle>` / `<ellipse>` (oval) |
-| Path grammar | One explicit `M`/`L` command per vertex followed by `Z`; do not use `H`, `V`, curves, or an implicit multi-point `L` command inside a marker path |
+| Shape | One direct shape representing a DrawingML `triangle`, `stealth`, `arrow`, `diamond`, or `oval` line end: a 3-vertex `<polygon>` / closed path (triangle), a simple concave 4-vertex `<polygon>` / closed path (stealth), an open 3-vertex path (arrow), a simple convex 4-vertex `<polygon>` / closed path (diamond), or one `<circle>` / `<ellipse>` (oval) |
+| Path grammar | Use one explicit `M`/`L` command per vertex. Triangle, stealth, and diamond paths end in `Z`; arrow paths remain open after the third vertex. Do not use `H`, `V`, curves, or an implicit multi-point `L` command inside a marker path |
| Color parity | Marker fill matches the parent line stroke; DrawingML arrows inherit the line color |
-The converter maps the three shapes to DrawingML triangle, diamond, and oval
-line ends. Prefer `<polygon>` for triangle/diamond markers because the vertex
-count is unambiguous. Checker and exporter preflight consume this same contract;
-other marker shapes have no native mapping and block export instead of being
-silently dropped.
+The converter maps these five shapes to their corresponding DrawingML line-end
+types. Prefer `<polygon>` for the closed triangle, stealth, and diamond forms;
+the open arrow form requires `<path>`. Four-vertex shapes must be simple and
+non-degenerate: convex geometry maps to diamond and concave geometry maps to
+stealth. Checker and exporter preflight consume this same contract; other
+marker shapes have no native mapping and block export instead of being silently
+dropped.
---
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
index a96bc24b..7fc4ddd0 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
@@ -1760,20 +1760,6 @@ def project_definition_errors(root: ET.Element) -> list[str]:
return sorted(errors)
-def _project_marker_polygon_vertex_count(raw: str) -> int | None:
- """Return the number of finite marker polygon vertices, or ``None``."""
- tokens = [token for token in re.split(r'[\s,]+', raw.strip()) if token]
- if not tokens or len(tokens) % 2:
- return None
- try:
- values = [float(token) for token in tokens]
- except ValueError:
- return None
- if not all(math.isfinite(value) for value in values):
- return None
- return len(values) // 2
-
-
def _project_marker_polygon_points(
raw: str,
) -> list[tuple[float, float]] | None:
@@ -1995,7 +1981,7 @@ def project_marker_errors(root: ET.Element) -> list[str]:
if shape is None:
errors.add(
f'{marker_label} must contain exactly one direct '
- 'triangle/diamond path or polygon, circle, or ellipse'
+ 'triangle, stealth, arrow, diamond, or oval shape'
)
else:
shape_tag = (_svg_element_tag(shape) or '').lower()
@@ -2004,27 +1990,27 @@ def project_marker_errors(root: ET.Element) -> list[str]:
f'{marker_label} child <{shape_tag}> cannot use '
'transform'
)
- if shape_tag == 'path':
- path_data = shape.get('d', '')
- if not (
- _PROJECT_MARKER_TRIANGLE_PATH_RE.fullmatch(path_data)
- or _PROJECT_MARKER_DIAMOND_PATH_RE.fullmatch(path_data)
- ):
- errors.add(
- f'{marker_label} path must be a closed 3- or '
- '4-vertex path with one explicit M/L command '
- 'per vertex'
- )
- elif shape_tag == 'polygon':
- vertex_count = _project_marker_polygon_vertex_count(
- shape.get('points', '')
+ marker_shape_type = classify_project_marker_shape(marker)
+ if marker_shape_type is None and shape_tag == 'path':
+ errors.add(
+ f'{marker_label} path must be a closed 3-vertex '
+ 'triangle, a simple closed 4-vertex '
+ 'diamond/stealth, or an open 3-vertex arrow, '
+ 'with one explicit M/L command per vertex'
+ )
+ elif (
+ marker_shape_type is None
+ and shape_tag == 'polygon'
+ ):
+ errors.add(
+ f'{marker_label} polygon must contain exactly '
+ '3 finite vertices or 4 finite vertices forming '
+ 'a simple diamond/stealth quadrilateral'
)
- if vertex_count not in {3, 4}:
- errors.add(
- f'{marker_label} polygon must contain exactly '
- '3 or 4 finite vertices'
- )
- elif shape_tag not in {'circle', 'ellipse'}:
+ elif (
+ marker_shape_type is None
+ and shape_tag not in {'circle', 'ellipse'}
+ ):
errors.add(
f'{marker_label} child <{shape_tag}> has no native '
'line-end mapping'
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 058ccc40..a02b7649 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2575,6 +2575,49 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
stroke_xml,
)
+ def test_native_line_end_shape_types_pass_checker_and_exporter(self):
+ drawingml_ns = (
+ 'http://schemas.openxmlformats.org/drawingml/2006/main'
+ )
+ for marker_type in (
+ 'triangle',
+ 'stealth',
+ 'arrow',
+ 'diamond',
+ 'oval',
+ ):
+ with self.subTest(marker_type=marker_type):
+ end = ET.Element(
+ f'{{{drawingml_ns}}}tailEnd',
+ {'type': marker_type, 'w': 'med', 'len': 'med'},
+ )
+ marker_id, marker_markup = _build_arrow_marker(
+ end,
+ '#112233',
+ id_prefix='roundtrip-',
+ seq=[0],
+ reversed_=False,
+ )
+ svg = f'''<svg xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 1280 720">
+ <defs>{marker_markup}</defs>
+ <line x1="80" y1="80" x2="300" y2="80" stroke="#112233"
+ marker-end="url(#{marker_id})"/>
+</svg>'''
+ with tempfile.TemporaryDirectory() as tmp_dir:
+ svg_path = Path(tmp_dir) / f'{marker_type}.svg'
+ svg_path.write_text(svg, encoding='utf-8')
+ checker_result = SVGQualityChecker().check_file(
+ str(svg_path)
+ )
+ self.assertEqual(checker_result['errors'], [])
+ slide_xml, *_rest = convert_svg_to_slide_shapes(svg_path)
+ self.assertIn(
+ f'<a:tailEnd type="{marker_type}" '
+ 'w="med" len="med"/>',
+ slide_xml,
+ )
+
def test_imported_head_end_uses_supported_reversible_orientation(self):
drawingml_ns = (
'http://schemas.openxmlformats.org/drawingml/2006/main'
@@ -2623,6 +2666,22 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
'invalid project line-end marker',
)
+ def test_unclassifiable_line_end_shape_blocks_checker_and_exporter(self):
+ self._assert_checker_and_exporter_reject(
+ '''<svg xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 1280 720">
+ <defs>
+ <marker id="broken" orient="auto">
+ <path d="M 0 0 L 10 10 L 0 10 L 10 0 Z" fill="#112233"/>
+ </marker>
+ </defs>
+ <line x1="80" y1="80" x2="300" y2="80" stroke="#112233"
+ marker-end="url(#broken)"/>
+</svg>''',
+ 'a simple closed 4-vertex diamond/stealth',
+ 'invalid project line-end marker',
+ )
+
def test_invalid_filter_contract_blocks_checker_and_exporter(self):
self._assert_checker_and_exporter_reject(
'''<svg xmlns="http://www.w3.org/2000/svg"