fix(tui): enable OSC 8 hyperlink detection for tree-sitter markdown#20400
Open
mugnimaestra wants to merge 1 commit intoanomalyco:devfrom
Open
fix(tui): enable OSC 8 hyperlink detection for tree-sitter markdown#20400mugnimaestra wants to merge 1 commit intoanomalyco:devfrom
mugnimaestra wants to merge 1 commit intoanomalyco:devfrom
Conversation
Add detectLinks from @opentui/core as onChunks callback on the markdown code renderable. This enables OSC 8 hyperlink sequences for URLs in tree-sitter rendered markdown, making Cmd/Ctrl+Click work correctly for wrapped links. Depends on anomalyco/opentui#736
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #14966
Type of change
What does this PR do?
URLs in tree-sitter markdown rendering don't emit OSC 8 hyperlink sequences, so Cmd/Ctrl+Click breaks when a URL wraps across terminal lines. The terminal's own URL auto-detection only sees the truncated portion on the clicked line.
This wires up the
detectLinkshook from@opentui/core(added in anomalyco/opentui#736) to the markdown<code>renderable. The hook post-processes tree-sitter highlights, detects URL-bearing scopes, and setschunk.link = { url }so the renderer emits proper OSC 8 escape sequences.2-line change:
detectLinksfrom@opentui/coreonChunks={detectLinks}to the markdown<code>element inTextPartHow did you verify your code works?
Screenshots / recordings
See video in #14966 for the broken behavior. After this fix, wrapped URLs are fully clickable.
Checklist