@NotNull
  public static @Nls String buildPreview(@NotNull @Nls final String header,
                                         @Nullable final String qName,
                                         @Nullable @Nls final String fullText) {
    if (fullText == null) {
      return header;
    }

    // Build links info.
    Map<String/*qName*/, String/*address*/> links = new HashMap<>();
    process(fullText, new LinksCollector(links));

    // Add derived names.
    Map<String, String> toAdd = new HashMap<>();
    for (Map.Entry<String, String> entry : links.entrySet()) {
      String shortName = parseShortName(entry.getKey());
      if (shortName != null) {
        toAdd.put(shortName, entry.getValue());
      }
      String longName = parseLongName(entry.getKey(), entry.getValue());
      if (longName != null) {
        toAdd.put(longName, entry.getValue());
      }
    }
    links.putAll(toAdd);
    if (qName != null) {
      links.put(qName, DocumentationManagerProtocol.PSI_ELEMENT_PROTOCOL + qName);
    }

    // Apply links info to the header template.
    List<TextRange> modifiedRanges = new ArrayList<>();
    List<String> sortedReplacements = new ArrayList<>(links.keySet());
    sortedReplacements.sort(REPLACEMENTS_COMPARATOR);
    @Nls StringBuilder buffer = new StringBuilder(header);
    replace(buffer, "\n", "<br/>", modifiedRanges);
    for (String replaceFrom : sortedReplacements) {
      replace(buffer, replaceFrom, String.format("<a href=\"%s\">%s</a>", links.get(replaceFrom), replaceFrom), modifiedRanges);
    }
    return buffer.toString();
  }
@NotNull
  public static @Nls String buildPreview(@NotNull @Nls final String header,
                                         @Nullable final String qName,
                                         @Nullable @Nls final String fullText)