Added a post conversion hook to PageDown + amended test for autolinking, fixes #2792 #2881

Merged
merged 3 commits into from Feb 19, 2012

Projects

None yet

4 participants

@beardedninja

No description provided.

@danielgrippi
Member

thanks for the pull request! but could you provide an explanation of what this does exactly?

@beardedninja

Oops! It adds target="_blank" to every autolinked link within markdown'd text. For example the comment below:

Hey everyone check out www.russianwives.com

becomes

Hey everyone check out <a href="www.russianwives.com" target="_blank">www.russianwives.com</a

Thus fixing for this issue: #2792 (test included)

The regular expression detects urls with well-formed domains, with or without protocol (http/https), with or without querystring parameters but not relative links (ie hashtags and mentions) - so links within the pod will not open a new window.

@maxwell
Member
maxwell commented Feb 17, 2012

whats the bit with the pagedown?

@beardedninja

Pagedown is the javascript library Diaspora uses to convert escaped "markdownified" text (such as in comments, posts, statuses) that comes from the database to clean html.

Read more here:

http://code.google.com/p/pagedown/wiki/PageDown

@maxwell
Member
maxwell commented Feb 19, 2012

heh, sorry wasnt thinking straight...

@maxwell
Member
maxwell commented Feb 19, 2012

I am going to pull this, but in the future, if you could make the behavior be testing in a separate test, that way we have some documentation of what everything does!

@maxwell maxwell merged commit 4f27834 into diaspora:master Feb 19, 2012
@beardedninja

Alright will do! Thanks maxwell.

@coclav
coclav commented on 5457126 Jan 21, 2014

Thanks, I have reused this piece of code in a project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment