diff --git a/domain/pom.xml b/domain/pom.xml
index 739e8b4..456e1b4 100644
--- a/domain/pom.xml
+++ b/domain/pom.xml
@@ -42,6 +42,11 @@
flexmark
0.62.2
+
+ com.vladsch.flexmark
+ flexmark-ext-gfm-tasklist
+ 0.62.2
+
org.yaml
snakeyaml
diff --git a/domain/src/main/kotlin/security/HtmlSanitizer.kt b/domain/src/main/kotlin/security/HtmlSanitizer.kt
index 43a58ae..85ec1b0 100644
--- a/domain/src/main/kotlin/security/HtmlSanitizer.kt
+++ b/domain/src/main/kotlin/security/HtmlSanitizer.kt
@@ -11,6 +11,8 @@ object HtmlSanitizer {
.allowAttributes("class").onElements("code")
.allowUrlProtocols("http", "https")
.allowAttributes("href").onElements("a")
+ .allowElements("input")
+ .allowAttributes("type", "checked", "disabled", "readonly").onElements("input")
.requireRelNofollowOnLinks()
.toFactory()!!
diff --git a/domain/src/main/kotlin/usecases/markdown/MarkdownConverter.kt b/domain/src/main/kotlin/usecases/markdown/MarkdownConverter.kt
index bce7374..385fbb5 100644
--- a/domain/src/main/kotlin/usecases/markdown/MarkdownConverter.kt
+++ b/domain/src/main/kotlin/usecases/markdown/MarkdownConverter.kt
@@ -1,20 +1,21 @@
package be.simplenotes.domain.usecases.markdown
import arrow.core.Either
-import arrow.core.Try
import arrow.core.extensions.fx
import arrow.core.left
import arrow.core.right
import be.simplenotes.domain.model.NoteMetadata
import be.simplenotes.domain.validation.NoteValidations
-import com.auth0.jwt.JWT
+import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension
import com.vladsch.flexmark.html.HtmlRenderer
import com.vladsch.flexmark.parser.Parser
+import com.vladsch.flexmark.util.data.MutableDataSet
import io.konform.validation.ValidationErrors
import org.yaml.snakeyaml.Yaml
import org.yaml.snakeyaml.parser.ParserException
import org.yaml.snakeyaml.scanner.ScannerException
+
sealed class MarkdownParsingError
object MissingMeta : MarkdownParsingError()
object InvalidMeta : MarkdownParsingError()
@@ -60,8 +61,16 @@ internal class MarkdownConverterImpl : MarkdownConverter {
return NoteMetadata(title, tags).right()
}
- private val parser = Parser.builder().build()
- private val renderer = HtmlRenderer.builder().build()
+ private val parser: Parser
+ private val renderer: HtmlRenderer
+
+ init {
+ val options = MutableDataSet()
+ options.set(Parser.EXTENSIONS, listOf(TaskListExtension.create()))
+ parser = Parser.builder(options).build()
+ renderer = HtmlRenderer.builder(options).build()
+ }
+
private fun renderMarkdown(markdown: String) = parser.parse(markdown).run(renderer::render)
override fun renderDocument(input: String) = Either.fx {