hdoc-tools 0.41.2 → 0.41.4
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/hdoc-build.js +21 -13
- package/hdoc-serve.js +6 -1
- package/package.json +1 -1
- package/templates/mermaid-puppeteer-config.json +6 -0
package/hdoc-build.js
CHANGED
@@ -18,33 +18,41 @@
|
|
18
18
|
|
19
19
|
const h_tags_to_search = ["h1", "h2", "h3"];
|
20
20
|
const image_extensions = ["png", "svg", "jpg"];
|
21
|
-
|
21
|
+
|
22
|
+
const templates_path = path.join(
|
22
23
|
__dirname,
|
23
|
-
"templates"
|
24
|
+
"templates"
|
25
|
+
);
|
26
|
+
const doc_header_template_path = path.join(
|
27
|
+
templates_path,
|
24
28
|
"doc-header.html",
|
25
29
|
);
|
26
30
|
const non_git_doc_header_template_path = path.join(
|
27
|
-
|
28
|
-
"templates",
|
31
|
+
templates_path,
|
29
32
|
"doc-header-non-git.html",
|
30
33
|
);
|
31
34
|
const pdf_header_template_path = path.join(
|
32
|
-
|
33
|
-
"templates",
|
35
|
+
templates_path,
|
34
36
|
"pdf-header.html",
|
35
37
|
);
|
36
38
|
const non_git_pdf_header_template_path = path.join(
|
37
|
-
|
38
|
-
"templates",
|
39
|
+
templates_path,
|
39
40
|
"pdf-header-non-git.html",
|
40
41
|
);
|
41
42
|
|
42
43
|
const mermaid_theme_path = path.resolve(
|
43
|
-
|
44
|
-
"templates",
|
44
|
+
templates_path,
|
45
45
|
"mermaid-theme.yaml",
|
46
46
|
);
|
47
47
|
|
48
|
+
let mermaid_puppeteer_config_path = path.resolve(
|
49
|
+
templates_path,
|
50
|
+
"mermaid-puppeteer-config.json",
|
51
|
+
);
|
52
|
+
if (process.platform === "win32") {
|
53
|
+
mermaid_puppeteer_config_path = `"${mermaid_puppeteer_config_path}"`
|
54
|
+
}
|
55
|
+
|
48
56
|
const pdf_template_path = path.join(__dirname, "templates", "pdf");
|
49
57
|
const ui_css_path = path.join(__dirname, "ui", "css");
|
50
58
|
const pdf_template_file_path = path.join(pdf_template_path, "template.html");
|
@@ -532,11 +540,11 @@
|
|
532
540
|
|
533
541
|
fs.writeFileSync(tmpInput.name, str);
|
534
542
|
let cmd = `${__dirname}/node_modules/.bin/mmdc`;
|
535
|
-
|
543
|
+
|
536
544
|
if (process.platform === "win32") {
|
537
|
-
cmd = `"${cmd}"`;
|
545
|
+
cmd = `"${cmd}.cmd"`;
|
538
546
|
}
|
539
|
-
cmd = `${cmd} -i "${tmpInput.name}" -o "${tmpOutput.name}" --
|
547
|
+
cmd = `${cmd} -i "${tmpInput.name}" -o "${tmpOutput.name}" --backgroundColor transparent --puppeteerConfigFile ${mermaid_puppeteer_config_path}`;
|
540
548
|
console.log(`Generating Inline Mermaid SVG found in: ${file_path.relativePath}`);
|
541
549
|
execSync(cmd);
|
542
550
|
|
package/hdoc-serve.js
CHANGED
@@ -143,7 +143,12 @@
|
|
143
143
|
|
144
144
|
fs.writeFileSync(tmpInput.name, str);
|
145
145
|
|
146
|
-
|
146
|
+
let cmd = `${__dirname}/node_modules/.bin/mmdc`;
|
147
|
+
|
148
|
+
if (process.platform === "win32") {
|
149
|
+
cmd = `"${cmd}"`;
|
150
|
+
}
|
151
|
+
cmd = `${cmd} -i "${tmpInput.name}" -o "${tmpOutput.name}" --quiet --backgroundColor transparent`;
|
147
152
|
console.log(`Generating Inline Mermaid SVG found in: ${file_path}`);
|
148
153
|
execSync(cmd);
|
149
154
|
|
package/package.json
CHANGED