![]() the sender argument indicates the UI item that triggers the invocation-usually the NSMenuItem object the user clicked on, but could also be nil if the plug-in is triggered programmatically. This method will be invoked when your plug-in is run. MacDown will use the value returned by this method as the menu item’s title for your plug-in. You should set up the project meta data according to Apple’s documentation, specifically provide a Principle Class config that points to the appropriate class inside the project as your plug-in’s entry class.Ī plug-in should provide two methods inside the principle class: Plug-in ArchitectureĪ plug-in project can be created via Xcode’s OS X → Framework & Library → Bundle project template. Store things with NSUserDefaults or other persistence solutions. This may change in the future, but as a rule of thumb, you should always treat your plug-in as stateless. One caveat is that MacDown does not reuse plug-in instances between invocations a new instance is re-created each time a method is called on the plug-in. A plug-in is invoked when the user clicks on its corresponding menu item. MacDown searches ~/Library/Application Support/MacDown/PlugIns, and builds menu items for loadable bundles inside the directory. :p IntroductionĪ plug-in in MacDown is a regular Cocoa dynamic-loading bundle, with extension. This section serves as a simple walkthrough on how plug-ins work in MacDown until proper documentation is written. ![]() This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. Be careful not to upload anything sensitive. You will not be able to delete or modify the Gist. The implementation does not include authentication, and all gists are uploaded anonymously. If the gist is created successfully, its URL will be copied automatically into yourĬlipboard, so that you can easily share, or open it inside a browser.Īlert!! This is for demo only. An alert dialog will appear to indicate whether the operation is successful. Open a document, and select menu item Plug-ins → Gist it! to upload. Put ugin in ~/Library/Application Support/MacDown/PlugIns. This particular plug-in works only under OS X 10.9 or later, not 10.8. Note: Plug-ins are available in MacDown 0.6+ only. It provides a menu item “Gist it!” that uploads the current document (if available) as a public GitHub Gist. This repository illustrates a basic example of a plug-in for MacDown, the open source Markdown editor for OS X.
0 Comments
Leave a Reply. |