Skip to content

Commit

Permalink
Merge pull request #556 from Crozzers/fix-issue-552
Browse files Browse the repository at this point in the history
Fix incorrect parsing of links after square brackets (#552)
  • Loading branch information
nicholasserra committed Dec 17, 2023
2 parents c34c957 + 2fb92a9 commit 5ddad68
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -5,6 +5,7 @@
- [pull #547] Update `markdown-in-html` extra to handle markdown on same line as HTML (#546)
- [pull #550] Fix tables with trailing whitespace not being recognized (#549)
- [pull #545] Fix multiple instances of strong emphasis (`**`) in one line (#541)
- [pull #556] Fix incorrect parsing of links after square brackets (#552)

## python-markdown2 2.4.11

Expand Down
3 changes: 2 additions & 1 deletion lib/markdown2.py
Expand Up @@ -1786,7 +1786,8 @@ def _do_links(self, text):
curr_pos = start_idx + 1
else:
# This id isn't defined, leave the markup alone.
curr_pos = match.end()
# set current pos to end of link title and continue from there
curr_pos = p
continue

# Otherwise, it isn't markup.
Expand Down
3 changes: 3 additions & 0 deletions test/tm-cases/link_after_square_brackets.html
@@ -0,0 +1,3 @@
<p>[before]
<a href="https://google.com">Some link</a>
[after]</p>
3 changes: 3 additions & 0 deletions test/tm-cases/link_after_square_brackets.text
@@ -0,0 +1,3 @@
[before]
[Some link](https://google.com)
[after]

0 comments on commit 5ddad68

Please sign in to comment.