Skip to content

feat(slides): support embedded SVG content - #2154

Merged
fangshuyu-768 merged 1 commit into
mainfrom
feat/slides-embed-svg-protocol
Aug 4, 2026
Merged

feat(slides): support embedded SVG content#2154
fangshuyu-768 merged 1 commit into
mainfrom
feat/slides-embed-svg-protocol

Conversation

@tianyouskrrr

@tianyouskrrr tianyouskrrr commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add embedded SVG content to the bundled Slides SML 2.0 schema, so a presentation can carry vector graphics inline via a new <embed> element alongside native shapes and text.

Changes

  • Register <embed> in the Slides XML schema and document its layout, visual effects, SVG namespace, and child ordering contract.
  • Teach the schema validator to honor xs:any namespace, occurrence, and sequence constraints, while requiring embedded SVG content to use an <svg> root.
  • Allow SVG subtrees inside <embed> and include embedded content in element extraction, blank-slide detection, and layout-density checks.
  • Keep embedded SVG payloads out of IconPark validation, so an <icon> that only shares a local name with the SML element is no longer misreported.
  • Add regression coverage for valid SVG, missing/wrong/multiple roots, invalid ordering, geometry extraction, embed-only slides, and <icon> inside an SVG payload.

Test Plan

  • python3 skills/lark-slides/scripts/xml_text_overlap_lint_test.py (188 tests)
  • make unit-test
  • make script-test
  • go vet ./...
  • gofmt -l . produces no output
  • go mod tidy leaves go.mod and go.sum unchanged
  • golangci-lint v2.1.6 run --new-from-rev=origin/main reports 0 issues
  • The embedded SVG example validates against slides_xml_schema_definition.xml with xmllint
  • Manual lark-cli API verification — not applicable; this change updates the bundled schema and local lint only.

Related Issues

Summary by CodeRabbit

  • New Features

    • Added support for embedding SVG graphics in slides.
    • Embedded graphics support positioning, sizing, rotation, flipping, transparency, reflection, and shadow effects.
  • Documentation

    • Added schema reference documentation and examples for SVG embedding.
  • Bug Fixes

    • Improved validation and slide analysis for embedded SVG content.
    • Embedded graphics are recognized as visual content, including on SVG-only slides.
    • Added clearer validation for invalid SVG roots, namespaces, child elements, and ordering.
    • Improved handling of supported extensible slide elements.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Aug 3, 2026
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The slide XML schema now supports embedded SVG content through embed. The SXSD validator handles wildcard child rules. The overlap linter validates, extracts, and analyzes embedded SVG elements.

Changes

Embedded SVG support

Layer / File(s) Summary
Define the embed contract
skills/lark-slides/references/slides_xml_schema_definition.xml, skills/lark-slides/references/xml-schema-quick-ref.md
The schema and reference document define embed, its layout attributes, SVG child requirements, and optional reflection/shadow effects.
Validate schema wildcards
skills/lark-slides/scripts/sxsd_validator.py
The validator parses wildcard rules and enforces namespace matching, sequence order, occurrence limits, and related diagnostics.
Process embeds in slide linting
skills/lark-slides/scripts/xml_text_overlap_lint.py, skills/lark-slides/scripts/xml_text_overlap_lint_test.py
The linter validates embedded SVG roots, skips SVG subtrees during SXSD and iconpark checks, extracts embed geometry, includes embeds in visual analysis, and tests valid and invalid cases.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant SlideXML
  participant SXSDValidator
  participant XMLTextOverlapLint
  participant LintTests
  SlideXML->>SXSDValidator: Validate embed wildcard children
  SXSDValidator-->>XMLTextOverlapLint: Return validation results
  XMLTextOverlapLint->>XMLTextOverlapLint: Validate SVG roots and extract embed geometry
  XMLTextOverlapLint->>LintTests: Produce visual-content and blank-slide results
  LintTests-->>XMLTextOverlapLint: Assert embed diagnostics and analysis
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main change: support for embedded SVG content in Slides.
Description check ✅ Passed The description includes the required summary, changes, test plan, and related issues sections with relevant details.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/slides-embed-svg-protocol

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@f571f90bbefbda9145c70f719d2eb47f5f5c4d75

🧩 Skill update

npx skills add larksuite/cli#feat/slides-embed-svg-protocol -y -g

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.70%. Comparing base (427cbd6) to head (f571f90).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2154      +/-   ##
==========================================
+ Coverage   75.55%   75.70%   +0.14%     
==========================================
  Files         931      944      +13     
  Lines       99362   100288     +926     
==========================================
+ Hits        75077    75926     +849     
- Misses      18549    18565      +16     
- Partials     5736     5797      +61     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@skills/lark-slides/scripts/xml_text_overlap_lint.py`:
- Around line 539-567: Update validate_embed_svg_roots to recognize SML embed
elements only when their namespace matches the SML namespace, and use
should_skip_sxsd_subtree during traversal to stop descending into
already-validated embedded SVG payloads. Preserve validation of direct SVG
children under genuine SML embed elements while ignoring unrelated HTML embed
tags inside SVG content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e339244f-b040-4490-9e08-80a08b3de1d1

📥 Commits

Reviewing files that changed from the base of the PR and between 427cbd6 and e3e2ab2.

📒 Files selected for processing (5)
  • skills/lark-slides/references/slides_xml_schema_definition.xml
  • skills/lark-slides/references/xml-schema-quick-ref.md
  • skills/lark-slides/scripts/sxsd_validator.py
  • skills/lark-slides/scripts/xml_text_overlap_lint.py
  • skills/lark-slides/scripts/xml_text_overlap_lint_test.py

Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py
@tianyouskrrr
tianyouskrrr force-pushed the feat/slides-embed-svg-protocol branch from e3e2ab2 to 7b43151 Compare August 3, 2026 09:46
@tianyouskrrr
tianyouskrrr requested a review from ethan-zhx August 3, 2026 10:58
Comment thread skills/lark-slides/scripts/xml_text_overlap_lint.py Outdated
@tianyouskrrr
tianyouskrrr force-pushed the feat/slides-embed-svg-protocol branch from 7b43151 to 06ba13c Compare August 4, 2026 06:19
Register <embed> in the bundled Slides SML 2.0 schema, document its SVG
contract, and teach the lint/schema validator to handle XSD wildcards and
embed geometry. Keep embedded SVG payloads out of IconPark validation so
foreign-namespaced <icon> elements inside a payload are not misreported.
@tianyouskrrr
tianyouskrrr force-pushed the feat/slides-embed-svg-protocol branch from 06ba13c to f571f90 Compare August 4, 2026 07:45
@fangshuyu-768
fangshuyu-768 merged commit 95a0449 into main Aug 4, 2026
29 of 57 checks passed
@fangshuyu-768
fangshuyu-768 deleted the feat/slides-embed-svg-protocol branch August 4, 2026 09:21
@tianyouskrrr tianyouskrrr self-assigned this Aug 4, 2026
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 4, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants