pygments-ansi-color icon indicating copy to clipboard operation
pygments-ansi-color copied to clipboard

Lack of ANSI hyperlink support (OSC Sequence Support)

Open ssbarnea opened this issue 1 year ago • 1 comments

Over the last decade most terminals added support for ANSI-hyperlinks, which is a small extension of ANSI that allows inclusion of links by applications.

A good resource about this can be found https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda which also includes a bit of history and also the good old https://en.wikipedia.org/wiki/ANSI_escape_code#OSC_(Operating_System_Command)_sequences -- thes extensions are also called OSC sequences.

To give some insights (from what I often use):

  • iTerm full support
  • vscode terminal full support (since around november 2022 if I remember well, as they upgraded the xterm.js version they use)
  • macos terminal does not render clickable link but it does process the escape codes correctly, so not really breaking the rendering.

The biggest problem with pygments-ansi-color is that it does break the rendering by not following the specification for ANSI escape codes. Even if a terminal is unable to process some codes, it should still be able to ignore them, something that is not happening with this library.

I guess that this could be better fixed in two stages, one that would first make it properly ignore the hyperlink codes, and a second one that would keep render them as links.

ssbarnea avatar Feb 02 '23 11:02 ssbarnea