Wiki links recognized as markdown links in todo tasks
Closed this issue · 3 comments
When using a wiki link in a todo list, the function markdown-link-p
will recognize the link as a markdown reference link.
- [ ] [[myfile]] will be recognized as a markdown link by markdwon-link-p
The regex specified by markdown-regex-link-reference
allows for a space between the link and d
Expected Behavior
As there is a space between the empty todo closing bracket and the link opening bracket, I would not expect this to be recognized as a markdown link. I would therefore expect markdown-link-p
to return nil.
Actual Behavior
The function markdown-link-p
indicates that this link is a markdown link.
I dug into the code a bit and saw that the regex specified in markdown-regex-link-reference
allows for a single space between the two sets of brackets in a markdown reference link via the syntax [ ]?
. I didn't realize spaces were allowed between the two sets of brackets, so I'm unsure why this is there, but removing this from the center of the regex expression seems to fix the issue.
Steps to Reproduce
- On a new line in any buffer, add the following to create a simple todo item with a wiki link:
- [ ] [[mylink]]
- With the cursor on the link, run the command
markdown-link-p
, which will returnt
Software Versions
- Markdown Mode: 2.6-alpha
- Emacs: 28.2
- OS: Fedora 38 (Linux 6.3.11)
I didn't realize spaces were allowed between the two sets of brackets, so I'm unsure why this is there, but removing this from the center of the regex expression seems to fix the issue.
Original markdown specification allows one space between link text and link label. So the original author wrote such regular expression. While CommonMark does not allow spaces between them
BTW removing space from its regular expression doesn't break any tests. So I think we can remove a space from it. And I think few people or no one put space between them.
Reference
Thanks for resolving this so quickly, I really appreciate it