Enable hyperlinks on default full output (OSC 8) #14341
Open
Description
Current terminal output (full) does provide nice ANSI colored output but without making the rule labels clickable.
Ideally these should point to official documentation pages, as these contain very good examples of adding hyperlinks.
The hyperlink terminal support extension is called OSC 8 and by now is already supported by most terminals.
def link(uri: str, label: str | None = None) -> str:
"""Return a link."""
if label is None:
label = uri
parameters = ""
# OSC 8 ; params ; URI ST <name> OSC 8 ;; ST
escape_mask = "\033]8;{};{}\033\\{}\033]8;;\033\\"
return escape_mask.format(parameters, uri, label)
References: