From 9110750ba97f45ca080f5b522a861d15f8140ab1 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 20 Feb 2024 12:48:50 +0100 Subject: [PATCH] Added support for Markdown task lists and inserts --- app/build.gradle | 2 ++ app/src/main/java/eu/faircode/email/Markdown.java | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/app/build.gradle b/app/build.gradle index c64089fe15..99123aa9f5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -774,6 +774,8 @@ dependencies { // https://github.com/commonmark/commonmark-java // https://mvnrepository.com/artifact/org.commonmark implementation "org.commonmark:commonmark:$commonmark_version"; + implementation "org.commonmark:commonmark-ext-ins:$commonmark_version"; + implementation "org.commonmark:commonmark-ext-task-list-items:$commonmark_version"; implementation "org.commonmark:commonmark-ext-gfm-tables:$commonmark_version"; implementation "org.commonmark:commonmark-ext-gfm-strikethrough:$commonmark_version"; diff --git a/app/src/main/java/eu/faircode/email/Markdown.java b/app/src/main/java/eu/faircode/email/Markdown.java index 77edb9ad39..3e483806f9 100644 --- a/app/src/main/java/eu/faircode/email/Markdown.java +++ b/app/src/main/java/eu/faircode/email/Markdown.java @@ -26,6 +26,8 @@ import com.vladsch.flexmark.util.data.MutableDataSet; import org.commonmark.Extension; import org.commonmark.ext.gfm.strikethrough.StrikethroughExtension; import org.commonmark.ext.gfm.tables.TablesExtension; +import org.commonmark.ext.ins.InsExtension; +import org.commonmark.ext.task.list.items.TaskListItemsExtension; import org.commonmark.node.Node; import org.commonmark.parser.Parser; import org.commonmark.renderer.html.HtmlRenderer; @@ -37,6 +39,8 @@ public class Markdown { static String toHtml(String markdown) { markdown = markdown.replace('\u00a0', ' '); List extensions = Arrays.asList( + InsExtension.create(), + TaskListItemsExtension.create(), TablesExtension.create(), StrikethroughExtension.create()); Parser p = Parser.builder()