Skip to content

Commit

Permalink
Correctly handle links with linebreaks
Browse files Browse the repository at this point in the history
  • Loading branch information
brunojppb committed May 30, 2024
1 parent b005685 commit 7a42a46
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions md_parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,9 @@ impl<'source> Parser<'source> {
Token::RightSquareBracket => markers[1] = 1,
Token::LeftParen => markers[2] = 1,
Token::RightParen => markers[3] = 1,
// Links can contain newlines, but if a newline
// is followed by any block-level token
token if token.is_block_level_token() => {
if let Some(&(Token::Newline, _)) = self.previous() {
break 'outer;
}
}

token if token == &Token::Newline => {
if let Some(&(Token::Newline, _)) = self.previous() {
if let Some(&(Token::Newline, _)) = self.peek() {
break 'outer;
}
}
Expand Down

0 comments on commit 7a42a46

Please sign in to comment.