Skip to content

Enhancement: add referenceWidth and referenceHeight configuration options #9

Description

@dpecos

Description

The slide scaler in src/mdeck/scaler.ts computes the scale factor using the ratio option (e.g. 4:3, 16:9), but there is no way to set the reference dimensions in pixels. Consumers who need pixel-perfect scaling (e.g. to match a specific output format like 1280×720) must resort to CSS hacks.

Proposed API

Add referenceWidth and referenceHeight options (in pixels) to SlideshowOptions:

mdeck.createSlideshow({
  referenceWidth: 1280,
  referenceHeight: 720,
});

When set, these take precedence over the ratio string for computing the scale factor. Default values should preserve existing behaviour (908 × 681 for 4:3, matching the current implementation).

Use cases

  • Generating slide screenshots / PDFs at a known pixel size
  • Matching a projector's native resolution exactly
  • Embedding slides in a fixed-size iframe

Ported from gnab/remark#700

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions