Skip to content

Commit c48431b

Browse files
committedDec 2, 2014
Added license and readme.
1 parent 597af8f commit c48431b

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
 

‎LICENSE

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
An Objective-C port of Pagedown's Markdown.Editor.js, as used on
2+
Stack Exchange.app.
3+
4+
Largely based on showdown.js by John Fraser (Attacklab).
5+
6+
Original Markdown Copyright (c) 2004-2005 John Gruber
7+
<http://daringfireball.net/projects/markdown/>
8+
9+
10+
Original Showdown code copyright (c) 2007 John Fraser
11+
12+
Modifications and bugfixes (c) 2009 Dana Robinson
13+
Modifications and bugfixes (c) 2009-2014 Stack Exchange Inc.
14+
15+
Objective-C port (c) 2009-2014 Stack Exchange Inc.
16+
17+
Permission is hereby granted, free of charge, to any person obtaining a copy
18+
of this software and associated documentation files (the "Software"), to deal
19+
in the Software without restriction, including without limitation the rights
20+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21+
copies of the Software, and to permit persons to whom the Software is
22+
furnished to do so, subject to the following conditions:
23+
24+
The above copyright notice and this permission notice shall be included in
25+
all copies or substantial portions of the Software.
26+
27+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
33+
THE SOFTWARE.

‎README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
SEMarkdownEditor
2+
================
3+
4+
SEMarkdownEditor is a port of [Pagedown's Markdown.Editor.js](https://code.google.com/p/pagedown/source/browse/Markdown.Editor.js) transformation logic to Objective-C. While this does not provide rendering capabilities, it does allow you to create a full-fledged markdown toolbar for your `UITextView` similar to what you would see on StackExchange sites.
5+
6+
Example
7+
-------
8+
9+
Performing any transformation is a matter of getting the text and selection information from your `UITextView`, performing a transformation and updating the text view with the new text and selected region:
10+
11+
```objc
12+
- (IBAction)toggleBoldface:(id)sender
13+
{
14+
SEMarkdownTextChunks *chunks = [self.textView SE_textChunksFromSelection];
15+
[chunks toggleBoldface];
16+
[self.textView SE_updateWithTextChunks:chunks];
17+
}
18+
```
19+
20+
```swift
21+
@IBAction func toggleBoldface(sender:AnyObject) {
22+
let chunks = textView.SE_textChunksFromSelection()
23+
chunks.toggleBoldface()
24+
textView.SE_updateWithTextChunks(chunks)
25+
}
26+
```
27+
28+
Demo
29+
----
30+
31+
The project contains an iOS demo with a simple toolbar demonstrating how to wire features to a toolbar. Open the project in Xcode 6 or later and run the **iOS Demo** target.

0 commit comments

Comments
 (0)
Please sign in to comment.