1
0
mirror of https://codeberg.org/tom79/Fedilab synced 2024-12-16 05:17:50 +01:00

Fix line breaks with Markdown

This commit is contained in:
Thomas 2023-08-09 17:18:18 +02:00
parent 147917fc58
commit c9a86aae01

View File

@ -91,6 +91,7 @@ import app.fedilab.android.mastodon.ui.drawer.StatusAdapter;
import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM; import app.fedilab.android.mastodon.viewmodel.mastodon.FiltersVM;
import es.dmoral.toasty.Toasty; import es.dmoral.toasty.Toasty;
import io.noties.markwon.Markwon; import io.noties.markwon.Markwon;
import io.noties.markwon.SoftBreakAddsNewLinePlugin;
import io.noties.markwon.ext.tables.TablePlugin; import io.noties.markwon.ext.tables.TablePlugin;
import io.noties.markwon.syntax.Prism4jThemeDefault; import io.noties.markwon.syntax.Prism4jThemeDefault;
import io.noties.markwon.syntax.SyntaxHighlightPlugin; import io.noties.markwon.syntax.SyntaxHighlightPlugin;
@ -184,6 +185,7 @@ public class SpannableHelper {
final Markwon markwon = Markwon.builder(context) final Markwon markwon = Markwon.builder(context)
.usePlugin(TablePlugin.create(context)) .usePlugin(TablePlugin.create(context))
.usePlugin(SoftBreakAddsNewLinePlugin.create())
.usePlugin(SyntaxHighlightPlugin.create(new Prism4j(new MySuperGrammerLocator()), Prism4jThemeDefault.create())).build(); .usePlugin(SyntaxHighlightPlugin.create(new Prism4j(new MySuperGrammerLocator()), Prism4jThemeDefault.create())).build();
final Spanned markdown = markwon.toMarkdown(initialContent.toString()); final Spanned markdown = markwon.toMarkdown(initialContent.toString());