Skip to content

Commit

Permalink
fix: lazy instead of greedy regex
Browse files Browse the repository at this point in the history
  • Loading branch information
learosema committed Oct 20, 2024
1 parent f758e02 commit 447a137
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/transforms/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const MAGIC = [
'<img src="$2" alt="$1" />'
],
[
/\[(.+)\]\((.+?)\)/g,
/\[(.+?)\]\((.+?)\)/g,
'<a href="$2">$1</a>'
]
];
Expand Down
2 changes: 2 additions & 0 deletions tests/fixtures/markdown/0003-links.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<p>This is a <a href="https://lea.codes/">link</a></p>

<p>This is another link: <a href="https://test.de">https://test.de</a>.</p>

<p>Two links: <a href="a.html">a</a> and <a href="b.html">b</a>.</p>
2 changes: 2 additions & 0 deletions tests/fixtures/markdown/0003-links.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
This is a [link](https://lea.codes/)

This is another link: <https://test.de>.

Two links: [a](a.html) and [b](b.html).

0 comments on commit 447a137

Please sign in to comment.