[EasyMark] Fix incorrect handling of non-ASCII characters
This commit is contained in:
parent
8189a78284
commit
b106d10202
1 changed files with 6 additions and 4 deletions
|
@ -299,12 +299,14 @@ impl<'a> Iterator for Parser<'a> {
|
|||
}
|
||||
|
||||
// Swallow everything up to the next special character:
|
||||
let special = self.s[1..]
|
||||
let end = self
|
||||
.s
|
||||
.find(&['*', '`', '~', '_', '/', '\\', '<', '[', '\n'][..])
|
||||
.map(|i| i + 1)
|
||||
.map(|special| special.max(1)) // make sure we swallow at least one character
|
||||
.unwrap_or_else(|| self.s.len());
|
||||
let item = Item::Text(self.style, &self.s[..special]);
|
||||
self.s = &self.s[special..];
|
||||
|
||||
let item = Item::Text(self.style, &self.s[..end]);
|
||||
self.s = &self.s[end..];
|
||||
self.start_of_line = false;
|
||||
return Some(item);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue