private String convertNodeToHtml(InspectionTreeNode node) {
    if (node instanceof InspectionRootNode) {
      return "<b>" + escapeNonBreakingSymbols(node) + "</b>";
    }
    else if (node instanceof ProblemDescriptionNode) {
      final CommonProblemDescriptor descriptor = ((ProblemDescriptionNode)node).getDescriptor();
      String warningLevelName = "";
      String color = null;
      if (descriptor instanceof ProblemDescriptorBase) {
        InspectionToolWrapper<?, ?> tool = ((ProblemDescriptionNode)node).getToolWrapper();
        HighlightDisplayKey key = HighlightDisplayKey.find(tool.getShortName());
        HighlightSeverity severity = myProfile.getErrorLevel(key, ((ProblemDescriptorBase)descriptor).getStartElement()).getSeverity();
        HighlightDisplayLevel level = HighlightDisplayLevel.find(severity);
        if (HighlightDisplayLevel.ERROR.equals(level)) {
          color = ERROR_COLOR;
        }
        else if (HighlightDisplayLevel.WARNING.equals(level)) {
          color = WARNING_COLOR;
        }
        warningLevelName = StringUtil.toUpperCase(level.getSeverity().getDisplayName());
      }

      final StringBuilder sb = new StringBuilder();
      sb.append("<span style=\"margin:1px;");
      if (color != null) {
        sb.append("background:#").append(color);
      }
      sb.append("\">").append(warningLevelName).append("</span>&nbsp;").append(escapeNonBreakingSymbols(node));
      return sb.toString();
    }
    else if (node instanceof RefElementNode) {
      String type = myManager.getType(Objects.requireNonNull(((RefElementNode)node).getElement()));
      return type + "&nbsp;<b>" + escapeNonBreakingSymbols(node) + "</b>";
    }
    else if (node instanceof InspectionNode) {
      return node.getClass() != InspectionNode.class
             ? "<b>" + escapeNonBreakingSymbols(node) + "</b>"
             : "<b>" + escapeNonBreakingSymbols(node) + "</b>&nbsp;inspection";
    }
    else if (node instanceof InspectionGroupNode) {
      return "<b>" + escapeNonBreakingSymbols(node) + "</b>&nbsp;group";
    }
    else {
      return escapeNonBreakingSymbols(node);
    }
  }
private String convertNodeToHtml(InspectionTreeNode node)