@hirokisakabe/pom-cli 0.5.2 → 0.6.0
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 +6 -0
- package/dist/cli.js +13 -0
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +3 -0
- package/dist/render.d.ts +2 -0
- package/dist/render.d.ts.map +1 -1
- package/dist/render.js +4 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,6 +100,12 @@ To output SVG instead of PNG:
|
|
|
100
100
|
pom render slides.pom.xml -o ./images --format svg
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
By default, SVG output converts text to `<path>` outlines so it renders identically in any environment. Pass `--text-output text` to emit native `<text>` elements with subsetted fonts embedded as `@font-face` data URIs instead — text becomes selectable and renders with browser font hinting, but may not display correctly when the SVG is referenced via `<img src="...">` or sanitized:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pom render slides.pom.xml -o ./images --format svg --text-output text
|
|
107
|
+
```
|
|
108
|
+
|
|
103
109
|
To render only specific slides (1-based, comma-separated) — useful when re-checking just the slides you edited:
|
|
104
110
|
|
|
105
111
|
```bash
|
package/dist/cli.js
CHANGED
|
@@ -79,6 +79,7 @@ program
|
|
|
79
79
|
.requiredOption("-o <dir>", "Output directory for rendered images")
|
|
80
80
|
.option("--format <format>", "Output format: png or svg", "png")
|
|
81
81
|
.option("--slides <numbers>", "Comma-separated slide numbers to render (e.g. 2,5)")
|
|
82
|
+
.option("--text-output <mode>", 'SVG text output mode: "path" (glyph outlines) or "text" (native <text> with embedded subset fonts). Only valid with --format svg')
|
|
82
83
|
.option("--verbose", "Show build step timing on stderr")
|
|
83
84
|
.action((input, options) => {
|
|
84
85
|
if (options.format !== "png" && options.format !== "svg") {
|
|
@@ -86,6 +87,17 @@ program
|
|
|
86
87
|
process.exit(1);
|
|
87
88
|
}
|
|
88
89
|
const format = options.format;
|
|
90
|
+
if (options.textOutput !== undefined) {
|
|
91
|
+
if (options.textOutput !== "path" && options.textOutput !== "text") {
|
|
92
|
+
console.error(`Invalid text output mode: ${options.textOutput} (expected "path" or "text")`);
|
|
93
|
+
process.exit(1);
|
|
94
|
+
}
|
|
95
|
+
if (format !== "svg") {
|
|
96
|
+
console.error("--text-output is only valid with --format svg");
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const textOutput = options.textOutput;
|
|
89
101
|
let slides;
|
|
90
102
|
if (options.slides !== undefined) {
|
|
91
103
|
slides = options.slides.split(",").map((s) => Number(s.trim()));
|
|
@@ -98,6 +110,7 @@ program
|
|
|
98
110
|
runRender(input, options.o, {
|
|
99
111
|
format,
|
|
100
112
|
slides,
|
|
113
|
+
textOutput,
|
|
101
114
|
verbose: options.verbose,
|
|
102
115
|
}).catch((err) => {
|
|
103
116
|
printBuildError(err);
|
package/dist/preview.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preview.d.ts","sourceRoot":"","sources":["../src/preview.ts"],"names":[],"mappings":"AA4WA,wBAAgB,UAAU,CACxB,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE,MAAqB,EAC3B,OAAO,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAO,GAClD,IAAI,CAmIN"}
|
package/dist/preview.js
CHANGED
|
@@ -53,11 +53,14 @@ async function generateSvgs(inputFile, verbose = false) {
|
|
|
53
53
|
}
|
|
54
54
|
const fontDirs = [resolveBundledFontsDir()];
|
|
55
55
|
const t2 = Date.now();
|
|
56
|
+
// インライン SVG なのでネイティブ <text> + サブセットフォント埋め込みが使える。
|
|
57
|
+
// ブラウザのテキスト描画 (ヒンティング等) が効き、テキスト選択も可能になる
|
|
56
58
|
const slides = await convertPptxToSvg(buffer, {
|
|
57
59
|
width: slideWidth,
|
|
58
60
|
fontDirs,
|
|
59
61
|
fontMapping: EXTRA_FONT_MAPPING,
|
|
60
62
|
skipSystemFonts: true,
|
|
63
|
+
textOutput: "text",
|
|
61
64
|
});
|
|
62
65
|
log(`Converting to SVG... done (${Date.now() - t2}ms)`);
|
|
63
66
|
const svgs = slides.map((s) => s.svg);
|
package/dist/render.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export type RenderFormat = "png" | "svg";
|
|
2
|
+
export type TextOutput = "path" | "text";
|
|
2
3
|
export declare function runRender(inputFile: string, outputDir: string, options?: {
|
|
3
4
|
format?: RenderFormat;
|
|
4
5
|
slides?: number[];
|
|
6
|
+
textOutput?: TextOutput;
|
|
5
7
|
verbose?: boolean;
|
|
6
8
|
}): Promise<void>;
|
|
7
9
|
//# sourceMappingURL=render.d.ts.map
|
package/dist/render.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC;AAOzC,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,CAAC;AACzC,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAOzC,wBAAsB,SAAS,CAC7B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,GACL,OAAO,CAAC,IAAI,CAAC,CAuFf"}
|
package/dist/render.js
CHANGED
|
@@ -42,7 +42,10 @@ export async function runRender(inputFile, outputDir, options = {}) {
|
|
|
42
42
|
const t2 = Date.now();
|
|
43
43
|
let outputs;
|
|
44
44
|
if (format === "svg") {
|
|
45
|
-
const slides = await convertPptxToSvg(buffer,
|
|
45
|
+
const slides = await convertPptxToSvg(buffer, {
|
|
46
|
+
...convertOptions,
|
|
47
|
+
...(options.textOutput ? { textOutput: options.textOutput } : {}),
|
|
48
|
+
});
|
|
46
49
|
outputs = slides.map((s) => ({ slideNumber: s.slideNumber, data: s.svg }));
|
|
47
50
|
}
|
|
48
51
|
else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hirokisakabe/pom-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "CLI tool for pom — preview, build, and render presentations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@hirokisakabe/pom": "^8.5.0",
|
|
34
34
|
"@hirokisakabe/pom-md": "^3.0.0",
|
|
35
35
|
"commander": "^15.0.0",
|
|
36
|
-
"pptx-glimpse": "^1.0
|
|
36
|
+
"pptx-glimpse": "^1.1.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^25.9.2"
|