Skip to main content

osc8_hyperlink

Function osc8_hyperlink 

Source
pub fn osc8_hyperlink(url: &str, text: &str) -> String
Expand description

Wrap text in an OSC 8 hyperlink escape pointing to url.

Format: ESC ] 8 ; ; <url> ESC \ <text> ESC ] 8 ; ; ESC \

Supported by: iTerm2, Kitty, Ghostty, WezTerm, gnome-terminal, Windows Terminal, and others. Terminals that don’t understand OSC 8 render the inner text as-is (the escape sequences are invisible/no-op).

use oxicode::tui_vt::notifications::osc8_hyperlink;
let link = osc8_hyperlink("https://example.com", "click here");
assert!(link.contains("https://example.com"));
assert!(link.contains("click here"));