Skip to content

Commit

Permalink
Fix regexes to allow whitespace in paths
Browse files Browse the repository at this point in the history
  • Loading branch information
evilstreak committed Apr 21, 2013
1 parent 5c053a2 commit ecf34ff
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ Markdown.dialects.Gruber.inline = {

// ![Alt text](/path/to/img.jpg "Optional title")
// 1 2 3 4 <--- captures
var m = text.match( /^!\[(.*?)\][ \t]*\([ \t]*(\S*)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/ );
var m = text.match( /^!\[(.*?)\][ \t]*\([ \t]*([^")]*?)(?:[ \t]+(["'])(.*?)\3)?[ \t]*\)/ );

if ( m ) {
if ( m[2] && m[2][0] == '<' && m[2][m[2].length-1] == '>' )
Expand Down Expand Up @@ -878,7 +878,7 @@ Markdown.dialects.Gruber.inline = {
// back based on if there a matching ones in the url
// ([here](/url/(test))
// The parens have to be balanced
var m = text.match( /^\s*\([ \t]*(\S+)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ );
var m = text.match( /^\s*\([ \t]*([^"']*)(?:[ \t]+(["'])(.*?)\2)?[ \t]*\)/ );
if ( m ) {
var url = m[1];
consumed += m[0].length;
Expand Down

0 comments on commit ecf34ff

Please sign in to comment.