From a3dd207e3b1ebcbcb6cec0f703a695e51ae4ece0 Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Fri, 24 Jun 2022 17:57:10 +0200 Subject: Add link, images (resource) This is still some messy code that needs cleaning up, but it adds support for links and images, of the resource kind (`[a](b)`). References (`[a][b]`) are parsed and will soon be supported, but need matching. * Fix bug to pad percent-encoded bytes when normalizing urls * Fix bug with escapes counting as balancing in destination * Add `space_or_tab_one_line_ending`, to parse whitespace including up to one line ending (but not a blank line) * Add `ParserState` to share codes, definitions, etc --- tests/misc_tabs.rs | 66 +++++++++++++++++++++++++----------------------------- 1 file changed, 30 insertions(+), 36 deletions(-) (limited to 'tests/misc_tabs.rs') diff --git a/tests/misc_tabs.rs b/tests/misc_tabs.rs index e9a0b72..568172e 100644 --- a/tests/misc_tabs.rs +++ b/tests/misc_tabs.rs @@ -221,48 +221,42 @@ fn tabs_text() { // "should support an initial tab after a line ending in a paragraph" // ); - // To do: link (reference). - // assert_eq!( - // micromark("x[\ty](z)"), - // "

x\ty

", - // "should support an initial tab in a link label" - // ); + assert_eq!( + micromark("x[\ty](z)"), + "

x\ty

", + "should support an initial tab in a link label" + ); - // To do: link (reference). - // assert_eq!( - // micromark("x[y\t](z)"), - // "

xy\t

", - // "should support a final tab in a link label" - // ); + assert_eq!( + micromark("x[y\t](z)"), + "

xy\t

", + "should support a final tab in a link label" + ); - // To do: link (reference). - // assert_eq!( - // micromark("[x\ty](z)"), - // "

x\ty

", - // "should support a tab in a link label" - // ); + assert_eq!( + micromark("[x\ty](z)"), + "

x\ty

", + "should support a tab in a link label" + ); - // To do: link (resource). // Note: CM.js bug, see: - // assert_eq!( - // micromark("[x](\ty)"), - // "

x

", - // "should support a tab starting a link resource" - // ); + assert_eq!( + micromark("[x](\ty)"), + "

x

", + "should support a tab starting a link resource" + ); - // To do: link (resource). - // assert_eq!( - // micromark("[x](y\t)"), - // "

x

", - // "should support a tab ending a link resource" - // ); + assert_eq!( + micromark("[x](y\t)"), + "

x

", + "should support a tab ending a link resource" + ); - // To do: link (resource). - // assert_eq!( - // micromark("[x](y\t\"z\")"), - // "

x

", - // "should support a tab between a link destination and title" - // ); + assert_eq!( + micromark("[x](y\t\"z\")"), + "

x

", + "should support a tab between a link destination and title" + ); } #[test] -- cgit