From b89be9610d913c744c2755a8d8d302e627397946 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= Date: Sat, 7 Jan 2023 17:15:19 +0100 Subject: [PATCH] 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. --- Userland/Utilities/markdown-check.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Userland/Utilities/markdown-check.cpp b/Userland/Utilities/markdown-check.cpp index 0a681eac01..4896a108e5 100644 --- a/Userland/Utilities/markdown-check.cpp +++ b/Userland/Utilities/markdown-check.cpp @@ -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; } }