1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-27 10:17:18 +00:00

Added support for Markdown task lists and inserts

This commit is contained in:
M66B 2024-02-20 12:48:50 +01:00
parent 77bed16207
commit 9110750ba9
2 changed files with 6 additions and 0 deletions

View file

@ -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";

View file

@ -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<Extension> extensions = Arrays.asList(
InsExtension.create(),
TaskListItemsExtension.create(),
TablesExtension.create(),
StrikethroughExtension.create());
Parser p = Parser.builder()