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

docs(svg-authoring): allow inline px geometry

hugohe3ddf541e8d4df
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 90843b18..1d084117 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -211,6 +211,33 @@ attributes remain valid when keeping palette and transparency separate is
clearer. This guarantee applies to the SVG-derived DrawingML route; opt-in
native table/chart payload styling follows its narrower native-object contract.
+**Allowed — literal inline geometry**: the following geometry properties may
+appear in the same element's `style="..."`. The pipeline materializes them as
+XML geometry attributes before SVG post-processing and native PPTX conversion.
+An inline geometry declaration overrides an existing same-name XML attribute.
+
+| Element | Supported properties |
+|---|---|
+| `<rect>` | `x`, `y`, `width`, `height`, `rx`, `ry` |
+| `<circle>` | `cx`, `cy`, `r` |
+| `<ellipse>` | `cx`, `cy`, `rx`, `ry` |
+| `<image>` | `x`, `y`, `width`, `height` |
+| `<svg>` | `x`, `y`, `width`, `height` |
+| `<use>` | `x`, `y`, `width`, `height` |
+
+**Hard rule — inline geometry grammar**: every non-zero value is one finite
+`px` literal, such as `120px` or `-8.5px`; exact zero may be unitless. `width`,
+`height`, `rx`, `ry`, and `r` must be non-negative. Percentages, `auto`,
+`calc()`, `var()`, `!important`, `inherit`, and every other unit are forbidden.
+Do not put geometry on an unsupported element: line endpoints, text positions,
+path data, and polygon/polyline points remain XML attributes.
+
+**Forbidden — CSS geometry cascade**: `<style>`, `class`, selector rules,
+external stylesheets, and imported styles remain forbidden. This allowance is
+only for literal declarations in an element's own `style` attribute; PPT Master
+does not compute CSS cascade or custom properties. Root canvas authority remains
+the `viewBox`, regardless of root `<svg>` compatibility width/height values.
+
**Allowed — group opacity (approximate)**: `<g opacity="0.3">...</g>` maps the
group alpha onto each descendant shape, text run, picture, and supported
shadow/glow effect. Nested group and child opacity values multiply. Overlapping
@@ -264,7 +291,9 @@ metadata. See
- **Background**: Use `<rect>` to define the page background color
- **`<tspan>`** has two purposes: (1) manual line breaks (use `dy` or explicit `y`); (2) inline run formatting on the same line (color/weight/size). `<foreignObject>` is FORBIDDEN. See "Single logical line" rule below.
- **Fonts**: every `font-family` stack MUST resolve to pre-installed exported Latin / EA typefaces (Microsoft YaHei / SimSun / Arial / Times New Roman / Consolas …); `@font-face` is FORBIDDEN. Full rule: [`strategist.md §g`](strategist.md).
-- **Styles**: inline only (`fill=""`, `font-size=""`); `<style>`/`class` FORBIDDEN (`id` inside `<defs>` is fine)
+- **Styles**: per-element only (`fill=""`, `font-size=""`, or `style="..."`);
+ literal inline geometry is restricted to §2. `<style>`/`class` are FORBIDDEN
+ (`id` inside `<defs>` is fine)
- **Colors**: common named colors, `rgb()` / `rgba()`, `hsl()` / `hsla()`, or
3/4/6/8-digit HEX; embedded and explicit opacity values multiply
- **Images**: `<image href="../images/xxx.png" preserveAspectRatio="xMidYMid slice"/>`; optional `opacity="0..1"` maps to native picture transparency
diff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.md
index fd5d2acb..062f1706 100644
--- a/skills/ppt-master/scripts/docs/svg-pipeline.md
+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md
@@ -229,6 +229,17 @@ Supported CSS paint colors include named colors, `rgb()` / `rgba()`, `hsl()` /
effect alpha during native export. Explicit opacity attributes remain valid
when they make palette reuse clearer.
+Literal inline geometry is compiled before finalize and native conversion.
+Supported pairs are `rect` (`x/y/width/height/rx/ry`), `circle` (`cx/cy/r`),
+`ellipse` (`cx/cy/rx/ry`), and `image` / `svg` / `use`
+(`x/y/width/height`). A declaration in `style="..."` overrides the same XML
+attribute. Non-zero values must be finite `px` literals; exact zero may omit the
+unit, and sizes/radii cannot be negative. Percentages, `auto`, `calc()`,
+`var()`, `!important`, `inherit`, other units, unsupported element/property
+pairs, stylesheets, selectors, and CSS cascade are rejected. Use XML attributes
+for line endpoints, text positions, path data, and polygon/polyline points. See
+[`shared-standards.md`](../../references/shared-standards.md) §2.
+
`<g opacity="0..1">` is supported as a per-descendant alpha approximation.
Nested values multiply; overlapping children may differ from isolated SVG
group compositing. Transparent native table/chart markers require the default
diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.py
index 4d6aa61c..65b39bbb 100644
--- a/skills/ppt-master/scripts/svg_quality_checker.py
+++ b/skills/ppt-master/scripts/svg_quality_checker.py
@@ -89,6 +89,15 @@ except ImportError:
})
_validate_semantic_markers = None
+try:
+ from svg_to_pptx.geometry_properties import (
+ materialize_inline_geometry_properties as _materialize_inline_geometry_properties,
+ validate_inline_geometry_properties as _validate_inline_geometry_properties,
+ )
+except ImportError:
+ _materialize_inline_geometry_properties = None
+ _validate_inline_geometry_properties = None
+
try:
from svg_to_pptx.use_expander import (
validate_local_use_references as _validate_local_use_references,
@@ -606,6 +615,17 @@ class SVGQualityChecker:
result['errors'].append("Detected forbidden <link rel=\"stylesheet\"> (external CSS references forbidden)")
if re.search(r'@import\s+', content_lower):
result['errors'].append("Detected forbidden @import (external CSS references forbidden)")
+ if _validate_inline_geometry_properties is None:
+ result['warnings'].append(
+ "Unable to import inline geometry validator; "
+ "native export will still validate geometry styles."
+ )
+ else:
+ geometry_errors = _validate_inline_geometry_properties(root)
+ for error in geometry_errors:
+ result['errors'].append(f"Invalid inline geometry property: {error}")
+ if not geometry_errors:
+ _materialize_inline_geometry_properties(root)
# Structure / nesting
if 'foreignobject' in local_names: