Closed deckar01 closed 6 years ago
From @marcguyer on January 13, 2015 14:44
Here's another thought:
Well... that seems to work...
From @marcguyer on January 17, 2015 15:31
I see now that you can optionally (perhaps unnecessarily?) use a space between the brackets in a reference-style link:
http://daringfireball.net/projects/markdown/syntax#link
That's annoying but perhaps still should be considered a bug?
From @mtodd on January 29, 2015 5:41
@marcguyer thanks for reporting this issue! The rendering looks fine, but the update behavior does appear to be affected by this issue.
Markdown gives us the \
to escape the brackets to prevent it from being rendered as a link, which will fix the broken behavior here, too. For instance:
- [ ] [try] breaks things, but
- [ ] \[try] works
Unfortunately, you need to put the \
in front of the brackets on all of the lines that you want to use square brackets on, otherwise it'll be broken.
I'll try to dig in and figure out how to prevent the issue.
Reproduced on master.
I just ran into this issue in my normal workflow. I decided I needed to label one of my task list items and naturally tried to use the "[Label]" format.
GitHub's markdown renderer seems to no longer support spaces between the brackets of reference style links, which resolves the ambiguity. GitLab currently supports the space.
This test case needs to be added to the test suite, this bug needs to be fixed if it is directly caused by core logic, and a note needs to be added to the documentation encouraging consumers to disable support for the space between reference link brackets.
I opened https://github.com/vmg/redcarpet/issues/610 since that is the markdown engine GitLab is using.
I'm starting to wonder if it might be better to fix this in the task_list filter since it is part of the markdown spec. It should be possible to find the links at the beginning of a list item that only contain a space or an "x", add the checkbox, and fix the link text.
GitLab fixed the parsing of - [ ] [foo] ...
and this was still an issue, so the core JavaScript doesn't seem to be handling it correctly.
(?:\[.*?\]\s*(?:\[.*?\]|\(.*?\))\s*)*
https://github.com/deckar01/task_list/blob/23e9126/app/assets/javascripts/task_list.coffee#L198
The link regex shouldn't have the \s*
between the link parts.
There is no harm in removing this, because if markdown parsers that allow an optional space will render it as a link instead of a task in the first place.
Actually since spaces are no longer allowed between the link parts, it's no longer necessary to check for links at all. A space after the bracket is sufficient.
From @marcguyer on January 13, 2015 14:39
When using square brackets in the beginning of the content of a list item, the checking of boxes doesn't work as expected. Here's an example:
For a good time, try clicking the second task.
_Copied from original issue: github-archive/tasklist#51