supports-hyperlinks (3.2.0)

Published 2026-02-24 14:05:57 +00:00 by atheaadmin

Installation

registry=
npm install supports-hyperlinks@3.2.0
"supports-hyperlinks": "3.2.0"

About this package

supports-hyperlinks

Detect whether a terminal supports hyperlinks

Terminal emulators are starting to support hyperlinks. While many terminals have long detected URL's and linkified them, allowing you to Command-Click or Control-Click them to open a browser, you were forced to print the long unsightly URL's on the screen. As of spring 2017 a few terminals began supporting HTML like links, where the link text and destination could be specified separately.

This module allows you to detect if hyperlinks are supported in the current Terminal.

As this is a new development, we anticipate the list of supported terminals to grow rapidly. Please open an issue or submit a PR as new terminals implement support.

Install

npm install supports-hyperlinks

Usage

import supportsHyperlinks from 'supports-hyperlinks';

if (supportsHyperlinks.stdout) {
	console.log('Terminal stdout supports hyperlinks');
}

if (supportsHyperlinks.stderr) {
	console.log('Terminal stderr supports hyperlinks');
}

API

Returns an Object with a stdout and stderr property for testing either streams. Each property is a boolean, indicating whether or not hyperlinks are supported.

Info

Obeys the --no-hyperlinks, --hyperlink=always, and --hyperlink=never CLI flags.

Can be overridden by the user with the flags --hyperlinks=always and --no-hyperlinks. For situations where using those flags are not possible, add the environment variable FORCE_HYPERLINK=1 to forcefully enable hyperlinks or FORCE_HYPERLINK=0 to forcefully disable. The use of FORCE_HYPERLINK overrides all other hyperlink support checks.

Dependencies

Dependencies

ID Version
has-flag ^4.0.0
supports-color ^7.0.0

Development Dependencies

ID Version
@tsconfig/node14 ^1.0.3
@types/supports-color ^8.1.1
ava ^3.2.0
codecov ^3.5.0
typescript ^4.9.5
xo ^0.53.0

Keywords

link terminal hyperlink cli detect check ansi escapes console
Details
npm
2026-02-24 14:05:57 +00:00
0
MIT
latest
3.2 KiB
Assets (1)
Versions (2) View all
2.3.0 2026-02-24
3.2.0 2026-02-24