diff options
author | kleines Filmröllchen <filmroellchen@serenityos.org> | 2022-02-25 13:47:41 +0100 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2022-02-26 20:05:06 +0200 |
commit | 4ef1bedc380d44eefee8c94ff7f83382f2e63d57 (patch) | |
tree | b8ddca36138df23894649618af730520b1a8a830 /Userland/Utilities | |
parent | 7399520e9a9da8c73ab7e58a4060e8ba089474a4 (diff) | |
download | serenity-4ef1bedc380d44eefee8c94ff7f83382f2e63d57.zip |
Utilities: Check help:// manpage links in markdown-check
Diffstat (limited to 'Userland/Utilities')
-rw-r--r-- | Userland/Utilities/markdown-check.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index 50ffcf2dbf..6a4fb58968 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -174,8 +174,19 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no return RecursionDecision::Recurse; } if (url.scheme() == "help") { - // TODO: Check that the man page actually exists. (That check would also fail because we are currently referring to some nonexistent man pages.) - outln("Not checking man page link {}", href); + if (url.host() != "man") { + warnln("help:// URL without 'man': {}", href); + m_has_invalid_link = true; + return RecursionDecision::Recurse; + } + if (url.paths().size() < 2) { + warnln("help://man URL is missing section or page: {}", href); + m_has_invalid_link = true; + return RecursionDecision::Recurse; + } + auto file = String::formatted("../man{}/{}.md", url.paths()[0], url.paths()[1]); + + m_file_links.append({ file, String(), StringCollector::from(*link_node.text) }); return RecursionDecision::Recurse; } if (url.scheme() == "file") { |