spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Clickable file:// links

Open lonix1 opened this issue 1 year ago • 1 comments

In https://github.com/spectreconsole/spectre.console/issues/75 support was added for clickable hyperlinks:

AnsiConsole.MarkupLine("[link=https://www.example.com]Foo[/]");
AnsiConsole.MarkupLine("[link]https://www.example.com[/]");

It would be nice to also have file:// links:

// watch for the triple slash on linux/macos for an absolute path
AnsiConsole.MarkupLine("[link=file:///home/username/file.txt]Foo[/]");
AnsiConsole.MarkupLine("[link]/home/username/file.txt[/]");

In my linux system (gnome terminal) those sort of links, when clicked, open the corresponding file in the default associated app. I'm sure it's similar on mac, I'm unsure about windows.

It's rendered like this, but ideally the file:// should not be shown: file:///home/username/file.txt

It would be a nice addition. Thanks for considering it!


Please upvote :+1: this issue if you are interested in it.

lonix1 avatar Sep 08 '22 12:09 lonix1

@lonix1, if you want to give it a go on a PR I'd be happy to review it. I'm pretty sure Windows Terminal didn't support them when we added links but with microsoft/terminal#7526 that isn't the case any more.

phil-scott-78 avatar Sep 11 '22 02:09 phil-scott-78