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:
parent
f4b95835d1
commit
b89be9610d
1 changed files with 10 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue