ghost-paper 0.1.0 → 0.1.2
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/dist/cli.js +51 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Command } from "commander";
|
|
5
5
|
import { readFileSync, writeFileSync } from "fs";
|
|
6
6
|
import { resolve } from "path";
|
|
7
|
+
import { createRequire } from "module";
|
|
7
8
|
|
|
8
9
|
// src/parse.ts
|
|
9
10
|
import { unified } from "unified";
|
|
@@ -1288,8 +1289,57 @@ function build(markdown) {
|
|
|
1288
1289
|
}
|
|
1289
1290
|
|
|
1290
1291
|
// src/cli.ts
|
|
1292
|
+
var require2 = createRequire(import.meta.url);
|
|
1293
|
+
var { version } = require2("../package.json");
|
|
1291
1294
|
var program = new Command();
|
|
1292
|
-
program.name("ghost-paper").description("Turn markdown into beautiful HTML reports").version(
|
|
1295
|
+
program.name("ghost-paper").description("Turn markdown into beautiful HTML reports").version(version);
|
|
1296
|
+
program.command("prompt").description("Print agent instructions for writing Ghost Paper markdown").action(() => {
|
|
1297
|
+
console.log(`Write a markdown report that Ghost Paper will convert into a beautiful HTML report with interactive charts.
|
|
1298
|
+
|
|
1299
|
+
## Structure
|
|
1300
|
+
|
|
1301
|
+
- Use YAML frontmatter for the report title and subtitle:
|
|
1302
|
+
---
|
|
1303
|
+
title: "Report Title"
|
|
1304
|
+
subtitle: "Author \xB7 Date"
|
|
1305
|
+
---
|
|
1306
|
+
- Use # H1 headings to separate major sections (each becomes a tab in the sidebar)
|
|
1307
|
+
- Put a blockquote immediately after an H1 to set that tab's subtitle
|
|
1308
|
+
- Use ## H2 headings for sections within a tab
|
|
1309
|
+
- Use blockquotes for key insight callouts
|
|
1310
|
+
|
|
1311
|
+
## Tables \u2192 Charts
|
|
1312
|
+
|
|
1313
|
+
Write standard markdown tables. Ghost Paper auto-classifies them:
|
|
1314
|
+
|
|
1315
|
+
**KPI strip** \u2014 2\u20136 rows, 2\u20134 columns with headers like Metric/Value/Change:
|
|
1316
|
+
| Metric | Value | Change |
|
|
1317
|
+
|--------|-------|--------|
|
|
1318
|
+
| Revenue | $4.2M | +23% YoY |
|
|
1319
|
+
| Users | 214K | +18% vs Q3 |
|
|
1320
|
+
|
|
1321
|
+
**Line chart** \u2014 first column is time (months, quarters, years), other columns numeric:
|
|
1322
|
+
| Month | Revenue ($K) | Users (K) |
|
|
1323
|
+
|-------|-------------|-----------|
|
|
1324
|
+
| Jan | 280 | 142 |
|
|
1325
|
+
| Feb | 295 | 148 |
|
|
1326
|
+
| Mar | 310 | 155 |
|
|
1327
|
+
|
|
1328
|
+
**Bar chart** \u2014 first column is categories, one numeric column, 3+ rows:
|
|
1329
|
+
| Channel | CPA ($) |
|
|
1330
|
+
|---------|---------|
|
|
1331
|
+
| Referral | 8.2 |
|
|
1332
|
+
| Organic SEO | 12.5 |
|
|
1333
|
+
| Paid Search | 30.5 |
|
|
1334
|
+
|
|
1335
|
+
**Pie chart** \u2014 exactly 2 columns (category + positive number), 2\u20138 rows:
|
|
1336
|
+
| Segment | Share |
|
|
1337
|
+
|---------|-------|
|
|
1338
|
+
| Enterprise | 60 |
|
|
1339
|
+
| SMB | 40 |
|
|
1340
|
+
|
|
1341
|
+
Any table that doesn't match these patterns renders as a styled HTML table.`);
|
|
1342
|
+
});
|
|
1293
1343
|
program.command("build").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) => {
|
|
1294
1344
|
const inputPath = resolve(input);
|
|
1295
1345
|
const markdown = readFileSync(inputPath, "utf-8");
|