Comments (3)
Hey there! Thanks for reporting this issue
I think I've found the issue. The extra space is due to a u200B
character, also known as a ZERO_WIDTH_SPACE. This is a sort of a "hacky" workaround used to force text to render as links in non-hyperlink terminals.
I'm on Windows at the moment, and all this time, I have been testing the code on both VSCode and Windows Terminal. Windows Terminal provides full support for text hyperlinks while VSCode, although, it does not support text hyperlinks, it does render the non-text hyperlink perfectly, without the extra space.
On legacy Command Prompt, however, I found out that the text had a space after the opening parentheses, like you mentioned. I'm guessing it boils down to whether the terminal is properly able to render the u200B
character. Also, if you remove that Update: no such forced hyperlink, still plain textu200B
character from the code, the extra space will be removed all right, except there will be no clickable link - just plain text
Please note that this code was based on sindresorhus/terminal-link which used the u200B
character as well. This also means that code run using this NodeJS package, on a terminal which doesn't support linking, will produce the exact same output as above (see below image). This also means that this package does the exact same thing as sindresorhus' popular NPM package.
(image is from command prompt btw)
As of now, it works fine on most modern terminals, I haven't had a lot of different terminals/apps to test it, since I'm constrained to use only Windows. There might be a few problems around, and if you know how to fix them, I would surely appreciate the help!
from termlink.
A whole lot of research later, and after looking up some old issues on sindresorhus/terminal-link, I found that you don't actually need that u200B
character anymore. Looks like that character was placed purely for appearance purposes, in order to remove a specific VSCode bug, which has fixed in newer versions of VSCode. There were a lot of issues (and other referenced issues) on that repository regarding problems caused by that specific character.
When I decided to make this package, I had simply copied that character from that repo, not knowing what exactly it was and figured it was just another hacky workaround thing. I should probably have done a bit more research, I guess, heh.
And no, there is no way to actually "force hyperlinks" in a non-hyperlink supported terminal.
I'll remove the unwanted character in a future commit, but I'll wait until if you have anything to add to this.
from termlink.
This would be perfect. Thank you.
from termlink.
Related Issues (4)
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 termlink.