« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/data/checks.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/data/checks.js b/src/data/checks.js
index 79a8d4c..d42146d 100644
--- a/src/data/checks.js
+++ b/src/data/checks.js
@@ -574,6 +574,16 @@ export function reportContentTextErrors(wikiData, {
             continue;
           }
         }
+      } else if (node.type === 'external-link') {
+        try {
+          new URL(node.data.href);
+        } catch (error) {
+          yield {
+            index, length,
+            message:
+              `Invalid URL ${colors.red(`"${node.data.href}"`)}`,
+          };
+        }
       }
     }
   }