-
Notifications
You must be signed in to change notification settings - Fork 95
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
Link detection faulty #65
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
while trying to hook into hyperlink processing (to make relative links work), I realized that hyperlink parsing in general seems to be broken.
problem
Suppose we have a markdown like
All three should be valid and interpreted as links. But rxmarkdown only interprets (1) as a link. The others are ignored and rendered as
[link!](example.com)
and[link!](56366)
in the output.presumed cause
com.yydcdut.markdown.syntax.text.HyperLinkSyntax#contains
seems to be broken.It return in all three cases
false
. While it should actually returntrue
in all three cases.As a result, you only check in line 60 the
AUTO_LINK_PATTERN
regex to see if you can do auto linking in this line. And for case (1) this actually works. That's why line (1) is interpreted correctly as a link but the other two not.The problem lies in line 106 and following.
Here
you increment
i
andfindPosition
in the method calls which results in incorrect behaviour. I guess replacing eg.++i
withi+1
(and the same forfindPosition
would solve the problem.On the other hand, I'm not entirely sure, why you need this method at all. Isn't matching with the
PATTERN
regex from the same file enough to detect whether the string contains a markdown link? It looks like the method tries to do the same as matching the regex programmatically (but does it faulty).regards,
Simon
The text was updated successfully, but these errors were encountered: