diff --git a/src/attr.rs b/src/attr.rs index 08ce9f0..32c72bf 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -262,11 +262,11 @@ impl> Parser { } } -fn is_name_start(c: char) -> bool { +pub fn is_name_start(c: char) -> bool { c.is_ascii_alphanumeric() || matches!(c, '_' | ':') } -fn is_name(c: char) -> bool { +pub fn is_name(c: char) -> bool { is_name_start(c) || c.is_ascii_digit() || matches!(c, '-') } diff --git a/src/block.rs b/src/block.rs index 68279cf..4b89599 100644 --- a/src/block.rs +++ b/src/block.rs @@ -654,8 +654,12 @@ impl IdentifiedBlock { f @ ('`' | ':' | '~') => { let fence_length = 1 + (&mut chars).take_while(|c| *c == f).count(); let spec = &line_t[fence_length..].trim_start(); - let valid_spec = - !spec.chars().any(char::is_whitespace) && !spec.chars().any(|c| c == '`'); + let valid_spec = if f == ':' && !spec.starts_with('=') { + spec.chars().next().map_or(true, attr::is_name_start) + && spec.chars().skip(1).all(attr::is_name) + } else { + !spec.chars().any(char::is_whitespace) && !spec.chars().any(|c| c == '`') + }; let skip = line_t.len() - spec.len(); (valid_spec && fence_length >= 3).then(|| { (