Skip to content

Commit

Permalink
markdown-check: Check that binary links use the text "Open"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kleinesfilmroellchen authored and linusg committed Jan 8, 2023
1 parent f4b9583 commit b89be96
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Userland/Utilities/markdown-check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit b89be96

Please sign in to comment.