hdoc-tools 0.41.1 → 0.41.3
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 +9 -2
- package/hdoc-serve.js +8 -1
- package/package.json +1 -1
package/hdoc-build.js
CHANGED
@@ -520,18 +520,25 @@
|
|
520
520
|
linkify: true,
|
521
521
|
typographer: true,
|
522
522
|
highlight: function (str, lang) {
|
523
|
-
|
523
|
+
|
524
|
+
if (lang === "mermaid" && process.env.GITHUB_ACTIONS !== 'true') {
|
524
525
|
try {
|
525
526
|
const tmpInput = tmp.fileSync({ postfix: ".mmd" });
|
526
527
|
const tmpOutput = tmp.fileSync({ postfix: ".svg" });
|
527
528
|
|
529
|
+
/*
|
528
530
|
if (!str.startsWith('---')) {
|
529
531
|
str = '---\n' + fs.readFileSync(mermaid_theme_path, {encoding: 'utf-8'}) + `\n---\n${str}`;
|
530
532
|
}
|
533
|
+
*/
|
531
534
|
|
532
535
|
fs.writeFileSync(tmpInput.name, str);
|
536
|
+
let cmd = `${__dirname}/node_modules/.bin/mmdc`;
|
533
537
|
|
534
|
-
|
538
|
+
if (process.platform === "win32") {
|
539
|
+
cmd = `"${cmd}"`;
|
540
|
+
}
|
541
|
+
cmd = `${cmd} -i "${tmpInput.name}" -o "${tmpOutput.name}" --quiet --backgroundColor transparent`;
|
535
542
|
console.log(`Generating Inline Mermaid SVG found in: ${file_path.relativePath}`);
|
536
543
|
execSync(cmd);
|
537
544
|
|
package/hdoc-serve.js
CHANGED
@@ -137,13 +137,20 @@
|
|
137
137
|
const tmpInput = tmp.fileSync({ postfix: ".mmd" });
|
138
138
|
const tmpOutput = tmp.fileSync({ postfix: ".svg" });
|
139
139
|
|
140
|
+
/*
|
140
141
|
if (!str.startsWith('---')) {
|
141
142
|
str = '---\n' + fs.readFileSync(mermaid_theme_path, {encoding: 'utf-8'}) + `\n---\n${str}`;
|
142
143
|
}
|
144
|
+
*/
|
143
145
|
|
144
146
|
fs.writeFileSync(tmpInput.name, str);
|
145
147
|
|
146
|
-
|
148
|
+
let cmd = `${__dirname}/node_modules/.bin/mmdc`;
|
149
|
+
|
150
|
+
if (process.platform === "win32") {
|
151
|
+
cmd = `"${cmd}"`;
|
152
|
+
}
|
153
|
+
cmd = `${cmd} -i "${tmpInput.name}" -o "${tmpOutput.name}" --quiet --backgroundColor transparent`;
|
147
154
|
console.log(`Generating Inline Mermaid SVG found in: ${file_path}`);
|
148
155
|
execSync(cmd);
|
149
156
|
|