-
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shorthand link references not recognized when there's whitespace between [] #39
Comments
Hey @nzakas! 👋 I don't see any spec changes in https://github.github.com/gfm/#link-reference-definitions to reference links |
This seems to be commonmark/commonmark-spec#653, which shows that most tools work differently than the spec. I think the spec is currently saying that this is not allowed:
I do consider this to be something that can improved in CM. But I also consider this a current bug in GFM, which says it sticks to CM, so I don’t feel good about “solving” it in |
To make sure I'm following, it sounds like you're saying that the spec disallows this behavior, so this is a bug in GitHub's Markdown parser? |
Correct |
I think that in this example, spaces and line breaks are not significant: [foo][
bar ]
[bar
]: https://example.com But they are significant if there are only spacing characters? |
Correct. There’s indeed a “gap” between the different shortcut links and how they are defined in CM. Shortcut ( |
Closing as behavior is intentional, I believe according to spec! |
Initial checklist
Affected packages and versions
mdast-util-from-markdown@2.0.1
Link to runnable example
https://stackblitz.com/edit/stackblitz-starters-ifpvft?file=index.js
Steps to reproduce
[]
:fromMarkdown()
Expected behavior
The returned AST should identify
[foo][ ]
as alinkReference
. (It appears that GitHub does this. I'm unsure if that's standard behavior for Markdown or not. The Micromark GFM extension exhibits the same behavior.)Actual behavior
The returned AST identifies
[foo][ ]
astext
rather than a link reference.Affected runtime and version
node@20.13.0
Affected package manager and version
No response
Affected OS and version
No response
Build and bundle tools
No response
The text was updated successfully, but these errors were encountered: