{"id":19076573,"url":"https://github.com/macdownapp/macdown-gistit","last_synced_at":"2025-04-30T03:39:39.019Z","repository":{"id":82076226,"uuid":"53399236","full_name":"MacDownApp/macdown-gistit","owner":"MacDownApp","description":"Basic example of a plug-in for MacDown","archived":false,"fork":false,"pushed_at":"2016-11-07T19:19:46.000Z","size":13,"stargazers_count":46,"open_issues_count":4,"forks_count":12,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-30T03:39:31.590Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://macdown.uranusjr.com","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MacDownApp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-03-08T09:22:21.000Z","updated_at":"2024-01-19T09:31:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"07dc4739-ab70-47f5-96df-248179cb814b","html_url":"https://github.com/MacDownApp/macdown-gistit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacDownApp%2Fmacdown-gistit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacDownApp%2Fmacdown-gistit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacDownApp%2Fmacdown-gistit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MacDownApp%2Fmacdown-gistit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MacDownApp","download_url":"https://codeload.github.com/MacDownApp/macdown-gistit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251638699,"owners_count":21619659,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T01:59:55.608Z","updated_at":"2025-04-30T03:39:38.996Z","avatar_url":"https://github.com/MacDownApp.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Gist it! for MacDown\n=====================\n\nThis repository illustrates a basic example of a plug-in for [MacDown], the open source Markdown editor for OS X. It provides a menu item “Gist it!” that uploads the current document (if available) as a public [GitHub Gist].\n\n\u003e Note: Plug-ins are available in MacDown 0.6+ only. This particular plug-in works only under OS X 10.9 or later, not 10.8.\n\n[MacDown]: http://macdown.uranusjr.com\n[GitHub Gist]: https://gist.github.com\n\n### Installation\n\nPut `macdown-gistit.plugin` in `~/Library/Application Support/MacDown/PlugIns`.\n\n### Usage\n\nOpen a document, and select menu item **Plug-ins → Gist it!** to upload. An alert dialog will appear to indicate whether the operation is successful. If the gist is created successfully, its URL will be copied automatically into your\nclipboard, so that you can easily share, or open it inside a browser.\n\n\u003e **Alert!!** This is for demo only. The implementation does not include authentication, and all gists are uploaded anonymously. *You will not be able to delete or modify the Gist. Be careful not to upload anything sensitive.*\n\n### License\n\n[![Created Commons License](https://i.creativecommons.org/l/by-sa/3.0/88x31.png)](http://creativecommons.org/licenses/by-sa/3.0/)\u003cbr\u003e\nThis work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).\n\n\n## The MacDown Plug-in Architecture\n\nThis section serves as a simple walkthrough on how plug-ins work in MacDown until proper documentation is written. Hopefully not by myself. :p\n\n### Introduction\n\nA plug-in in MacDown is a regular Cocoa [dynamic-loading bundle], with extension `.plugin`. MacDown searches `~/Library/Application Support/MacDown/PlugIns`, and builds menu items for loadable bundles inside the directory. A plug-in is invoked when the user clicks on its corresponding menu item.\n\nOne 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. This may change in the future, but as a rule of thumb, you should always treat your plug-in as stateless. Store things with `NSUserDefaults` or other persistence solutions.\n\n[dynamic-loading bundle]: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingCode/LoadingCode.html#//apple_ref/doc/uid/10000052-SW1\n\n\n### Plug-in Architecture\n\nA plug-in project can be created via Xcode’s **OS X → Framework \u0026 Library → Bundle** project template. 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.\n\nA plug-in should provide two methods inside the principle class:\n\n**`- (NSString *)name`**\n\nThis indicates the name of the plug-in. MacDown will use the value returned by this method as the menu item’s title for your plug-in.\n\n**`- (BOOL)run:(id)sender`**\n\nThis method will be invoked when your plug-in is run. 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.\n\nThe return value indicates whether the plug-in is invoked successfully.\n\nThis method may be invoked in the UI thread. Therefore, it is strongly recommended you push long operations into background threads, and/or run them asynchronously.\n\n### Tips\n\nMacDown uses the standard OS X document-based application structure. This means that you can get almost all information via the standard `NSDocumentController` API. Refer to the official documentation for more detail.\n\nA document instance in MacDown provides two additional properties:\n\n**`@property (nonatomic, readwrite) NSString *markdown`**\n\nThis holds the string inside the editor. Writing to this property modifies the editor content.\n\n**`@property (nonatomic, readonly) NSString *html`**\n\nThis holds the *rendered* HTML content.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacdownapp%2Fmacdown-gistit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmacdownapp%2Fmacdown-gistit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmacdownapp%2Fmacdown-gistit/lists"}