quicklook-pptx-renderer 0.2.1 → 0.2.3
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 -4
- package/dist/cli.js +12 -6
- package/dist/lint.js +6 -3
- package/package.json +6 -3
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Slide 4:
|
|
|
51
51
|
[ERR ] "cloud" is not supported by OfficeImport — shape will be invisible (Shape 12)
|
|
52
52
|
-> Use a supported preset or embed as an image
|
|
53
53
|
|
|
54
|
-
0 errors,
|
|
54
|
+
0 errors, 5 warnings, 0 info across 18 slides
|
|
55
55
|
```
|
|
56
56
|
|
|
57
57
|
```bash
|
|
@@ -128,9 +128,9 @@ for (const issue of result.issues) {
|
|
|
128
128
|
| `table-style-unresolved` | warn | Table style reference that OfficeImport won't resolve |
|
|
129
129
|
| `text-inscription-shift` | warn | Text in non-rect shape uses geometry-inscribed bounds (text may shift) |
|
|
130
130
|
| `font-substitution` | warn/info | Font will be substituted on macOS — includes width delta (warn if ≥10% reflow risk) |
|
|
131
|
-
| `effect-forces-pdf` |
|
|
132
|
-
| `rotation-forces-pdf` |
|
|
133
|
-
| `group-as-pdf` |
|
|
131
|
+
| `effect-forces-pdf` | warn | Non-rect shape rendered as opaque PDF instead of CSS |
|
|
132
|
+
| `rotation-forces-pdf` | warn | Rotated rect rendered as opaque PDF instead of CSS |
|
|
133
|
+
| `group-as-pdf` | warn | Group rendered as single opaque PDF image |
|
|
134
134
|
| `vertical-text` | info | Vertical text uses CSS writing-mode |
|
|
135
135
|
|
|
136
136
|
---
|
package/dist/cli.js
CHANGED
|
@@ -19,7 +19,7 @@ function hasFlag(args, name) {
|
|
|
19
19
|
function positional(args) {
|
|
20
20
|
const out = [];
|
|
21
21
|
for (let i = 0; i < args.length; i++) {
|
|
22
|
-
if (args[i].startsWith("--")) {
|
|
22
|
+
if (args[i].startsWith("--") || args[i] === "-o") {
|
|
23
23
|
i++;
|
|
24
24
|
continue;
|
|
25
25
|
}
|
|
@@ -46,17 +46,18 @@ async function cmdRender(args) {
|
|
|
46
46
|
const width = Number(getFlag(args, "--width") ?? 1920);
|
|
47
47
|
const scale = Number(getFlag(args, "--scale") ?? 2);
|
|
48
48
|
const slideNum = getFlag(args, "--slide");
|
|
49
|
-
const outPath = getFlag(args, "--out");
|
|
49
|
+
const outPath = getFlag(args, "--out") ?? getFlag(args, "-o");
|
|
50
50
|
const all = hasFlag(args, "--all") || !slideNum;
|
|
51
51
|
const pptxBuf = await readFile(resolve(input));
|
|
52
52
|
const pkg = await PptxPackage.open(pptxBuf);
|
|
53
53
|
const pres = await readPresentation(pkg);
|
|
54
54
|
if (all) {
|
|
55
|
-
const
|
|
55
|
+
const singleFile = outPath && pres.slides.length === 1;
|
|
56
|
+
const outDir = singleFile ? dirname(outPath) : (outPath ?? ".");
|
|
56
57
|
await mkdir(outDir, { recursive: true });
|
|
57
58
|
for (let i = 0; i < pres.slides.length; i++) {
|
|
58
59
|
const png = await renderSlide(pres.slides[i], pres, { width, scale, pkg, slideIndex: i });
|
|
59
|
-
const dest =
|
|
60
|
+
const dest = singleFile
|
|
60
61
|
? resolve(outPath)
|
|
61
62
|
: resolve(outDir, `slide-${i + 1}.png`);
|
|
62
63
|
await writeFile(dest, png);
|
|
@@ -82,7 +83,7 @@ async function cmdHtml(args) {
|
|
|
82
83
|
console.error(`Usage: ${BIN} html <input.pptx> [--out output.html]`);
|
|
83
84
|
process.exit(1);
|
|
84
85
|
}
|
|
85
|
-
const outPath = getFlag(args, "--out");
|
|
86
|
+
const outPath = getFlag(args, "--out") ?? getFlag(args, "-o") ?? pos[1];
|
|
86
87
|
const pptxBuf = await readFile(resolve(input));
|
|
87
88
|
const pkg = await PptxPackage.open(pptxBuf);
|
|
88
89
|
const pres = await readPresentation(pkg);
|
|
@@ -155,7 +156,12 @@ async function cmdLint(args) {
|
|
|
155
156
|
process.exit(1);
|
|
156
157
|
}
|
|
157
158
|
// ── Main ───────────────────────────────────────────────────────────
|
|
158
|
-
const
|
|
159
|
+
const allArgs = process.argv.slice(2);
|
|
160
|
+
if (allArgs.includes("--version") || allArgs.includes("-v")) {
|
|
161
|
+
console.log("0.2.3");
|
|
162
|
+
process.exit(0);
|
|
163
|
+
}
|
|
164
|
+
const [command, ...args] = allArgs;
|
|
159
165
|
switch (command) {
|
|
160
166
|
case "render":
|
|
161
167
|
await cmdRender(args);
|
package/dist/lint.js
CHANGED
|
@@ -121,17 +121,19 @@ function lintShape(shape, slide, issues) {
|
|
|
121
121
|
else if (geom !== "rect") {
|
|
122
122
|
issues.push({
|
|
123
123
|
rule: "effect-forces-pdf",
|
|
124
|
-
severity: "
|
|
124
|
+
severity: "warn",
|
|
125
125
|
slide, element: name,
|
|
126
126
|
message: `"${geom}" renders as PDF in QuickLook (only plain rect uses CSS)`,
|
|
127
|
+
suggestion: `Use rect geometry to keep CSS rendering, or accept PDF output`,
|
|
127
128
|
});
|
|
128
129
|
}
|
|
129
130
|
if (hasRotation && geom === "rect") {
|
|
130
131
|
issues.push({
|
|
131
132
|
rule: "rotation-forces-pdf",
|
|
132
|
-
severity: "
|
|
133
|
+
severity: "warn",
|
|
133
134
|
slide, element: name,
|
|
134
135
|
message: `Rotated rect renders as PDF instead of CSS div`,
|
|
136
|
+
suggestion: `Remove rotation or accept PDF rendering`,
|
|
135
137
|
});
|
|
136
138
|
}
|
|
137
139
|
}
|
|
@@ -179,9 +181,10 @@ function lintGroup(group, slide, issues) {
|
|
|
179
181
|
const name = group.name || `group #${group.id}`;
|
|
180
182
|
issues.push({
|
|
181
183
|
rule: "group-as-pdf",
|
|
182
|
-
severity: "
|
|
184
|
+
severity: "warn",
|
|
183
185
|
slide, element: name,
|
|
184
186
|
message: `Group renders as single PDF image in QuickLook — all children merged into one opaque block`,
|
|
187
|
+
suggestion: `Ungroup shapes for individual rendering, or accept merged PDF`,
|
|
185
188
|
});
|
|
186
189
|
// Still lint children for their own issues
|
|
187
190
|
lintDrawables(group.children, slide, issues);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quicklook-pptx-renderer",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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",
|
|
@@ -12,8 +12,11 @@
|
|
|
12
12
|
"pptx", "powerpoint", "quicklook", "macos", "ios", "officeimport",
|
|
13
13
|
"pptx-to-html", "pptx-to-png", "ooxml", "office-open-xml",
|
|
14
14
|
"presentation", "renderer", "preview", "apple", "webkit",
|
|
15
|
-
"python-pptx", "pptxgenjs", "
|
|
16
|
-
"
|
|
15
|
+
"python-pptx", "pptxgenjs", "cross-platform", "lint", "compatibility",
|
|
16
|
+
"iphone", "ipad", "finder", "font-metrics", "font-fallback",
|
|
17
|
+
"table-borders", "shapes", "gradients", "rendering",
|
|
18
|
+
"google-slides", "canva", "libreoffice", "pandoc",
|
|
19
|
+
"pptx-linter", "pptx-validator", "slides"
|
|
17
20
|
],
|
|
18
21
|
"exports": {
|
|
19
22
|
".": {
|