@heylemon/lemonade 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,270 @@
1
+ # Template-Based Editing Workflow
2
+
3
+ When you have an existing presentation and need to adapt it for new content, use this structured workflow instead of rebuilding from scratch.
4
+
5
+ ## Overview
6
+
7
+ 1. **Analyze template** — Understand existing structure, design, and theme
8
+ 2. **Plan slide mapping** — How does new content fit existing layouts?
9
+ 3. **Unpack** — Extract PPTX into XML files for editing
10
+ 4. **Build presentation** — Duplicate, delete, and reorder slides as needed
11
+ 5. **Edit content** — Update text, numbers, and labels
12
+ 6. **Clean** — Remove extra files from unpacked directory
13
+ 7. **Pack** — Rebuild PPTX from XML files
14
+
15
+ ## Step 1: Analyze Template
16
+
17
+ ### Extract Content
18
+
19
+ ```bash
20
+ python -m markitdown template.pptx > template_content.txt
21
+ ```
22
+
23
+ Review the output to understand:
24
+ - Total slide count
25
+ - Slide types and layouts (title, content, stats, etc.)
26
+ - Color and typography used
27
+ - Structure and narrative flow
28
+
29
+ ### Generate Thumbnails
30
+
31
+ ```bash
32
+ soffice --headless --convert-to pdf template.pptx
33
+ pdftoppm -jpeg -r 100 template.pdf slide
34
+ ```
35
+
36
+ Open the slide images to visually assess:
37
+ - Design style and color palette
38
+ - Typography and spacing
39
+ - Visual elements (icons, cards, shadows)
40
+ - Layout patterns used
41
+
42
+ ## Step 2: Plan Slide Mapping
43
+
44
+ Create a mapping between new content and existing slide layouts.
45
+
46
+ **Example:**
47
+ ```
48
+ New Content → Template Slide → Layout
49
+ ─────────────────────────────────────────────────
50
+ Title slide → Slide 1 → Title
51
+ "Where we are" → Slide 2 → Section
52
+ Q4 metrics → Slide 3 → Stats (3 cards)
53
+ Market opportunity → Slide 4-5 → Content + image
54
+ Our solution → Slide 6 → Two-column
55
+ Comparison → Slide 7 → Comparison
56
+ Call to action → Slide 8 → Closing
57
+ ```
58
+
59
+ ### Important: Use Varied Layouts
60
+
61
+ Don't force all content into one slide type. If the template has multiple layout styles, use them. Variety prevents fatigue.
62
+
63
+ - Title slides → Section dividers → Content → Stats → Closing
64
+ - Content → Two-column → Content → Comparison → Content → Closing
65
+ - Never 5 content slides in a row
66
+
67
+ ## Step 3: Unpack the Presentation
68
+
69
+ Extract the PPTX (which is a ZIP file) into XML:
70
+
71
+ ```bash
72
+ unzip template.pptx -d template_unpacked
73
+ ```
74
+
75
+ This creates a folder structure:
76
+ ```
77
+ template_unpacked/
78
+ ├── ppt/
79
+ │ ├── slides/
80
+ │ │ ├── slide1.xml
81
+ │ │ ├── slide2.xml
82
+ │ │ └── ...
83
+ │ ├── presentation.xml
84
+ │ └── ...
85
+ ├── _rels/
86
+ ├── docProps/
87
+ └── [Content_Types].xml
88
+ ```
89
+
90
+ ## Step 4: Build the Presentation Structure
91
+
92
+ Modify the slides folder to match your new slide plan:
93
+
94
+ ### Delete Unused Slides
95
+
96
+ ```bash
97
+ rm template_unpacked/ppt/slides/slide7.xml
98
+ rm template_unpacked/ppt/slides/slide8.xml
99
+ ```
100
+
101
+ Update the slide relationships in `_rels/presentation.xml.rels` to remove references.
102
+
103
+ ### Duplicate Slides for Content
104
+
105
+ If you need multiple copies of the same layout:
106
+
107
+ ```bash
108
+ cp template_unpacked/ppt/slides/slide3.xml template_unpacked/ppt/slides/slide3_copy1.xml
109
+ ```
110
+
111
+ Then reference the copy in the relationships file.
112
+
113
+ ### Reorder Slides
114
+
115
+ Rename slides by their intended order. PptxGenJS will read them sequentially.
116
+
117
+ ## Step 5: Edit Content
118
+
119
+ Use the Read and Edit tools to modify slide XML directly. **Do not use scripts** — editing XML by hand is safer and more controllable.
120
+
121
+ ### Finding Text in XML
122
+
123
+ Slide content is in XML. Text appears in `<a:t>` tags:
124
+
125
+ ```xml
126
+ <a:t>Old Slide Title</a:t>
127
+ ```
128
+
129
+ Use Read to find the exact text, then Edit to replace it.
130
+
131
+ ### Pattern: Updating Title Text
132
+
133
+ ```xml
134
+ <!-- Before -->
135
+ <a:t>Q3 Results Overview</a:t>
136
+
137
+ <!-- After -->
138
+ <a:t>Q4 Revenue Beat Target by 15%</a:t>
139
+ ```
140
+
141
+ ### Pattern: Updating Bullet Points
142
+
143
+ Bullets are separate `<a:p>` (paragraph) elements:
144
+
145
+ ```xml
146
+ <a:p>
147
+ <a:pPr lvl="0"/>
148
+ <a:r>
149
+ <a:t>Old bullet point</a:t>
150
+ </a:r>
151
+ </a:p>
152
+ ```
153
+
154
+ Update the `<a:t>` content.
155
+
156
+ ### Pattern: Updating Stats Numbers
157
+
158
+ In stat cards, the large number and label are separate text elements:
159
+
160
+ ```xml
161
+ <!-- Number -->
162
+ <a:t>3x</a:t>
163
+
164
+ <!-- Label -->
165
+ <a:t>User Growth</a:t>
166
+ ```
167
+
168
+ Find and replace each separately.
169
+
170
+ ### Common Edits
171
+
172
+ | Task | Approach |
173
+ |---|---|
174
+ | Change slide title | Find `<a:t>Old Title</a:t>`, replace with new title |
175
+ | Update a bullet | Find paragraph with old text, replace `<a:t>` content |
176
+ | Change a number | Find the stat value text, replace |
177
+ | Update labels | Find caption text, replace |
178
+
179
+ ## Step 6: Clean
180
+
181
+ Remove relationship references to deleted slides. This prevents broken links when repacking.
182
+
183
+ For each deleted slide, find its reference in:
184
+ - `ppt/_rels/presentation.xml.rels`
185
+ - `[Content_Types].xml`
186
+
187
+ And remove the corresponding `<Relationship>` entries.
188
+
189
+ ## Step 7: Pack Back into PPTX
190
+
191
+ After editing XML, repack the folder:
192
+
193
+ ```bash
194
+ cd template_unpacked
195
+ zip -r ../new_presentation.pptx *
196
+ cd ..
197
+ ```
198
+
199
+ The result is a valid PPTX file with your edits.
200
+
201
+ ## Formatting Rules
202
+
203
+ ### Text Content
204
+
205
+ - **Always use straight quotes** — PPTX XML sometimes converts smart quotes (`"` to `"`) which breaks content. Use straight quotes only: `"text"`.
206
+ - **No Unicode bullets** — Don't manually add `•` or `◦` symbols. PPTX bullets are generated from the XML structure, not characters.
207
+ - **Bullet consistency** — If bullets exist in the template, keep them. If not, don't add them unless the layout expects them.
208
+
209
+ ### Slide Numbers
210
+
211
+ If slides are numbered, update them:
212
+
213
+ ```xml
214
+ <a:t>1 / 8</a:t> <!-- Change if slide count changes -->
215
+ <a:t>2 / 8</a:t>
216
+ <a:t>3 / 8</a:t>
217
+ ```
218
+
219
+ ## Common Pitfalls
220
+
221
+ ### Template Adaptation
222
+
223
+ - **Don't assume all slides are the same** — Templates often have subtle variations (different fonts for different sections, different margins). Check the actual XML before assuming.
224
+ - **Don't delete slides with complex layouts** — Duplicate and reuse. Deleting and recreating complex slides (tables, charts) is error-prone.
225
+ - **Preserve the theme** — Don't change color hex values or fonts unless necessary. Templates are designed as a unit.
226
+
227
+ ### Multi-Item Content
228
+
229
+ - **Multi-line bullets** — If a bullet has multiple lines, wrap in a single `<a:p>` with line breaks.
230
+ - **Table cells with bullets** — If a table cell contains bullets, structure must be nested correctly.
231
+
232
+ ### Smart Quotes
233
+
234
+ - **Replace smart quotes** — If the template has "curly" quotes (`"text"`), replace with straight quotes (`"text"`).
235
+ - **Check apostrophes** — Same issue with apostrophes (`'text'` vs `'text'`).
236
+
237
+ ## When to Unpack vs. Rebuild
238
+
239
+ | Situation | Approach |
240
+ |---|---|
241
+ | Minor text updates (titles, bullets, stats) | Unpack and edit |
242
+ | Completely different layout | Rebuild from scratch with PptxGenJS |
243
+ | Reusing color scheme and design | Unpack and adapt |
244
+ | Adding new features (charts, complex shapes) | PptxGenJS code |
245
+ | Changing theme colors across all slides | PptxGenJS with custom theme |
246
+
247
+ ## QA After Editing
248
+
249
+ After packing, always verify:
250
+
251
+ 1. **Extract and check text**
252
+ ```bash
253
+ python -m markitdown new_presentation.pptx > qa_check.txt
254
+ ```
255
+ Look for garbled text, missing content, or encoding issues.
256
+
257
+ 2. **Convert to images**
258
+ ```bash
259
+ soffice --headless --convert-to pdf new_presentation.pptx
260
+ pdftoppm -jpeg -r 150 new_presentation.pdf slide
261
+ ```
262
+
263
+ 3. **Visually inspect** — Open slide images and check for:
264
+ - Text overflow or cut-off
265
+ - Misaligned elements
266
+ - Incorrect formatting
267
+
268
+ 4. **Fix and re-verify** — If issues found, fix the XML and repack. Then re-run extraction and image conversion.
269
+
270
+ Do not declare success until you've completed at least one fix-and-verify cycle.