Skip to content

Commit

Permalink
fix: Wrong code block renderer when documentation contains CLRF
Browse files Browse the repository at this point in the history
Fixes #368

Signed-off-by: azerr <[email protected]>
  • Loading branch information
angelozerr committed Jul 29, 2024
1 parent 532417b commit eef9634
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
package com.redhat.devtools.lsp4ij.features.documentation;

import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtilRt;
import com.intellij.psi.PsiFile;
import com.redhat.devtools.lsp4ij.internal.StringUtils;
import org.eclipse.lsp4j.*;
Expand Down Expand Up @@ -96,7 +97,7 @@ private LSPDocumentationHelper() {
})
.filter(Objects::nonNull)
.toList();
} else if (hoverContents.isRight()){
} else if (hoverContents.isRight()) {
MarkupContent content = hoverContents.getRight();
if (isValidContent(content)) {
return List.of(content);
Expand Down Expand Up @@ -134,7 +135,7 @@ public static String convertToHtml(@NotNull List<MarkupContent> contents,
}
MarkupContent content = contents.get(i);
htmlBody.append(MarkupKind.MARKDOWN.equals(content.getKind()) ?
MarkdownConverter.getInstance(project).toHtml(content.getValue(), file) :
MarkdownConverter.getInstance(project).toHtml(StringUtilRt.convertLineSeparators(content.getValue()), file) :
content.getValue());
}
return htmlBody.toString();
Expand Down

0 comments on commit eef9634

Please sign in to comment.