hdoc-tools 0.26.2 → 0.26.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-validate.js +6 -5
- package/package.json +1 -1
package/hdoc-validate.js
CHANGED
@@ -415,6 +415,9 @@ const e = require("express");
|
|
415
415
|
};
|
416
416
|
|
417
417
|
const isHashAnchor = (html_file, hash_anchor, full_hash_anchor_link = "") => {
|
418
|
+
const markdown_paths = getMDPathFromHtmlPath(html_file);
|
419
|
+
const markdown_content = fs.readFileSync(markdown_paths.markdownPath, 'utf8');
|
420
|
+
|
418
421
|
try {
|
419
422
|
const file_content = fs.readFileSync(html_file.path, {
|
420
423
|
encoding: "utf-8",
|
@@ -425,9 +428,8 @@ const e = require("express");
|
|
425
428
|
if (
|
426
429
|
!file_content.includes(`<div id="hb-doc-anchor-${clean_hash_anchor}"`)
|
427
430
|
) {
|
428
|
-
|
429
|
-
|
430
|
-
);
|
431
|
+
const error_message = processErrorMessage(`Target hash anchor is not present in page content: ${full_hash_anchor_link !== "" ? full_hash_anchor_link : hash_anchor}`, markdown_paths.relativePath, markdown_content, full_hash_anchor_link);
|
432
|
+
errors[html_file.relativePath].push( error_message );
|
431
433
|
}
|
432
434
|
} catch (e) {
|
433
435
|
errors[html_file.relativePath].push(e);
|
@@ -527,7 +529,6 @@ const e = require("express");
|
|
527
529
|
continue;
|
528
530
|
}
|
529
531
|
|
530
|
-
console.log(`Debug checking: [${links[i]}]`);
|
531
532
|
if (
|
532
533
|
links[i].toLowerCase().includes("docs.hornbill.com") ||
|
533
534
|
links[i].toLowerCase().includes("docs-internal.hornbill.com")
|
@@ -689,7 +690,7 @@ const e = require("express");
|
|
689
690
|
// Check for hash anchor
|
690
691
|
if (hash_anchor !== null) {
|
691
692
|
isHashAnchor(
|
692
|
-
{ path: html_file_path, relativePath: html_path.relativePath },
|
693
|
+
{ path: html_file_path, relativePath: html_path.relativePath, extension: html_path.extension },
|
693
694
|
hash_anchor,
|
694
695
|
relative_path,
|
695
696
|
);
|