Skip to content

Commit e2417e1

Browse files
committed
- improve simple example
1 parent 0fb0d74 commit e2417e1

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

README.md

Lines changed: 23 additions & 9 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">
@@ -107,24 +107,38 @@ dependencies {
107107

108108
## Usage
109109

110-
```Kotlin
111-
val markdown = """
112110
### What's included 🚀
113111

114-
- Super simple setup
115-
- Cross-platform ready
116-
- Lightweight
117-
""".trimIndent()
112+
The most basic usage is to simply pass your markdown string to the `Markdown` composable:
118113

119-
//
120-
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+
)
121129
```
122130

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+
123134
<details><summary><b>Advanced Usage</b></summary>
124135
<p>
125136

126137
### `rememberMarkdownState`
127138

139+
For better performance, especially with larger markdown content, use `rememberMarkdownState` or move
140+
the parsing of the markdown into your viewmodel:
141+
128142
```kotlin
129143
val markdownState = rememberMarkdownState(markdown)
130144
Markdown(markdownState)

0 commit comments

Comments
 (0)