We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,430 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Request to improve the URL handling functionality

Hello,

I'm mostly active in the Java forums these days, and often I find the desire to link to a method in the Java API, but the markdown syntax doesn't seem to handle the URL format quite well.

Here's an example of a URL that I was recently trying to link to:

http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...)

I guess you can easily notice that it breaks a valid URL.

3
Contributors
9
Replies
3 Weeks
Discussion Span
3 Months Ago
Last Updated
24
Views
mvmalderen
Posting Maven
2,612 posts since Feb 2009
Reputation Points: 2,221
Solved Threads: 280
Skill Endorsements: 36
Dani
The Queen of DaniWeb
Administrator
21,367 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Here's how you do that:

[Click here](http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...))

OR

[http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...)](http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...))

OR

Click the 'Link' button in the editor toolbar or hit Ctrl+L to insert a link.

All three ways should work.

Dani
The Queen of DaniWeb
Administrator
21,367 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Thank you, problem solved :)

mvmalderen
Posting Maven
2,612 posts since Feb 2009
Reputation Points: 2,221
Solved Threads: 280
Skill Endorsements: 36

I've reopened this question because of another issue that I'm facing.

In this post the URL doesn't get rendered correctly. I checked using a different browser with cleared cache.

I wrote the text "Math.pow", selected it, clicked the Link button, and pasted there the copied URL:
http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#pow(double, double).

Result:
[Math.pow](http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#pow(double, double))

Also it feels unpleasant that a URL gets URLified when marked as inline code.

I use Pale Moon 15.4.1-x64 and Chrome 24.0.1312.57 m.

mvmalderen
Posting Maven
2,612 posts since Feb 2009
Reputation Points: 2,221
Solved Threads: 280
Skill Endorsements: 36
Dani
The Queen of DaniWeb
Administrator
21,367 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

The issue is that your link cannot have a space within it.

Convert spaces to %20 as so:

Math.pow

It is by design that URLs get URLified within code. It's a common occurrence that code includes a comment with a link to its author, etc. Because it doesn't make sense to allow markup within code, since code should be literal, I chose to auto-linkify all links within code.

Dani
The Queen of DaniWeb
Administrator
21,367 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

Convert spaces to %20 as so

That fixes it. Thank you :)

It is by design that URLs get URLified within code.

However this post first inline code box doesn't URLify the whole link. As you can see the '(T...)' part is not URLified. How is that done then?
Also that makes me wonder why a valid URL such as
'http://docs.oracle.com/javase/6/docs/api/java/lang/Math.html#pow(double,%20double)'
or
'http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...)'
doesn't get URLified as a whole automatically?

mvmalderen
Posting Maven
2,612 posts since Feb 2009
Reputation Points: 2,221
Solved Threads: 280
Skill Endorsements: 36

The problem is with closing parentheses. Just escape the closing parentheses by leading it with backslash character and it should work out fine. For e.g.

http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...) [without backslash]

v/s

http://docs.oracle.com/javase/6/docs/api/java/util/Arrays.html#asList(T...) [with backslash before the )]

EDIT: It seems like there is a bug in the MD renderer. The preview shows the complete URLfied URL for the second case but after a submit it disappears.

~s.o.s~
Failure as a human
Administrator
12,220 posts since Jun 2006
Reputation Points: 3,307
Solved Threads: 783
Skill Endorsements: 55

It's possible there is a bug in the live-preview. :( Will check into that ...

The auto-linkify feature will automatically quit at the sight of parentheses (Because it makes sense for people to naturally type naked links in parentheses like this: http://www.daniweb.com).

However, the explicity linkify feature will linkify everything (including parens) up until the first non-URL compliant character that it sees (such as a space).

Dani
The Queen of DaniWeb
Administrator
21,367 posts since Feb 2002
Reputation Points: 1,555
Solved Threads: 368
Skill Endorsements: 122

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1040 seconds using 2.69MB