Skip to content

Commit

Permalink
Make it so
Browse files Browse the repository at this point in the history
  • Loading branch information
uranusjr committed Mar 8, 2016
0 parents commit 176fe8d
Show file tree
Hide file tree
Showing 7 changed files with 681 additions and 0 deletions.
185 changes: 185 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
#########################
# .gitignore file for Xcode4 and Xcode5 Source projects
#
# Apple bugs, waiting for Apple to fix/respond:
#
# 15564624 - what does the xccheckout file in Xcode5 do? Where's the documentation?
#
# Version 2.1
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# 2013 updates:
# - fixed the broken "save personal Schemes"
# - added line-by-line explanations for EVERYTHING (some were missing)
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
#########################

#####
# OS X temporary files that should never be committed
#
# c.f. http://www.westwind.com/reference/os-x/invisibles.html

.DS_Store

# c.f. http://www.westwind.com/reference/os-x/invisibles.html

.Trashes

# c.f. http://www.westwind.com/reference/os-x/invisibles.html

*.swp

# *.lock - this is used and abused by many editors for many different things.
# For the main ones I use (e.g. Eclipse), it should be excluded
# from source-control, but YMMV

*.lock

#
# profile - REMOVED temporarily (on double-checking, this seems incorrect; I can't find it in OS X docs?)
#profile


####
# Xcode temporary files that should never be committed
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...

*~.nib


####
# Xcode build files -
#
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"

DerivedData/

# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"

build/


#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"

# .pbxuser: http://lists.apple.com/archives/xcode-users/2004/Jan/msg00193.html

*.pbxuser

# .mode1v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html

*.mode1v3

# .mode2v3: http://lists.apple.com/archives/xcode-users/2007/Oct/msg00465.html

*.mode2v3

# .perspectivev3: http://stackoverflow.com/questions/5223297/xcode-projects-what-is-a-perspectivev3-file

*.perspectivev3

# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3


####
# Xcode 4 - semi-personal settings
#
#
# OPTION 1: ---------------------------------
# throw away ALL personal settings (including custom schemes!
# - unless they are "shared")
#
# NB: this is exclusive with OPTION 2 below
xcuserdata

# OPTION 2: ---------------------------------
# get rid of ALL personal settings, but KEEP SOME OF THEM
# - NB: you must manually uncomment the bits you want to keep
#
# NB: this *requires* git v1.8.2 or above; you may need to upgrade to latest OS X,
# or manually install git over the top of the OS X version
# NB: this is exclusive with OPTION 1 above
#
#xcuserdata/**/*

# (requires option 2 above): Personal Schemes
#
#!xcuserdata/**/xcschemes/*

####
# XCode 4 workspaces - more detailed
#
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
#
# Workspace layout is quite spammy. For reference:
#
# /(root)/
# /(project-name).xcodeproj/
# project.pbxproj
# /project.xcworkspace/
# contents.xcworkspacedata
# /xcuserdata/
# /(your name)/xcuserdatad/
# UserInterfaceState.xcuserstate
# /xcsshareddata/
# /xcschemes/
# (shared scheme name).xcscheme
# /xcuserdata/
# /(your name)/xcuserdatad/
# (private scheme).xcscheme
# xcschememanagement.plist
#
#

####
# Xcode 4 - Deprecated classes
#
# Allegedly, if you manually "deprecate" your classes, they get moved here.
#
# We're using source-control, so this is a "feature" that we do not want!

*.moved-aside

####
# UNKNOWN: recommended by others, but I can't discover what these files are
#
# ...none. Everything is now explained.


####
# Other files
#

# This needs to be included explicitly because we excluded *.lock previously.
!Podfile.lock

Build/
Pods/
Dependency/version/version.h
Dependency/peg-markdown-highlight/pmh_parser_core.c
Dependency/peg-markdown-highlight/pmh_parser.c
Dependency/peg-markdown-highlight/*.o
Dependency/peg-markdown-highlight/greg/*.o
Dependency/peg-markdown-highlight/greg/*.o-*
Dependency/peg-markdown-highlight/greg/greg

# Generated by build script
MacDown/Resources/Prism/*
67 changes: 67 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
Gist it! for MacDown
=====================

This 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].

> 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.
[MacDown]: http://macdown.uranusjr.com
[GitHub Gist]: https://gist.github.com

### Installation

Put the `macdown-gistit.plugin` file in `~/Library/Application Support/MacDown/PlugIns`.

### Usage

Open 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 creation successfully, its URL will be copied automatically into your
clipboard, so that you can easily share, or open it inside a browser.

### License

[![Created Commons License](https://i.creativecommons.org/l/by-sa/3.0/88x31.png)](http://creativecommons.org/licenses/by-sa/3.0/)<br>
This work is licensed under a [Creative Commons Attribution-ShareAlike 3.0 Unported License](http://creativecommons.org/licenses/by-sa/3.0/).


## The MacDown Plug-in Architecture

This section serves as a simple walkthrough to how plug-ins work in MacDown until proper documentation is written. Hopefully not by myself. :p

### Introduction

A plugin in MacDown is a regular Cocoa [dynamic-loading bundle], with extension `.plugin`. MacDown searches `~/Library/Application Support/MacDown/PlugIns`, and build menu items for loadable bundles inside the directory. A plug-in in invoked when the user clicks on its corresponding menu item.

[dynamic-loading bundle]: https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/LoadingCode/LoadingCode.html#//apple_ref/doc/uid/10000052-SW1


### Plug-in Architecture

A plug-in project can be created via Xcode’s **OS X → Framework & 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.

A plug-in should provide two methods inside the principle class:

**`- (NSString *)name`**

This 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.

**`- (BOOL)run:(id)sender`**

This 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.

The return value indicates whether the plug-in is invoked successfully.

This 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.

### Tips

MacDown 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.

A document instance in MacDown provides two additional properties:

**`@property (nonatomic, readwrite) NSString *markdown`**

This holds the string inside the editor. Writing to this property modifies the editor content.

**`@property (nonatomic, readonly) NSString *html`**

This holds the *rendered* HTML content.
Loading

0 comments on commit 176fe8d

Please sign in to comment.