Repository navigation
Conversation
|
This is stacked atop #280 so this either needs to be split into a separate PR atop |
|
This is part of a stack but not showing here because stacks aren't enabled for this repo it seems: I can split these later if needs be, but stacks at least make it easier to |
|
I would prefer this dependency bump on its own and not stacked with the unrelated change please. If you have the time; proof that it doesn't break tests in cli/cli would also be an asset to decrease the review burden. If it does break tests, some investigation into why is in order as well. I don't understand the "replacement module" comment, sorry. If that's something you meant for us to action, can you expand on that? |
@BagToad if you're open to taking it, I can unstack them. I mainly did that so I could simply build against the head of the stack against my fork. Less for the stack and more for the natural I'm making a similar change to the cli right now for cli/cli#3718. There were a few expected But how would this change impact the cli directly? I see you are using |
|
The lint issue is that |
|
Since I can't rerun the failed test I simply amended the commit and did a force push. |
|
@heaths sorry for the long delay on this. Definitely do want to fix this in cli/cli.
I would like to take this change, yes. If we could unstack the changes I think we can merge it. |
|
I think that if we take the glamour v2 upgrade here, we need to figure out some way in the markdown renderer to avoid emitting the OSC8 links when rendering markdown in the non-interactive mode. Think without any work they will still be included, which probably isn't what users expect. |
@BagToad done. @williammartin the OSC8 characters aren't there when piping to, say,
Or did you just mean markdown in general? That's with my changes i.e.,
In fact, I just redirected both commands' output to tmp files and diff'd them. No differences at all.
The new glamour takes into account whether the output is a TTY just like the old one did. |
I don't think that's the case. What you're seeing with As a comparison, That said, I've probably changed my mind anyway. It just seems that we should fix our call sites to not |
|
That seems like a failure of the agent harness, though. Either it emulates a TTY (which is funny, since TTYs we know are emulations) and handles VT sequences e.g., VSCode's integrated terminal, or it attaches output streams that are not a TTY. Glamour et. al. all consistently check TTY the same way.
Yeah, seems like a better approach overall. Do you want me to do that in cli/cli#14148 or treat that as a separate change? |
|
@williammartin FWIW, I was looking into some way to avoid rendering VT sequences—turns out Glamour doesn't care about TTY at all, just renders text given—and realized it's not only hyperlinks that force VT sequences. Some other elements do to, like positioning, bold, etc. Sure enough, even the current release of
So, yes, seems just not calling |
No particular opinion. Nice if we can cover it in one release, but it doesn't need to be a single PR for me. This is probably ready for review right? There's nothing else we think is required in go-gh? |
There was a problem hiding this comment.
🟡 Changes recommended
It pins versions with a known rendering panic, mishandles relative OSC 8 targets, and lacks regression coverage for wrapped hyperlinks.
3 open findings
What changed in this PR
Upgrades Glamour to v2 to add OSC 8 hyperlink support.
Changes:
- Migrates Glamour and Lip Gloss to v2 import paths.
- Updates dependencies and rendering expectations.
- Preserves accessibility styling compatibility.
| File | Description |
|---|---|
go.mod |
Updates Go and terminal-rendering dependencies. |
go.sum |
Refreshes dependency checksums. |
pkg/markdown/markdown.go |
Migrates Markdown rendering to Glamour v2. |
pkg/markdown/markdown_test.go |
Updates ANSI output expectations. |
pkg/text/text.go |
Migrates width calculation to Lip Gloss v2. |
pkg/x/markdown/accessibility.go |
Migrates accessible styles to Glamour v2. |
pkg/x/markdown/accessibility_test.go |
Updates accessibility test imports. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Hmmm, the most painful thing about this PR is that since this is a major version bump of glamour, and glamour package types are exposed on exported function signatures, this is a breaking change for anyone who references the For example, anyone who does something like Still, I'm probably inclined to say we should just make it a breaking change and apologise if anyone gets into problems where they integrate with |
|
Re: my previous comment. Public usage of the package is quite small, so we might just be able to go round opening PRs to fix it for people. On the other hand, there might be private repos we don't know about. If we're worried then we should consider deprecating the current package and making a new one beside it with types we own that adapts glamour/v2. This would be safer in the long run too. Since there aren't too many integrators there also won't be lots of people that don't realise they need to upgrade. This would probably be my preferred option just to avoid the same thing happening in future. |
|
The fact I didn't have to change any WithOptions in Maybe it would also be better right now in this PR to change that WithOptions arg to use our own duck type-compatible WithOptions and avoid exposing |
|
Unfortunately, I found a bug adding a test case: charmbracelet/glamour#637 As long as no one actually uses Probably should hold off merging this until I can get a fix upstream or at least figure out a way to work around it. The behavior in glamour/v2 definitely seems incorrect because the navigable href is wrong and, well, unnavigable. |
Unfortunately I don't think this is a duck typing thing, otherwise your suggestion would work. I think the reason you didn't need to change functions in That you needed to change the import is the breaking change. There's also an issue with indirect dependency compatibility on Here's the dep graph showing the issue:
I think fixing it takes one of two paths depending on whether we make a breaking change to
In the second case, we'd still have
If we don't take either of these options, our consumers can run |
That's still semver-compatible with 1.25.0, which is what go-gh declares now. Is that so bad? For a >= 1.x, even a >= 1.25 is semver-compatible but I appreciate not forcing a minor upgrade.
We could take an explicit dependency on it. 0.0.15 is semver-compatible with 0.0.13. While we see so many devs afraid to support a 1.x in Rust, I'm sad to see it seemingly increasing in Go as well; however, at least they are only rev'ing the patch version and not the minor because a hypothetical 0.13.0 is not semver-compatible with 0.15.0. |
Once charmbracelet/glamour#639 is merged, it's just a matter of the cellbuf dependency. If we could force a dependency—even though it's transitive—perhaps we could upgrade people automatically. |










Fixes #188