diff --git a/markwon/src/test/java/ru/noties/markwon/renderer/visitor/SpannableMarkdownVisitorTest.java b/markwon/src/test/java/ru/noties/markwon/renderer/visitor/SpannableMarkdownVisitorTest.java
index fcfd2058..c47bccdf 100644
--- a/markwon/src/test/java/ru/noties/markwon/renderer/visitor/SpannableMarkdownVisitorTest.java
+++ b/markwon/src/test/java/ru/noties/markwon/renderer/visitor/SpannableMarkdownVisitorTest.java
@@ -18,6 +18,7 @@ import ru.noties.markwon.Markwon;
import ru.noties.markwon.SpannableBuilder;
import ru.noties.markwon.SpannableConfiguration;
import ru.noties.markwon.SpannableFactory;
+import ru.noties.markwon.html.api.MarkwonHtmlParser;
import ru.noties.markwon.renderer.SpannableMarkdownVisitor;
import ru.noties.markwon.spans.SpannableTheme;
@@ -134,11 +135,15 @@ public class SpannableMarkdownVisitorTest {
private SpannableConfiguration configuration(@NonNull TestConfig config) {
final SpannableFactory factory = new TestFactory(config.hasOption(TestConfig.USE_PARAGRAPHS));
+ final MarkwonHtmlParser htmlParser = config.hasOption(TestConfig.USE_HTML)
+ ? null
+ : MarkwonHtmlParser.noOp();
// todo: rest omitted for now
return SpannableConfiguration.builder(null)
.theme(mock(SpannableTheme.class))
.linkResolver(mock(LinkResolverDef.class))
+ .htmlParser(htmlParser)
.factory(factory)
.build();
}
diff --git a/markwon/src/test/java/ru/noties/markwon/renderer/visitor/TestDataReader.java b/markwon/src/test/java/ru/noties/markwon/renderer/visitor/TestDataReader.java
index b5e5bb2e..427be11e 100644
--- a/markwon/src/test/java/ru/noties/markwon/renderer/visitor/TestDataReader.java
+++ b/markwon/src/test/java/ru/noties/markwon/renderer/visitor/TestDataReader.java
@@ -276,7 +276,14 @@ abstract class TestDataReader {
if (object != null) {
attributes = new HashMap<>(object.size());
for (String key : object.keySet()) {
- attributes.put(key, object.get(key).getAsString());
+ final String value;
+ final JsonElement valueElement = object.get(key);
+ if (valueElement.isJsonNull()) {
+ value = null;
+ } else {
+ value = valueElement.getAsString();
+ }
+ attributes.put(key, value);
}
} else {
attributes = Collections.emptyMap();
diff --git a/markwon/src/test/resources/tests/deeply-nested.yaml b/markwon/src/test/resources/tests/deeply-nested.yaml
new file mode 100644
index 00000000..f81eca55
--- /dev/null
+++ b/markwon/src/test/resources/tests/deeply-nested.yaml
@@ -0,0 +1,15 @@
+input: |-
+ **bold *bold italic ~~bold italic strike `bold italic strike code` bold italic strike~~ bold italic* bold** normal
+
+output:
+ - b:
+ - text: "bold "
+ - i:
+ - text: "bold italic "
+ - s:
+ - text: "bold italic strike "
+ - code: "bold italic strike code"
+ - text: " bold italic strike"
+ - text: " bold italic"
+ - text: " bold"
+ - text: " normal"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/first.yaml b/markwon/src/test/resources/tests/first.yaml
index 0bcd844b..9559a9cd 100644
--- a/markwon/src/test/resources/tests/first.yaml
+++ b/markwon/src/test/resources/tests/first.yaml
@@ -12,8 +12,7 @@ config:
output:
- text: "Here is some "
- - a:
- - text: "link"
+ - a: "link"
attrs:
href: "https://my.href"
- text: " "
diff --git a/markwon/src/test/resources/tests/single-a.yaml b/markwon/src/test/resources/tests/single-a.yaml
new file mode 100644
index 00000000..c5824108
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-a.yaml
@@ -0,0 +1,6 @@
+input: "[link](#href)"
+
+output:
+ - a: "link"
+ attrs:
+ href: "#href"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-b.yaml b/markwon/src/test/resources/tests/single-b.yaml
new file mode 100644
index 00000000..a107424d
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-b.yaml
@@ -0,0 +1,4 @@
+input: "**bold**"
+
+output:
+ - b: "bold"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-blockquote.yaml b/markwon/src/test/resources/tests/single-blockquote.yaml
new file mode 100644
index 00000000..3c8d818e
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-blockquote.yaml
@@ -0,0 +1,4 @@
+input: "> blockquote"
+
+output:
+ - blockquote: "blockquote"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-code-block.yaml b/markwon/src/test/resources/tests/single-code-block.yaml
new file mode 100644
index 00000000..d44d9818
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-code-block.yaml
@@ -0,0 +1,7 @@
+input: |-
+ ```
+ code block
+ ```
+
+output:
+ - code-block: "code block"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-code.yaml b/markwon/src/test/resources/tests/single-code.yaml
new file mode 100644
index 00000000..e82d1123
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-code.yaml
@@ -0,0 +1,4 @@
+input: "`code`"
+
+output:
+ - code: "code"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-h1.yaml b/markwon/src/test/resources/tests/single-h1.yaml
new file mode 100644
index 00000000..613ae0c5
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-h1.yaml
@@ -0,0 +1,4 @@
+input: "# head1"
+
+output:
+ - h1: "head1"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-h2.yaml b/markwon/src/test/resources/tests/single-h2.yaml
new file mode 100644
index 00000000..09489697
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-h2.yaml
@@ -0,0 +1,4 @@
+input: "## head2"
+
+output:
+ - h2: "head2"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-h3.yaml b/markwon/src/test/resources/tests/single-h3.yaml
new file mode 100644
index 00000000..8f2d99a0
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-h3.yaml
@@ -0,0 +1,4 @@
+input: "### head3"
+
+output:
+ - h3: "head3"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-h4.yaml b/markwon/src/test/resources/tests/single-h4.yaml
new file mode 100644
index 00000000..b65a2b73
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-h4.yaml
@@ -0,0 +1,4 @@
+input: "#### head4"
+
+output:
+ - h4: "head4"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-h5.yaml b/markwon/src/test/resources/tests/single-h5.yaml
new file mode 100644
index 00000000..44a3d078
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-h5.yaml
@@ -0,0 +1,4 @@
+input: "##### head5"
+
+output:
+ - h5: "head5"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-h6.yaml b/markwon/src/test/resources/tests/single-h6.yaml
new file mode 100644
index 00000000..f040ecaf
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-h6.yaml
@@ -0,0 +1,4 @@
+input: "###### head6"
+
+output:
+ - h6: "head6"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-hr.yaml b/markwon/src/test/resources/tests/single-hr.yaml
new file mode 100644
index 00000000..7d457b51
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-hr.yaml
@@ -0,0 +1,7 @@
+# it is failing as we are still removing white spaces manually
+# this will be fixed when different logic for new lines will be introduced
+
+input: "---"
+
+output:
+ - hr: " "
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-i.yaml b/markwon/src/test/resources/tests/single-i.yaml
new file mode 100644
index 00000000..334e923c
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-i.yaml
@@ -0,0 +1,4 @@
+input: "*italic*"
+
+output:
+ - i: "italic"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-img.yaml b/markwon/src/test/resources/tests/single-img.yaml
new file mode 100644
index 00000000..4ff5a02c
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-img.yaml
@@ -0,0 +1,8 @@
+input: ""
+
+output:
+ - img: "image"
+ attrs:
+ scr: "#href"
+ imageSize: null
+ replacementTextIsLink: false
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-ol.yaml b/markwon/src/test/resources/tests/single-ol.yaml
new file mode 100644
index 00000000..9c7ac05b
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-ol.yaml
@@ -0,0 +1,6 @@
+input: "1. ol"
+
+output:
+ - ol: "ol"
+ attrs:
+ start: 1
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-s.yaml b/markwon/src/test/resources/tests/single-s.yaml
new file mode 100644
index 00000000..3a1c12cc
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-s.yaml
@@ -0,0 +1,4 @@
+input: "~~strike~~"
+
+output:
+ - s: "strike"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-sub.yaml b/markwon/src/test/resources/tests/single-sub.yaml
new file mode 100644
index 00000000..bfeb5367
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-sub.yaml
@@ -0,0 +1,7 @@
+input: "sub"
+
+config:
+ use-html: true
+
+output:
+ - sub: "sub"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-sup.yaml b/markwon/src/test/resources/tests/single-sup.yaml
new file mode 100644
index 00000000..8b21ad61
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-sup.yaml
@@ -0,0 +1,7 @@
+input: "sup"
+
+config:
+ use-html: true
+
+output:
+ - sup: "sup"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-task-list.yaml b/markwon/src/test/resources/tests/single-task-list.yaml
new file mode 100644
index 00000000..f9667289
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-task-list.yaml
@@ -0,0 +1,7 @@
+input: "- [ ] task-list"
+
+output:
+ - task-list: "task-list"
+ attrs:
+ blockIdent: 1
+ done: false
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-tr.yaml b/markwon/src/test/resources/tests/single-tr.yaml
new file mode 100644
index 00000000..aafcd2ac
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-tr.yaml
@@ -0,0 +1,4 @@
+input: "table-table-table"
+
+output:
+ - text: "should fail as we are to decide how to pass info here"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-u.yaml b/markwon/src/test/resources/tests/single-u.yaml
new file mode 100644
index 00000000..1bd135d1
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-u.yaml
@@ -0,0 +1,7 @@
+input: "underline"
+
+config:
+ use-html: true
+
+output:
+ - u: "underline"
\ No newline at end of file
diff --git a/markwon/src/test/resources/tests/single-ul.yaml b/markwon/src/test/resources/tests/single-ul.yaml
new file mode 100644
index 00000000..2fab7dc8
--- /dev/null
+++ b/markwon/src/test/resources/tests/single-ul.yaml
@@ -0,0 +1,6 @@
+input: "* ul"
+
+output:
+ - ul: "ul"
+ attrs:
+ level: 0
\ No newline at end of file