Skip to content

feat(pptx): support PowerPoint templates (.potx)#77

Merged
karthikmudunuri merged 1 commit into
mainfrom
karthikmudunuri/extend-pptx-with-potx
Jun 3, 2026
Merged

feat(pptx): support PowerPoint templates (.potx)#77
karthikmudunuri merged 1 commit into
mainfrom
karthikmudunuri/extend-pptx-with-potx

Conversation

@karthikmudunuri
Copy link
Copy Markdown
Member

What

Extends the PPTX importer/exporter to support PowerPoint templates (.potx). .potx and .pptx share an identical OOXML package — the only on-disk difference is the main part's content type in [Content_Types].xml (…presentationml.template.main+xml vs …presentation.main+xml). This PR preserves template-ness across the full import → edit → export round-trip.

Changes

Library (@textcortex/slidewise)

  • New export isPptxTemplate(blob) — detects a template by inspecting the package content type rather than trusting a filename extension, so a mis-named .pptx that is really a template is handled correctly.
  • serializeDeck gains asTemplate?: boolean — when omitted, template-ness is inherited from the source archive, so a parsed .potx round-trips back to a .potx; pass true/false to force the output kind. Templates emit the template.main+xml main-part content type and the .potx MIME type.
  • parsePptx itself needed no changes — it reads parts by path, not by content type, so it already parsed .potx transparently.

Website

  • Accepts .pptx/.potx in the upload gate, accept filter, drag prompt, and button label.
  • Detects template-ness from the actual package content type via isPptxTemplate, and exports .potx (with asTemplate) when the loaded file was a template.

Behavior

In Out
.potx .potx (inherited by content type, no flag)
.pptx .pptx

Library callers can override with serializeDeck(deck, { asTemplate: true | false }).

Tests

New template.test.ts (6 cases): default → presentation CT/MIME; asTemplate → template CT/MIME; isPptxTemplate content-vs-filename + garbage-input handling; parses a .potx; auto round-trips template→template; can force template→presentation.

  • pptx suite: 58 passed / 3 skipped
  • tsc --noEmit clean (library + website)
  • pnpm build:lib succeeds; isPptxTemplate confirmed in the bundle

A changeset (minor, new public API) is included.

.potx and .pptx share an identical OOXML package; only the main part's
content type in [Content_Types].xml differs. Extend the importer/exporter
to preserve template-ness across the round-trip.

- Add isPptxTemplate(blob): detect a template by package content type
  rather than filename extension
- serializeDeck gains asTemplate?: boolean; when omitted, inherit from the
  source archive so a parsed .potx round-trips back to a .potx. Templates
  emit the template.main+xml main-part content type and .potx MIME
- Website: accept .potx, detect template-ness from content, export .potx
@karthikmudunuri karthikmudunuri merged commit 019e000 into main Jun 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant