Page MenuHomePhabricator

When suggesting a link, this link shouldn't be preceding or following an existing link
Open, Needs TriagePublic

Description

This effect is known as WP:BLUESEA:

When possible, avoid placing links next to each other so that they look like a single link (a "sea of blue"), as in [[Ireland|Irish]] [[Chess]] [[Championship]] (Irish Chess Championship). Consider rephrasing the sentence, omitting one of the links, or using a single, more specific link instead (e.g. [[Irish Chess Championship]]).

Example at ru.wp.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Thanks for flagging this.
The reported behavior is expected to happen (sometimes) as the current model does not check for already existing links next to the anchor of the recommended link.
In principle, it is possible to control for that. When iterating through the text to find candidate anchors for new links (code), we would have to keep track of what comes before and what comes after and check whether it is a link or not. However, currently we only iterate through text-nodes of mwparserfromhell's output (ignoring any other nodes such as links) since these are the only type of elements where we want to place new links. Thus, we would have to slightly change the way we iterate through the nodes to be able to check whether a preceeding or following node (directly next to a candidate anchor) is of type WikiLink.