1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 08:44:58 +00:00

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.
This commit is contained in:
kleines Filmröllchen 2023-01-07 17:05:33 +01:00 committed by Linus Groh
parent e430667923
commit f4b95835d1
2 changed files with 6 additions and 1 deletions

View file

@ -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());