Skip to content

Commit

Permalink
Fixes issue with multiple links on a single line (#17)
Browse files Browse the repository at this point in the history
* If there was more than a single MD link on a single line in
  a page, the Regex would capture too aggressively, ending up
  with a broken capture

* Adds some tests for single line with multiple links

Resolves: #16
  • Loading branch information
orbikm authored Mar 7, 2021
1 parent dc11350 commit 6aee4f8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mkdocs_ezlinks_plugin/scanners/md_link_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def pattern(self) -> Pattern:
|
(?P<md_alt_is_image>\!?)
\[
(?P<md_text>.+)
(?P<md_text>[^\]]+)
\]
)
\(
Expand Down
15 changes: 14 additions & 1 deletion test/docs/my-project/link_updates.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@
[External Link](https://www.example.com)
[External Link](http://www.example.com)
[External Link w/ Title](https://www.example.com "LINK TITLE")
[External link no scheme](www.example.com)
[External link no scheme](www.example.com)

MD Links:

[My Section](my-section) [My Section Link 2](my-section.md) [My Section Link 3](my-section.md#anchor "Test")


WikiLinks:

[[My Section]] [[My Section|My Section 2]] [[My Section|My Section 3]]

Both:

[[My Section|Wiki Link]] [My Section 2](my-section) [[Fence Blocks]]

0 comments on commit 6aee4f8

Please sign in to comment.