Jelajahi Sumber

markdown-check: Check that no old-style inter-manpage links are used

We've had quite some instances of people reintroducing these kinds of
links because they didn't know about the "new" help:// scheme. This
check should now prevent that from happening, though it might in rare
circumstances trigger a false positive.
kleines Filmröllchen 2 tahun lalu
induk
melakukan
f4b95835d1

+ 1 - 1
Base/usr/share/man/man1/pmemdump.md

@@ -35,4 +35,4 @@ offset fails.
 
 ## See also
 
-* [`mem`(4)](../man4/mem.md)
+* [`mem`(4)](help://man/4/mem)

+ 5 - 0
Userland/Utilities/markdown-check.cpp

@@ -204,6 +204,11 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
             return RecursionDecision::Recurse;
         }
         if (url.scheme() == "file") {
+            if (url.path().contains("man"sv) && url.path().ends_with(".md"sv)) {
+                warnln("Inter-manpage link without the help:// scheme: {}\nPlease use help URLs of the form 'help://man/<section>/<subsection...>/<page>'", href);
+                m_has_invalid_link = true;
+                return RecursionDecision::Recurse;
+            }
             // TODO: Check more possible links other than icons.
             if (url.path().starts_with("/res/icons/"sv)) {
                 auto file = DeprecatedString::formatted("{}/Base{}", m_serenity_source_directory, url.path());