@Override
  public @Nls String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
    if (!(element instanceof PsiFileSystemItem) || ((PsiFileSystemItem)element).isDirectory()) {
      return null;
    }
    final VirtualFile file = ((PsiFileSystemItem)element).getVirtualFile();
    if (file == null) {
      return null;
    }
    ImageInfo imageInfo = ImageInfoIndex.getInfo(file, element.getProject());
    if (imageInfo == null) {
      return null;
    }
    int imageWidth = imageInfo.width;
    int imageHeight = imageInfo.height;

    int maxSize = Math.max(imageInfo.width, imageInfo.height);
    if (maxSize > MAX_IMAGE_SIZE) {
      double scaleFactor = (double)MAX_IMAGE_SIZE / (double)maxSize;
      imageWidth *= scaleFactor;
      imageHeight *= scaleFactor;
    }
    try {
      String path = file.getPath();
      if (SystemInfo.isWindows) {
        path = "/" + path;
      }
      final String url = new URI("file", null, path, null).toString();
      HtmlChunk.Element img = HtmlChunk.tag("img")
        .attr("src", url)
        .attr("width", imageWidth)
        .attr("height", imageHeight);
      String message = ImagesBundle.message("image.description", imageInfo.width, imageInfo.height, imageInfo.bpp);
      return new HtmlBuilder().append(img).append(HtmlChunk.p().addText(message)).toString();
    }
    catch (URISyntaxException ignored) {
      return null;
    }
  }
@Override
  public @Nls String generateDoc(PsiElement element, @Nullable PsiElement originalElement)