Markdown renderer for Kotlin Compose Multiplatform (Android, Desktop)

Overview

Kotlin Multiplatform Markdown Renderer

... a Kotlin Multiplatform Markdown Renderer. (Android, Desktop, ...) powered by Compose Multiplatform



What's included ๐Ÿš€ โ€ข Setup ๐Ÿ› ๏ธ โ€ข Usage ๐Ÿ› ๏ธ โ€ข License ๐Ÿ““


What's included ๐Ÿš€

  • Super simple setup
  • Cross-platform ready
  • Lightweight

Setup

Using Gradle

Multiplatform

For multiplatform projects specify this single dependency:

dependencies {
    implementation("com.mikepenz:multiplatform-markdown-renderer:${version}")
}

JVM

To use the library on JVM, you have to include:

dependencies {
    implementation("com.mikepenz:multiplatform-markdown-renderer-jvm:${version}")
}

Android

For Android a special dependency is available:

dependencies {
    implementation("com.mikepenz:multiplatform-markdown-renderer-android:${version}")
}


Usage

val markdown = """
### What's included ๐Ÿš€

- Super simple setup
- Cross-platform ready
- Lightweight
""".trimIndent()

//
Markdown(markdown, Modifier.fillMaxSize())

Dependency

This project uses JetBrains markdown Multiplatform Markdown processor as dependency to parse the markdown content.

Developed By

Contributors

This free, open source software was also made possible by a group of volunteers that put many hours of hard work into it. See the CONTRIBUTORS.md file for details.

Credits

Big thanks to Erik Hellman and his awesome article on Rendering Markdown with Jetpack Compose, and the related source MarkdownComposer.

Fork License

Copyright for portions of the code are held by [Erik Hellman, 2020] as part of project MarkdownComposer under the MIT license. All other copyright for project multiplatform-markdown-renderer are held by [Mike Penz, 2021] under the Apache License, Version 2.0.

License

Copyright 2021 Mike Penz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Comments
  • Images are rendered using only remote paths

    Images are rendered using only remote paths

    About this issue

    You can make images using remote links (https, http), but you can't specify local path to render local image i've tried ./path/img.png, path/img.png, file:///path/img.png but none worked so far and by the looks of imagePainter in ImagePainterProvider - it won't, because it fetches image always through http

    Credited project could use local image paths

    Details

    • [multiplatform-markdown-renderer 0.4.0]
    • [Desktop]
    • [Compose 1.1.1]
    • [Gradle 7.2]
    • [JDK 17]
    opened by Meister1593 5
  • Support custom text color

    Support custom text color

    This PR proposes an optional color override for the markdown text. It allows applications that do not use MaterialTheme to still be able to set their text color. The default color is still MaterialTheme.color.onBackground

    Also add the ability to specify colors per node-type via an optional map. This is probably a naive approach, I just wanted to get the idea out there.

    opened by raidzero 5
  • Compose Desktop Don't work

    Compose Desktop Don't work

    Multiplatform For multiplatform projects specify this single dependency:

    dependencies { implementation("com.mikepenz:multiplatform-markdown-renderer:0.1.0") }

    Use Markdown("", Modifier.fillMaxSize())

    Exception in thread "AWT-EventQueue-0" java.lang.IncompatibleClassChangeError: Found class androidx.compose.runtime.Composer, but interface was expected at com.mikepenz.markdown.MarkdownKt.Markdown(Markdown.kt:51)

    wontfix 
    opened by zhao-pf 3
  • Links with URLs as their label do not render

    Links with URLs as their label do not render

    About this issue

    Given a link that looks like this: [https://example.com](https://github.com/mikepenz), the library renders nothing on screen. Expected behavior would be for it to show https://example.com.

    Details

    • Used library version: 0.1.0
    • Used platform: Compose Desktop
    • Used support library version: 1.0.0-alpha4-build398
    • Used gradle build tools version: Gradle 7.2
    • Used tooling / Android Studio version: IntelliJ IDEA 2021.3 EAP, reproducible without an IDE.
    • Other used libraries, potential conflicting libraries: None, this is reproducible in the Compose Desktop sample.

    Checklist

    fix 
    opened by msfjarvis 2
  • Markdown links using the reference pattern are not rendered

    Markdown links using the reference pattern are not rendered

    About this issue

    The CommonMark spec for it can be found here.

    Changing the text rendered by the compose-desktop sample to either of the ones given below reproduces the issue.

    First reproducer
    ### Getting Started
    
    To get started you will need GPG on your computer to create a new key pair. 
    
    Usually I go with the [GPG Suite][1], which offers a nice UI to manage your keys. (You may want to use advanced installation to only install the parts you need)
    But you can also use any other solution to create your key pair.
    
    ![Image](https://avatars.githubusercontent.com/u/1476232?v=4)
    
    After installing GPG Suite (or your prefered solution) first create a new key.
    
    Using GPG Suite, start the GPG Keychain, which shows all current known GPG keys on your system.
    
    Click on `New` and you will be offered to enter your name, e-mail and password. Ensure to pick a secure password to protect your key. 
    [1]: https://gpgtools.org/
    
    Second reproducer
    ### Getting Started
    
    To get started you will need GPG on your computer to create a new key pair. 
    
    Usually I go with the [GPG Suite], which offers a nice UI to manage your keys. (You may want to use advanced installation to only install the parts you need)
    But you can also use any other solution to create your key pair.
    
    ![Image](https://avatars.githubusercontent.com/u/1476232?v=4)
    
    After installing GPG Suite (or your prefered solution) first create a new key.
    
    Using GPG Suite, start the GPG Keychain, which shows all current known GPG keys on your system.
    
    Click on `New` and you will be offered to enter your name, e-mail and password. Ensure to pick a secure password to protect your key. 
    [GPG Suite]: https://gpgtools.org/
    

    Details

    • Used library version: 0.1.0
    • Used platform: Compose Desktop
    • Used support library version: 1.0.0-alpha4-build398
    • Used gradle build tools version: Gradle 7.2
    • Used tooling / Android Studio version: IntelliJ IDEA 2021.3 EAP, reproducible without an IDE.
    • Other used libraries, potential conflicting libraries: None, this is reproducible in the Compose Desktop sample.

    Checklist

    feature 
    opened by msfjarvis 1
  • Upgrade AGP to 7.2.0-alpha01

    Upgrade AGP to 7.2.0-alpha01

    The 0.0.1๏ปฟrelease of the library was published with AGP 7.1.0-alpha13 which presents the artifact as incompatible when trying to consume it in a project using the newly released AGP 7.2.0-alpha01.

    Here is a Gradle build scan detailing the failure encountered, and the source code to reproduce the failure can be found here. Building the android module of the linked project is enough to reproduce the bug.

    opened by msfjarvis 1
  • Dependency upgrades | Kotlin 1.7.0 | Compose 1.2.1

    Dependency upgrades | Kotlin 1.7.0 | Compose 1.2.1

    • upgrade dependencies to the major new versions
        const val compose = "1.2.1"
        const val composeCompiler = "1.2.0"
        const val activityCompose = "1.5.1"
        kotlin = 1.7.0
        dokka = 1.7.10
        aboutLibraries = 10.4.0
        compose-jb = 1.2.0-alpha01-dev755
    
    feature 
    opened by mikepenz 0
  • Some features

    Some features

    About this issue

    What u think about create data class Typography/Color with text style for all item in markdown? And I think great point for custom padding

    opened by Programistich 0
  • Dependency updates 2022.06.22

    Dependency updates 2022.06.22

    • upgrade dependencies to newer version
    classpath("com.android.tools.build:gradle:7.2.1")
    classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.20.0")
    classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:10.3.1")
    
    const val material = "1.6.1"
    
    
    feature 
    opened by mikepenz 0
  • Adjust bullet list styling

    Adjust bullet list styling

    • introduce new bullet list handling (use circle ascii character by default)
    • offer custom local handlers to adjust the behavior for ordered and unordered list
      • FIX #41
    feature 
    opened by mikepenz 0
  • Bullet lists are not colored correctly

    Bullet lists are not colored correctly

    Based off the code from what I can tell passing a custom MarkdownColors with the text color set should render things in text color. Bullet lists however always stay black.

    opened by CarlosEsco 0
  • Draft: Allow to use custom components.

    Draft: Allow to use custom components.

    This is an POC for #57 Its just an example to show how custom components can be used.

    The handleElement function does not handle the rendering itself. It delegates to the configured components.

    The changes in existing code should be backward compatible.

    Whats included:

    Add a configuration to allow custom components. The default delegates to the current implementation (see CurrentComponentsBridge)

    opened by pbit 0
  • Feature: Allow to use custom components.

    Feature: Allow to use custom components.

    About this issue

    It would be nice if I could use my own components for rendering.

    Use Cases:

    • Render only a subset of components (e.g. only headings for a table of contents)
    • Decorate a component (e.g. add a "copy to clipboard" button to code)
    • Add custom logic (e.g. resolve relative URLs in links anmd images)
    opened by pbit 0
  • Add JS support

    Add JS support

    About this issue

    • Briefly describe the issue

    • How can the issue be reproduced / sample code Hi, I'm using Compose for Web as a kotlin("js") project and I installed the library in multiplatform, but I still can't use it in my project, I'm in Compose 1.2.0-apha01-dev753 using Kotlin 1.7.0 with Gradle 7.5.0 and the library in 0.6.1 with Intellij 2022.2.

    Checklist

    help wanted 
    opened by Ayfri 1
  • ![Image](ImageURL) rendered by PARAGRAPH

    ![Image](ImageURL) rendered by PARAGRAPH

    About this issue

    ASTNode.handleElement for ![Image](Image URL's) section are handled by a paragraph and not MarkdownElementTypes.IMAGE This is causing images to appear with a fixed size of 180.dp since Placeholders aren't supporting flexibility here.

    Details

    • [ ]ย  0.2.4
    • [ ]ย Android, Desktop(Linux)
    • [ ]ย 7.0.4
    • [ ]ย IDEA-U
    opened by BreimerR 2
Releases(v0.6.1)
๐Ÿซ๐Ÿ๐Ÿข๐Ÿ…ฟ Multiplatform Kotlin library to convert strings between various case formats including Camel Case, Snake Case, Pascal Case and Kebab Case

KaseChange Multiplatform Kotlin library to convert strings between various case formats Supported Case Formats SCREAMING_SNAKE_CASE snake_case PascalC

PearX Team 67 Dec 30, 2022
KDoctor - A command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development

KDoctor is a command-line tool that helps to set up the environment for Kotlin Multiplatform Mobile app development.

Kotlin 331 Dec 29, 2022
ASN.1 encoder/decoder for Kotlin/Multiplatform

ASN.1 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments

Sascha Peilicke 2 Mar 10, 2022
Base64 encoder/decoder for Kotlin/Multiplatform

Base64 encoder/decoder for Kotlin/Multiplatform. Supports Android, iOS, JavaScript and plain JVM environments.

Sascha Peilicke 11 Oct 25, 2022
recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.

recompose is a tool for converting Android layouts in XML to Kotlin code using Jetpack Compose.

Sebastian Kaspari 565 Jan 2, 2023
Multi-module, Kotlin, MVI, Compose, Hilt, Navigation Component, Use-cases, Room, Retrofit

Work in progress Multi-module demo app that gets data from dota2 api. API https://docs.opendota.com/ Players by rank (GET) https://api.opendota.com/ap

Mitch Tabian 321 Dec 27, 2022
A compose friendly way to deal with in app updates on android

In-App update compose A way to make in app updates in compose How to include in your project The library is available via MavenCentral: allprojects {

Stefan Wรคrting 25 Dec 31, 2022
Compose easy forms validation library

Compose EasyForms Focus on building your form UI while the library do the heavy work for you. Features Built in support for most of the Form widgets i

Kosh Sergani 24 Jul 18, 2022
Generate helper methods for compose navigation using KSP

Compose NavGen Generate helper methods for compose navigation using KSP. ?? You can try it now, but it's still under development. ?? TODO Support defa

Kenji Abe 6 Feb 5, 2022
CreditCardHelper ๐Ÿ–Š๏ธ A Jetpack-Compose library providing useful credit card utilities such as card type recognition and TextField ViewTransformations

CreditCardHelper ??๏ธ A Jetpack-Compose library providing useful credit card utilities such as card type recognition and TextField ViewTransformations

Stelios Papamichail 18 Dec 19, 2022
Remove the dependency of compiled kotlin on kotlin-stdlib

Dekotlinify This project aims to take compiled Kotlin Java bytecode (compiled by the standard Kotlin compiler) and remove all references to the Kotlin

Joseph Burton 10 Nov 29, 2022
Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Android Utilities Library build in kotlin Provide user 100 of pre defined method to create advanced native android app.

Shahid Iqbal 4 Nov 29, 2022
gRPC and protocol buffers for Android, Kotlin, and Java.

Wire โ€œA man got to have a code!โ€ - Omar Little See the project website for documentation and APIs. As our teams and programs grow, the variety and vol

Square 3.9k Dec 31, 2022
DiskCache - Simple and readable disk cache for kotlin and android applications

DiskCache Simple and readable disk cache for kotlin and android applications (with journaled lru strategy) This is a simple lru disk cache, based on t

Giovanni Corte 14 Dec 2, 2022
A DSL to handle soft keyboard visibility change event written in Kotlin.

About A DSL to handle soft keyboard visibility change event written in Kotlin. How to use? Step 1. Add it in your root build.gradle at the end of repo

Vinรญcius Oliveira 17 Jan 7, 2023
Kotlin matrix class which supports determinant, inverse matrix, matmul, etc.

Kotrix is a set of classes that helps people dealing with linear algebra in Kotlin.

Kanguk Lee 5 Dec 8, 2022
Fuzzy string matching for Kotlin (JVM, native, JS, Web Assembly) - port of Fuzzy Wuzzy Python lib

FuzzyWuzzy-Kotlin Fuzzy string matching for Kotlin (JVM, iOS) - fork of the Java fork of of Fuzzy Wuzzy Python lib. For use in on JVM, Android, or Kot

WillowTree, LLC 54 Nov 8, 2022
Multiplaform kotlin library for calculating text differences. Based on java-diff-utils, supports JVM, JS and native targets.

kotlin-multiplatform-diff This is a port of java-diff-utils to kotlin with multiplatform support. All credit for the implementation goes to original a

Peter Trifanov 51 Jan 3, 2023
Dagger Hilt, MVP Moxy, Retrofit, Kotlin coroutine, Sealed class

Dagger Hilt, MVP Moxy, Retrofit, Kotlin coroutine, Sealed class

Dostonjon 1 Nov 2, 2021