aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--readme.md2
-rw-r--r--src/construct/attention.rs3
-rw-r--r--tests/attention.rs66
-rw-r--r--tests/link_reference.rs68
-rw-r--r--tests/link_resource.rs11
5 files changed, 71 insertions, 79 deletions
diff --git a/readme.md b/readme.md
index 9a5867c..030f15a 100644
--- a/readme.md
+++ b/readme.md
@@ -128,7 +128,6 @@ cargo doc --document-private-items
#### Parse
- [ ] (2) Fix attention/label interplay
-- [ ] (2) Fix resizing attention bug
- [ ] (8) block quote\
test (`code_fenced`, `definition`, `code_indented`, `heading_atx`, `heading_setext`,
`html_flow`, `misc_default_line_ending`, `thematic_break`)
@@ -276,3 +275,4 @@ important.
- [x] (1) Use rust to crawl unicode
- [x] (1) Document attention
- [x] (1) Remove todos in `span.rs` if not needed
+- [x] (2) Fix resizing attention bug
diff --git a/src/construct/attention.rs b/src/construct/attention.rs
index 2144864..d445938 100644
--- a/src/construct/attention.rs
+++ b/src/construct/attention.rs
@@ -379,7 +379,8 @@ fn resolve(tokenizer: &mut Tokenizer) -> Vec<Event> {
// Opening.
edit_map.add_before(
- open_event_index,
+ // Add after the current sequence (it might remain).
+ open_event_index + 2,
0,
vec![
Event {
diff --git a/tests/attention.rs b/tests/attention.rs
index 11ba7d8..6ab173b 100644
--- a/tests/attention.rs
+++ b/tests/attention.rs
@@ -559,12 +559,11 @@ fn attention() {
"should support strong emphasis around the other marker"
);
- // To do: resizing attention bug?
- // assert_eq!(
- // micromark("**foo*"),
- // "<p>*<em>foo</em></p>",
- // "should support a superfluous marker at the start of emphasis"
- // );
+ assert_eq!(
+ micromark("**foo*"),
+ "<p>*<em>foo</em></p>",
+ "should support a superfluous marker at the start of emphasis"
+ );
assert_eq!(
micromark("*foo**"),
@@ -572,19 +571,17 @@ fn attention() {
"should support a superfluous marker at the end of emphasis"
);
- // To do: resizing attention bug?
- // assert_eq!(
- // micromark("***foo**"),
- // "<p>*<strong>foo</strong></p>",
- // "should support a superfluous marker at the start of strong"
- // );
+ assert_eq!(
+ micromark("***foo**"),
+ "<p>*<strong>foo</strong></p>",
+ "should support a superfluous marker at the start of strong"
+ );
- // To do: resizing attention bug?
- // assert_eq!(
- // micromark("****foo*"),
- // "<p>***<em>foo</em></p>",
- // "should support multiple superfluous markers at the start of strong"
- // );
+ assert_eq!(
+ micromark("****foo*"),
+ "<p>***<em>foo</em></p>",
+ "should support multiple superfluous markers at the start of strong"
+ );
assert_eq!(
micromark("**foo***"),
@@ -635,12 +632,11 @@ fn attention() {
"should support strong emphasis around the other marker"
);
- // To do: resizing attention bug?
- // assert_eq!(
- // micromark("__foo_"),
- // "<p>_<em>foo</em></p>",
- // "should support a superfluous marker at the start of emphasis"
- // );
+ assert_eq!(
+ micromark("__foo_"),
+ "<p>_<em>foo</em></p>",
+ "should support a superfluous marker at the start of emphasis"
+ );
assert_eq!(
micromark("_foo__"),
@@ -648,19 +644,17 @@ fn attention() {
"should support a superfluous marker at the end of emphasis"
);
- // To do: resizing attention bug?
- // assert_eq!(
- // micromark("___foo__"),
- // "<p>_<strong>foo</strong></p>",
- // "should support a superfluous marker at the start of strong"
- // );
+ assert_eq!(
+ micromark("___foo__"),
+ "<p>_<strong>foo</strong></p>",
+ "should support a superfluous marker at the start of strong"
+ );
- // To do: resizing attention bug?
- // assert_eq!(
- // micromark("____foo_"),
- // "<p>___<em>foo</em></p>",
- // "should support multiple superfluous markers at the start of strong"
- // );
+ assert_eq!(
+ micromark("____foo_"),
+ "<p>___<em>foo</em></p>",
+ "should support multiple superfluous markers at the start of strong"
+ );
assert_eq!(
micromark("__foo___"),
diff --git a/tests/link_reference.rs b/tests/link_reference.rs
index 3a0be9f..b53b99b 100644
--- a/tests/link_reference.rs
+++ b/tests/link_reference.rs
@@ -27,12 +27,11 @@ fn link_reference() {
"should support escaped brackets in link references"
);
- // To do: link/attention interplay.
- // assert_eq!(
- // micromark("[ref]: /uri\n\n[link *foo **bar** `#`*][ref]"),
- // "<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>",
- // "should support content in link references"
- // );
+ assert_eq!(
+ micromark("[ref]: /uri\n\n[link *foo **bar** `#`*][ref]"),
+ "<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>",
+ "should support content in link references"
+ );
assert_eq!(
micromark("[ref]: /uri\n\n[![moon](moon.jpg)][ref]"),
@@ -336,35 +335,34 @@ fn link_reference() {
"should not support mismatched character references in fulls"
);
- // To do: link/attention interplay.
- // assert_eq!(
- // micromark(
- // "[*f*][]
- // [&semi;][]
- // [\\;][]
- // [;][]
- // [*f*&semi;][]
- // [*f*\\;][]
- // [*f*;][]
-
- // [*f*]: alpha
- // [&semi;]: bravo
- // [\\;]: charlie
- // [;]: delta
- // [*f*&semi;]: echo
- // [*f*\\;]: foxtrot
- // [*f*;]: golf"
- // ),
- // "<p><a href=\"alpha\"><em>f</em></a>
- // <a href=\"bravo\">;</a>
- // <a href=\"charlie\">;</a>
- // <a href=\"delta\">;</a>
- // <a href=\"echo\"><em>f</em>;</a>
- // <a href=\"foxtrot\"><em>f</em>;</a>
- // <a href=\"golf\"><em>f</em>;</a></p>
- // ",
- // "should properly handle labels w/ character references and -escapes, and phrasing"
- // );
+ assert_eq!(
+ micromark(
+ "[*f*][]
+[&semi;][]
+[\\;][]
+[;][]
+[*f*&semi;][]
+[*f*\\;][]
+[*f*;][]
+
+[*f*]: alpha
+[&semi;]: bravo
+[\\;]: charlie
+[;]: delta
+[*f*&semi;]: echo
+[*f*\\;]: foxtrot
+[*f*;]: golf"
+ ),
+ "<p><a href=\"alpha\"><em>f</em></a>
+<a href=\"bravo\">;</a>
+<a href=\"charlie\">;</a>
+<a href=\"delta\">;</a>
+<a href=\"echo\"><em>f</em>;</a>
+<a href=\"foxtrot\"><em>f</em>;</a>
+<a href=\"golf\"><em>f</em>;</a></p>
+",
+ "should properly handle labels w/ character references and -escapes, and phrasing"
+ );
// 999 `x` characters.
let max = "x".repeat(999);
diff --git a/tests/link_resource.rs b/tests/link_resource.rs
index bebf6cc..e4037a2 100644
--- a/tests/link_resource.rs
+++ b/tests/link_resource.rs
@@ -231,12 +231,11 @@ fn link_resource() {
"should support characer escapes"
);
- // To do: link/attention interplay.
- // assert_eq!(
- // micromark("[link *foo **bar** `#`*](/uri)"),
- // "<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>",
- // "should support content"
- // );
+ assert_eq!(
+ micromark("[link *foo **bar** `#`*](/uri)"),
+ "<p><a href=\"/uri\">link <em>foo <strong>bar</strong> <code>#</code></em></a></p>",
+ "should support content"
+ );
assert_eq!(
micromark("[![moon](moon.jpg)](/uri)"),