summaryrefslogtreecommitdiff
path: root/Userland/Utilities/markdown-check.cpp
diff options
context:
space:
mode:
authorkleines Filmröllchen <filmroellchen@serenityos.org>2023-01-07 17:15:19 +0100
committerLinus Groh <mail@linusgroh.de>2023-01-08 13:35:29 +0100
commitb89be9610d913c744c2755a8d8d302e627397946 (patch)
tree180de0922df98f5bf7c517e89058bdb78ec2dffb /Userland/Utilities/markdown-check.cpp
parentf4b95835d11252140ea1c44fcda055e56355c7d6 (diff)
downloadserenity-b89be9610d913c744c2755a8d8d302e627397946.zip
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.
Diffstat (limited to 'Userland/Utilities/markdown-check.cpp')
-rw-r--r--Userland/Utilities/markdown-check.cpp12
1 files 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;
}
}