Open deckar01 opened 7 years ago
/* skip any amount of whitespace or newline */
/* (this is much more laxist than original markdown syntax) */
while (i < size && _isspace(data[i]))
i++;
https://github.com/vmg/redcarpet/blob/8db31cb/ext/redcarpet/markdown.c#L1068-L1071
Wrapping this in a conditional should achieve the desired behavior.
I am closing this since the space is explicitly included in the markdown spec. It should be possible to fix the link after redcarpet gets done mangling it.
@robin850 Reopening per https://github.com/vmg/redcarpet/issues/471#issuecomment-299321564. This causes problems with normal markdown usage and popular extensions like task lists. Would you consider the option to disable the space inside links, or even disable by default it in a future major version?
@robin850 The [reference][]
solution from https://github.com/vmg/redcarpet/issues/471#issuecomment-299321564 does not help with task lists.
- [ ] [blue][]
[blue]: /blue
[ ] [blue]
takes priority over [blue][]
resulting in:
<ul>
<li><a href="/blue"> </a][]</li>
</ul>
Hi @deckar01 !
Yes unfortunately ! I don't know what we can do here ; I would love to try to avoid as much as possible the option path, there are still enough options to enable. GitHub Flavored Markdown is actually a super set of CommonMark and the latter explicitly forbids spaces:
A full reference link consists of a link text immediately followed by a link label that matches a link reference definition elsewhere in the document.
This is why this is not a problem in their case. I will try to think about a possible solution but I guess your best option here for now is to escape the checkbox brackets with a slash ; sorry about that. 😕
Thanks for your insight.
Markdown allows a space between the square brackets
] [
of a reference style link, but that behavior creates ambiguity and interference with extensions like task lists.Reference
Ambiguity
Red Carpet renders this as:
but, other markdown engines (like GitHub Flavored Markdown) have disabled the optional space and render it as:
Interference
Extensions like task lists work by filtering list items looking for lines starting with
[ /x/X]
, but Red Carpet will have already transformed them into links:If Red Carpet had a way to disable the optional space the ambiguity would be resolved.
Proposal
Add an option named
reference_space
that defaults to true, that determines if the optional space is recognized.