Skip to content

Enable hyperlinks on default full output (OSC 8) #14341

Open
@ssbarnea

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:

Metadata

Assignees

No one assigned

    Labels

    diagnosticsRelated to reporting of diagnostics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions