Abstract Nonsense

TIL Hyperlinks in terminal emulators

TIL that terminal emulators can opt to support hyperlinks via the OSC 8 escape sequence. In terminals that support it, the following snippet should produce a clickable link:

shell
$ printf '\e]8;;https://abstractnonsense.xyz\e\\This is a link to this blog\e]8;;\e\\\n'
This is a link to this blog

I tested this to work in iTerm and VS Code’s terminal, but not in the native macOS Terminal. Conceivably, this could be used nefariously, since a URL rendered may not match the URL opened. The linked post has some valuable points re mitigation and security rationale, though.