Comments (11)
It sounds good to me @wooorm
from remark-external-links.
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.
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.
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.
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.
/cc also maybe @xuopled or @fand have thoughts on this
from remark-external-links.
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.
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.
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 thetarget=_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.
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.
Just created #10 let me know what you think. Thanks!
from remark-external-links.
Related Issues (11)
- Update for changes in remark HOT 3
- Add option to append text/markup HOT 6
- HTML Anchor tags aren't accounted HOT 2
- plugin overwrites node data.hProperties set by other remark plugins HOT 1
- Pass additional properties to a and span elements HOT 9
- Ignoring specific URLs HOT 2
- Add to remarkjs npm org HOT 3
- is it possible to exclude fragment anchors? HOT 3
- Whitelisting domains? HOT 3
- Add more support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remark-external-links.