Skip to content

Commit f4bcddc

Browse files
authored
Merge pull request #425 from mikepenz/feature/README_refine
Refine the README
2 parents 8343d17 + e2417e1 commit f4bcddc

File tree

1 file changed

+53
-31
lines changed

1 file changed

+53
-31
lines changed

README.md

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
</h1>
44

55
<p align="center">
6-
... a Kotlin Multiplatform Markdown Renderer. (Android, Desktop, ...) powered by Compose Multiplatform
6+
... a powerful Kotlin Multiplatform Markdown Renderer for Kotlin Multiplatform projects using Compose Multiplatform
77
</p>
88

99
<div align="center">
@@ -45,30 +45,35 @@
4545

4646
### Using Gradle
4747

48+
Choose the appropriate configuration based on your project type:
49+
4850
<details open><summary><b>Multiplatform</b></summary>
4951
<p>
5052

51-
For multiplatform projects specify this single dependency:
53+
For multiplatform projects, add these dependencies to your `build.gradle.kts`:
5254

5355
```kotlin
5456
dependencies {
57+
// Core library
5558
implementation("com.mikepenz:multiplatform-markdown-renderer:${version}")
5659

57-
// Offers Material 2 defaults for Material 2 themed apps (com.mikepenz.markdown.m2.Markdown)
60+
// Choose ONE of the following based on your Material theme:
61+
62+
// For Material 2 themed apps
5863
implementation("com.mikepenz:multiplatform-markdown-renderer-m2:${version}")
5964

60-
// Offers Material 3 defaults for Material 3 themed apps (com.mikepenz.markdown.m3.Markdown)
65+
// OR for Material 3 themed apps
6166
implementation("com.mikepenz:multiplatform-markdown-renderer-m3:${version}")
6267
}
6368
```
6469

6570
</p>
6671
</details>
6772

68-
<details><summary><b>JVM</b></summary>
73+
<details><summary><b>JVM (Desktop)</b></summary>
6974
<p>
7075

71-
To use the library on JVM, you have to include:
76+
For JVM-only projects, add this dependency:
7277

7378
```kotlin
7479
dependencies {
@@ -82,7 +87,7 @@ dependencies {
8287
<details><summary><b>Android</b></summary>
8388
<p>
8489

85-
For Android a special dependency is available:
90+
For Android-only projects, add this dependency:
8691

8792
```kotlin
8893
dependencies {
@@ -93,34 +98,47 @@ dependencies {
9398
</p>
9499
</details>
95100

96-
> [!TIP]
97-
> Since 0.13.0 the core library does not depend on a Material theme anymore. Include the `-m2`
98-
> or `-m3` module to get
99-
> access to the defaults.
101+
> [!IMPORTANT]
102+
> Since version 0.13.0, the core library does not depend on a Material theme. You must include
103+
> either the `-m2` or `-m3` module to get access to the default styling.
100104
101105

102106
-------
103107

104108
## Usage
105109

106-
```Kotlin
107-
val markdown = """
108110
### What's included 🚀
109111

110-
- Super simple setup
111-
- Cross-platform ready
112-
- Lightweight
113-
""".trimIndent()
112+
The most basic usage is to simply pass your markdown string to the `Markdown` composable:
114113

115-
//
116-
Markdown(markdown)
114+
```kotlin
115+
// In your composable (use the appropriate Markdown implementation for your theme)
116+
Markdown(
117+
"""
118+
# Hello Markdown
119+
120+
This is a simple markdown example with:
121+
122+
- Bullet points
123+
- **Bold text**
124+
- *Italic text*
125+
126+
[Check out this link](https://github.com/mikepenz/multiplatform-markdown-renderer)
127+
""".trimIndent()
128+
)
117129
```
118130

131+
**Note:** Import either `com.mikepenz.markdown.m3.Markdown` for Material 3 or
132+
`com.mikepenz.markdown.m2.Markdown` for Material 2 themed applications.
133+
119134
<details><summary><b>Advanced Usage</b></summary>
120135
<p>
121136

122137
### `rememberMarkdownState`
123138

139+
For better performance, especially with larger markdown content, use `rememberMarkdownState` or move
140+
the parsing of the markdown into your viewmodel:
141+
124142
```kotlin
125143
val markdownState = rememberMarkdownState(markdown)
126144
Markdown(markdownState)
@@ -440,11 +458,17 @@ Markdown(
440458
)
441459
```
442460

443-
## Dependency
461+
## Dependencies
462+
463+
This library uses the following key dependencies:
444464

445-
This project uses JetBrains [markdown](https://github.com/JetBrains/markdown/) Multiplatform
446-
Markdown processor as
447-
dependency to parse the markdown content.
465+
- [JetBrains Markdown](https://github.com/JetBrains/markdown/) - Multiplatform Markdown processor
466+
for parsing markdown content
467+
- [Compose Multiplatform](https://github.com/JetBrains/compose-multiplatform) - For cross-platform
468+
UI rendering
469+
- [Extended Spans](https://github.com/saket/extended-spans) - For advanced text styling (integrated
470+
as multiplatform)
471+
- [Highlights](https://github.com/SnipMeDev/Highlights) - For code syntax highlighting (optional)
448472

449473
## Developed By
450474

@@ -454,9 +478,8 @@ dependency to parse the markdown content.
454478

455479
## Contributors
456480

457-
This free, open source software was also made possible by a group of volunteers that put many hours
458-
of hard work into
459-
it. See the [CONTRIBUTORS.md](CONTRIBUTORS.md) file for details.
481+
This free, open source software was made possible by a group of volunteers who put many hours of
482+
hard work into it. See the [CONTRIBUTORS.md](CONTRIBUTORS.md) file for details.
460483

461484
## Credits
462485

@@ -465,16 +488,15 @@ on [Rendering Markdown with Jetpack Compose](https://www.hellsoft.se/rendering-m
465488
and the related source [MarkdownComposer](https://github.com/ErikHellman/MarkdownComposer).
466489

467490
Also huge thanks to [Saket Narayan](https://github.com/saket/) for his great work on
468-
the [extended-spans](https://github.com/saket/extended-spans) project. Ported into this project to
469-
make it multiplatform.
491+
the [extended-spans](https://github.com/saket/extended-spans) project, which was ported into this
492+
project to make it multiplatform.
470493

471494
## Fork License
472495

473496
Copyright for portions of the code are held by [Erik Hellman, 2020] as part of
474497
project [MarkdownComposer](https://github.com/ErikHellman/MarkdownComposer) under the MIT license.
475-
All other copyright
476-
for project multiplatform-markdown-renderer are held by [Mike Penz, 2023] under the Apache License,
477-
Version 2.0.
498+
All other copyright for project multiplatform-markdown-renderer are held by [Mike Penz, 2023] under
499+
the Apache License, Version 2.0.
478500

479501
## License
480502

0 commit comments

Comments
 (0)