Add File menu entry to set Margin as default Markdown editor - #4
Open
francip wants to merge 1 commit into
Open
Conversation
Registers the running app as the Launch Services default handler for the Markdown (.md) UTType via NSWorkspace.setDefaultApplication(at:toOpen:), with a success or failure alert. Info.plist already declares the Editor role for md files; no launch-path work is added. Signed-off-by: Franci Penov <francip@kortexa.ai>
irl-dan
force-pushed
the
main
branch
3 times, most recently
from
August 21, 2026 14:55
c0287ff to
7e11af4
Compare
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.
Problem
Users who want Margin to open .md files by default must go through Finder (Get Info, default-app picker) for every file type. There is no in-app way to make the change.
Design
AppDelegate.setAsDefaultMarkdownEditor(_:).NSWorkspace.setDefaultApplication(at:toOpen:completion:)(macOS 12+) for themdUTType (UTType(filenameExtension: "md")→net.daringfireball.markdown), then shows a success or failure alert; the failure alert points at the manual Finder path.Info.plistalready declares theEditorrole formd(plusmarkdown,mdown,mkd,txt) withLSHandlerRank: Alternate, so no plist change is needed; the running app is already registered with Launch Services.Tests
WorkspaceBehaviorTests.testFileMenuOffersDefaultMarkdownEditorRegistrationasserts the File menu entry exists and is wired to the delegate action.make test(173 tests, 0 failures) andmake smoke(bundle, CLI, document inspection, and app window launch all pass; smoke built with the full Xcode toolchain).Screenshot
Docs
Docs/RELEASE_NOTES.md: added an Unreleased entry describing the new menu item.