Format tables with a bit more spacing.
Change-Id: Iba0dcabce7a0841dbb0f5cf795cb2d684faf7462
diff --git a/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java b/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java
index 4286e25..013a5dd 100644
--- a/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java
+++ b/src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java
@@ -13,6 +13,7 @@
import java.util.Arrays;
import javax.enterprise.context.ApplicationScoped;
import org.jsoup.Jsoup;
+import org.jsoup.safety.Cleaner;
import org.jsoup.safety.Safelist;
@ApplicationScoped
@@ -47,7 +48,10 @@
public String htmlify(String markdown) {
var parsedDocument = parser.parse(markdown);
- var unsanitizedHtml = renderer.render(parsedDocument);
- return Jsoup.clean(unsanitizedHtml, Safelist.relaxed());
+ var uncleanHtml = renderer.render(parsedDocument);
+ var cleaner = new Cleaner(Safelist.relaxed().addTags("abbr", "acronym"));
+ var cleanedDocument = cleaner.clean(Jsoup.parseBodyFragment(uncleanHtml));
+ cleanedDocument.select("table").addClass("pure-table").addClass("pure-table-horizontal");
+ return cleanedDocument.body().html();
}
}
diff --git a/src/main/resources/META-INF/resources/cms2/base.css b/src/main/resources/META-INF/resources/cms2/base.css
index 3855486..e11f295 100644
--- a/src/main/resources/META-INF/resources/cms2/base.css
+++ b/src/main/resources/META-INF/resources/cms2/base.css
@@ -57,6 +57,10 @@
font-feature-settings: "calt" off, "dlig" on;
}
+article td, article th {
+ padding: .1em .5em !important;
+}
+
body {
display: grid;
}