Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

coder-wp/Markdown

Repository files navigation

MarkDown

Android平台的原生Markdown解析器,已整合进 RichText

  • 由markdown文本直接转换为Spanned,快捷高效
  • 不依赖特定控件,低侵入性
  • 遵循 Github Flavored Markdown 标准

效果展示

效果图

使用

Markdown.fromMarkdown(text,imageGetter,textView);

注意: 此方法需要在textView的Measure完成后调用,因为需要获取textView的宽高

例子:

textView.post(new Runnable() {
 @Override
 public void run() {
 Spanned spanned = MarkDown.fromMarkdown(stream, new Html.ImageGetter() {
 @Override
 public Drawable getDrawable(String source) {
 Drawable drawable = getResources().getDrawable(R.mipmap.ic_launcher);
 drawable.setBounds(0, 0, 400, 400);
 return drawable;
 }
 }, textView);
 textView.setText(spanned);
}

在RichText中使用

RichText 包含了一些对图片和其它东西的处理,使用更简单

RichText.fromMarkdown(markdown).into(textView);

Use in Gradle

compile 'com.zzhoujay.markdown:markdown:0.0.4'

已知问题

  • (削除) 引用块内不支持Setext-style的标题(后续会想办法修复 (削除ここまで) (已修复)
  • 暂不支持使用反斜杠 \ 转义
  • 不支持表格

后续计划

  • 修复一些已知问题

by zzhoujay

About

Android平台下的原生Markdown解析器

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

Languages

  • Java 100.0%

AltStyle によって変換されたページ (->オリジナル) /