From fd23afc7295c0408c30bd71237bf93f03bfd095d Mon Sep 17 00:00:00 2001 From: Jeziel Lago Date: Thu, 29 Aug 2024 01:15:43 -0300 Subject: [PATCH] Fix #107 - Add TaskList plugin --- markdowntext/build.gradle | 1 + .../jeziellago/compose/markdowntext/MarkdownRender.kt | 2 ++ .../java/dev/jeziellago/compose/markdown/MainActivity.kt | 9 +++++++++ 3 files changed, 12 insertions(+) diff --git a/markdowntext/build.gradle b/markdowntext/build.gradle index 294d273..3d8f19c 100644 --- a/markdowntext/build.gradle +++ b/markdowntext/build.gradle @@ -49,6 +49,7 @@ dependencies { implementation "io.noties.markwon:ext-tables:$markwon_version" implementation "io.noties.markwon:html:$markwon_version" implementation "io.noties.markwon:linkify:$markwon_version" + implementation "io.noties.markwon:ext-tasklist:$markwon_version" // TODO: Change it after migrating markwon project implementation "com.github.jeziellago:Markwon:58aa5aba6a" diff --git a/markdowntext/src/main/java/dev/jeziellago/compose/markdowntext/MarkdownRender.kt b/markdowntext/src/main/java/dev/jeziellago/compose/markdowntext/MarkdownRender.kt index c3030e4..040ff23 100644 --- a/markdowntext/src/main/java/dev/jeziellago/compose/markdowntext/MarkdownRender.kt +++ b/markdowntext/src/main/java/dev/jeziellago/compose/markdowntext/MarkdownRender.kt @@ -13,6 +13,7 @@ import io.noties.markwon.SoftBreakAddsNewLinePlugin import io.noties.markwon.core.MarkwonTheme import io.noties.markwon.ext.strikethrough.StrikethroughPlugin import io.noties.markwon.ext.tables.TablePlugin +import io.noties.markwon.ext.tasklist.TaskListPlugin import io.noties.markwon.html.HtmlPlugin import io.noties.markwon.image.coil.CoilImagesPlugin import io.noties.markwon.linkify.LinkifyPlugin @@ -35,6 +36,7 @@ internal object MarkdownRender { .usePlugin(StrikethroughPlugin.create()) .usePlugin(TablePlugin.create(context)) .usePlugin(LinkifyPlugin.create(linkifyMask)) + .usePlugin(TaskListPlugin.create(context)) .apply { if (enableSoftBreakAddsNewLine) { usePlugin(SoftBreakAddsNewLinePlugin.create()) diff --git a/sample/src/main/java/dev/jeziellago/compose/markdown/MainActivity.kt b/sample/src/main/java/dev/jeziellago/compose/markdown/MainActivity.kt index 5c967a7..9aa4201 100644 --- a/sample/src/main/java/dev/jeziellago/compose/markdown/MainActivity.kt +++ b/sample/src/main/java/dev/jeziellago/compose/markdown/MainActivity.kt @@ -36,6 +36,15 @@ class MainActivity : AppCompatActivity() { .padding(8.dp) .fillMaxWidth(), ) { + item { + MarkdownText( + markdown = """ + - [x] Review #123 + - [ ] Complete XYZ + - [ ] Add delight to the experience when all tasks are complete :tada: + """.trimIndent(), + ) + } item { MarkdownText( markdown = """