Handle zero-width space in text markup.
This commit is contained in:
@@ -127,15 +127,14 @@ pub fn start_of_line<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
#[cfg_attr(feature = "tracing", tracing::instrument(ret, level = "debug"))]
|
||||
pub fn preceded_by_whitespace<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, ()> {
|
||||
let preceding_character = input.get_preceding_character();
|
||||
match preceding_character {
|
||||
Some('\n') | Some('\r') | Some(' ') | Some('\t') => {}
|
||||
// If None, we are at the start of the file which is not allowed
|
||||
None | Some(_) => {
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Not preceded by whitespace.".into(),
|
||||
))));
|
||||
}
|
||||
};
|
||||
if !preceding_character
|
||||
.map(|c| c.is_whitespace() || c == '\u{200B}') // 200B = Zero-width space
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Err(nom::Err::Error(CustomError::MyError(MyError(
|
||||
"Not preceded by whitespace.".into(),
|
||||
))));
|
||||
}
|
||||
Ok((input, ()))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user