About

MarkdownView (Markdown For Android) is an Android library that helps you display Markdown text or files as formmated HTML, you could load markdown text or local/remote files and you could style the output using CSS.

The MarkdownView itself extends Android webview and adds the nessery logic to parse Markdown (using MarkdownJ) and displaying the output.

Getting started

    dependencies { 
        compile 'us.feras.mdv:markdownview:1.0'
    }

Usage

A simple usage is to set the whole activity to a MarkdownView by Adding the following to your onCreate method:

MarkdownView markdownView = new MarkdownView(this);
setContentView(markdownView);

Or you can also add it to your layout by using <us.feras.mdv.MarkdownView android:id="@+id/markdownView" /> and reference it in your activity:

MarkdownView markdownView = (MarkdownView) findViewById(R.id.markdownView);

Screenshots

Demo App and Code Sample

The above screenshots taking from the demo app which could be found here. The demo app include code to demonstrate:

Loading Markdown text or file:

To load a local file, you have to add it to your assets folder and pass a url that start with "file:///android_asset/" :

markdownView.loadMarkdownFile("file:///android_asset/myFile.md");

To load a file on the web you need to pass the full url :

markdownView.loadMarkdownFile("http://www.my-site.com/myFile.md");

Theming

You could apply custom CSS to the MarkdownView. Example:

markdownView.loadMarkdownFile("file:///android_asset/hello.md","file:///android_asset/MyCustomTheme.css");

You could take a look at CSS example here, you could also view them in the sample app.

License

Apache 2.0