xterm.js Web Links
Closed this issue · 2 comments
I have an application where I would like to allow the user to export the data. Since downloading isn't implemented in textual-serve yet, I decided to just provide the user a link which should be clickable in the browser. It seems like XTerm.js doesn't support this out the box, but has an official addon for this:
https://github.com/xtermjs/xterm.js/tree/master?tab=readme-ov-file#addons
https://www.npmjs.com/package/@xterm/addon-web-links
This might be useful to add for textual-serve.
I forgot to mention, as a workaround in the meantime, you can make OSC 8 hyperlinks manually:
def terminal_link(url, text):
"""Return a terminal hyperlink."""
return f"\033]8;;{url}\033\\{text}\033]8;;\033\\"
This will create a clickable link in the browser.
I think Textual supports this now: https://textual.textualize.io/blog/2024/09/08/towards-textual-web-applications/#opening-web-links. Does that help? It is a bit flaky on Safari, though.