Skip to content

Commit

Permalink
[markdown mode] Fix bug with two links or email addresses on same line.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Frohs authored and marijnh committed Jun 19, 2013
1 parent 4dee296 commit 03449c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mode/markdown/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
return type;
}

if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, true)) {
if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
return switchInline(stream, state, inlineElement(linkinline, '>'));
}

if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, true)) {
if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
return switchInline(stream, state, inlineElement(linkemail, '>'));
}

Expand Down
6 changes: 6 additions & 0 deletions mode/markdown/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -533,9 +533,15 @@
MT("linkWeb",
"[link <http://example.com/>] foo");

MT("linkWebDouble",
"[link <http://example.com/>] foo [link <http://example.com/>]");

MT("linkEmail",
"[link <user@example.com>] foo");

MT("linkEmailDouble",
"[link <user@example.com>] foo [link <user@example.com>]");

MT("emAsterisk",
"[em *foo*] bar");

Expand Down

0 comments on commit 03449c6

Please sign in to comment.