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.

Overview

MarkdownView screenshot Download

About

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

The MarkdownView itself extends Android Webview and adds the necessary logic to parse Markdown (using MarkdownJ) and display the output HTML on the view.

Getting started

  • To add MarkdownView to your project, add the following to build.gradle file:
	dependencies { 
	    compile 'us.feras.mdv:markdownview:1.1.0'
	}

Usage

Add MarkdownView to your layout:

">
    <us.feras.mdv.MarkdownView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/markdownView" />

and reference it in your Activity/Fragment:

MarkdownView markdownView = (MarkdownView) findViewById(R.id.markdownView);
markdownView.loadMarkdown("## Hello Markdown"); 

Note: You could also create the view by code. Below an example of how to set the whole activity to be a MarkdownView by Adding the following to your onCreate method:

  MarkdownView markdownView = new MarkdownView(this);
  setContentView(markdownView);
  markdownView.loadMarkdown("## Hello Markdown"); 

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 Local Markdown File.
  • Loading Remote Markdown File.
  • Loading Markdown text.
  • Live Preview sample code (similar to Marked Mac app)
  • Themes

Loading Markdown text or file:

  • 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 remote file 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.

ChangeLog:

  • MarkdownView 1.1.0:
    • Support Loading Markdown file from assets subfolders (Thanks @echodjb).
  • MarkdownView 1.0.0:
    • Convert to Gradle Project (Avillable now on jCenter).
    • Fix CSS Issue (Thanks @swanson & @echodjb).
    • Update demo app.

License

Apache 2.0

Comments
  • Feature Request: Inline Markdown Editing

    Feature Request: Inline Markdown Editing

    Hi,

    it would be a really cool feature to be able to edit directly in the parsed markdown. As a reference, see ownCloud Notes, which is using mdEdit (Javascript Library)

    Best Regards

    Feature Request 
    opened by stefan-niedermann 7
  • Fixed minSdkVersion to 7.

    Fixed minSdkVersion to 7.

    I fixed version of the library to use it for my project whose minSdkVersion is 7. I confirmed it's launchable on API 7. Please accept this request and publish new release as soon as possible! :)

    image

    opened by BoxResin 3
  • How to make a table?

    How to make a table?

    I've tried

    String md = 
              "First Header   | Second Header\n" +
              "-------------  | -------------\n" +
              "*Content Cell* | Content Cell\n" +
              "Content Cell   | Content Cell";
    
    mMarkdownView.loadMarkdown(md);
    

    :boom: But it doesn't display a table

    What do I wrong? - Please help! :shipit:

    opened by SohnyBohny 3
  • Bump versionCode

    Bump versionCode

    You requested an update for the F-Droid version at https://f-droid.org/forums/topic/markdownview/, however your build.gradle file still says this is version "1.0" with versioncode "1". You have to bump at least the versioncode (an integer value), because that determines if it's an update or not. See: https://developer.android.com/studio/publish/versioning.html

    opened by ghost 3
  • Add installation process to main project page

    Add installation process to main project page

    I tried to use your library through compiling the project and including the jar file into my project, but either ways I was not able to use it.

    a) I tried adding the next lines to my settings.gradle def markdownView = file('../MarkdownView/MarkdownView' ) settings.createProjectDescriptor( rootProjectDescriptor, 'markdown-view', markdownView ) include ':markdown-view'

    and to my build.gradle compile project( ':markdown-view')

    The result is that the Android Studio (v.0.8.6) says: Error:Configuration with name 'default' not found.

    b) I tried adding the jar file markdownview-1.2.jar into the libs folder but for some reason when I want to use the MarkdownView class that is not in the classpath.

    Any suggestion? I think the library looks quite well, but could be really handy if you could add the installation process.

    I think the best way to include your project is through the first solution because I everyone can pull the repository and rebuild the project, getting the latest changes.

    opened by proverbface 3
  • Can MarkdownView provide loadDataWithBaseURL?

    Can MarkdownView provide loadDataWithBaseURL?

    I wonder if MarkdownView can provide a constructor like this that one could use to display unicode?

    loadDataWithBaseURL()

    For example, in WebView one can do:

    mywebView.loadDataWithBaseURL(null, "some unicode string", "text/html", "utf-8", null);

    I think we would have to replace "text/html" with something else in case of markdown but I'm not sure which...

    opened by bsaelim 3
  • Displaying an image from Assets

    Displaying an image from Assets

    Hi, I tried adding this line to my markdown text:

    ![Levels Meter](file:///android_asset/levels.PNG)
    

    It didn't display the image from the assets folder. Is there a way to do it?

    opened by Nurdok 3
  • How scale image (without horizontal scrolling)?

    How scale image (without horizontal scrolling)?

    My layout xml:

    <us.feras.mdv.MarkdownView android:id="@+id/markdownView" android:layout_width="match_parent" android:layout_height="match_parent" />

    My code:

    `public class MarkdownViewActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.markdown_view_activity);
    
        MarkdownView markdownViewFeras = (MarkdownView) findViewById(R.id.markdownView_Feras);
        markdownViewFeras.loadMarkdownFile("file:///android_asset/my.md" );
    }
    

    }`

    OK. It's work.

    But has problem only with image. The image is horizontal scrolling. But I need to scale image (without horizontal scrolling). Is it possible?

    opened by alexei28 2
  • How to show Bullet or numbered list

    How to show Bullet or numbered list

    I am not able to see the bullet or number list, how to show using MarkdownView

    Also if I try to set text from some string variable it is not rendered in markdown

    opened by rohan2817 2
  • MarkdownView Background

    MarkdownView Background

    MarkdownView's background seem to always be white, as opposed to TextView's default transparent. It also ignores any andoird:background definitions in the layout XML.

    opened by Nurdok 2
  • Cannot Embed images

    Cannot Embed images

    This is most likely an error on my part:

    I have several local image files linked in an MD file like so: ![AdvDisNeutral1](AdvDisNeutral1.png)

    However, they do not show up. What syntax should I use? This MD file is in the assets folder along with the images embedded in them.

    Just a note: text renders perfectly.

    opened by pujitm 1
  • removed attributes from Manifest

    removed attributes from Manifest

    these attributes should belong to the application project, not to the library project They cause problems in applications project using that library, e.g.:

    Attribute application@label value=(@string/appName) from [:features:base] AndroidManifest.xml:51:9-40 is also present at [us.feras.mdv:markdownview:1.1.0] AndroidManifest.xml:13:9-41 value=(@string/app_name). Suggestion: add 'tools:replace="android:label"' to element at AndroidManifest.xml:6:5-157:19 to override.

    It might be easily fixable with the tools:replace Attribute, but thats more a workaround than a real fix...

    opened by metinkale38 1
  • Strikethrough not working

    Strikethrough not working

    Markdown ~~strikethrough~~ syntax doesn't render properly unless done in HTML.

    ~~This doesn't work...~~
    <span style="text-decoration: line-through">...But this does</span>
    
    opened by wbrawner 0
  • Doesn't render image links properly

    Doesn't render image links properly

    Hey,

    I gave it the markdown for the readme of this repository markdownView.loadMarkdownFile("https://raw.githubusercontent.com/falnatsheh/MarkdownView/master/README.md");

    And it doesn't render the images in this readme properly.

    Below is not rendered. screen shot 2017-05-30 at 11 11 02 am

    Additionally, most of the text in the readme has the link to the icon and there is a lot of starting white space (at least 1 screen). screen shot 2017-05-30 at 11 07 37 am screen shot 2017-05-30 at 11 07 49 am screen shot 2017-05-30 at 11 08 17 am Thanks.

    opened by darvid7 2
  • Can not display table

    Can not display table

    Does MarkdownView support to display table? I tested that it only show plain text instead of a table, I use the markdown text presents at: https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#tables

    opened by Khang-NT 1
Owner
Feras Alnatsheh
Feras Alnatsheh
TextView to display simple HTML

Project stopped This project has been stopped. 4.0 is the last release. Feel free to fork this project and take over maintaining. HtmlTextView for And

Sufficiently Secure 2.5k Dec 28, 2022
A editable text with a constant text/placeholder for Android.

ParkedTextView A EditText with a constant text in the end. How to use <com.goka.parkedtextview.ParkedTextView xmlns:app="http://schemas.android.co

goka 270 Nov 11, 2022
RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

RTL marquee text view android right to left moving text - persian - farsi - arabic - urdo

mehran elyasi 4 Feb 14, 2022
Build valid HTML for Android TextView

HTML Builder Build valid HTML for Android TextView. Description There is a lovely method on the android.text.Html class, fromHtml(), that converts HTM

Jared Rummler 527 Dec 25, 2022
Chips EditText, Token EditText, Bubble EditText, Spannable EditText and etc.. There are many names of this control. Here I develop easy to understand , modify and integrate Chips Edit Text widget for Android

Chips EditText Library Chips EditText, Token EditText, Bubble EditText, Spannable EditText and etc.. There are many names of this control. Here I deve

kpbird 381 Nov 20, 2022
Android library contain custom realisation of EditText component for masking and formatting input text

Masked-Edittext Masked-Edittext android library EditText widget wrapper add masking and formatting input text functionality. Install Maven <dependency

Evgeny Safronov 600 Nov 29, 2022
Add text masking functionality to Android EditText. It will prevent user from inserting not allowed signs, and format input as well.

MaskFormatter MaskFormatter adds mask functionality to your EditText. It will prevent user from inserting not allowed signs, and format input as well.

Azimo Labs 161 Nov 25, 2022
Simple way to create linked text, such as @username or #hashtag, in Android TextView and EditText

Simple Linkable Text Simple way to create link text, such as @username or #hashtag, in Android TextView and EditText Installation Gradle Add dependenc

Aditya Pradana Sugiarto 76 Nov 29, 2022
Androids EditText that animates the typed text. EditText is extended to create AnimatedEditText and a PinEntryEditText.

AnimatedEditText for Android This repository contains AnimatedEditText and TextDrawable all of which extend the behaviour of EditText and implement fe

Ali Muzaffar 439 Nov 29, 2022
A simple library for hide and show text with animation.

ViewMore TextView ViewMore TextView allows you to use a TextView by hiding the content of the text by a number of established lines and to display all

Michele Quintavalle 81 Dec 23, 2022
Micro Template 📃 A very tiny and simple text templating library for Kotlin.

Micro Template ?? A very tiny and simple text templating library for Kotlin. It has very limited features, so it's intended to be used for short templ

Matteo Mirk 24 Aug 20, 2022
Irineu A. Silva 2 Feb 17, 2022
RichEditor for Android is a beautiful Rich Text WYSIWYG Editor for Android.

RichEditor for Android is a beautiful Rich Text WYSIWYG Editor for Android. Looking for iOS? Check out cjwirth/RichEditorView Supported Functions Bold

Daichi Furiya 6k Jan 2, 2023
:page_facing_up: Android Text Full Jusiftication / Wrapping / Justify / Hyphenate - V2.0

LIBRARY IS NO LONGER MAINTAINED If you want to adopt + maintain this library, please drop me a message - [email protected] Android Full Justific

Mathew Kurian 1.9k Dec 29, 2022
Android form edit text is an extension of EditText that brings data validation facilities to the edittext.

Android Form EditText Android form edit text is an extension of EditText that brings data validation facilities to the edittext. Example App I built a

Andrea 1.5k Dec 14, 2022
[DISCONTINUED] Rrich text editor for android platform. 安卓富文本编辑器,暂停维护

icarus-android Maybe the best rich text editor on android platform. Base on Simditor Features Alignment (left/center/right) Bold Blockquote Code Horiz

Dyson Woo 739 Sep 5, 2022
An address-autocompleting text field for Android

android-PlacesAutocompleteTextView An AutocompleteTextView that interacts with the Google Maps Places API to provide location results and caches selec

SeatGeek 283 Dec 28, 2022
AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size.

AutoscaleEditText AutosizeEditText for Android is an extension of native EditText that offer a smooth auto scale text size. Latest Version How to use

Txus Ballesteros 354 Nov 28, 2022
Dealing with Android Text by simple way to get high performance.

Gapo Android RichText RichText supports Hashtag, Mention, Url, Phone Number, Email, Markdown, Custom Span, SeeMore/SeeLess by limited line or length,

GapoWork 8 Oct 20, 2021