Skip to content

Commit

Permalink
Don't allow escaped spaces in link destination.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgm committed Mar 25, 2018
1 parent 691fc67 commit f0da145
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/inlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ var parseLinkDestination = function() {
var openparens = 0;
var c;
while ((c = this.peek()) !== -1) {
if (c === C_BACKSLASH) {
if (c === C_BACKSLASH
&& reEscapable.test(this.subject.charAt(this.pos + 1))) {
this.pos += 1;
if (this.peek() !== -1) {
this.pos += 1;
Expand Down
8 changes: 8 additions & 0 deletions test/regression.txt
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ Issue #116 - tabs before and after ATX closing heading
.
<h1>foo</h1>
````````````````````````````````

commonmark/CommonMark#493 - escaped space not allowed in link
destination.
```````````````````````````````` example
[link](a\ b)
.
<p>[link](a\ b)</p>
````````````````````````````````

0 comments on commit f0da145

Please sign in to comment.