burodepeper / language-markdown

Add support for Markdown to Atom (including Github flavored, Markdown Extra, CriticMark, YAML/TOML front-matter, and R Markdown), and smart behavior to lists.
https://atom.io/packages/language-markdown
MIT License
119 stars 296 forks source link

Highlight link references with variable whitespace #250

Closed Alhadis closed 5 years ago

Alhadis commented 5 years ago

Both of the following are legal syntax for declaring link references:

[Link]:https://github.com/
[Link]:  https://github.com/

However, the language-markdown grammar incorrectly accepts only 1 space between the colon and URL:

[Link]: https://github.com/

This PR fixes that.

burodepeper commented 5 years ago

Thanks for the PR!

Could you add a link to documentation that says that this syntax is legal? Also, mind adding tests for it?

Alhadis commented 5 years ago

Could you add a link to documentation that says that this syntax is legal?

From § 4.7 of the latest CommonMark spec (emphasis mine):

_A link reference definition consists of a link label, indented up to three spaces, followed by a colon (:), optional whitespace (including up to one line ending)

The link above is actually using a reference without whitespace. Edit this comment and see for yourself.

Also, mind adding tests for it?

Sure, if you tell me precisely how. The test suite is using some weird format I've not seen before.