Add folder workspaces: hideable sidebar + native tabs + macdown .#493
Open
fluxa wants to merge 1 commit into
Open
Add folder workspaces: hideable sidebar + native tabs + macdown .#493fluxa wants to merge 1 commit into
fluxa wants to merge 1 commit into
Conversation
Browse a folder of Markdown files in a hideable sidebar and open them as native macOS window tabs (one NSDocument per file). Reachable via a new File > Open Folder... command and a 'macdown .' CLI directory argument. - MPFileNode: filesystem-tree model (folders + Markdown files, sorted; dotfiles excluded). - MPFolderWatcher: recursive FSEvents watcher for live refresh (respects the remote-volume guard). - MPFolderSidebarViewController: NSOutlineView source list; double-click / Enter opens a file as a tab (reusing an already-open tab); Reveal in Finder / Copy Path context menu. - MPSidebarSyncCoordinator: keeps sidebar width / visibility / folder expansion in sync across a workspace's tabs so switching tabs is seamless. - MPDocument gains workspaceRootURL + sidebar install/toggle (Cmd-\) + open-as-tab; MPMainController gains Open Folder... and programmatic menu items located by selector (locale-proof); macdown-cmd routes directory arguments through shared defaults. No new dependencies. The editor/preview pipeline and existing single-file behaviour are unchanged. Covered by XCTest.
Owner
|
@fluxa pretty exciting, thank you for submitting. this is a feature that several folks have asked for. I'll have a review done and send notes back. we can try to target the 3000.0.8 release for this feature. |
Author
|
Thanks, sounds great, ready for your notes whenever. |
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
Adds folder workspaces to MacDown 3000: browse a folder of Markdown files in a hideable sidebar and open them as native macOS window tabs, instead of only opening individual files. Reachable from a new File → Open Folder… command and from the command line with
macdown ..This is an additive feature — the editor/preview pipeline and existing single-file behaviour are untouched, and there are no new dependencies.
What you get
NSOutlineViewsource list) showing subfolders and Markdown files (.md/.markdown), dotfiles excluded.macdown .— the CLI learns to accept a directory and opens it as a workspace (files still open as before;macdown file.mdis unchanged).How it works
MacDown is a standard
NSDocumentapp (one document per window). Rather than refactor that, this leans into native window tabbing (addTabbedWindow:): each file stays its ownMPDocument, and the OS merges their windows into one tabbed window. The sidebar is added per-window by nesting the existing editor/preview split inside an outerNSSplitView.New components (all under
MacDown/Code/Sidebar/):MPFileNode— filesystem-tree model (filtering + folders-first sort).MPFolderWatcher— recursive FSEvents watcher (respects the existing remote-volume guard).MPFolderSidebarViewController— the source list + open/activation + context menu.MPSidebarSyncCoordinator— shares sidebar state across tabs.Wiring:
MPDocumentgainsworkspaceRootURL, sidebar install/toggle, and the open-as-tab flow.MPMainControllergainsOpen Folder…and inserts its menu items by member selector (so they install in non-English locales too).macdown-cmdroutes directory arguments to a new shared-defaults key.Testing
XCTestcoverage for the model, watcher, sync coordinator, directory routing, menu installation, tab-reuse lookup, and workspace-root propagation. The full suite passes (the pre-existingHGMarkdownHighlighterTeststheme failures are unrelated to this change).macdown ., double-click-to-tab + tab reuse, ⌘\ toggle, live refresh, Reveal/Copy Path, and cross-tab sync.Notes / design decisions
Closes/relates to: (feel free to link a folder-browsing feature request if one exists)