Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ifyun/markdown-it-android

Android Markdown View
https://github.com/ifyun/markdown-it-android

android-library custom-view markdown markdown-viewer

Last synced: 27 days ago
JSON representation

Android Markdown View

Awesome Lists containing this project

README

        

# markdown-it-android

![License](https://img.shields.io/github/license/imcloudfloating/markdown-it-android)
![JitPack](https://jitpack.io/v/imcloudfloating/markdown-it-android.svg)

Markdown View for Android, based on [markdown-it](https://github.com/markdown-it/markdown-it) and WebView.

## Preview





## Features

- Auto fit system theme
- Code Highlighting([highlight.js](https://github.com/highlightjs/highlight.js))
- HTML
- KaTeX([katex](https://github.com/KaTeX/KaTeX) and [markdown-it-katex](https://github.com/waylonflinn/markdown-it-katex))
- Container(info, success, warning, error)

## Usage

### Setup

Add it in your root build.gradle at the end of repositories(for older gradle version):

```groovy
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

Or add following to settings.gradle(for newer gradle version):

```groovy
dependencyResolutionManagement {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
```

Add the dependency:

```groovy
dependencies {
implementation 'com.github.imcloudfloating:markdown-it-android:1.0.4'
}
```

### Use in project

**Required SDK Version >= 22**.

Data Binding:

```xml

```

No Data Binding:

```kotlin
val md = "# Hello, Markdown!"

findViewById(R.id.markdown_view).markdownString = md
```

> If the HTTP image link cannot be displayed, add `android:usesCleartextTraffic="true"` to `AndroidManifest.xml` of your project.

### Fields and methods

| Field/Method | Note |
| ------------------ | ------------------------------------------------------------ |
| `fitSystemTheme` | Default is `true`, auto fit system theme. |
| `darkTheme` | Use dark theme when `fitSystemTheme = false` |
| `markdownString` | The markdown content you want to show. |
| `urlClickListener` | Click listener for link. |