DEV Community

Valeria
Valeria

Posted on

3

Day 17: Terminal Links & Other Escapes πŸ”—

Ever wondered how to make a clickable link in a terminal? Well you don't have to wonder no more: you can use special ANSI code for it!
And ansi-escapes have you covered!

Install the package with e.g. deno add npm:ansi-escapes and create a file, e.g. main.ts:

import {link as createLink} from "ansi-escapes";

const link = createLink("link", "https://valeriavg.dev");

console.log(`Hello! Would you like to check this ${link} perhaps?`);
Enter fullscreen mode Exit fullscreen mode

Run with e.g. deno run -A ./main.ts and enjoy:

VSCode Terminal with a link

The screenshot is from VSCode terminal, but not every terminal would support links!

On Mac, for example, iTerm2 would support it:

iTerm2

But default terminal app would not:

Mac terminal

There are other libraries that would help you detect if a feature is supported or not and ansi-escapes comes with a lot of features!

Check it out and do share your creations!

Liked the content and would love to have more of it all year long?

Buy Me A Coffee

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

πŸ‘₯ Ideal for solo developers, teams, and cross-company projects

Learn more

πŸ‘‹ Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay