Fix relative markdown link handling#5505
Merged
YourRobotOverlord merged 1 commit intoJun 19, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Markdown rendering/click handling pipeline so relative Markdown link targets behave like other clickable links (styling + LinkClicked), while keeping OSC8 hyperlink emission restricted to safe absolute URI schemes.
Changes:
- Treat relative link targets as Markdown “link targets” for styling/clickability (underline + click events).
- Gate OSC8 hyperlink emission behind a “safe absolute URI” check (scheme allowlist).
- Add regression tests for clicking relative links in both normal Markdown text and table cells, and adjust styling expectations.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Tests/UnitTestsParallelizable/Views/Markdown/MarkdownViewTests.cs | Adds click regression tests for relative links (plain + table) and updates expected underline styling for relative links. |
| Terminal.Gui/Views/Markdown/MarkdownView.Drawing.cs | Restricts OSC8 emission (Driver.CurrentUrl) to safe absolute URI targets only. |
| Terminal.Gui/Views/Markdown/MarkdownTable.cs | Applies the same safe-absolute check for table rendering behavior tied to absolute URLs. |
| Terminal.Gui/Views/Markdown/Markdown.cs | Adds a relative-link example to demo Markdown content. |
| Terminal.Gui/Drawing/Markdown/MarkdownAttributeHelper.cs | Centralizes link-target detection (anchors/safe absolute/relative) and adds helper for safe absolute URI parsing. |
tig
approved these changes
Jun 19, 2026
This was referenced Jun 23, 2026
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.
Summary
Fixes #5504
Testing
dotnet build Terminal.Gui/Terminal.Gui.csproj --no-restoredotnet test --project Tests/UnitTestsParallelizable --no-restore --filter-class "*MarkdownViewTests" /p:BuildProjectReferences=false