]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
mdlinkcheck: only look for markdown links in markdown files
authorDaniel Stenberg <daniel@haxx.se>
Thu, 11 Dec 2025 16:16:37 +0000 (17:16 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 11 Dec 2025 22:40:07 +0000 (23:40 +0100)
It finds debug outputs in source code otherwise.

Output the whitelist "warnings" to stderr to better allow us to count
URLs with `./mdlinkcheck --dry-run | wc -l`.

Closes #19938

scripts/mdlinkcheck

index bd54d96fe2ea2a673eb624650625467da178b710..4ee0b537525a2afa4a88220bc8dd08cfc8d4e53c 100755 (executable)
@@ -158,9 +158,12 @@ sub findlinks {
     open(F, "<:crlf", "$f") ||
         return;
 
+    # is it a markdown extension?
+    my $md = ($f =~ /\.md$/i);
+
     while(<F>) {
         chomp;
-        if(/\]\(([^)]*)/) {
+        if($md && /\]\(([^)]*)/) {
             my $link = $1;
             #print "$f:$line $link\n";
             storelink($f, $line, $link);
@@ -209,7 +212,7 @@ for my $f (@files) {
 
 for my $u (sort keys %whitelist) {
     if($whitelist{$u} == 1) {
-        printf "warning: unused whitelist entry: '$u'\n";
+        printf STDERR "warning: unused whitelist entry: '$u'\n";
     }
 }