Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upIn Markdown, URLs in <…> have the period moved outside the link #209
Comments
jcs
added
the
bug
label
Jul 20, 2015
added a commit
that referenced
this issue
Dec 3, 2015
jcs
closed this
Dec 3, 2015
jcs
reopened this
Dec 3, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
|
fixed by 6e6803f |
jcs
closed this
Dec 3, 2015
added a commit
that referenced
this issue
Dec 7, 2015
pushed a commit
to RedCarpetUp/lobsters
that referenced
this issue
Jul 11, 2016
pushed a commit
to RedCarpetUp/lobsters
that referenced
this issue
Jul 11, 2016
pushed a commit
to RedCarpetUp/lobsters
that referenced
this issue
Aug 1, 2016
pushed a commit
to RedCarpetUp/lobsters
that referenced
this issue
Aug 1, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
roryokane commentedJul 2, 2015
The symptoms
Try previewing a comment containing this markup (e.g. on this story):
What should be rendered:
What Lobsters renders:
The period at the end is moved outside of the link, breaking it. This is useful when autolinking, but not with explicit
<…>links.I can work around this by using
[…](…)syntax instead, duplicating the URL:The cause
The problem is probably this part in
extras/markdowner.rb, labeled “fix links that got the trailing punctuation appended to move it outside the link”. I know the problem is after line 15, because I confirmed that RDiscount 2.1.7.1 (the version Lobsters uses) includes the period correctly when I try to parse<…>with RDiscount directly fromirb, with the same arguments.The fix
RDiscount still wrongly includes the punctuation in links like
So you can’t just delete that punctuation-removal code.
To fix this bug, I think you have to run the filter before the Markdown is processed. In the filter, look for raw URLs in the text that are not part of a link (a harder task than just searching for
<a>tags), and then explicitly wrap them with<…>s that exclude ending periods.