Skip to main content

Module hyperlink

Module hyperlink 

Source
Expand description

OSC 8 hyperlink writer and parser.

§Category

OSC 8 annotates following text with a URI until a closing OSC 8 with an empty URI is emitted. This module writes start/end markers and parses the body of an already-framed OSC 8 string.

§OSC framing

Writers use the 7-bit OSC introducer and the ST terminator (ESC \\):

ESC ] 8 ; params ; uri ESC \\  text  ESC ] 8 ; ; ESC \\
──┬── ┬   ───┬──   ┬   ──┬──        ───── close ─────
 OSC code  attrs target  ST

§Mode interaction

Hyperlinks are not controlled by an ANSI/DEC mode. They are zero-width string controls and are preserved by width-aware text utilities.

Constants§

HYPERLINK_RESET
Bytes that reset the current OSC 8 hyperlink: ESC ] 8 ; ; ESC \.

Functions§

parse_hyperlink
Parse an OSC 8 body into (params, url).
write_hyperlink
Begin an OSC 8 hyperlink with ESC ] 8 ; <params> ; <url> ESC \.