Skip to content

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

Description

@adamatan

TL;DR: I implemented internal file linking for the markdown preview (360fc9f). Now that I'm using it, I've changed my mind about how directory links specifically should behave: they should work like GitHub's folder view, not open the Mac Finder.

Backstory

When I built link support for the markdown preview, a link resolving to a directory (rather than a file) had no obvious in-app destination, so I made it reveal the folder in Finder. It seemed reasonable at the time, better than opening a dead tab.

But now that I'm using it day to day (in one of my repos, whose README links straight to each project's subfolder, e.g. [some-project](some-project/)), it feels wrong. GitHub renders a folder listing page for that same link. Termic instead punts out of the app entirely into Finder, which breaks the flow of reading a README, especially since other links in the same file (to actual files) open fine in a tab right there in the editor.

What I want instead

Directory links should do something GitHub-like, staying inside termic, not jumping to the OS file manager. The most natural fit is focusing/expanding the target directory in the sidebar file tree (switching workspace/member first if needed). Keep the Finder-reveal as a fallback only for paths the sidebar genuinely can't represent (e.g. outside the open workspace).

Where

  • src/components/workspace/MarkdownPreview.tsx — the is_dir branch in onClick (currently calls workspaceRevealPath)
  • Sidebar/file-tree "reveal this path" API, whatever FileTree/sidebar store exposes

Repro

  1. Open a repo's README.md whose links point to a subfolder (trailing slash) in the markdown preview.
  2. Click one of those directory links.
  3. Finder opens instead of anything happening in termic.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions