Comments (12)
@mipearson I don’t suppose you know where the chosen 1339
escape code was from? I don’t seem to be able to establish provenance other than your adding it in #30!
from terminal-to-html.
Yeah, I reckon we should totally just support the iterm2 one @ticky
from terminal-to-html.
FWIW this is now supported by many more terminal emulators and tools, including ls
in coreutils
, gcc
, and so on: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
from terminal-to-html.
I realised because terminal-to-html doesn't handle ST as a terminator, like a conforming terminal should, it is possible to make output that results in the same thing on iTerm2 and this. That's probably confusing to say; so best illustrated by this code:
func crazyURL(url string) string {
// This generates a very particular set of escape sequences:
// OSC8 + ST (terminal-to-html doesn't see this terminator) + URL
// OSC8 + BEL (empty URL - terminates OSC8, "xterm" terminator)
// OSC1339 (custom buildkite URL)
return fmt.Sprintf("\x1B]8;;%s\x1B\\%s\x1B]8;;\x07\x1B]1339;url=%s\x07",
url, url, url)
}
That will result in a single URL being visible and it will be a link in both iTerm2 and terminal-to-html (and correctly degrades to just the plain text version in terminals not supporting OSC8/OSC1339).
from terminal-to-html.
I .. might have picked it out of thin air? I can't remember if iterm supported links at the time, it might have been a code I chose as it wasn't used elsewhere.
from terminal-to-html.
That’s fair - image_code + 1
totes sounds reasonable too! 😃
from terminal-to-html.
iTerm's image format is different too: https://www.iterm2.com/documentation-images.html
from terminal-to-html.
What's the reasoning behind requiring the escape sequence for links? Would it not be generally helpful to just linkify anything starting with http:// or https://? It seems like a bad user experience to have to muck about with escape codes to generate links in build output.
from terminal-to-html.
Talking as one of the original authors of this, but I don't work for buildkite, and their views may differ:
It would have been hard to code with the way that terminal parses input (poorly, but quickly).
There's also gotchas that you need to deal with when auto-linking anything that starts with https://
- eg what to do about periods or quotes at the end. I've a vague memory that there might be security concerns as well.
(worth noting also that iterm2 used to auto-link, but then stopped when it turned into a security nightmare as it would try to resolve the domain to work out whether something was a "link" or not, meaning that sometimes people's things that looked like links but were actually security credentials would be transmitted in the clear to a DNS server)
from terminal-to-html.
The link escape sequence is to turn any text into a link, much like on the web, without needing to show the full URL in the output
from terminal-to-html.
Any update? Just found out I can't make output which works with this library and in an OSC8 supporting terminal.
from terminal-to-html.
Hey @dgl, this is to let you know I'm going to break your awesome hack in the next release (with #159). But I think I've figured out how to add OSC 8 support, so hopefully you won't be waiting too long for that!
from terminal-to-html.
Related Issues (20)
- APC with standard ST terminator would break parser
- Published docker image HOT 3
- pkg.go.dev does not recognize your LICENSE HOT 1
- Support Buildkite log groups and expand/collapsing
- DECSC / DECRC should save more than cursor position
- Request to take ownership of the terminal Ruby gem HOT 6
- Prevent wrapping long lines on small screens HOT 4
- Support for terminal URLs HOT 2
- Incorrect output for `playwright` output - lines being incorrectly removed
- (feature request) Automatically add links for URLs HOT 1
- terminal-to-html imposes odd formatting on Terraform plans HOT 3
- Garbled output from Gradle HOT 8
- [Feature request] Add an option to customize title of output HTML HOT 1
- Dockerfile out of date?
- Add support to install with homebrew HOT 1
- Flaky test: TestRendererAgainstCases renders APC escapes as processing instructions
- Add the remaining 8-bit colors to the css
- Add checksum for an archive while downloading
- Ignore 2J & 3J "scrollback clear" codes HOT 1
- Bug with rendering characters in Gradle progress output HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terminal-to-html.