md: add local markdown link navigation within CWD sandbox#102
Closed
tig wants to merge 1 commit into
Closed
Conversation
Clicking a relative .md link in the viewer now navigates to that file in-place, provided it's within the CWD sandbox. Links outside CWD, to non-markdown files, or using http/https remain SurfaceOnly (shown in the status bar). New --allow-external-links option opts in to following markdown links outside the working directory. Prep for gui-cs/Terminal.Gui#5220 which adds Link.SafeSchemes and blocks file:// by default. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Member
Author
|
Closing — this work will be done as part of #96 (file-access confinement for clet md). |
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
Prep for gui-cs/Terminal.Gui#5220 (which adds
Link.SafeSchemesand blocksfile://by default).Clicking a relative
.mdlink in the markdown viewer now navigates to that file in-place. The sandbox is CWD — links that resolve outside the working directory are blocked by default and remain SurfaceOnly (URL shown in status bar).Behavior
--allow-external-links true.mdwithin CWD.mdoutside CWDfile://to.mdwithin CWDhttp://,https://,mailto:.mdfilesHow it works
TryResolveLocalMarkdownLinkresolves URLs relative to the currently-viewed file's directory#section) are stripped before path resolution../../etc/passwd.md) is caught by the sandbox checkcurrentFileDiris updated on each navigation so chains of relative links work--allow-external-linksis a clet-specific option (passed as--allow-external-links true)Relation to D-017/D-031
The SurfaceOnly policy (D-017, D-031) is preserved for all non-local links.
--allow-link-open(browser opening) remains deferred. This PR only adds in-viewer navigation between local markdown files.Test plan
TryResolveLocalMarkdownLink(sandbox, external, HTTP, non-md, fragment)clet md README.md→ click a relative link like[spec](specs/clet-spec.md)→ navigates--allow-external-links true→ permits navigation outside CWDSpec/decisions impact
specs/decisions.md— needs a D-NNN entry for the sandbox boundary decisionspecs/clet-spec.md— Appendix A link policy section should mention in-viewer navigation--allow-external-linksto md options(Will update docs once the design is confirmed.)
🤖 Generated with Claude Code