hdoc-tools 0.26.3 → 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 -4
- 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);
|
@@ -688,7 +690,7 @@ const e = require("express");
|
|
688
690
|
// Check for hash anchor
|
689
691
|
if (hash_anchor !== null) {
|
690
692
|
isHashAnchor(
|
691
|
-
{ path: html_file_path, relativePath: html_path.relativePath },
|
693
|
+
{ path: html_file_path, relativePath: html_path.relativePath, extension: html_path.extension },
|
692
694
|
hash_anchor,
|
693
695
|
relative_path,
|
694
696
|
);
|