Show card

Markwon

Markwon is a library for Android that renders markdown as system-native Spannables. It gives ability to display markdown in all TextView widgets (TextView, Button, Switch, CheckBox, etc), Notifications, Toasts, etc. No WebView is required. Library provides reasonable defaults for display style of markdown but also gives all the means to tweak the appearance if desired. All markdown features are supported (including limited support for inlined HTML code, markdown tables and images).

*This file is displayed by default in the sample-apk application. Which is a generic markdown viewer with support to display markdown via http, https & file schemes and 2 themes included: Light & Dark

This flow answers the most simple usage of displaying markdown: one shot parsing & configuration of relatively small markdown chunks. If your markdown contains a lot of text or you plan to display multiple UI widgets with markdown you might consider stepping in and taking control of this flow.

Please note that if you are having trouble with LinkMovementMethod you can use Markwon.setText(textView, markdown, movementMethod) method (@since 1.0.6) to specify no movement method (aka null) or own implementation. As an alternative to the system LinkMovementMethod you can use Better-Link-Movement-Method.

Syntax highlight

Starting with version 1.1.0 there is an artifact (markwon-syntax) that allows you to have syntax highlight functionality. It is based on Prism4j project. It contains 2 builtin themes: Default (light, Prism4jThemeDefault) and Darkula (dark, Prism4jThemeDarkula).