Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ansi terminal links #47

Open
LaKing opened this issue Nov 10, 2018 · 4 comments
Open

Support for ansi terminal links #47

LaKing opened this issue Nov 10, 2018 · 4 comments

Comments

@LaKing
Copy link

LaKing commented Nov 10, 2018

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;;url�text]8;;�
]8;;http://example.com\This is a link]8;;\

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

@rburns
Copy link
Owner

rburns commented Nov 13, 2018

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.

@davidmalcolm
Copy link

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)

@rburns
Copy link
Owner

rburns commented Nov 25, 2019

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.

@ocervell
Copy link

ocervell commented Oct 25, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants