Skip to content

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

License

Notifications You must be signed in to change notification settings

WilliamRen/MarkdownView

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MarkdownView screenshot

What is it?

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

##How to use it?

  • To add MarkdownView to your project, include the jar, or the source code.
  • 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);

##Loading MarkDown text or file (local/online):

  • loadMarkdown(String text) Using this method will result in loading md string to the MarkdownView and displaying it as HTML.

  • loadMarkdownFile(String url) You can use this method to load local or online files.

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

About

MarkdownView is an Android webview with the capablity of loading Markdown text or file and display it as HTML, it uses MarkdownJ and extends Android webview.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 69.6%
  • CSS 30.4%