Skip to content

fix: reveal markdown directory links in the file tree, not Finder (#72)#87

Merged
simion merged 1 commit into
mainfrom
fix/72-markdown-dir-links-reveal-in-tree
Jul 11, 2026
Merged

fix: reveal markdown directory links in the file tree, not Finder (#72)#87
simion merged 1 commit into
mainfrom
fix/72-markdown-dir-links-reveal-in-tree

Conversation

@simion

@simion simion commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Closes #72.

Problem

A link in the markdown preview that resolves to a directory (e.g. [some-project](some-project/)) revealed the folder in Finder, jumping the reader out of the app mid-README, while sibling links to actual files open in a tab right there. GitHub instead renders a folder-listing page for the same link.

Fix

Redirect the is_dir branch in MarkdownPreview.onClick to revealInTree(taskId, resolved, true) instead of taskRevealPath. That store action already:

  • un-hides the right panel and switches it to the All files view,
  • expands the target directory's ancestors (and the dir itself, since isDir is supported),
  • scrolls to and briefly highlights it.

It's the same reveal the editor breadcrumb's folder segments use (TaskView.tsx), so behavior is consistent app-wide.

resolved from resolveTaskHref is already task-root-relative and containment-checked (root-escaping paths return null), so it's exactly the path space the tree keys on. Member files resolve to <member_dir>/rest, which is just a subfolder in the wrapper tree, so multi-repo works with no special casing.

Binary files (images, archives) that the editor can't render still reveal in the OS file manager, unchanged.

Test plan

  • Open a README whose links point to a subfolder (trailing slash) in the markdown preview.
  • Click a directory link, confirm the sidebar file tree focuses/expands the folder in-app instead of opening Finder.
  • Click a file link, confirm it still opens in an editor tab.
  • Click an image/archive link, confirm it still reveals in Finder.

tsc -b clean. No CHANGELOG entry (maintainer-authored at release time).

🤖 Generated with Claude Code

https://claude.ai/code/session_019x3kbDKdUAfbCKeWhBnmJw

A markdown-preview link resolving to a directory used to reveal the
folder in Finder, jumping the reader out of the app mid-README while
sibling file links open in a tab right there. GitHub instead renders a
folder listing for the same link.

Redirect the is_dir branch to revealInTree(taskId, resolved, true),
which un-hides the right panel, switches it to All files, and
expands/scrolls/highlights the target directory in the sidebar tree.
resolved is already task-root-relative and resolveTaskHref guarantees
containment, so it's the exact path space the tree keys on (the same one
the editor breadcrumb reveal uses). Binary files (images, archives),
which the editor can't render, still reveal in the OS file manager.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019x3kbDKdUAfbCKeWhBnmJw
@simion simion merged commit b776c93 into main Jul 11, 2026
2 checks passed
@simion simion deleted the fix/72-markdown-dir-links-reveal-in-tree branch July 11, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Directory links in markdown preview should behave like GitHub, not open Finder

1 participant