@masumdev/markforge 0.2.5 → 0.4.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 +173 -116
- package/dist/App-3QDKBKHG.mjs +328 -0
- package/dist/{chunk-IYGPJIK5.mjs → chunk-BPHDY6VB.mjs} +6 -0
- package/dist/{App-GNRUPFM7.mjs → chunk-CRV7R2BG.mjs} +2094 -570
- package/dist/{chunk-NGC2ZAWZ.mjs → chunk-TNWZ4MFS.mjs} +1 -1
- package/dist/cli.mjs +29 -7
- package/dist/index.d.mts +603 -117
- package/dist/index.d.ts +603 -117
- package/dist/index.js +2863 -202
- package/dist/index.mjs +2851 -202
- package/dist/{loadConfig-PD6ENMAM.mjs → loadConfig-PGJKPE6G.mjs} +1 -1
- package/dist/previewServer-XAUOBNBZ.mjs +893 -0
- package/package.json +5 -1
- package/schema.json +142 -0
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,7 @@ try {
|
|
|
9
9
|
} catch {}
|
|
10
10
|
import {
|
|
11
11
|
MARKFORGE_VERSION
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-TNWZ4MFS.mjs";
|
|
13
13
|
import "./chunk-YZHGBG4N.mjs";
|
|
14
14
|
|
|
15
15
|
// src/cli.tsx
|
|
@@ -45,7 +45,7 @@ process.on("warning", (w) => {
|
|
|
45
45
|
});
|
|
46
46
|
async function main() {
|
|
47
47
|
const program = new Command();
|
|
48
|
-
program.name("markforge").description("Modern Markdown & MDX multi-format publishing engine & CLI (DOCX, PDF, HTML, Images)").version(MARKFORGE_VERSION, "-V, --version", "Output current markforge version").argument("[input-file]", "Markdown or MDX source file to compile", "README.md").option("-t, --to <formats>", "Target formats to compile to (comma-separated: docx,pdf,html)").option("-o, --output <dir>", "Output directory for generated documents").option("--theme <theme>", "Built-in theme name (default, academic, github, corporate, minimal)").option("--css <path...>", "Custom CSS stylesheet(s) to inject").option("-c, --config <path>", "Path to custom markforge configuration file").option("--toc", "Force Table of Contents generation").option("-w, --watch", "Watch input file for changes and recompile", false).option("-s, --serve [port]", "Start
|
|
48
|
+
program.name("markforge").description("Modern Markdown & MDX multi-format publishing engine & CLI (DOCX, PDF, HTML, Images)").version(MARKFORGE_VERSION, "-V, --version", "Output current markforge version").argument("[input-file]", "Markdown or MDX source file to compile", "README.md").option("-t, --to <formats>", "Target formats to compile to (comma-separated: docx,pdf,html)").option("-o, --output <dir>", "Output directory for generated documents").option("--theme <theme>", "Built-in theme name (default, academic, github, corporate, minimal)").option("--css <path...>", "Custom CSS stylesheet(s) to inject").option("-c, --config <path>", "Path to custom markforge configuration file").option("--toc", "Force Table of Contents generation").option("-w, --watch", "Watch input file for changes and recompile", false).option("-s, --serve [port]", "Start interactive live-reload preview server").option("-O, --open", "Open preview or compiled document in default browser", false);
|
|
49
49
|
program.parse(process.argv);
|
|
50
50
|
const options = program.opts();
|
|
51
51
|
const inputArg = program.args[0] || "README.md";
|
|
@@ -55,11 +55,7 @@ async function main() {
|
|
|
55
55
|
process.exit(1);
|
|
56
56
|
}
|
|
57
57
|
const cliFormats = options.to ? options.to.split(",").map((f) => f.trim().toLowerCase()).filter(Boolean) : void 0;
|
|
58
|
-
const
|
|
59
|
-
import("ink"),
|
|
60
|
-
import("./App-GNRUPFM7.mjs"),
|
|
61
|
-
import("./loadConfig-PD6ENMAM.mjs")
|
|
62
|
-
]);
|
|
58
|
+
const { loadConfig } = await import("./loadConfig-PGJKPE6G.mjs");
|
|
63
59
|
const { config: fileConfig } = await loadConfig(
|
|
64
60
|
options.config,
|
|
65
61
|
path.dirname(resolvedInputPath)
|
|
@@ -72,6 +68,32 @@ async function main() {
|
|
|
72
68
|
...options.css ? { css: options.css } : {},
|
|
73
69
|
...options.toc ? { toc: true } : {}
|
|
74
70
|
};
|
|
71
|
+
if (options.serve !== false && options.serve !== void 0) {
|
|
72
|
+
const rawPort = options.serve === true ? 3e3 : parseInt(String(options.serve), 10);
|
|
73
|
+
const port = isNaN(rawPort) ? 3e3 : rawPort;
|
|
74
|
+
const { startPreviewServer } = await import("./previewServer-XAUOBNBZ.mjs");
|
|
75
|
+
const instance = await startPreviewServer({
|
|
76
|
+
filePath: resolvedInputPath,
|
|
77
|
+
port,
|
|
78
|
+
open: Boolean(options.open),
|
|
79
|
+
config: mergedConfig
|
|
80
|
+
});
|
|
81
|
+
console.log(`
|
|
82
|
+
======================================================`);
|
|
83
|
+
console.log(` MarkForge Live Reload Preview Server`);
|
|
84
|
+
console.log(` Target File : ${resolvedInputPath}`);
|
|
85
|
+
console.log(` Server URL : ${instance.url}`);
|
|
86
|
+
console.log(` Author : Ma'sum (https://github.com/masumrpg)`);
|
|
87
|
+
console.log(`======================================================
|
|
88
|
+
`);
|
|
89
|
+
console.log(`[READY] Watching for markdown and style changes. Press Ctrl+C to exit.
|
|
90
|
+
`);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const [{ render }, { App }] = await Promise.all([
|
|
94
|
+
import("ink"),
|
|
95
|
+
import("./App-3QDKBKHG.mjs")
|
|
96
|
+
]);
|
|
75
97
|
render(
|
|
76
98
|
/* @__PURE__ */ jsx(
|
|
77
99
|
App,
|