Skip to content

Commit

Permalink
avoid special "^" char pattern matching
Browse files Browse the repository at this point in the history
  • Loading branch information
gjtorikian committed Jan 25, 2023
1 parent 43f334e commit 83a81ce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/parser/inlines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ impl<'a, 'r, 'o, 'd, 'i, 'c, 'subj> Subject<'a, 'r, 'o, 'd, 'i, 'c, 'subj> {
}
}
'~' if self.options.extension.strikethrough => Some(self.handle_delim(b'~')),
'^' if self.options.extension.superscript => Some(self.handle_delim(b'^')),
'^' if self.options.extension.superscript && !self.within_brackets => {
Some(self.handle_delim(b'^'))
}
_ => {
let endpos = self.find_special_char();
let mut contents = self.input[self.pos..endpos].to_vec();
Expand Down Expand Up @@ -458,7 +460,11 @@ impl<'a, 'r, 'o, 'd, 'i, 'c, 'subj> Subject<'a, 'r, 'o, 'd, 'i, 'c, 'subj> {
pub fn find_special_char(&self) -> usize {
for n in self.pos..self.input.len() {
if self.special_chars[self.input[n] as usize] {
return n;
if self.input[n] == b'^' && self.within_brackets {
// NO OP
} else {
return n;
}
}
if self.options.parse.smart && self.smart_chars[self.input[n] as usize] {
return n;
Expand Down

0 comments on commit 83a81ce

Please sign in to comment.