Skip to content

Commit 64b00a9

Browse files
committed
Merge pull request #5 from elebetsamer/master
Make reg ex less greedy so it can match multiple links
2 parents 5354a7c + 41c21fa commit 64b00a9

File tree

9 files changed

+15
-15
lines changed

9 files changed

+15
-15
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "showdown-target-blank",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Add target=\"_blank\" to markdown link",
55
"homepage": "https://github.com/cybercase/showdown-target-blank",
66
"license": "BSD",

dist/showdown-target-blank.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! showdown-target-blank 26-06-2015 */
1+
/*! showdown-target-blank 02-11-2015 */
22
//
33
// Target blank extension
44
// [somelink](https://some.url.com/some/path) -> <a target="_blank" href="..." >somelink</a>
@@ -11,9 +11,9 @@
1111
return [
1212
{
1313
type: 'output',
14-
regex: '<a(.*)a>',
14+
regex: '<a(.*?)>',
1515
replace: function (match, content) {
16-
return '<a target="_blank"' + content + 'a>';
16+
return '<a target="_blank"' + content + '>';
1717
}
1818
}
1919
];

dist/showdown-target-blank.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/showdown-target-blank.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "showdown-target-blank",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Target blank extension for showdown",
55
"keywords": [
66
"markdown",

src/target_blank.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
return [
1111
{
1212
type: 'output',
13-
regex: '<a(.*)a>',
13+
regex: '<a(.*?)>',
1414
replace: function (match, content) {
15-
return '<a target="_blank"' + content + 'a>';
15+
return '<a target="_blank"' + content + '>';
1616
}
1717
}
1818
];

test/browser.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
var converter = new showdown.Converter({extensions: ['targetblank']});
3030

3131
it('should add target="_blank"', function () {
32-
var input = 'Ping [Google](http://google.com) to find out more',
33-
expected = '<p>Ping <a target="_blank" href="http://google.com">Google</a> to find out more</p>',
32+
var input = 'Link to [Google](http://google.com) and [Yahoo](http://yahoo.com)',
33+
expected = '<p>Link to <a target="_blank" href="http://google.com">Google</a> and <a target="_blank" href="http://yahoo.com">Yahoo</a></p>',
3434
otp = converter.makeHtml(input);
3535
expect(otp).to.equal(expected);
3636
});
@@ -43,4 +43,4 @@
4343
}
4444
</script>
4545
</body>
46-
</html>
46+
</html>

test/cases/basic.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<p>Testing of the target blank extension.</p>
22

3-
<p>Link to <a target="_blank" href="http://google.com">Google</a></p>
3+
<p>Link to <a target="_blank" href="http://google.com">Google</a> and <a target="_blank" href="http://yahoo.com">Yahoo</a></p>

test/cases/basic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Testing of the target blank extension.
22

3-
Link to [Google](http://google.com)
3+
Link to [Google](http://google.com) and [Yahoo](http://yahoo.com)

0 commit comments

Comments
 (0)