Does a lightweight markup language library for Android exist?
Suppose I want to render/present a text transmitted in the form of some lightweight
markup language
. Are there any ready-to-use libraries for Android
, which take as input text in a lightweight markup language and present it nicely? When I say lightweight markup language, I mean Markdown (http://en.wikipedia.org/wiki/Markdown) or something simil开发者_运维百科ar.
There's also AndDown, an Android wrapper around the C-based parser sundown:
By using the NDK with this C library, parsing speeds are nice and fast -- 5K of input can be converted into HTML in about 1 millisecond. Also, sundown is a fairly popular Markdown processor and is the brains behind GitHub-flavored Markdown.
You can look at:
MarkdownJ
I haven't tried this.
JMD
This works, but the latest build has issues with some numbers in the text being interpreted as entities; e.g. "The 39th President" becomes "The &39;th President".
PegDown
This works properly, but in the rather old 0.8.0.1 version I am currently using it's really surprisingly CPU intensive(*) - much more so that JMD. It's dependent on the separate parboiled PEG parser (which also has a newer version than I am currently using). (Stricken based on comment below)
(*) The excessive CPU load seems to only occur on the IBM Classic JVM for the AS/400.
NOTE: I have used these only on Java VMs, not on Android, but I know of no reason why any or all of them should not work on Android.
You can also check markdown4j, which is a lightweight java library (and can be used in Android).
精彩评论