Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion markdown_it/helpers/parse_link_destination.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,10 @@ def parseLinkDestination(string: str, pos: int, maximum: int) -> _Result:

if code == 0x5C and pos + 1 < maximum:
if charCodeAt(string, pos + 1) == 0x20:
break
# a backslash before a space is a literal backslash,
# and the space then ends the destination
pos += 1
continue
pos += 2
continue

Expand Down
15 changes: 15 additions & 0 deletions tests/test_port/fixtures/commonmark_extras.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,21 @@ Escaped space is not allowed in link destination, commonmark/CommonMark#493.
<p>[link](a\ b)</p>
.

Backslash before a space in a link destination is a literal backslash, and the space ends the destination (CommonMark 0.31.2 6.3)
.
[a](/url\ )

[b](/url\ "title")

[c]

[c]: /url\ "title"
.
<p><a href="/url%5C">a</a></p>
<p><a href="/url%5C" title="title">b</a></p>
<p><a href="/url%5C" title="title">c</a></p>
.

Link destination cannot contain '<'
.
[](<foo<bar>)
Expand Down