@@ -162,6 +162,14 @@ Hello | |||||
assert!(res.0.contains(r#"//player.vimeo.com/video/210073083""#)); | assert!(res.0.contains(r#"//player.vimeo.com/video/210073083""#)); | ||||
} | } | ||||
#[test] | |||||
fn errors_if_unterminated_shortcode() { | |||||
let permalinks_ctx = HashMap::new(); | |||||
let context = Context::new(&GUTENBERG_TERA, true, "base16-ocean-dark".to_string(), "", &permalinks_ctx, InsertAnchor::None); | |||||
let res = markdown_to_html(r#"{{ youtube(id="w7Ft2ym_a"#, &context); | |||||
assert!(res.is_err()); | |||||
} | |||||
#[test] | #[test] | ||||
fn doesnt_render_shortcode_in_code_block() { | fn doesnt_render_shortcode_in_code_block() { | ||||
let permalinks_ctx = HashMap::new(); | let permalinks_ctx = HashMap::new(); | ||||
@@ -45,7 +45,7 @@ Any shortcodes in code blocks will be ignored. | |||||
Lastly, a shortcode name (and thus the corresponding `.html` file) as well as the arguments name | Lastly, a shortcode name (and thus the corresponding `.html` file) as well as the arguments name | ||||
can only contain numbers, letters and underscores, or in Regex terms the following: `[0-9A-Za-z_]`. | can only contain numbers, letters and underscores, or in Regex terms the following: `[0-9A-Za-z_]`. | ||||
While theoretically an argument name could be a number, it will not be possible to use in the template. | |||||
While theoretically an argument name could be a number, it will not be possible to use it in the template in that case. | |||||
### Shortcodes without body | ### Shortcodes without body | ||||