Skip to content

Commit f0ad478

Browse files
authored
Merge pull request #127 from mikepenz/develop
dev -> main
2 parents 90a0e04 + 1595eb3 commit f0ad478

File tree

16 files changed

+128
-64
lines changed

16 files changed

+128
-64
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ For multiplatform projects specify this single dependency:
4545
dependencies {
4646
implementation("com.mikepenz:multiplatform-markdown-renderer:${version}")
4747

48-
// Offers Material 2 defaults for Material 3 themed apps (com.mikepenz.markdown.m2.Markdown)
48+
// Offers Material 2 defaults for Material 2 themed apps (com.mikepenz.markdown.m2.Markdown)
4949
implementation("com.mikepenz:multiplatform-markdown-renderer-m2:${version}")
5050

5151
// Offers Material 3 defaults for Material 3 themed apps (com.mikepenz.markdown.m3.Markdown)
@@ -181,6 +181,19 @@ Markdown(
181181
</p>
182182
</details>
183183

184+
### Image Loading
185+
186+
In the current versions of the library, image loading is included in different variants.
187+
188+
- Android: Uses `coil` to load images (Default configuration). The global `ImageLoader` is respected.
189+
- JVM: Load image as HTTPUrlConnection and set to the view
190+
- JS / Native: No image loading provided at this time
191+
192+
Provide your own `ImageTransformer` to the `Markdown` compose function to modify this behavior.
193+
194+
> [!NOTE]
195+
> It is planned to update to coil3 for all platforms once it reaches a more stable release cycle.
196+
184197
## Dependency
185198

186199
This project uses JetBrains [markdown](https://github.com/JetBrains/markdown/) Multiplatform Markdown processor as

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ dependencies {
7878
implementation(activityCompose)
7979
}
8080

81-
8281
with(Deps.Compose) {
8382
implementation(coilCompose)
83+
implementation(coilComposeSvg)
8484

8585
implementation(foundationLayout)
8686
implementation(material)

app/src/main/AndroidManifest.xml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
33

4-
<uses-permission android:name="android.permission.INTERNET"/>
4+
<uses-permission android:name="android.permission.INTERNET" />
55

66
<application
7-
android:allowBackup="true"
8-
android:icon="@mipmap/ic_launcher"
9-
android:label="@string/app_name"
10-
android:supportsRtl="true"
11-
android:theme="@style/Theme.Sample">
7+
android:name="com.mikepenz.markdown.ui.MyApplication"
8+
android:allowBackup="true"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:supportsRtl="true"
12+
android:theme="@style/Theme.Sample">
1213
<activity
13-
android:name="com.mikepenz.markdown.ui.MainActivity"
14-
android:exported="true"
15-
android:theme="@style/Theme.Sample.NoActionBar">
14+
android:name="com.mikepenz.markdown.ui.MainActivity"
15+
android:exported="true"
16+
android:theme="@style/Theme.Sample.NoActionBar">
1617
<intent-filter>
17-
<action android:name="android.intent.action.MAIN"/>
18+
<action android:name="android.intent.action.MAIN" />
1819

19-
<category android:name="android.intent.category.LAUNCHER"/>
20+
<category android:name="android.intent.category.LAUNCHER" />
2021
</intent-filter>
2122
</activity>
2223
</application>

app/src/main/java/com/mikepenz/markdown/ui/MainActivity.kt

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,14 @@ import androidx.activity.compose.setContent
66
import androidx.compose.foundation.background
77
import androidx.compose.foundation.isSystemInDarkTheme
88
import androidx.compose.foundation.layout.Arrangement
9-
import androidx.compose.foundation.layout.Column
109
import androidx.compose.foundation.layout.Row
1110
import androidx.compose.foundation.layout.Spacer
1211
import androidx.compose.foundation.layout.fillMaxSize
1312
import androidx.compose.foundation.layout.fillMaxWidth
1413
import androidx.compose.foundation.layout.height
1514
import androidx.compose.foundation.layout.padding
1615
import androidx.compose.foundation.lazy.LazyColumn
17-
import androidx.compose.foundation.rememberScrollState
18-
import androidx.compose.foundation.verticalScroll
1916
import androidx.compose.material.MaterialTheme
20-
import androidx.compose.material.Surface
2117
import androidx.compose.material.Switch
2218
import androidx.compose.material.Text
2319
import androidx.compose.runtime.Composable
@@ -28,13 +24,14 @@ import androidx.compose.runtime.setValue
2824
import androidx.compose.ui.Alignment
2925
import androidx.compose.ui.Modifier
3026
import androidx.compose.ui.unit.dp
31-
import com.mikepenz.markdown.compose.Markdown
3227
import com.mikepenz.markdown.m2.Markdown
3328

3429
class MainActivity : ComponentActivity() {
3530

31+
3632
override fun onCreate(savedInstanceState: Bundle?) {
3733
super.onCreate(savedInstanceState)
34+
3835
setContent {
3936
MainLayout()
4037
}
@@ -43,8 +40,8 @@ class MainActivity : ComponentActivity() {
4340

4441
@Composable
4542
fun MainLayout() {
46-
val isSystemInDarkMode = isSystemInDarkTheme()
47-
var darkMode by remember { mutableStateOf(isSystemInDarkMode) }
43+
val isSystemInDarkMode = isSystemInDarkTheme()
44+
var darkMode by remember { mutableStateOf(isSystemInDarkMode) }
4845

4946
SampleTheme(darkMode) {
5047

@@ -111,29 +108,35 @@ fun MainLayout() {
111108

112109
LazyColumn(
113110
modifier = Modifier
114-
.fillMaxSize().background(MaterialTheme.colors.background).padding(horizontal = 16.dp),
111+
.fillMaxSize()
112+
.background(MaterialTheme.colors.background)
113+
.padding(horizontal = 16.dp),
115114
) {
116115

117-
item {
118-
Spacer(modifier = Modifier.height(56.dp))
119-
}
120-
item {
121-
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically) {
122-
Text(text = "Dark mode enabled", color = MaterialTheme.colors.onBackground)
123-
Switch(checked = darkMode, onCheckedChange = { darkMode = !darkMode })
124-
}
125-
}
126-
item {
127-
Spacer(modifier = Modifier.height(16.dp))
128-
}
129-
item {
130-
Markdown(markdown)
131-
}
132-
item {
133-
Spacer(modifier = Modifier.height(48.dp))
116+
item {
117+
Spacer(modifier = Modifier.height(56.dp))
118+
}
119+
item {
120+
Row(
121+
modifier = Modifier.fillMaxWidth(),
122+
horizontalArrangement = Arrangement.SpaceBetween,
123+
verticalAlignment = Alignment.CenterVertically
124+
) {
125+
Text(text = "Dark mode enabled", color = MaterialTheme.colors.onBackground)
126+
Switch(checked = darkMode, onCheckedChange = { darkMode = !darkMode })
134127
}
135128
}
129+
item {
130+
Spacer(modifier = Modifier.height(16.dp))
131+
}
132+
item {
133+
Markdown(markdown)
134+
}
135+
item {
136+
Spacer(modifier = Modifier.height(48.dp))
137+
}
136138
}
137-
138139
}
139140

141+
}
142+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.mikepenz.markdown.ui
2+
3+
import android.app.Application
4+
import coil.ImageLoader
5+
import coil.ImageLoaderFactory
6+
import coil.decode.SvgDecoder
7+
8+
class MyApplication : Application(), ImageLoaderFactory {
9+
override fun newImageLoader(): ImageLoader {
10+
return ImageLoader.Builder(this)
11+
.components {
12+
add(SvgDecoder.Factory())
13+
}
14+
.build()
15+
}
16+
}

build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath("com.android.tools.build:gradle:8.2.2")
11+
classpath("com.android.tools.build:gradle:8.3.1")
1212
classpath("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.23.5")
13-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
14-
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10")
15-
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:11.1.0")
16-
classpath("org.jetbrains.compose:compose-gradle-plugin:1.6.0")
13+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.23")
14+
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.20")
15+
classpath("com.mikepenz.aboutlibraries.plugin:aboutlibraries-plugin:11.1.1")
16+
classpath("org.jetbrains.compose:compose-gradle-plugin:1.6.1")
1717
}
1818
}
1919

buildSrc/src/main/java/Dependencies.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ object Versions {
33
const val androidCompileSdk = 34
44
const val androidTargetSdk = androidCompileSdk
55

6-
const val kotlin = "1.9.22"
6+
const val kotlin = "1.9.23"
77

8-
const val markdown = "0.6.1"
8+
const val markdown = "0.7.0"
99

1010
const val coil = "2.6.0"
11-
const val compose = "1.6.2"
12-
const val composeCompiler = "1.5.10"
11+
const val compose = "1.6.4"
12+
const val composeCompiler = "1.5.11"
1313

1414
const val material = "1.11.0"
1515
const val activityCompose = "1.8.2"
@@ -36,5 +36,6 @@ object Deps {
3636
const val material = "androidx.compose.material:material:${Versions.compose}"
3737

3838
const val coilCompose = "io.coil-kt:coil-compose:${Versions.coil}"
39+
const val coilComposeSvg = "io.coil-kt:coil-svg:${Versions.coil}"
3940
}
4041
}

gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Maven stuff
22
GROUP=com.mikepenz
3-
VERSION_NAME=0.13.0
4-
VERSION_CODE=1300
3+
VERSION_NAME=0.14.0
4+
VERSION_CODE=1400
55

66
POM_URL=https://github.com/mikepenz/multiplatform-markdown-renderer
77

@@ -29,6 +29,7 @@ kotlin.js.compiler=both
2929
kotlin.mpp.stability.nowarn=true
3030
kotlin.mpp.androidSourceSetLayoutVersion=2
3131

32+
org.jetbrains.compose.experimental.wasm.enabled=true
3233
org.jetbrains.compose.experimental.uikit.enabled=true
3334
org.jetbrains.compose.experimental.jscanvas.enabled=true
3435
org.jetbrains.compose.experimental.macos.enabled=true

gradle/wrapper/gradle-wrapper.jar

-19.8 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)