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

markdown-check: Check that binary links use the text "Open"

Binary links will only be allowed in these contexts, which is all that
we currently use them for anyways. This mainly gets rid of useless "not
checking local link" spam relating to binaries, and only a few local
links remain.
This commit is contained in:
kleines Filmröllchen 2023-01-07 17:15:19 +01:00 committed by Linus Groh
parent f4b95835d1
commit b89be9610d

View file

@ -213,9 +213,17 @@ RecursionDecision MarkdownLinkage::visit(Markdown::Text::LinkNode const& link_no
if (url.path().starts_with("/res/icons/"sv)) {
auto file = DeprecatedString::formatted("{}/Base{}", m_serenity_source_directory, url.path());
m_file_links.append({ file, DeprecatedString(), StringCollector::from(*link_node.text) });
return RecursionDecision::Recurse;
} else if (url.path().starts_with("/bin"sv)) {
StringBuilder builder;
link_node.text->render_to_html(builder);
auto link_text = builder.string_view();
if (link_text != "Open"sv) {
warnln("Binary link named '{}' is not allowed, binary links must be called 'Open'. Linked binary: {}", link_text, href);
m_has_invalid_link = true;
}
} else {
outln("Not checking local link {}", href);
}
outln("Not checking local link {}", href);
return RecursionDecision::Recurse;
}
}