Skip to content

Commit

Permalink
Disallow escaped spaces inside link destination
Browse files Browse the repository at this point in the history
  • Loading branch information
rlidwka committed Nov 24, 2020
1 parent 83b0575 commit 2290e10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- `[](<foo<bar>)` is no longer a valid link.
- `[](url (xxx())` is no longer a valid link.
- `[](url\ xxx)` is no longer a valid link.
- Fix performance issues when parsing links, #732, #734.
- Fix performance issues when parsing backticks, #733.
- Fix performance issues when parsing emphases, #735.
Expand Down
1 change: 1 addition & 0 deletions lib/helpers/parse_link_destination.js
Expand Up @@ -53,6 +53,7 @@ module.exports = function parseLinkDestination(str, pos, max) {
if (code < 0x20 || code === 0x7F) { break; }

if (code === 0x5C /* \ */ && pos + 1 < max) {
if (str.charCodeAt(pos + 1) === 0x20) { break; }
pos += 2;
continue;
}
Expand Down
8 changes: 8 additions & 0 deletions test/fixtures/markdown-it/commonmark_extras.txt
Expand Up @@ -278,6 +278,14 @@ Link title cannot contain '(' when opened with it
.


Escaped space is not allowed in link destination, commonmark/CommonMark#493.
.
[link](a\ b)
.
<p>[link](a\ b)</p>
.


Coverage. Directive can terminate paragraph.
.
a
Expand Down

0 comments on commit 2290e10

Please sign in to comment.