Skip the HTML, Bypass takes markdown and renders it directly on Android and iOS.
Bypass 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.
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());
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];
If you just want to include Bypass in your Maven project, add the following dependency block to your pom.xml:
<dependency>
<groupId>in.uncod.android.bypass</groupId>
<artifactId>bypass</artifactId>
<type>apklib</type>
<version>1.1</version>
</dependency>
For the two following methods you will also need to install the Android NDK and have the Boost libraries installed.
If you're using the Eclipse Development Environment with the ADT plugin version 0.9.7 or greater you can include Bypass as a library project. Create a new Android project in Eclipse using the library/
folder as the existing source. Then, in your project properties, add the created project under the 'Libraries' section of the 'Android' category.
If you use ant
to compile from the command line you will need to run android update project -p .
inside the library/
folder of the project. Once completed, you can reference the library/
folder of Bypass from your application's project.properties
file. For more information please see the Android developer guide for referencing library projects.
You will also need to run ndk-build inside the library folder to build the required native platfom libs.
bypass/platform/ios/Bypass/Bypass.xcodeproj
into your project from the Finder.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.-ObjC
$(SRCROOT)/<relative path to bypass home>/Bypass/Bypass
libc++ (LLVM C++ standard library with C++11 support)
BPMarkdownView *markdownView = [[BPMarkdownView alloc] initWithFrame:someRect];
[markdownView setMarkdown:@"#Markdown!"];