diff options
Diffstat (limited to 'src/main')
-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; } |