Skip to content
This repository was archived by the owner on Mar 10, 2022. It is now read-only.

Commit 0721cdb

Browse files
committed
Disabled pretty print of blog post html content
1 parent e00a8ce commit 0721cdb

File tree

1 file changed

+5
-1
lines changed
  • java-dto/src/main/java/net/cryptic_game/backend/dto/website

1 file changed

+5
-1
lines changed

java-dto/src/main/java/net/cryptic_game/backend/dto/website/BlogPost.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import lombok.AllArgsConstructor;
1010
import lombok.Data;
1111
import org.jsoup.Jsoup;
12+
import org.jsoup.nodes.Document.OutputSettings;
1213
import org.jsoup.safety.Whitelist;
1314

1415
@Data
@@ -23,6 +24,9 @@ public class BlogPost {
2324
.addEnforcedAttribute("a", "target", "_blank")
2425
.addEnforcedAttribute("a", "rel", "nofollow noopener noreferrer");
2526

27+
private static final OutputSettings OUTPUT_SETTINGS = new OutputSettings()
28+
.prettyPrint(false);
29+
2630
private final Id id;
2731
private final String title;
2832
@Pattern(regexp = IMAGE_REGEX)
@@ -51,7 +55,7 @@ public BlogPost(
5155
this.updated = updated;
5256
this.published = published;
5357
this.description = description;
54-
this.content = Jsoup.clean(content, WHITELIST);
58+
this.content = Jsoup.clean(content, "", WHITELIST, OUTPUT_SETTINGS);
5559
this.languages = null;
5660
}
5761

0 commit comments

Comments
 (0)