RequiresReadLock
  @RequiresBackgroundThread
  private @Nullable HtmlChunk getExternalText(
    @Nullable PsiElement element,
    @NlsSafe @Nullable String externalUrl,
    @Nullable DocumentationProvider provider
  ) {
    if (element == null || provider == null) return null;

    PsiElement originalElement = getOriginalElement(element);
    if (!shouldShowExternalDocumentationLink(provider, element, originalElement)) {
      return null;
    }

    String title = getTitle(element);
    if (externalUrl == null) {
      List<String> urls = provider.getUrlFor(element, originalElement);
      if (urls == null) {
        return null;
      }
      HtmlChunk links = getExternalLinks(title, urls);
      if (links != null) {
        return links;
      }
    }
    else {
      HtmlChunk link = getLink(title, externalUrl);
      if (link != null) return link;
    }

    return getGenericExternalDocumentationLink(title);
  }

RequiresReadLock
  @RequiresBackgroundThread
  private @Nullable HtmlChunk getExternalText(
    @Nullable PsiElement element,
    @NlsSafe @Nullable String externalUrl,
    @Nullable DocumentationProvider provider
  ) 