summaryrefslogtreecommitdiff
path: root/Userland/Utilities/markdown-check.cpp
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2023-01-07 17:05:33 +0100
committerLinus Groh <mail@linusgroh.de>2023-01-08 13:35:29 +0100
commitf4b95835d11252140ea1c44fcda055e56355c7d6 (patch)
tree6bb208a47accefa6fe850515fd80bac702bcec9d /Userland/Utilities/markdown-check.cpp
parente430667923cabbf2b95821d3654eeec0d65392f5 (diff)
downloadserenity-f4b95835d11252140ea1c44fcda055e56355c7d6.zip
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.
Diffstat (limited to 'Userland/Utilities/markdown-check.cpp')
-rw-r--r--Userland/Utilities/markdown-check.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp
index fe93b0e865..0a681eac01 100644
--- a/Userland/Utilities/markdown-check.cpp
+++ b/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());