hdoc-tools 0.60.1 → 0.62.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/LICENSE +21 -21
- package/README.md +89 -75
- package/hdoc-build-db.js +275 -275
- package/hdoc-build-embeddings.js +202 -202
- package/hdoc-build-pdf.js +232 -232
- package/hdoc-build.js +14 -6
- package/hdoc-bump.js +4 -2
- package/hdoc-content-routes.js +143 -83
- package/hdoc-create.js +110 -108
- package/hdoc-db.js +114 -114
- package/hdoc-help.js +60 -60
- package/hdoc-init.js +103 -68
- package/hdoc-install-browser.js +145 -145
- package/hdoc-mermaid.js +204 -204
- package/hdoc-module.js +1102 -1079
- package/hdoc-serve.js +13 -7
- package/hdoc-stats.js +9 -9
- package/hdoc-validate-config.js +355 -329
- package/hdoc-validate-interbook.js +321 -0
- package/hdoc-validate.js +1231 -1158
- package/hdoc-ver.js +4 -2
- package/hdoc.js +12 -11
- package/npm-shrinkwrap.json +2 -2
- package/package.json +13 -2
- package/schemas/hdocbook-project.schema.json +20 -0
- package/schemas/hdocbook.schema.json +6 -2
- package/templates/doc-header-non-git.html +19 -19
- package/templates/doc-header.html +26 -26
- package/templates/init/.github/workflows/hdocbuild_onpull.yml +16 -16
- package/templates/init/.github/workflows/hdocbuild_onpush.yml +15 -15
- package/templates/init/LICENSE +21 -21
- package/templates/init/README.md +9 -9
- package/templates/init/_hdocbook/index.md +4 -4
- package/templates/init/gitignore +8 -8
- package/templates/init/resources/README.md +2 -2
- package/templates/pdf/css/custom-block.css +90 -90
- package/templates/pdf/css/fonts.css +221 -221
- package/templates/pdf/css/hdocs-pdf.css +495 -495
- package/templates/pdf/css/vars.css +404 -404
- package/templates/pdf/template-footer.html +19 -19
- package/templates/pdf/template-header.html +37 -37
- package/templates/pdf/template.html +20 -20
- package/templates/pdf-header-non-git.html +12 -12
- package/templates/pdf-header.html +16 -16
- package/ui/content/invalid-hdocbook-json.html +6 -6
- package/ui/content/invalid-hdocbook-json.md +7 -7
- package/ui/css/theme-default/styles/components/content.css +124 -124
- package/ui/css/theme-default/styles/components/sidebar.css +182 -182
- package/ui/css/theme-default/styles/htldoc.layouts.css +310 -310
- package/ui/index.html +419 -419
- package/ui/js/doc.hornbill.js +31 -44
- package/ui/js/mermaid-theme.json +27 -0
- package/hdoc-build-onyx.js +0 -134
- package/templates/mermaid-theme.yaml +0 -28
- package/templates/pdf/fonts/inter-cyrillic copy.woff2 +0 -0
package/hdoc-serve.js
CHANGED
|
@@ -4,9 +4,8 @@
|
|
|
4
4
|
const fs = require("node:fs");
|
|
5
5
|
const path = require("node:path");
|
|
6
6
|
const hdoc = require(path.join(__dirname, "hdoc-module.js"));
|
|
7
|
-
const { create_content_handler, build_nav_inline } =
|
|
8
|
-
path.join(__dirname, "hdoc-content-routes.js")
|
|
9
|
-
);
|
|
7
|
+
const { create_content_handler, build_nav_inline, resolve_within_root } =
|
|
8
|
+
require(path.join(__dirname, "hdoc-content-routes.js"));
|
|
10
9
|
|
|
11
10
|
let port = 3000;
|
|
12
11
|
let docId;
|
|
@@ -47,9 +46,12 @@
|
|
|
47
46
|
"hdocbook-project.json",
|
|
48
47
|
);
|
|
49
48
|
|
|
50
|
-
// Load the hdocbook config
|
|
49
|
+
// Load the hdocbook config file (readFileSync, not require — no module
|
|
50
|
+
// cache, and the content routes re-read it per request anyway)
|
|
51
51
|
try {
|
|
52
|
-
hdocbook_project =
|
|
52
|
+
hdocbook_project = JSON.parse(
|
|
53
|
+
fs.readFileSync(hdocbook_project_config_path, "utf8"),
|
|
54
|
+
);
|
|
53
55
|
} catch (e) {
|
|
54
56
|
console.error(`\nFailed to load hdocbook-project.json:\n${e}\n`);
|
|
55
57
|
process.exit(1);
|
|
@@ -72,7 +74,7 @@
|
|
|
72
74
|
|
|
73
75
|
// Pull in the book config file
|
|
74
76
|
try {
|
|
75
|
-
hdocbook_config =
|
|
77
|
+
hdocbook_config = JSON.parse(fs.readFileSync(hdocbook_path, "utf8"));
|
|
76
78
|
} catch (e) {
|
|
77
79
|
console.error(`\nFailed to load hdocbook.json:${e}\n`);
|
|
78
80
|
process.exit(1);
|
|
@@ -93,7 +95,11 @@
|
|
|
93
95
|
// Catch all
|
|
94
96
|
app.get("/{*splat}", (req, res) => {
|
|
95
97
|
|
|
96
|
-
const ui_file_path =
|
|
98
|
+
const ui_file_path = resolve_within_root(ui_path, req.url);
|
|
99
|
+
if (ui_file_path === null) {
|
|
100
|
+
content.send_content_resource_404(req, res);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
97
103
|
|
|
98
104
|
// To support the SPA application behavior, if there is no file extension present, then
|
|
99
105
|
// we simply return the /index.html file content to the client
|
package/hdoc-stats.js
CHANGED
|
@@ -5,9 +5,10 @@
|
|
|
5
5
|
const hdoc = require(path.join(__dirname, "hdoc-module.js"));
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
// Regex to remove Hornbill
|
|
8
|
+
// Regex to remove Hornbill admonition markers (::: note etc — see
|
|
9
|
+
// custom_modules/tips.js) so the marker keywords don't inflate word counts.
|
|
9
10
|
const hbMDTagRegex =
|
|
10
|
-
/(:{3}[ ]note)|(:{3}[ ]tip)|(:{3}[ ]important)|(:{3}[ ]caution)|(:{3}[ ]warning)|(:{3})/g;
|
|
11
|
+
/(:{3}[ ]note)|(:{3}[ ]tip)|(:{3}[ ]important)|(:{3}[ ]info)|(:{3}[ ]caution)|(:{3}[ ]warning)|(:{3})/g;
|
|
11
12
|
|
|
12
13
|
const stats = {
|
|
13
14
|
totalMDFiles: 0,
|
|
@@ -42,15 +43,12 @@
|
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
// Options for hdoc.scan_dir (see hdoc-module.js for the supported keys)
|
|
47
|
+
const scanOptions = {
|
|
47
48
|
depth: 10,
|
|
48
49
|
extensions: ["md", "html", "htm"],
|
|
49
|
-
hash: false,
|
|
50
50
|
normalize: true,
|
|
51
|
-
size: true,
|
|
52
51
|
sizeInBytes: true,
|
|
53
|
-
stat: false,
|
|
54
52
|
symbolicLinks: false,
|
|
55
53
|
};
|
|
56
54
|
|
|
@@ -105,12 +103,14 @@
|
|
|
105
103
|
});
|
|
106
104
|
|
|
107
105
|
// Scan content path directory, send file info to callback for processing
|
|
108
|
-
hdoc.scan_dir(bookPath,
|
|
106
|
+
hdoc.scan_dir(bookPath, scanOptions, fileCallback);
|
|
109
107
|
for (const element of markdownFiles) {
|
|
110
108
|
// Load markdown file
|
|
111
109
|
const md_txt = fs.readFileSync(element.path, "utf8");
|
|
112
110
|
|
|
113
|
-
const html_txt = md.render(
|
|
111
|
+
const html_txt = md.render(
|
|
112
|
+
md_txt.toString().replace(hbMDTagRegex, ""),
|
|
113
|
+
);
|
|
114
114
|
const text = hdoc.html_to_text(html_txt);
|
|
115
115
|
|
|
116
116
|
// Do the wordcount and add to status
|