Fork me on GitHub


#Header sizes
##Smaller header
###Even smaller header

Paragraphs are obviously supported along with all the fancy text styling you could want.
There is *italic*, **bold** and ***bold italic***. Even links are supported, visit the
github page for Bypass [here](https://github.com/Uncodin/bypass).

* Nested List
	* One
	* Two
	* Three
* One
	* One
	* Two
	* Three

## Code Block Support

    const char* str;
    str = env->GetStringUTFChars(markdown, NULL);
			

We wanted to be able to take advantage of Markdown on mobile devices but all of the implementations that we found were either slow, feature incomplete or both.

Bypass uses libsoldout to parse the Markdown and build a data structure. This data gets passed through the respective binding layer on each platform and is used to build the formatted text (Spanned strings on Android and Attributed Strings on iOS).

On Android we were able to get more than a 4x speed increase by bypassing Html.fromHtml(), hence the name Bypass.


Usage

Android

TextView text = (TextView) findViewById(R.id.demoText);
Bypass bypass = new Bypass();
String markdownString = "#Markdown!";
CharSequence string = bypass.markdownToSpannable(markdownString);
text.setText(string);
text.setMovementMethod(LinkMovementMethod.getInstance());
			

iOS

NSString *markdownString = @"#Markdown!";
BPParser *parser = [[BPParser alloc] init];
BPDocument *document = [parser parse:markdownString];

BPAttributedStringConverter *converter = [[BPAttributedStringConverter alloc] init];
NSAttributedString *attributedText = [converter convertDocument:document];

[[self markdownView] setAttributedText:attributedText];

Setup

Android

There are a few different ways to use Bypass with your project.

iOS

  1. Clone bypass from Github.
  2. Drag bypass/platform/ios/Bypass/Bypass.xcodeproj into your project from the Finder.
  3. Open your target settings.
  4. Select the Build Phases tab.
  5. Add Bypass as a target dependency.
  6. Add libBypass.a, CoreGraphics.framework, CoreText.framework, Foundation.framework, and QuartzCore.framework, and UIKit.framework to the list of required libraries to link against, if they aren't already included.
  7. Modify your build settings so they have the following values:
    • Linking
      • Other Linker Flags: -ObjC
    • Search Paths
      • Header Search Paths: $(SRCROOT)/<relative path to bypass home>/Bypass/Bypass
    • Apple LLVM Compile 4.2 - Language
      • C++ Standard Library: libc++ (LLVM C++ standard library with C++11 support)
See the iOS README.md for more detailed setup instructions.

Usage

BPMarkdownView *markdownView = [[BPMarkdownView alloc] initWithFrame:someRect];
[markdownView setMarkdown:@"#Markdown!"];