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

Image of Timescale

πŸš€ pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applicationsβ€”without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more β†’

Top comments (0)

Image of Docusign

πŸ› οΈ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay