diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-05-07 04:51:40 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2022-05-07 12:01:58 +0200 |
commit | 51025649ffce0fd68b794d28a1b073750f517a4d (patch) | |
tree | ccc6b22e91eed910087b285fd8eeb64e07f239a4 /src | |
parent | 3b2d5a13fd5243d0f6422ff52eb3a9993eb1a197 (diff) |
Format tables with a bit more spacing.
Change-Id: Iba0dcabce7a0841dbb0f5cf795cb2d684faf7462
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/mulk/mulkcms2/common/markdown/MarkdownConverter.java | 8 | ||||
-rw-r--r-- | src/main/resources/META-INF/resources/cms2/base.css | 4 |
2 files changed, 10 insertions, 2 deletions
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 com.vladsch.flexmark.util.data.MutableDataSet; 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 class MarkdownConverter { 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 @@ code, kbd, samp, pre { font-feature-settings: "calt" off, "dlig" on; } +article td, article th { + padding: .1em .5em !important; +} + body { display: grid; } |