• Stars
    star
    326
  • Rank 129,027 (Top 3 %)
  • Language
    Kotlin
  • License
    MIT License
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Markdown Text for Android Jetpack Compose 📋.

MarkdownText - Jetpack Compose

Android CI

demo.mp4
  • Markdown
  • HTML
  • Image
  • Highlight
  • Linkfy
  • Table

Setup

  1. Open the file settings.gradle (it looks like that)
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        // add jitpack here 👇🏽
        maven { url 'https://jitpack.io' }
       ...
    }
} 
...
  1. Sync the project
  2. Add compose-markdown dependency
dependencies {
        implementation 'com.github.jeziellago:compose-markdown:0.3.3'
}

Supported attributes

Most of the attributes of that a default Text composable has are also supported by MarkdownText.

  • color
  • fontSize
  • textAlign
  • maxLines
  • style (only styling for supported attributes is applied)

The font can be changed by passing a font xml resource as fontResource parameter.

How to use

val markdownContent = """  
	# Sample  
	* Markdown  
	* [Link](https://example.com)  
	![Image](https://example.com/img.png)  
	<a href="https://www.google.com/">Google</a>  
"""

//Minimal example
@Composable  
fun MinimalExampleContent() {  
    MarkdownText(markdown = markdownContent)  
} 

//Complex example
@Composable  
fun ComplexExampleContent() {  
     MarkdownText(
                modifier = Modifier.padding(8.dp),
                markdown = markdown,
                textAlign = TextAlign.Center,
                fontSize = 12.sp,
                color = LocalContentColor.current,
                maxLines = 3,
                fontResource = R.font.montserrat_medium,
                style = MaterialTheme.typography.overline,
              
     )  
}  

License

Copyright (c) 2021 Jeziel Lago  
  
Permission is hereby granted, free of charge, to any person obtaining  
a copy of this software and associated documentation files (the  
"Software"), to deal in the Software without restriction, including  
without limitation the rights to use, copy, modify, merge, publish,  
distribute, sublicense, and/or sell copies of the Software, and to  
permit persons to whom the Software is furnished to do so, subject to  
the following conditions:  
  
The above copyright notice and this permission notice shall be  
included in all copies or substantial portions of the Software.  
  
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND  
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE  
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION  
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  

More Repositories

1

FlowNav

Annotation processor that provides better navigation on android multi-modules projects 🛳.
Kotlin
135
star
2

Linkt

A lightweight and simple Kotlin library for deep link handling on Android 🔗.
Kotlin
102
star
3

image-minifier

Minifier is a lightweight android library for image resizing, format changing and quality focusing in reduce file size 🖼.
Kotlin
65
star
4

kachej

An alternative to building cache easily backed by Kotlin coroutines 📦.
Kotlin
25
star
5

SecBox

Script Box for Android Reverse Engineering
Python
24
star
6

multinavcompose

Android multi-module navigation built on top of Jetpack Navigation Compose
Kotlin
21
star
7

AppCloneDetector

Kill app if it is running under a cloned environment in Android device.
Kotlin
11
star
8

CoroutinesFlowExt

Reactive components with Kotlin Flow 🛠
Kotlin
6
star
9

dojo-flow-with-room

Kotlin
5
star
10

mlkit-face-detection

Android face detection example with ML Kit
Kotlin
5
star
11

jni-android-sha-256

Android JNI example for get ANDROID_ID and generate SHA-256 hash using C/C++.
C++
4
star
12

rustium

Medium rss feed api built with Rust (study project).
Rust
4
star
13

dojo-coroutines-2

Kotlin
4
star
14

explore-event-driven-arch-android

Study project
Kotlin
3
star
15

rust-url-shortener

Url shortener written in Rust
Rust
3
star
16

ktxsafe

Kotlin functions and extensions to do safe unwrap and extract values.
Kotlin
3
star
17

android-image-kit

Open-source library for image processing in Android.
Kotlin
3
star
18

GoogleFilesFinder

A Google Files Finder in python
Python
2
star
19

dojos-coroutines

Kotlin
2
star
20

android-reverse-shell-example

Android reverse shell example with native library.
CMake
2
star
21

minimal-android-ci

Minimal container for android builds.
Dockerfile
2
star
22

hello-koin

Sample project with Koin 2.0 and JUnit Test
Kotlin
1
star
23

jeziellago

1
star
24

dojo-kotlin-file-watcher

Kotlin
1
star
25

coroutines-dojo-3

Kotlin
1
star
26

talk-android-reverse-engeneering

Kotlin
1
star
27

injection-with-locator

Basic Service locator implementation solving dependency injection on Android.
Kotlin
1
star
28

kotlin-primitive-map

A simple solution to create maps of primitive values in Kotlin.
Kotlin
1
star
29

ideas-kotlin-problems

Kotlin
1
star
30

algorithms

Kotlin
1
star