MCPcopy Create free account
hub / github.com/Noumena-Network/code / extractHyperlinkFromStyles

Function extractHyperlinkFromStyles

src/ink/screen.ts:1432–1444  ·  view source on GitHub ↗
(
  styles: AnsiCode[],
)

Source from the content-addressed store, hash-verified

1430export const OSC8_PREFIX = `${ESC}]8${SEP}`
1431
1432export function extractHyperlinkFromStyles(
1433 styles: AnsiCode[],
1434): Hyperlink | null {
1435 for (const style of styles) {
1436 const code = style.code
1437 if (code.length < 5 || !code.startsWith(OSC8_PREFIX)) continue
1438 const match = code.match(OSC8_REGEX)
1439 if (match) {
1440 return match[1] || null
1441 }
1442 }
1443 return null
1444}
1445
1446export function filterOutHyperlinkStyles(styles: AnsiCode[]): AnsiCode[] {
1447 return styles.filter(

Callers 1

flushBufferFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected