ansi-to-html icon indicating copy to clipboard operation
ansi-to-html copied to clipboard

Support for ansi terminal links

Open LaKing opened this issue 7 years ago • 4 comments

I'm looking for a package that can convert ansi-tagged links to html.

It is possible to create VT100 terminal hyperlinks.

const ESC = '\u001B[';
const OSC = '\u001B]';
const BEL = '\u0007';
const SEP = ';';

var test = [
		OSC,
		'8',
		SEP,
		SEP,
		"url",
		BEL,
		"text",
		OSC,
		'8',
		SEP,
		SEP,
		BEL
	].join('');
console.log(test);

or

echo -e '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\'

These are correctly displayed in the terminal, and correctly represented in a file.

However, currently ansi-to-html displays them in plain text.

]8;;urltext]8;;
]8;;http://example.com\This is a link]8;;\

Could we make these type of links work? Thank you.

LaKing avatar Nov 10 '18 18:11 LaKing

are there ansi escape codes which denote a URL? I had guessed the terminal application was doing pattern matching on the text, to treat links in a special fashion. In either case I think it's possible to render url's as anchor tags, and seems like a reasonable thing to do. possibly hidden behind an option.

rburns avatar Nov 13 '18 13:11 rburns

I believe this is the emerging standard here: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda

(FWIW I've added experimental support for this to GCC 10 for adding hyperlinks to our documentation to compiler warnings, so I'm interested in seeing this supported in more places)

davidmalcolm avatar Nov 22 '19 14:11 davidmalcolm

looks like something that could be implemented without hiding it behind an option. for more reliable support, I'd guess it would still be better to additionally have the option of using pattern matching.

rburns avatar Nov 25 '19 03:11 rburns

+1 for this, is there any movement here @rburns ?

ocervell avatar Oct 25 '23 13:10 ocervell