Skip to content

Commit 367a191

Browse files
committed
Invert greentext check
1 parent fe9bdf2 commit 367a191

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/parser/mod.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,7 @@ where
381381
fn parse_block_quote_prefix(&mut self, line: &str) -> bool {
382382
let bytes = line.as_bytes();
383383
let indent = self.indent;
384-
if indent <= 3
385-
&& bytes.get(self.first_nonspace) == Some(&b'>')
386-
&& self.is_not_greentext(line)
384+
if indent <= 3 && bytes.get(self.first_nonspace) == Some(&b'>') && !self.is_greentext(line)
387385
{
388386
self.advance_offset(line, indent + 1, true);
389387

@@ -397,13 +395,16 @@ where
397395
false
398396
}
399397

400-
fn is_not_greentext(&self, line: &str) -> bool {
401-
!self.options.extension.greentext
402-
|| byte_matches(
403-
line.as_bytes(),
404-
self.first_nonspace + 1,
405-
strings::is_space_or_tab,
406-
)
398+
fn is_greentext(&self, line: &str) -> bool {
399+
if !self.options.extension.greentext {
400+
return false;
401+
}
402+
403+
!byte_matches(
404+
line.as_bytes(),
405+
self.first_nonspace + 1,
406+
strings::is_space_or_tab,
407+
)
407408
}
408409

409410
fn parse_node_item_prefix(&mut self, line: &str, container: Node<'a>, nl: &NodeList) -> bool {
@@ -767,7 +768,7 @@ where
767768
}
768769

769770
fn detect_blockquote(&self, line: &str) -> bool {
770-
line.as_bytes().get(self.first_nonspace) == Some(&b'>') && self.is_not_greentext(line)
771+
line.as_bytes().get(self.first_nonspace) == Some(&b'>') && !self.is_greentext(line)
771772
}
772773

773774
fn handle_atx_heading(&mut self, container: &mut Node<'a>, line: &str) -> bool {

0 commit comments

Comments
 (0)