Skip to content

Allow tabs in links and link reference definitions - #317

Merged
jgm merged 1 commit into
commonmark:masterfrom
Lotion-3:link-definition-trailing-tab
Nov 26, 2026
Merged

jgm merged 1 commit into
commonmark:masterfrom
Lotion-3:link-definition-trailing-tab

Conversation

@Lotion-3

Copy link
Copy Markdown
Contributor

reSpnl and reSpaceAtEndOfLine only skip spaces, so a tab next to a link destination breaks links and definitions:

[a](<TAB>/url)          -> <p>[a](	/url)</p>
[a](/url<TAB>"title")   -> <p>[a](/url	&quot;title&quot;)</p>
[b]:<TAB>/url           -> <p>[b]:	/url</p>

The spec allows spaces or tabs in each of these places, and cmark accepts them (its spnl and skip_spaces skip both). This allows tabs in both regexes and adds regression tests. The reSpnl change is the same as in #259, which was waiting on a regression test; this adds one, and the same fix for link reference definitions.

Fixes #191.

reSpnl and reSpaceAtEndOfLine only skipped spaces, so a tab before or
after a link destination stopped [a](<TAB>/url) and [a](/url<TAB>"t") from
being links, and [a]:<TAB>/url or [a]: /url<TAB> from being definitions.
The spec allows spaces or tabs in all of these places, and cmark skips
both.
@jgm
jgm merged commit 90bbcf9 into commonmark:master Nov 26, 2026
4 checks passed
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.

Incorrect handling of tabs in link resources compared to spaces, newlines

2 participants