quicklook-pptx-renderer 0.3.0 → 0.3.1
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.
- package/README.md +4 -7
- package/dist/lint.d.ts +1 -3
- package/dist/lint.js +9 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ It happens because Apple uses a private framework called `OfficeImport.framework
|
|
|
22
22
|
|---|---|
|
|
23
23
|
| **Shapes disappear** — heart, cloud, lightningBolt, sun, moon, and ~120 more | OfficeImport's `CMCanonicalShapeBuilder` only supports ~60 of 187 preset geometries. The rest are silently dropped — no error, no fallback. |
|
|
24
24
|
| **Opaque white blocks cover content** — rounded rectangles with shadows become solid rectangles | Any non-`rect` shape or any shape with effects (drop shadow, glow, reflection) is rendered as an opaque PDF image via `CMDrawingContext.copyPDF`. The PDF has a non-transparent background. |
|
|
25
|
-
| **Table borders missing** — tables appear as plain text without any grid | OfficeImport doesn't resolve `tableStyleId` references. It
|
|
25
|
+
| **Table borders missing** — tables appear as plain text without any grid | OfficeImport doesn't resolve `tableStyleId` references. It emits `border-style:none` per-cell unless borders are explicit in `<a:lnL>`, `<a:lnR>`, `<a:lnT>`, `<a:lnB>`. PowerPoint resolves the style and shows borders; QuickLook doesn't. python-pptx and most generators rely on style references. |
|
|
26
26
|
| **Gradients become flat colors** — gradient fills show as a single solid color | Gradients with 3+ color stops are averaged to one color instead of being rendered as a gradient. |
|
|
27
27
|
| **Fonts shift and text reflows** — text overflows boxes, lines break differently | Calibri → Helvetica Neue, Arial → Helvetica, Segoe UI → Helvetica Neue. Different metrics cause text reflow. |
|
|
28
28
|
| **Charts are blank rectangles** — chart content simply vanishes | Charts without an embedded fallback image render as empty rectangles. |
|
|
@@ -153,10 +153,8 @@ for (const issue of result.issues) {
|
|
|
153
153
|
case "inline-borders":
|
|
154
154
|
// issue.fix.tableStyleId = "{5C22544A-...}"
|
|
155
155
|
// Resolve table style and write explicit borders on each cell
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
case "add-borders":
|
|
159
|
-
// Add default 1px solid black borders to all cells
|
|
156
|
+
// Note: tables without a style AND without borders are intentionally
|
|
157
|
+
// borderless — both PowerPoint and QuickLook render them the same way.
|
|
160
158
|
break;
|
|
161
159
|
|
|
162
160
|
case "add-fallback-image":
|
|
@@ -185,8 +183,7 @@ Every issue carries a typed `fix` object with machine-readable remediation data
|
|
|
185
183
|
| `chart-no-fallback` | error | Chart without fallback image — renders as blank rectangle | `add-fallback-image` |
|
|
186
184
|
| `opaque-pdf-block` | warn | Shape with effects rendered as opaque PDF covering content behind it | `strip-effects` |
|
|
187
185
|
| `gradient-flattened` | warn | 3+ gradient stops collapsed to single average color | `reduce-stops` (includes computed 2-stop colors + average) |
|
|
188
|
-
| `table-
|
|
189
|
-
| `table-style-unresolved` | warn | Table style reference that OfficeImport won't resolve | `inline-borders` (includes `tableStyleId`) |
|
|
186
|
+
| `table-style-unresolved` | warn | Table has style but cells lack explicit borders — PowerPoint shows borders, QL won't | `inline-borders` (includes `tableStyleId`) |
|
|
190
187
|
| `font-substitution` | warn/info | Font will be substituted on macOS — includes width delta (warn if ≥10% reflow risk) | `replace-font` (includes macOS target, delta, metrically-closest alternatives) |
|
|
191
188
|
| `group-as-pdf` | warn | Group rendered as single opaque PDF image | `ungroup` (includes child count, whether group contains pictures) |
|
|
192
189
|
| `geometry-forces-pdf` | info | Non-rect geometry renders as PDF — opaque background may cover adjacent content | — |
|
package/dist/lint.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* re-detecting the problem.
|
|
10
10
|
*/
|
|
11
11
|
export type Severity = "error" | "warn" | "info";
|
|
12
|
-
export type RuleId = "unsupported-geometry" | "opaque-pdf-block" | "gradient-flattened" | "font-substitution" | "table-
|
|
12
|
+
export type RuleId = "unsupported-geometry" | "opaque-pdf-block" | "gradient-flattened" | "font-substitution" | "table-style-unresolved" | "group-as-pdf" | "chart-no-fallback" | "text-inscription-shift" | "rotation-forces-pdf" | "geometry-forces-pdf" | "vertical-text";
|
|
13
13
|
/** Machine-readable remediation data — one variant per fix strategy. */
|
|
14
14
|
export type LintFix = {
|
|
15
15
|
action: "replace-geometry";
|
|
@@ -35,8 +35,6 @@ export type LintFix = {
|
|
|
35
35
|
} | {
|
|
36
36
|
action: "inline-borders";
|
|
37
37
|
tableStyleId: string;
|
|
38
|
-
} | {
|
|
39
|
-
action: "add-borders";
|
|
40
38
|
} | {
|
|
41
39
|
action: "add-fallback-image";
|
|
42
40
|
} | {
|
package/dist/lint.js
CHANGED
|
@@ -280,7 +280,10 @@ function lintGraphicFrame(frame, slide, issues, ctx) {
|
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
282
|
function lintTable(table, slide, element, issues, ctx) {
|
|
283
|
-
// Check for table style reference without explicit borders
|
|
283
|
+
// Check for table style reference without explicit borders.
|
|
284
|
+
// OfficeImport emits `border-style:none` per-cell unless borders are explicit in XML.
|
|
285
|
+
// It ignores tableStyleId entirely — PowerPoint resolves the style and shows borders,
|
|
286
|
+
// but QuickLook shows a borderless grid. This is the #1 table issue for python-pptx users.
|
|
284
287
|
if (table.tableStyleId) {
|
|
285
288
|
const hasMissingBorders = table.rows.some(row => row.cells.some(cell => !hasExplicitBorders(cell)));
|
|
286
289
|
if (hasMissingBorders) {
|
|
@@ -288,25 +291,15 @@ function lintTable(table, slide, element, issues, ctx) {
|
|
|
288
291
|
rule: "table-style-unresolved",
|
|
289
292
|
severity: "warn",
|
|
290
293
|
slide, element,
|
|
291
|
-
message: `Table uses style "${table.tableStyleId}" but
|
|
292
|
-
suggestion: `Inline borders
|
|
294
|
+
message: `Table uses style "${table.tableStyleId}" but cells lack explicit borders — PowerPoint shows borders, QuickLook won't`,
|
|
295
|
+
suggestion: `Inline the style's borders as explicit <a:lnT>/<a:lnB>/<a:lnL>/<a:lnR> on each cell`,
|
|
293
296
|
fix: { action: "inline-borders", tableStyleId: table.tableStyleId },
|
|
294
297
|
});
|
|
295
298
|
}
|
|
296
299
|
}
|
|
297
|
-
//
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
if (noBorderCells > 0 && noBorderCells === totalCells) {
|
|
301
|
-
issues.push({
|
|
302
|
-
rule: "table-missing-borders",
|
|
303
|
-
severity: "warn",
|
|
304
|
-
slide, element,
|
|
305
|
-
message: `All ${totalCells} table cells have no explicit borders — table will appear borderless in QuickLook`,
|
|
306
|
-
suggestion: `Add explicit borders to cells if borders are expected`,
|
|
307
|
-
fix: { action: "add-borders" },
|
|
308
|
-
});
|
|
309
|
-
}
|
|
300
|
+
// Note: tables without a style AND without explicit borders are intentionally borderless.
|
|
301
|
+
// OfficeImport correctly renders them with border-style:none. No lint issue needed.
|
|
302
|
+
// (PowerPoint also shows these as borderless — no divergence.)
|
|
310
303
|
// Lint text in table cells
|
|
311
304
|
for (const row of table.rows) {
|
|
312
305
|
for (const cell of row.cells) {
|
|
@@ -322,12 +315,6 @@ function hasExplicitBorders(cell) {
|
|
|
322
315
|
const b = cell.borders;
|
|
323
316
|
return !!(b.top?.fill || b.bottom?.fill || b.left?.fill || b.right?.fill);
|
|
324
317
|
}
|
|
325
|
-
function hasAnyBorder(cell) {
|
|
326
|
-
if (!cell.borders)
|
|
327
|
-
return false;
|
|
328
|
-
const b = cell.borders;
|
|
329
|
-
return !!(b.top?.width || b.bottom?.width || b.left?.width || b.right?.width);
|
|
330
|
-
}
|
|
331
318
|
// ── Fill checks ─────────────────────────────────────────────────────
|
|
332
319
|
function lintFill(fill, slide, element, issues, ctx) {
|
|
333
320
|
if (!fill || fill.type !== "gradient")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicklook-pptx-renderer",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Open-source PPTX rendering engine that replicates Apple's macOS QuickLook and iOS preview — pixel for pixel. Test how PowerPoint files look on Mac/iPhone without a Mac.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|