Skip to content

Commit 4a5608a

Browse files
authored
Merge pull request #378 from mikepenz/develop
dev -> main
2 parents 5f7d1b0 + 818f315 commit 4a5608a

File tree

263 files changed

+3766
-2141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+3766
-2141
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414

1515
strategy:
1616
matrix:
17-
os: [ macos-14 ]
17+
os: [ macos-latest ]
1818

1919
runs-on: ${{matrix.os}}
2020

@@ -62,7 +62,7 @@ jobs:
6262
6363
build:
6464
name: Build
65-
runs-on: macos-14
65+
runs-on: macos-latest
6666
steps:
6767
- name: Checkout
6868
uses: actions/checkout@v4
@@ -86,17 +86,17 @@ jobs:
8686
- name: Build Debug
8787
run: |
8888
./gradlew clean || true
89-
./gradlew app:assembleDebug --stacktrace
89+
./gradlew sample:android:assembleDebug --stacktrace
9090
9191
- name: Run Tests
9292
run: |
93-
./gradlew app:validateDebugScreenshotTest
93+
./gradlew sample:android:validateDebugScreenshotTest
9494
9595
- name: Publish Test Report
9696
if: (failure() || success()) && github.event_name == 'pull_request'
9797
uses: mikepenz/action-junit-report@v5
9898
with:
99-
report_paths: '**/app/build/test-results/validateDebugScreenshotTest/TEST-*.xml'
99+
report_paths: '**/sample/android/build/test-results/validateDebugScreenshotTest/TEST-*.xml'
100100
github_token: ${{ secrets.GITHUB_TOKEN }}
101101
fail_on_failure: true
102102
annotate_only: true
@@ -106,9 +106,9 @@ jobs:
106106
uses: actions/upload-artifact@v4
107107
with:
108108
name: "Test-Artifacts"
109-
path: "app/build/reports/screenshotTest/preview/debug/"
109+
path: "sample/android/build/reports/screenshotTest/preview/debug/"
110110

111-
- name: Aoi Check
111+
- name: Api Check
112112
if: github.event_name == 'pull_request'
113113
run: ./gradlew apiCheck
114114

@@ -135,11 +135,11 @@ jobs:
135135
if: startsWith(github.ref, 'refs/tags/')
136136
run: |
137137
echo "${{ secrets.KEYSTORE }}" > opensource.jks.asc
138-
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch "opensource.jks.asc" > "app/opensource.jks"
138+
gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch "opensource.jks.asc" > "sample/android/opensource.jks"
139139
140140
- name: Build Release App
141141
if: startsWith(github.ref, 'refs/tags/')
142-
run: ./gradlew app:assembleRelease app:bundleRelease -P"com.mikepenz.android.signing.enabled"="true" -P"com.mikepenz.android.signing.storeFile"="opensource.jks" -P"com.mikepenz.android.signing.storePassword"="${{ secrets.STORE_PASSWORD }}" -P"com.mikepenz.android.signing.keyAlias"="${{ secrets.KEY_ALIAS }}" -P"com.mikepenz.android.signing.keyPassword"="${{ secrets.KEY_PASSWORD }}"
142+
run: ./gradlew sample:android:assembleRelease sample:android:bundleRelease -P"com.mikepenz.android.signing.enabled"="true" -P"com.mikepenz.android.signing.storeFile"="opensource.jks" -P"com.mikepenz.android.signing.storePassword"="${{ secrets.STORE_PASSWORD }}" -P"com.mikepenz.android.signing.keyAlias"="${{ secrets.KEY_ALIAS }}" -P"com.mikepenz.android.signing.keyPassword"="${{ secrets.KEY_PASSWORD }}"
143143

144144
- name: Collect artifacts
145145
if: startsWith(github.ref, 'refs/tags/')

.github/workflows/static.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343
uses: gradle/actions/setup-gradle@v4
4444
- name: Build Page
4545
run: |
46-
./gradlew app-wasm:wasmJsBrowserDistribution --no-configuration-cache
46+
./gradlew sample:web:wasmJsBrowserDistribution --no-configuration-cache
4747
4848
- name: Upload artifact
4949
uses: actions/upload-pages-artifact@v3
5050
with:
51-
path: 'app-wasm/build/dist/wasmJs/productionExecutable'
51+
path: 'sample/web/build/dist/wasmJs/productionExecutable'
5252

5353
- name: Deploy to GitHub Pages
5454
id: deployment

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ captures/
4343
# Generated podspec
4444
*.podspec
4545
/.kotlin/
46+
47+
## User settings
48+
xcuserdata/

CONTRIBUTORS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Multiplatform Markdown Renderer contributors (sorted alphabeticaly)
1+
Multiplatform Markdown Renderer contributors (sorted alphabetically)
22
============================================

MIGRATION.md

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,100 @@
11
### Upgrade Notes
2+
3+
#### Version 0.33.0
4+
5+
- **Dependency Upgrade**: Kotlin 2.1.20
6+
- **Breaking Change**: The provided `Markdown` (String) is now parsed asynchronously.
7+
- This results in a `loading` state being displayed prior to the parsing result.
8+
- While the `rememberMarkdownState` offers the ability to require `immediate` parsing as
9+
before, this is not advised as it might block the composition of the UI.
10+
- A new `loading` and `error` composable can be provided to handle the different states
11+
- A new `success` composable was also introduced to modify success states (See more on the lazy
12+
handling)
13+
- The `linkDefinition` component was deprecated in favor of the new link lookup ahead of time
14+
- Accompanying this change, a new `rememberMarkdownState` was introduced to retrieve a hoisted
15+
observable state from the markdown.
16+
- This offers greater flexibility and allows custom state handling.
17+
18+
```kotlin
19+
val markdownState = rememberMarkdownState(MARKDOWN)
20+
Markdown(markdownState = markdownState)
21+
22+
// exposes the general state:
23+
markdownState.state
24+
25+
// exposes found link definitions and links
26+
markdownState.links
27+
```
28+
29+
- **Breaking Change**: The `MarkdownComponent` composable function no longer passes on a
30+
`ColumnScope`
31+
- This change was made to allow for more flexibility in the layout of the markdown components.
32+
- The `ColumnScope` wasn't used by the library before, and prevented use cases like
33+
`LazyColumn`.
34+
- If you have implemented your own `MarkdownComponent` depending on this, you will need to
35+
remove the `ColumnScope` parameter from your implementation, and wrap the component in a
36+
`Column {}` directly.
37+
- Thanks to this change a new `LazyMarkdownSuccess` composable was introduced to allow
38+
rendering very long markdown content as `LazyColumn` instead of a `Column`
39+
40+
```kotlin
41+
Markdown(
42+
markdownState = markdownState,
43+
success = { state, components, modifier ->
44+
LazyMarkdownSuccess(state, components, modifier, contentPadding = PaddingValues(16.dp))
45+
},
46+
modifier = Modifier.fillMaxSize()
47+
)
48+
```
49+
50+
- **Breaking Change**: The `level` argument for `MarkdownOrderedList` and `MarkdownBulletList` were
51+
renamed to `depth`.
52+
- **Breaking Change**: The `MarkdownListItems` component was refactored rendering nested
53+
Ordered/Unordered lists using the `MarkdownComponents` as defined.
54+
- As a result the component spec now needs to handle depth.
55+
See [Source](https://github.com/keta1/multiplatform-markdown-renderer/blob/develop/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/components/MarkdownComponents.kt#L201-L208)
56+
for details.
57+
- **Breaking Change**: The `MarkdownListItems` component now takes 2 optional lambdas
58+
- These lambdas offer the ability to provide custom `Modifier`s for the marker and the list
59+
content.
60+
- This can be helpful for example to adjust the baseline.
61+
See: https://github.com/mikepenz/multiplatform-markdown-renderer/issues/329
62+
- **Breaking Change**: The `BulletHandler` adds a new argument in the function `listNumber: Int`.
63+
- This was introduced to allow for more flexibility in the rendering of the bullet points.
64+
- But also specifically to enable list rendering according to spec:
65+
- https://spec.commonmark.org/0.31.2/#start-number
66+
- The `index` argument was retained to allow custom implementations adjust this behavior.
67+
68+
- **Behavior Change**: To account for the behavior change introduced in v0.32.0 on EOL handling a
69+
new API was introduced to bring back prior behavior
70+
71+
```kotlin
72+
annotator = markdownAnnotator(
73+
config = markdownAnnotatorConfig(
74+
eolAsNewLine = true
75+
)
76+
)
77+
```
78+
79+
#### Version 0.32.0
80+
81+
- **Breaking Change**: The `MarkdownTypography` interface introduces the `table` property.
82+
- This property is used to define the typography for tables in markdown.
83+
- If you have implemented your own `MarkdownTypography`, you will need to add the `table`
84+
property to your implementation.
85+
- **Breaking Change**: The `BulletHandler` function has been updated to include another argument
86+
`depth`
87+
- This property can be used to use a different `bullet style` for different levels of depth.
88+
- **Behavior Change**: `EOL`is now considered a `' '` whitespace character instead of a line break.
89+
- This change was made to align more properly with the markdown standard
90+
- More details: https://github.com/mikepenz/multiplatform-markdown-renderer/issues/337
91+
- **Behavior Change**: The primary definition for text color of components is now in the
92+
`MarkdownTypography` text styles.
93+
- This change was made to have a more consistent definition of text colors across all
94+
components.
95+
96+
#### Prior release
97+
98+
Unfortunately no upgrade notes were provided for the releases prior to 0.32.0.
99+
See the release notes available on GitHub for more
100+
details: https://github.com/mikepenz/multiplatform-markdown-renderer/releases

README.md

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@ Markdown(markdown)
113113
<details><summary><b>Advanced Usage</b></summary>
114114
<p>
115115

116+
### `rememberMarkdownState`
117+
118+
```kotlin
119+
val markdownState = rememberMarkdownState(markdown)
120+
Markdown(markdownState)
121+
```
122+
123+
### Parse Markdown in VM
124+
125+
```kotlin
126+
// In the VM setup the flow to parse the markdown
127+
val markdownFlow = parseMarkdownFlow("# Markdown")
128+
129+
// In the Composable use the flow
130+
val state by markdownFlow.collectAsStateWithLifecycle(State.Loading())
131+
Markdown(state)
132+
```
133+
116134
The library offers the ability to modify different behaviour when rendering the markdown.
117135

118136
### Provided custom style
@@ -138,7 +156,7 @@ Markdown(
138156
/** No animation */
139157
}
140158
),
141-
}
159+
)
142160
```
143161

144162
### Extended spans
@@ -250,7 +268,7 @@ Another example to of a custom component is changing the rendering of an unorder
250268
// Define a custom component for rendering unordered list items in Markdown
251269
val customUnorderedListComponent: MarkdownComponent = {
252270
// Use the MarkdownListItems composable to render the list items
253-
MarkdownListItems(it.content, it.node, level = 0) { index, child ->
271+
MarkdownListItems(it.content, it.node, level = 0) { startNumber, index, child ->
254272
// Render an icon for the bullet point with a green tint
255273
Icon(
256274
imageVector = icon,
@@ -291,49 +309,44 @@ Markdown(markdown)
291309

292310
### Image Loading
293311

294-
Starting with 0.21.0 the library does not include image loading by default, however exposes 2
295-
modules for either coil2 or coil3 dependencies.
296-
The chosen image transformer implementation has to be passed to the `Markdown` API.
312+
To configure image loading, the library offers different implementations, to offer great flexibility
313+
for the respective integration.
314+
After adding the dependency, the chosen image transformer implementation has to be passed to the
315+
`Markdown` API.
297316

298-
#### coil2
317+
> [!NOTE]
318+
> Please refer to the official documentation for the specific image loading integration you are
319+
> using (e.g., coil3) on how to adjust its
320+
> behavior.
321+
322+
#### coil3
299323

300324
```groovy
301-
// Offers coil2 (Coil2ImageTransformerImpl)
302-
implementation("com.mikepenz:multiplatform-markdown-renderer-coil2:${version}")
325+
// Offers coil3 (Coil3ImageTransformerImpl)
326+
implementation("com.mikepenz:multiplatform-markdown-renderer-coil3:${version}")
303327
```
304328

305329
```kotlin
306330
Markdown(
307331
MARKDOWN,
308-
imageTransformer = Coil2ImageTransformerImpl,
332+
imageTransformer = Coil3ImageTransformerImpl,
309333
)
310334
```
311335

312-
> [!NOTE]
313-
> 0.21.0 adds JVM support for this dependency via `HTTPUrlConnection` -> however this is expected to
314-
> be removed in the
315-
> future.
316-
317-
> [!NOTE]
318-
> Please refer to the official coil2 documentation on how to adjust the `ImageLoader`
319-
320-
#### coil3
336+
#### coil2
321337

322338
```groovy
323-
// Offers coil3 (Coil3ImageTransformerImpl)
324-
implementation("com.mikepenz:multiplatform-markdown-renderer-coil3:${version}")
339+
// Offers coil2 (Coil2ImageTransformerImpl)
340+
implementation("com.mikepenz:multiplatform-markdown-renderer-coil2:${version}")
325341
```
326342

327343
```kotlin
328344
Markdown(
329345
MARKDOWN,
330-
imageTransformer = Coil3ImageTransformerImpl,
346+
imageTransformer = Coil2ImageTransformerImpl,
331347
)
332348
```
333349

334-
> [!NOTE]
335-
> Please refer to the official coil3 documentation on how to adjust the `SingletonImageLoader`
336-
337350
### Syntax Highlighting
338351

339352
The library (introduced with 0.27.0) offers optional support for syntax highlighting via
@@ -422,7 +435,7 @@ Version 2.0.
422435

423436
## License
424437

425-
Copyright 2024 Mike Penz
438+
Copyright 2025 Mike Penz
426439

427440
Licensed under the Apache License, Version 2.0 (the "License");
428441
you may not use this file except in compliance with the License.

app-desktop/README.md

Lines changed: 0 additions & 13 deletions
This file was deleted.

app-desktop/build.gradle.kts

Lines changed: 0 additions & 62 deletions
This file was deleted.

app-desktop/gradle.properties

Lines changed: 0 additions & 2 deletions
This file was deleted.

app-desktop/src/commonMain/composeResources/files/aboutlibraries.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)