1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 17:57:16 +00:00

Disabled Markdown set text headings

This commit is contained in:
M66B 2024-02-20 12:35:01 +01:00
parent fc91acded2
commit 77bed16207

View file

@ -20,6 +20,8 @@ package eu.faircode.email;
*/
import com.vladsch.flexmark.html2md.converter.FlexmarkHtmlConverter;
import com.vladsch.flexmark.util.data.DataHolder;
import com.vladsch.flexmark.util.data.MutableDataSet;
import org.commonmark.Extension;
import org.commonmark.ext.gfm.strikethrough.StrikethroughExtension;
@ -49,7 +51,10 @@ public class Markdown {
static String fromHtml(String html) {
// https://github.com/vsch/flexmark-java/wiki/Extensions#html-to-markdown
String markdown = FlexmarkHtmlConverter.builder()
DataHolder options = new MutableDataSet()
.set(FlexmarkHtmlConverter.SETEXT_HEADINGS, false)
.toImmutable();
String markdown = FlexmarkHtmlConverter.builder(options)
.build()
.convert(html);
return markdown.replaceAll("\n\n\\s+<!-- -->\n", "");