diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-10-13 10:40:01 +0200 |
commit | ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a (patch) | |
tree | 2da4be3be22c2324c48cb17133b3f4b26b9139d2 /tests/character_escape.rs | |
parent | 861af95c119721e814460fa7dc32bd3d74b38484 (diff) | |
download | markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.gz markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.tar.bz2 markdown-rs-ec2d1bfb4232178fb3a6cba36f138bc6efbbf34a.zip |
Rename crate to `markdown`
Diffstat (limited to 'tests/character_escape.rs')
-rw-r--r-- | tests/character_escape.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tests/character_escape.rs b/tests/character_escape.rs index c5c9004..0546269 100644 --- a/tests/character_escape.rs +++ b/tests/character_escape.rs @@ -1,7 +1,7 @@ -extern crate micromark; -use micromark::{ +extern crate markdown; +use markdown::{ mdast::{Node, Paragraph, Root, Text}, - micromark, micromark_to_mdast, micromark_with_options, + to_html, to_html_with_options, to_mdast, unist::Position, CompileOptions, Constructs, Options, ParseOptions, }; @@ -19,75 +19,75 @@ fn character_escape() -> Result<(), String> { }; assert_eq!( - micromark( + to_html( "\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\-\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\\\\\]\\^\\_\\`\\{\\|\\}\\~"), "<p>!"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~</p>", "should support escaped ascii punctuation" ); assert_eq!( - micromark("\\→\\A\\a\\ \\3\\φ\\«"), + to_html("\\→\\A\\a\\ \\3\\φ\\«"), "<p>\\→\\A\\a\\ \\3\\φ\\«</p>", "should not support other characters after a backslash" ); assert_eq!( - micromark( + to_html( "\\*not emphasized*\n\\<br/> not a tag\n\\[not a link](/foo)\n\\`not code`\n1\\. not a list\n\\* not a list\n\\# not a heading\n\\[foo]: /url \"not a reference\"\n\\ö not a character entity"), "<p>*not emphasized*\n<br/> not a tag\n[not a link](/foo)\n`not code`\n1. not a list\n* not a list\n# not a heading\n[foo]: /url "not a reference"\n&ouml; not a character entity</p>", "should escape other constructs" ); assert_eq!( - micromark("foo\\\nbar"), + to_html("foo\\\nbar"), "<p>foo<br />\nbar</p>", "should escape a line break" ); assert_eq!( - micromark("`` \\[\\` ``"), + to_html("`` \\[\\` ``"), "<p><code>\\[\\`</code></p>", "should not escape in text code" ); assert_eq!( - micromark(" \\[\\]"), + to_html(" \\[\\]"), "<pre><code>\\[\\]\n</code></pre>", "should not escape in indented code" ); assert_eq!( - micromark("<http://example.com?find=\\*>"), + to_html("<http://example.com?find=\\*>"), "<p><a href=\"http://example.com?find=%5C*\">http://example.com?find=\\*</a></p>", "should not escape in autolink" ); assert_eq!( - micromark_with_options("<a href=\"/bar\\/)\">", &danger)?, + to_html_with_options("<a href=\"/bar\\/)\">", &danger)?, "<a href=\"/bar\\/)\">", "should not escape in flow html" ); assert_eq!( - micromark("[foo](/bar\\* \"ti\\*tle\")"), + to_html("[foo](/bar\\* \"ti\\*tle\")"), "<p><a href=\"/bar*\" title=\"ti*tle\">foo</a></p>", "should escape in resource and title" ); assert_eq!( - micromark("[foo]: /bar\\* \"ti\\*tle\"\n\n[foo]"), + to_html("[foo]: /bar\\* \"ti\\*tle\"\n\n[foo]"), "<p><a href=\"/bar*\" title=\"ti*tle\">foo</a></p>", "should escape in definition resource and title" ); assert_eq!( - micromark("``` foo\\+bar\nfoo\n```"), + to_html("``` foo\\+bar\nfoo\n```"), "<pre><code class=\"language-foo+bar\">foo\n</code></pre>", "should escape in fenced code info" ); assert_eq!( - micromark_with_options( + to_html_with_options( "\\> a", &Options { parse: ParseOptions { @@ -105,7 +105,7 @@ fn character_escape() -> Result<(), String> { ); assert_eq!( - micromark_to_mdast("a \\* b", &ParseOptions::default())?, + to_mdast("a \\* b", &ParseOptions::default())?, Node::Root(Root { children: vec![Node::Paragraph(Paragraph { children: vec![Node::Text(Text { |