GithubHelp home page GithubHelp logo

Comments (11)

cedricdelpoux avatar cedricdelpoux commented on June 19, 2024 1

It sounds good to me @wooorm

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

Currently, any URL that starts with a protocol is seen as external (through here and here).

We can go two ways: see every protocol except mailto as absolute, or see only http / https as absolute. What are your thoughts, and benefits / tradeoffs?

/cc @makenowjust (last person to touch that line)

from remark-external-links.

zslabs avatar zslabs commented on June 19, 2024

Hey @wooorm appreciate the quick reply as always. I could see this being a compounding issue for protocols like tel:, skype:, etc. A quick google search for all of them brought up https://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml

Do you think it'd be worth trying to "whitelist" those in that list? I can't personally think of a time you'd want to have any of those protocols open up a new tab, but I'm not familiar with a bunch of 'em.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

Iā€™m not really into adding a big list here šŸ˜• So Iā€™m up for allowing just http / https. But I can see potential exceptions in the future (about? blob? more?). Or just ignoring mailto for now and seeing where that goes?

from remark-external-links.

zslabs avatar zslabs commented on June 19, 2024

Yeah maybe just checking for http/https would be best for now; as I could make the same argument for a number of those in that list.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

/cc also maybe @xuopled or @fand have thoughts on this

from remark-external-links.

makenowjust avatar makenowjust commented on June 19, 2024

Only Chrome (and Chromium family browsers like Vivaldi) remains a blank tab after clicking a mailto link having target=_blank attribute. Other browsers (Safari, Firefox and Edge) doesn't produce a new tab.

I think it is Chrome's problem, however treating only http/https is good workaround.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

Hmm, also like to add that people can set up mailto: to open in the browser (such as in Gmail or so). In which case the target=_blank definitely makes sense.

from remark-external-links.

zslabs avatar zslabs commented on June 19, 2024

Hmm, also like to add that people can set up mailto: to open in the browser (such as in Gmail or so). In which case the target=_blank definitely makes sense.

While I do agree there can be different cases for protocol URLs, I myself have never seen a target="blank" attached to a mailto: link; and is something they can easily customize on their own by just writing out the link as regular HTML if needed.

from remark-external-links.

wooorm avatar wooorm commented on June 19, 2024

How about the following pseudo-code changes?

  • var defaultProtocols = ['http', 'https']
  • var protocols = opts.protocols || defaultProtocols
  • if (ctx && isAbsoluteURL(ctx.url) && protocols.indexOf(ctx.url.slice(0, ctx.url.indexOf(':')) !== -1)) {

...that would allow people to still specify their own protocols.

@zslabs Want to write a PR for this, with tests?

from remark-external-links.

zslabs avatar zslabs commented on June 19, 2024

Just created #10 let me know what you think. Thanks!

from remark-external-links.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    šŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. šŸ“ŠšŸ“ˆšŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ā¤ļø Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.