hdoc-tools 0.29.0 → 0.29.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/hdoc-validate.js +10 -3
  2. package/package.json +1 -1
package/hdoc-validate.js CHANGED
@@ -529,8 +529,9 @@ const e = require("express");
529
529
  }
530
530
 
531
531
  if (
532
- links[i].toLowerCase().includes("docs.hornbill.com") ||
533
- links[i].toLowerCase().includes("docs-internal.hornbill.com")
532
+ (links[i].toLowerCase().includes("docs.hornbill.com") ||
533
+ links[i].toLowerCase().includes("docs-internal.hornbill.com")) &&
534
+ !markdown_paths.relativePath.includes('/_inline/')
534
535
  ) {
535
536
  const error_message = processErrorMessage(`Hornbill Docs links should not be fully-qualified: ${links[i]}`, markdown_paths.relativePath, markdown_content, links[i]);
536
537
  errors[htmlFile.relativePath].push( error_message );
@@ -542,7 +543,7 @@ const e = require("express");
542
543
  url: links[i],
543
544
  method: 'get',
544
545
  timeout: 10000,
545
- maxRedirects: 0,
546
+ maxRedirects: 5,
546
547
  validateStatus: (status) =>
547
548
  status >= 200 && status < 400,
548
549
  })
@@ -576,6 +577,12 @@ const e = require("express");
576
577
  for (let i = 0; i < links.length; i++) {
577
578
  // Validate that image is a valid URL first
578
579
  if (!hdoc.valid_url(links[i])) {
580
+
581
+ if (!links[i].startsWith("/") && !markdown_paths.relativePath.includes('/_inline/')) {
582
+ const error_message = processErrorMessage(`Root relative image links should start with a forward-slash: ${links[i]}`, markdown_paths.relativePath, markdown_content, links[i]);
583
+ errors[htmlFile.relativePath].push(error_message);
584
+ }
585
+
579
586
  // Could be a relative path, check image exists
580
587
  doesFileExist(source_path, htmlFile, links[i], markdown_paths.relativePath, markdown_content);
581
588
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hdoc-tools",
3
- "version": "0.29.0",
3
+ "version": "0.29.2",
4
4
  "description": "Hornbill HDocBook Development Support Tool",
5
5
  "main": "hdoc.js",
6
6
  "bin": {