Skip to content

Support Marpit image alignment and representative multi-image composition #122

@jongalloway

Description

@jongalloway

Summary

Implement a first practical subset of Marpit image alignment and multi-image composition behaviors as a slice of #103.

Motivation

After background-image and image-sizing support, the next compatibility gap is image placement and composition. These behaviors affect how real-world decks lay out side-by-side or aligned images.

Proposed Scope

Support a bounded first slice that includes:

  • alignment / placement variants such as left and right
  • representative multi-image composition cases documented by Marpit
  • explicit fallback behavior for composition patterns that cannot yet be matched faithfully in PPTX

Acceptance Criteria

  • Supported alignment forms visibly affect placement in generated PPTX output.
  • At least one representative multi-image composition scenario is covered.
  • Parser and renderer tests cover the supported alignment/composition cases.
  • Limitations are documented where full Marpit parity is not yet achieved.

Relationship To Parent

Tracked under #103 as the placement and composition slice after syntax scaffolding and core sizing/background support.

Implementation Starting Points

Key files to extend (do not create parallel parsing paths):

  • src/MarpToPptx.Core/Parsing/MarpitImageSizingParser.cs — strip left/right keywords from alt text and return them as parsed alignment values, following the same pattern used for w:/h: and % tokens.
  • src/MarpToPptx.Core/Parsing/MarpMarkdownParser.cs (~line 540) — the bg alt-text branch already handles background image promotion; extend it to recognise bg left/bg right for split-background layout.
  • src/MarpToPptx.Core/Models/ImageElement.cs — thread a new alignment property through the model so the renderer can consume it.
  • src/MarpToPptx.Pptx/Rendering/OpenXmlPptxRenderer.csAddImage already accepts xAlign/yAlign parameters and CalculateImagePlacement honours them; wire the parsed alignment into these existing parameters.
  • tests/MarpToPptx.Tests/ParserTests.cs and tests/MarpToPptx.Tests/PptxRendererTests.cs — the compatibility matrix tests (Parser_MarpitLeftAlignmentKeyword_*, Renderer_MarpitLeftAlignmentKeyword_*, etc.) document the current gap; update them to assert on actual position/alignment values once the feature lands.

Metadata

Metadata

Labels

area:renderingPPTX rendering and layout worktype:featureNew feature or capability

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions