diff --git a/src/entity.rs b/src/entity.rs index 7b7a5e02..95f74bfa 100644 --- a/src/entity.rs +++ b/src/entity.rs @@ -36,7 +36,11 @@ pub fn unescape(text: &[u8]) -> Option<(Vec, usize)> { 0 }; - if (1..=8).contains(&num_digits) && i < text.len() && text[i] == b';' { + if i < text.len() + && text[i] == b';' + && (((text[1] == b'x' || text[1] == b'X') && (1..=6).contains(&num_digits)) + || (1..=7).contains(&num_digits)) + { if codepoint == 0 || (0xD800..=0xE000).contains(&codepoint) || codepoint >= 0x110000 { codepoint = 0xFFFD; } diff --git a/src/parser/inlines.rs b/src/parser/inlines.rs index 5b55b715..900957a9 100644 --- a/src/parser/inlines.rs +++ b/src/parser/inlines.rs @@ -1010,8 +1010,10 @@ impl<'a, 'r, 'o, 'd, 'i, 'c, 'subj> Subject<'a, 'r, 'o, 'd, 'i, 'c, 'subj> { if c == b'_' { ( numdelims, - left_flanking && (!right_flanking || before_char.is_punctuation() || before_char.is_symbol()), - right_flanking && (!left_flanking || after_char.is_punctuation() || after_char.is_symbol()), + left_flanking + && (!right_flanking || before_char.is_punctuation() || before_char.is_symbol()), + right_flanking + && (!left_flanking || after_char.is_punctuation() || after_char.is_symbol()), ) } else if c == b'\'' || c == b'"' { (