Presentation creator
The term presentation creator is something we use internally to designate two things:
Package
Section titled “Package”This is a special part of the codebase that handles everything related to presentation creation, except the content generation part.
It is quite special because, unlike other parts of the codebase, it is not used solely by the backend or the frontend — it is shared by both.
The reason is mainly convenience. We undeniably need this code to be accessible from the backend, since some presentation creation scenarios don’t even use the frontend (e.g. through the API).
On the other hand, we also need parts of this code when editing the presentation from the frontend. One option would have been to expose the parts needed by the frontend through our internal API, but that would have been far more tedious and would come with performance downsides (due to HTTP overhead).
So we decided to keep it as-is for now, even though we might split it later (e.g. the parsing and writing parts have no reason to be shared with the frontend).
Module
Section titled “Module”As part of the presentation creator package, we also have a presentation creator module, whose more straightforward goal is to create the Presentation data structure from a set of inputs:
- the
Templatedata - the
Contentdata - some
Settingsdata
Here’s an overview of the process:
- receive content and template data
- create the cover slide if needed
- create the table of contents slide if needed
- loop over content slides
- retrieve the best matching layout from the template
- fill the layout with the content to create the slide
- output the
Presentationdata
Finding the best layout
Section titled “Finding the best layout”Deciding which layout to use for a given slide’s content is a key part of our presentation generation process.
We went back and forth on this, but the current algorithm is a series of ordered sorting criteria.
Given the slide content, all the template’s layouts are sorted according to these criteria, and we select the top of the list.
Some of the decision is influenced by the content generation step (and sometimes even by the user with the latest features), and the rest is left to the algorithm.
These criteria include things like:
- ensuring that the layout type matches
- ensuring that the item count matches
- ensuring that the presence of an image in the content and the layout matches
- …