diff --git a/CHANGELOG.md b/CHANGELOG.md index e167ee17..2ae2dd85 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Add line highlighting in code blocks - Fix the new `zola serve` being broken on Windows - Fix slugified taxonomies not being rendered at the right path +- Fix issues with shortcodes with newlines ## 0.12.0 (2020-09-04) diff --git a/Cargo.lock b/Cargo.lock index 5003e5b3..65a264db 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -157,9 +157,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytemuck" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92046dbb6f9332943252123f53623e0a6d513651af14967e2991c371ec20201c" +checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac" [[package]] name = "byteorder" @@ -185,9 +185,9 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "cc" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66120af515773fb005778dc07c261bd201ec8ce50bd6e7144c927753fe013381" +checksum = "ef611cc68ff783f18535d77ddd080185275713d852c4f5cbb6122c462a7a825c" [[package]] name = "cedarwood" @@ -290,12 +290,12 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ee0cc8804d5393478d743b035099520087a5186f3b93fa58cec08fa62407b6" +checksum = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87" dependencies = [ - "cfg-if", "crossbeam-utils", + "maybe-uninit", ] [[package]] @@ -421,9 +421,9 @@ checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" [[package]] name = "either" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56b59865bce947ac5958779cfa508f6c3b9497cc762b7e24a12d11ccde2c4f" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "elasticlunr-rs" @@ -565,7 +565,7 @@ dependencies = [ "cfg-if", "crc32fast", "libc", - "miniz_oxide 0.4.1", + "miniz_oxide 0.4.2", ] [[package]] @@ -721,9 +721,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "fc587bc0ec293155d5bfa6b9891ec18a1e330c234f896ea47fbada4cadbe47e6" dependencies = [ "cfg-if", "libc", @@ -799,6 +799,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "hashbrown" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d63df3d41950fb462ed38308eea019113ad1508da725bbedcd0fa5a85ef5f7" + [[package]] name = "heck" version = "0.3.1" @@ -810,9 +816,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +checksum = "4c30f6d0bc6b00693347368a67d41b58f2fb851215ff1da49e90fe2c5c667151" dependencies = [ "libc", ] @@ -858,6 +864,12 @@ version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +[[package]] +name = "httpdate" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" + [[package]] name = "humansize" version = "1.1.0" @@ -866,9 +878,9 @@ checksum = "b6cab2627acfc432780848602f3f558f7e9dd427352224b0d9324025796d2a5e" [[package]] name = "hyper" -version = "0.13.7" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb" +checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" dependencies = [ "bytes 0.5.6", "futures-channel", @@ -878,10 +890,10 @@ dependencies = [ "http", "http-body", "httparse", + "httpdate", "itoa", "pin-project", "socket2", - "time", "tokio", "tower-service", "tracing", @@ -983,12 +995,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.5.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e47a3566dd4fd4eec714ae6ceabdee0caec795be835c223d92c2d40f1e8cf1c" +checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.9.0", ] [[package]] @@ -1039,7 +1051,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2ca2de723e93727460917d9542f7ae35a74d03d93923f03380a0238d860d137c" dependencies = [ "cedarwood", - "hashbrown", + "hashbrown 0.8.2", "lazy_static", "phf", "phf_codegen", @@ -1058,9 +1070,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.44" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85a7e2c92a4804dd459b86c339278d0fe87cf93757fae222c3fa3ae75458bc73" +checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" dependencies = [ "wasm-bindgen", ] @@ -1095,9 +1107,9 @@ checksum = "73a004f877f468548d8d0ac4977456a249d8fabbdb8416c36db163dfc8f2e8ca" [[package]] name = "libc" -version = "0.2.76" +version = "0.2.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "755456fae044e6fa1ebbbd1b3e902ae19e73097ed4ed87bb79934a867c007bc3" +checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235" [[package]] name = "library" @@ -1287,9 +1299,9 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memoffset" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" dependencies = [ "autocfg", ] @@ -1332,11 +1344,12 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d7559a8a40d0f97e1edea3220f698f78b1c5ab67532e49f68fde3910323b722" +checksum = "c60c0dfe32c10b43a144bad8fc83538c52f58302c92300ea7ec7bf7b38d5a7b9" dependencies = [ "adler", + "autocfg", ] [[package]] @@ -1402,9 +1415,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.34" +version = "0.2.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" dependencies = [ "cfg-if", "libc", @@ -1507,9 +1520,9 @@ checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" [[package]] name = "onig" -version = "6.0.0" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd91ccd8a02fce2f7e8a86655aec67bc6c171e6f8e704118a0e8c4b866a05a8a" +checksum = "8a155d13862da85473665694f4c05d77fb96598bdceeaf696433c84ea9567e20" dependencies = [ "bitflags", "lazy_static", @@ -1519,9 +1532,9 @@ dependencies = [ [[package]] name = "onig_sys" -version = "69.5.0" +version = "69.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3814583fad89f3c60ae0701d80e87e1fd3028741723deda72d0d4a0ecf0cb0db" +checksum = "9bff06597a6b17855040955cae613af000fc0bfc8ad49ea68b9479a74e59292d" dependencies = [ "cc", "pkg-config", @@ -1758,9 +1771,9 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "175c513d55719db99da20232b06cda8bab6b83ec2d04e3283edf0213c37c1a29" +checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c" dependencies = [ "unicode-xid", ] @@ -1850,9 +1863,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91739a34c4355b5434ce54c9086c5895604a9c278586d1f1aa95e04f66b525a0" +checksum = "e8c4fec834fb6e6d2dd5eece3c7b432a52f0ba887cf40e595190c4107edc08bf" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -2098,18 +2111,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.115" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e54c9a88f2da7238af84b5101443f0c0d0a3bbdc455e34a5c9497b1903ed55d5" +checksum = "96fe57af81d28386a513cbc6858332abc6117cfdb5999647c6444b8f43a370a5" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.115" +version = "1.0.116" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "609feed1d0a73cc36a0182a840a9b37b4a82f0b1150369f0536a9e3f2a31dc48" +checksum = "f630a6370fd8e457873b4bd2ffdae75408bc291ba72be773772a4c2a065d9ae8" dependencies = [ "proc-macro2", "quote", @@ -2225,9 +2238,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" [[package]] name = "socket2" -version = "0.3.12" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" dependencies = [ "cfg-if", "libc", @@ -2304,9 +2317,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.39" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "891d8d6567fe7c7f8835a3a98af4208f3846fba258c1bc3c31d6e506239f11f9" +checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b" dependencies = [ "proc-macro2", "quote", @@ -2545,9 +2558,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f0e00789804e99b20f12bc7003ca416309d28a6f495d6af58d1e2c2842461b5" +checksum = "5bcf46c1f1f06aeea2d6b81f3c863d0930a596c86ad1920d4e5bad6dd1d7119a" dependencies = [ "lazy_static", ] @@ -2764,9 +2777,9 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0563a9a4b071746dd5aedbc3a28c6fe9be4586fb3fbadb67c400d4f53c6b16c" +checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" dependencies = [ "cfg-if", "serde", @@ -2776,9 +2789,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc71e4c5efa60fb9e74160e89b93353bc24059999c0ae0fb03affc39770310b0" +checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" dependencies = [ "bumpalo", "lazy_static", @@ -2791,9 +2804,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95f8d235a77f880bcef268d379810ea6c0af2eacfa90b1ad5af731776e0c4699" +checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" dependencies = [ "cfg-if", "js-sys", @@ -2803,9 +2816,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97c57cefa5fa80e2ba15641578b44d36e7a64279bc5ed43c6dbaf329457a2ed2" +checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2813,9 +2826,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841a6d1c35c6f596ccea1f82504a192a60378f64b3bb0261904ad8f2f5657556" +checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" dependencies = [ "proc-macro2", "quote", @@ -2826,15 +2839,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.67" +version = "0.2.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93b162580e34310e5931c4b792560108b10fd14d64915d7fff8ff00180e70092" +checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" [[package]] name = "web-sys" -version = "0.3.44" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda38f4e5ca63eda02c059d243aa25b5f35ab98451e518c51612cd0f1bd19a47" +checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/components/rendering/src/lib.rs b/components/rendering/src/lib.rs index dd896f93..36c1f61d 100644 --- a/components/rendering/src/lib.rs +++ b/components/rendering/src/lib.rs @@ -14,8 +14,7 @@ pub fn render_content(content: &str, context: &RenderContext) -> Result", "\n"); + let html = markdown_to_html(&rendered, context)?; return Ok(html); } diff --git a/components/rendering/src/markdown.rs b/components/rendering/src/markdown.rs index dd06371e..ff419fbd 100644 --- a/components/rendering/src/markdown.rs +++ b/components/rendering/src/markdown.rs @@ -182,6 +182,7 @@ pub fn markdown_to_html(content: &str, context: &RenderContext) -> Result Result") => { - has_summary = true; - Event::Html(CONTINUE_READING.into()) + Event::Html(ref markup) => { + if markup.contains("") { + has_summary = true; + Event::Html(CONTINUE_READING.into()) + } else { + if in_html_block && markup.contains("") { + in_html_block = false; + Event::Html(markup.replacen("", "", 1).into()) + } else if markup.contains("pre data-shortcode") { + in_html_block = true; + let m = markup.replacen("
", "", 1);
+                                if m.contains("
") { + in_html_block = false; + Event::Html(m.replacen("", "", 1).into()) + } else { + Event::Html(m.into()) + } + } else { + event + } + } } _ => event, } diff --git a/components/rendering/src/shortcode.rs b/components/rendering/src/shortcode.rs index 6e1520b9..497a28f4 100644 --- a/components/rendering/src/shortcode.rs +++ b/components/rendering/src/shortcode.rs @@ -131,7 +131,7 @@ fn render_shortcode( // someone wants to include that comment in their content. This behaviour is unwanted in when // rendering markdown shortcodes. if template_name.ends_with(".html") { - Ok(res.replace('\n', "").to_string()) + Ok(format!("
{}
", res)) } else { Ok(res.to_string()) } @@ -404,7 +404,7 @@ Some body {{ hello() }}{%/* end */%}"#, let mut tera = Tera::default(); tera.add_raw_template("shortcodes/youtube.html", "Hello {{id}}").unwrap(); let res = render_shortcodes("Inline {{ youtube(id=1) }}.", &tera); - assert_eq!(res, "Inline Hello 1."); + assert_eq!(res, "Inline
Hello 1
."); } #[test] @@ -412,7 +412,7 @@ Some body {{ hello() }}{%/* end */%}"#, let mut tera = Tera::default(); tera.add_raw_template("shortcodes/youtube.html", "{{body}}").unwrap(); let res = render_shortcodes("Body\n {% youtube() %}Hey!{% end %}", &tera); - assert_eq!(res, "Body\n Hey!"); + assert_eq!(res, "Body\n
Hey!
"); } // https://github.com/Keats/gutenberg/issues/462 @@ -421,7 +421,7 @@ Some body {{ hello() }}{%/* end */%}"#, let mut tera = Tera::default(); tera.add_raw_template("shortcodes/youtube.html", "{{body | safe}}").unwrap(); let res = render_shortcodes("Body\n {% youtube() %}\nHello \n \n\n World{% end %}", &tera); - assert_eq!(res, "Body\n Hello World"); + assert_eq!(res, "Body\n
Hello \n \n\n World
"); } #[test] @@ -429,7 +429,7 @@ Some body {{ hello() }}{%/* end */%}"#, let mut tera = Tera::default(); tera.add_raw_template("shortcodes/youtube.html", " \n {{body}} \n ").unwrap(); let res = render_shortcodes("\n{% youtube() %} \n content \n {% end %}\n", &tera); - assert_eq!(res, "\n content \n"); + assert_eq!(res, "\n
  content  
\n"); } #[test] @@ -437,7 +437,7 @@ Some body {{ hello() }}{%/* end */%}"#, let mut tera = Tera::default(); tera.add_raw_template("shortcodes/youtube.html", " \n Hello, Zola. \n ").unwrap(); let res = render_shortcodes("\n{{ youtube() }}\n", &tera); - assert_eq!(res, "\n Hello, Zola. \n"); + assert_eq!(res, "\n
  Hello, Zola.  
\n"); } #[test] diff --git a/components/rendering/tests/markdown.rs b/components/rendering/tests/markdown.rs index 4b11b397..3b1c6499 100644 --- a/components/rendering/tests/markdown.rs +++ b/components/rendering/tests/markdown.rs @@ -142,7 +142,7 @@ fn can_render_body_shortcode_with_markdown_char_in_name() { let res = render_content(&format!("{{% {}(author=\"Bob\") %}}\nhey\n{{% end %}}", i), &context) .unwrap(); - println!("{:?}", res); + assert!(res.body.contains("
hey - Bob
")); } } @@ -166,12 +166,12 @@ Here is another paragraph.

Here is another paragraph.

"; - tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap(); + tera.add_raw_template("shortcodes/figure.html", shortcode).unwrap(); let config = Config::default(); let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); let res = render_content(markdown_string, &context).unwrap(); - println!("{:?}", res); + assert_eq!(res.body, expected); } @@ -199,12 +199,12 @@ Here is another paragraph.

Here is another paragraph.

"; - tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap(); + tera.add_raw_template("shortcodes/figure.html", shortcode).unwrap(); let config = Config::default(); let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); let res = render_content(markdown_string, &context).unwrap(); - println!("{:?}", res); + assert_eq!(res.body, expected); } @@ -790,7 +790,7 @@ fn doesnt_try_to_highlight_content_from_shortcode() { let expected = "
\n \n \"Some\n \n\n
Some spheres.
\n
"; - tera.add_raw_template(&format!("shortcodes/{}.html", "figure"), shortcode).unwrap(); + tera.add_raw_template("shortcodes/figure.html", shortcode).unwrap(); let config = Config::default(); let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); @@ -942,6 +942,64 @@ Bla bla"#; let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); let res = render_content(markdown_string, &context).unwrap(); - println!("{:?}", res); + + assert_eq!(res.body, expected); +} + +// https://github.com/getzola/zola/issues/1172 +#[test] +fn can_render_shortcode_body_with_no_invalid_escaping() { + let permalinks_ctx = HashMap::new(); + let mut tera = Tera::default(); + tera.extend(&ZOLA_TERA).unwrap(); + + let shortcode = r#" + + {{ alt }} + +

(click for full size)

+
+"#; + + let markdown_string = r#"{{ resize_image(path="tlera-corp-gnat/gnat-with-picoblade-cable.jpg", width=600, alt="Some alt") }}"#; + + let expected = "\n \n \n

(click for full size)

\n
"; + + tera.add_raw_template("shortcodes/resize_image.html", shortcode).unwrap(); + let config = Config::default(); + let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); + + let res = render_content(markdown_string, &context).unwrap(); + assert_eq!(res.body, expected); +} + +// https://github.com/getzola/zola/issues/1172 +#[test] +fn can_render_commented_out_shortcodes_fine() { + let permalinks_ctx = HashMap::new(); + let mut tera = Tera::default(); + tera.extend(&ZOLA_TERA).unwrap(); + + let shortcode = r#" + + {{ alt }} + +

(click for full size)

+
+"#; + + let markdown_string = r#""#; + + let expected = ""; + + tera.add_raw_template("shortcodes/resize_image.html", shortcode).unwrap(); + let config = Config::default(); + let context = RenderContext::new(&tera, &config, "", &permalinks_ctx, InsertAnchor::None); + + let res = render_content(markdown_string, &context).unwrap(); assert_eq!(res.body, expected); }