ghost-paper 0.2.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 +5 -3
- package/dist/{-5YRZFEDB.js → -7SCHCOLC.js} +1 -1
- package/dist/{chunk-B7BSOHDL.js → chunk-QUOENJTZ.js} +22 -0
- package/dist/cli.js +5 -4
- package/package.json +2 -2
- package/dist/-6A745MKY.js +0 -10
- package/dist/-ANANGS26.js +0 -10
- package/dist/-EON5YM73.js +0 -10
- package/dist/-FCFRRCIG.js +0 -10
- package/dist/-G2AWPUXZ.js +0 -10
- package/dist/-HRRPL4SN.js +0 -10
- package/dist/-K6SQE2E5.js +0 -10
- package/dist/-N6RDWVBC.js +0 -10
- package/dist/-NRPITI2A.js +0 -10
- package/dist/-OKZHAHO3.js +0 -10
- package/dist/-RMMSGBXC.js +0 -10
- package/dist/-RZB6N6OZ.js +0 -10
- package/dist/-TG5MSQYZ.js +0 -10
- package/dist/-TTLTI6LQ.js +0 -10
- package/dist/-U5MQJGM2.js +0 -10
- package/dist/-YCMFHAET.js +0 -10
- package/dist/chunk-2QOHE4NF.js +0 -1464
- package/dist/chunk-3HX4SVJH.js +0 -1504
- package/dist/chunk-4P2YAHD2.js +0 -1522
- package/dist/chunk-6WF3MSUR.js +0 -1362
- package/dist/chunk-DSRRH4T2.js +0 -1425
- package/dist/chunk-J2XA7LOH.js +0 -1463
- package/dist/chunk-MNZVZ2ZA.js +0 -1464
- package/dist/chunk-NUWIGEJ3.js +0 -1462
- package/dist/chunk-QMHJ3BGD.js +0 -1471
- package/dist/chunk-RMODJYHI.js +0 -1526
- package/dist/chunk-SOKYK7YV.js +0 -1496
- package/dist/chunk-TV6ABXBU.js +0 -1534
- package/dist/chunk-TW7HQTU6.js +0 -1444
- package/dist/chunk-U2G5K2PR.js +0 -1465
- package/dist/chunk-UWUILD43.js +0 -1471
- package/dist/chunk-ZRSWDAXH.js +0 -1433
- package/dist/pdf-ADH6BBSB.js +0 -71
- package/dist/pdf-EDRHZK4V.js +0 -72
- package/dist/pdf-HC6MMT72.js +0 -62
- package/dist/pdf-SKUNOP45.js +0 -62
- package/dist/pdf-TQDMPPSC.js +0 -71
- package/dist/pdf-VCMDLIDX.js +0 -71
- package/dist/pdf-WLYWKSHR.js +0 -71
package/README.md
CHANGED
|
@@ -13,14 +13,16 @@ npm install -g ghost-paper
|
|
|
13
13
|
Or run directly:
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
npx ghost-paper build report.md
|
|
16
|
+
npx ghost-paper build html report.md
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
ghost-paper build report.md # → report.html
|
|
23
|
-
ghost-paper build report.md -o output.html # custom output path
|
|
22
|
+
ghost-paper build html report.md # → report.html
|
|
23
|
+
ghost-paper build html report.md -o output.html # custom output path
|
|
24
|
+
ghost-paper build pdf report.md # → report.pdf
|
|
25
|
+
ghost-paper build pdf report.md --landscape # landscape orientation
|
|
24
26
|
```
|
|
25
27
|
|
|
26
28
|
Open the resulting HTML file in any browser. Everything is self-contained — no server needed.
|
|
@@ -284,6 +284,10 @@ function parse(markdown) {
|
|
|
284
284
|
}
|
|
285
285
|
continue;
|
|
286
286
|
}
|
|
287
|
+
if (node.type === "thematicBreak") {
|
|
288
|
+
currentTab.elements.push({ kind: "pagebreak" });
|
|
289
|
+
continue;
|
|
290
|
+
}
|
|
287
291
|
if (node.type === "blockquote") {
|
|
288
292
|
const html = blockquoteToHtml(node);
|
|
289
293
|
currentTab.elements.push({ kind: "aside", html });
|
|
@@ -957,6 +961,12 @@ var CSS = `
|
|
|
957
961
|
color: var(--text-primary);
|
|
958
962
|
}
|
|
959
963
|
|
|
964
|
+
hr.pagebreak {
|
|
965
|
+
border: none;
|
|
966
|
+
border-top: 1px solid var(--border);
|
|
967
|
+
margin: 32px 0;
|
|
968
|
+
}
|
|
969
|
+
|
|
960
970
|
.tab-content .footnote {
|
|
961
971
|
font-size: 13px;
|
|
962
972
|
color: var(--text-muted);
|
|
@@ -1267,6 +1277,16 @@ var PRINT_CSS = `
|
|
|
1267
1277
|
thead { display: table-header-group; }
|
|
1268
1278
|
tr { break-inside: avoid; }
|
|
1269
1279
|
|
|
1280
|
+
hr.pagebreak {
|
|
1281
|
+
border: none;
|
|
1282
|
+
margin: 0;
|
|
1283
|
+
padding: 0;
|
|
1284
|
+
height: 0;
|
|
1285
|
+
column-span: all;
|
|
1286
|
+
break-after: page;
|
|
1287
|
+
page-break-after: always;
|
|
1288
|
+
}
|
|
1289
|
+
|
|
1270
1290
|
/* First appendix section starts on a new page */
|
|
1271
1291
|
.tab-appendix-start { page-break-before: always; break-before: page; }
|
|
1272
1292
|
|
|
@@ -1365,6 +1385,8 @@ function renderElement(el) {
|
|
|
1365
1385
|
return renderTable(el.table);
|
|
1366
1386
|
case "aside":
|
|
1367
1387
|
return ` <aside>${el.html}</aside>`;
|
|
1388
|
+
case "pagebreak":
|
|
1389
|
+
return ` <hr class="pagebreak">`;
|
|
1368
1390
|
}
|
|
1369
1391
|
}
|
|
1370
1392
|
function buildSidebar(doc) {
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
build
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QUOENJTZ.js";
|
|
5
5
|
|
|
6
6
|
// src/cli.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -59,7 +59,8 @@ Write standard markdown tables. Ghost Paper auto-classifies them:
|
|
|
59
59
|
|
|
60
60
|
Any table that doesn't match these patterns renders as a styled HTML table.`);
|
|
61
61
|
});
|
|
62
|
-
program.command("build").description("Convert a markdown file to
|
|
62
|
+
var buildCmd = program.command("build").description("Convert a markdown file to HTML or PDF");
|
|
63
|
+
buildCmd.command("html").description("Convert a markdown file to an HTML report").argument("<input>", "Markdown file path").option("-o, --output <path>", "Output HTML file path").action((input, opts) => {
|
|
63
64
|
const inputPath = resolve(input);
|
|
64
65
|
const markdown = readFileSync(inputPath, "utf-8");
|
|
65
66
|
const outputPath = opts.output ? resolve(opts.output) : inputPath.replace(/\.md$/, ".html");
|
|
@@ -67,11 +68,11 @@ program.command("build").description("Convert a markdown file to an HTML report"
|
|
|
67
68
|
writeFileSync(outputPath, html, "utf-8");
|
|
68
69
|
console.log(`\u2728 ${outputPath}`);
|
|
69
70
|
});
|
|
70
|
-
|
|
71
|
+
buildCmd.command("pdf").description("Convert a markdown file to a PDF report").argument("<input>", "Markdown file path").option("-o, --output <path>", "Output PDF file path").option("--page-size <size>", "Page size: A4 or Letter", "A4").option("--landscape", "Use landscape orientation").action(async (input, opts) => {
|
|
71
72
|
const inputPath = resolve(input);
|
|
72
73
|
const markdown = readFileSync(inputPath, "utf-8");
|
|
73
74
|
const outputPath = opts.output ? resolve(opts.output) : inputPath.replace(/\.md$/, ".pdf");
|
|
74
|
-
const { buildPdf } = await import("./-
|
|
75
|
+
const { buildPdf } = await import("./-7SCHCOLC.js");
|
|
75
76
|
await buildPdf(markdown, outputPath, {
|
|
76
77
|
pageSize: opts.pageSize ?? "A4",
|
|
77
78
|
landscape: opts.landscape ?? false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ghost-paper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Turn markdown into beautiful HTML reports",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"ghost-paper": "./dist/cli.js"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
|
-
"build": "tsup src/cli.ts --format esm --out-dir dist --external puppeteer-core",
|
|
31
|
+
"build": "tsup src/cli.ts --format esm --out-dir dist --external puppeteer-core --clean",
|
|
32
32
|
"dev": "tsup src/cli.ts --format esm --out-dir dist --watch --external puppeteer-core"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
package/dist/-6A745MKY.js
DELETED
package/dist/-ANANGS26.js
DELETED
package/dist/-EON5YM73.js
DELETED
package/dist/-FCFRRCIG.js
DELETED
package/dist/-G2AWPUXZ.js
DELETED
package/dist/-HRRPL4SN.js
DELETED
package/dist/-K6SQE2E5.js
DELETED
package/dist/-N6RDWVBC.js
DELETED
package/dist/-NRPITI2A.js
DELETED
package/dist/-OKZHAHO3.js
DELETED
package/dist/-RMMSGBXC.js
DELETED
package/dist/-RZB6N6OZ.js
DELETED
package/dist/-TG5MSQYZ.js
DELETED
package/dist/-TTLTI6LQ.js
DELETED
package/dist/-U5MQJGM2.js
DELETED