HtmlChunk (@NlsSafe @NotNull String string) { if (string.isEmpty()) { return HtmlChunk.empty(); } @NlsSafe String[] lines = string.split("\n"); return new HtmlBuilder().appendWithSeparators( HtmlChunk.br(), ContainerUtil.map(lines, line -> HtmlChunk.text(line)) ).wrapWith("p"); }