Skip to content

🐛 FIX: Keep a literal backslash before a space in link destinations - #468

Open
abhishekcpp007 wants to merge 1 commit into
executablebooks:masterfrom
abhishekcpp007:fix/backslash-space-link-destination
Open

abhishekcpp007 wants to merge 1 commit into
executablebooks:masterfrom
abhishekcpp007:fix/backslash-space-link-destination

Conversation

@abhishekcpp007

Copy link
Copy Markdown

In an unbracketed link destination, \ followed by a space hits break, so the backslash is dropped and the whole link fails to parse:

MarkdownIt().render("[a](/url\\ )")
# main: <p>[a](/url\ )</p>
# this: <p><a href="/url%5C">a</a></p>

Per CommonMark 6.1, a backslash before a non-punctuation character is literal, and the space just ends the destination. cmark and markdown-it 15 give the second output. This is the same one-line change as markdown-it/markdown-it#1188 (pos++; continue), which landed after the 14.1.0 port.

Added a fixture next to the existing CommonMark#493 case, covering an inline link, one with a title, and a reference definition.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant