Page MenuHomePhabricator

VisualEditor: Automatically convert inserted URLs to readable formatted links
Closed, ResolvedPublic1 Estimated Story Points

Description

Quora has a lovely feature in its visual editor: paste a URL and it's immediately and automatically converted in a smart way.

  • If it's a link to another answer on Quora, it is given an appropriate title.
  • If it's a link to YouTube, the video is embedded.
  • If it's a link to some other website, the page's HTML <title> is inserted and automatically linked. (There may be other special cases, but you get the idea.)

After the link is thus inserted, the user can edit the text or click another button to make the actual URL appear or to make the URL just plain text.

I'd love such a feature in VE. It's especially relevant for newbies who link to other Wikipedia articles with full http links as if they were external. For external links, getting the title automatically is usually better than having a plain URL (in fact, there are some bots that automatically insert such titles). And pasting a Commons URL can embed the media as such.


Version: unspecified
Severity: enhancement

Details

Reference
bz65540

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:27 AM
bzimport set Reference to bz65540.

Interesting idea. We've got some work planned to do this kind of thing for citations (you feed it a URL, it inserts a nice <ref>{{cite web|…}}</ref> block), and links to internal or interwiki targets get auto-converted on save (so [[:en:Foo|Bar]] not [https://en.wikipedia.org/wiki/Foo Bar]), but we don't do this for pasting into the surface. Maybe something we could do in the future?

This could potentially inform the VE UI for citoid;

I.e. we could have have one reference dialog, (i.e. the basic reference dialog) and then if a user pastes a link *into* the reference dialog, that inserts the citation guessed from the link. And then keep the drop down menu for individual templates in the ref dialog.

This does take some user discovery; however, I see this commonly being done with references already- i.e. a ref tag containing only an unformatted url. So it seems people are already just pasting links into the ref field and this is a natural enhancement of that work flow.

This, by the way, is what both G+ and Facebook do for links as well, not just Quora. So there may be already some user comfort with a pasted link becoming formatted in some fashion.

Hmm. Right now we're taking newly-created external links and displaying them as auto-numbered link nodes; having this as a secondary mode to fetching the <title> could work, but… I'm not sure.

I meant not only external links, but pages in the same wiki, too. It's anecdotal, but I see newbies adding http urls to other Wikipedia article instead of using square brackets, and this should be DWIMmier.

(In reply to Amir E. Aharoni from comment #4)

I meant not only external links, but pages in the same wiki, too. It's
anecdotal, but I see newbies adding http urls to other Wikipedia article
instead of using square brackets, and this should be DWIMmier.

Those already get converted to internal (well, interwiki) links, though…

Esanders claimed this task.
Esanders added subscribers: cscott, Esanders.

Pasting URLs now does sensible things, even converting to internal links when appropriate. Mostly thanks to work by @cscott.