Skip to content

Commit c2e39da

Browse files
authored
Merge pull request #592 from mikepenz/develop
dev -> main
2 parents 2f98ff0 + a88af38 commit c2e39da

12 files changed

Lines changed: 152 additions & 9 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "Java",
3-
"image": "mcr.microsoft.com/devcontainers/java:3-21@sha256:1e8bc687983da0d516d1c8d53c15abef59a5c83c0e829331ba145d9910ff4d9c",
3+
"image": "mcr.microsoft.com/devcontainers/java:3-21@sha256:53e4659f8ca8d859366fa0f9bf2d0a56c334a07635e03d26fb6cba2d0885f6c7",
44
"features": {
55
"ghcr.io/devcontainers/features/java:1": {
66
"version": "none",

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
3434

3535
- name: Setup Gradle
36-
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
36+
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
3737

3838
- name: Cache konan
3939
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -79,13 +79,13 @@ jobs:
7979
21
8080
8181
- name: Validate gradle wrapper
82-
uses: gradle/actions/wrapper-validation@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
82+
uses: gradle/actions/wrapper-validation@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
8383

8484
- name: Copy CI gradle.properties
8585
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
8686

8787
- name: Setup Gradle
88-
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
88+
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
8989

9090
- name: Build Debug
9191
run: |

.github/workflows/gradle-dependency-submission.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ jobs:
2424
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties
2525

2626
- name: Setup Gradle & Submit dependency graphs
27-
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
27+
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
2828
with:
2929
dependency-graph: generate-and-submit

.github/workflows/static.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
17
4141
21
4242
- name: Setup Gradle
43-
uses: gradle/actions/setup-gradle@50e97c2cd7a37755bbfafc9c5b7cafaece252f6e # v6.1.0
43+
uses: gradle/actions/setup-gradle@3f131e8634966bd73d06cc69884922b02e6faf92 # v6.2.0
4444
- name: Build Page
4545
run: |
4646
./gradlew sample:web:wasmJsBrowserDistribution --no-configuration-cache

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,22 @@ val state by markdownFlow.collectAsStateWithLifecycle()
224224
Markdown(state)
225225
```
226226

227+
### Parse Markdown synchronously
228+
229+
If you want to pre-parse content before showing the UI and hand the result to `Markdown` without any
230+
Flow/StateFlow machinery, use `parseMarkdown`. It parses on the calling thread and returns the final,
231+
immutable `State` directly (`State.Success` on success, or `State.Error` on failure).
232+
233+
```kotlin
234+
// Parse ahead of time and pass the already-parsed state to the Composable
235+
val state = parseMarkdown("# Markdown")
236+
Markdown(state)
237+
```
238+
239+
> [!NOTE]
240+
> Parsing happens on the calling thread. For large documents consider invoking this off the main
241+
> thread.
242+
227243
The library offers the ability to modify different behaviour when rendering the markdown.
228244

229245
### Provided custom style

gradle.properties

Lines changed: 2 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.42.0
4-
VERSION_CODE=4200
3+
VERSION_NAME=0.43.0
4+
VERSION_CODE=4300
55
#
66
POM_URL=https://github.com/mikepenz/multiplatform-markdown-renderer
77
POM_SCM_URL=https://github.com/mikepenz/multiplatform-markdown-renderer

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
androidx-activityCompose = "1.13.0"
3-
coil = "3.4.0"
3+
coil = "3.5.0"
44
coil2 = "2.7.0"
55
markdown = "0.7.5"
66
ktor = "3.5.0"

multiplatform-markdown-renderer/api/android/multiplatform-markdown-renderer.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,8 @@ public abstract interface class com/mikepenz/markdown/model/MarkdownState {
608608
public final class com/mikepenz/markdown/model/MarkdownStateKt {
609609
public static final fun asMarkdownState (Lkotlinx/coroutines/flow/Flow;ZZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;)Lkotlinx/coroutines/flow/Flow;
610610
public static synthetic fun asMarkdownState$default (Lkotlinx/coroutines/flow/Flow;ZZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
611+
public static final fun parseMarkdown (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;)Lcom/mikepenz/markdown/model/State;
612+
public static synthetic fun parseMarkdown$default (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ILjava/lang/Object;)Lcom/mikepenz/markdown/model/State;
611613
public static final fun parseMarkdownFlow (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;)Lkotlinx/coroutines/flow/Flow;
612614
public static synthetic fun parseMarkdownFlow$default (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
613615
public static final fun rememberMarkdownState (Ljava/lang/String;ZZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ZLandroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/model/MarkdownState;

multiplatform-markdown-renderer/api/jvm/multiplatform-markdown-renderer.api

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@ public abstract interface class com/mikepenz/markdown/model/MarkdownState {
678678
public final class com/mikepenz/markdown/model/MarkdownStateKt {
679679
public static final fun asMarkdownState (Lkotlinx/coroutines/flow/Flow;ZZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;)Lkotlinx/coroutines/flow/Flow;
680680
public static synthetic fun asMarkdownState$default (Lkotlinx/coroutines/flow/Flow;ZZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
681+
public static final fun parseMarkdown (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;)Lcom/mikepenz/markdown/model/State;
682+
public static synthetic fun parseMarkdown$default (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ILjava/lang/Object;)Lcom/mikepenz/markdown/model/State;
681683
public static final fun parseMarkdownFlow (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;)Lkotlinx/coroutines/flow/Flow;
682684
public static synthetic fun parseMarkdownFlow$default (Ljava/lang/String;ZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ILjava/lang/Object;)Lkotlinx/coroutines/flow/Flow;
683685
public static final fun rememberMarkdownState (Ljava/lang/String;ZZLorg/intellij/markdown/flavours/MarkdownFlavourDescriptor;Lorg/intellij/markdown/parser/MarkdownParser;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;ZLandroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/model/MarkdownState;

multiplatform-markdown-renderer/api/multiplatform-markdown-renderer.klib.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ final fun com.mikepenz.markdown.model/markdownDimens(androidx.compose.ui.unit/Dp
921921
final fun com.mikepenz.markdown.model/markdownExtendedSpans(kotlin/Function2<androidx.compose.runtime/Composer, kotlin/Int, com.mikepenz.markdown.compose.extendedspans/ExtendedSpans>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownExtendedSpans // com.mikepenz.markdown.model/markdownExtendedSpans|markdownExtendedSpans(kotlin.Function2<androidx.compose.runtime.Composer,kotlin.Int,com.mikepenz.markdown.compose.extendedspans.ExtendedSpans>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
922922
final fun com.mikepenz.markdown.model/markdownInlineContent(kotlin.collections/Map<kotlin/String, androidx.compose.foundation.text/InlineTextContent>?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownInlineContent // com.mikepenz.markdown.model/markdownInlineContent|markdownInlineContent(kotlin.collections.Map<kotlin.String,androidx.compose.foundation.text.InlineTextContent>?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
923923
final fun com.mikepenz.markdown.model/markdownPadding(androidx.compose.ui.unit/Dp, androidx.compose.ui.unit/Dp, androidx.compose.ui.unit/Dp, androidx.compose.ui.unit/Dp, androidx.compose.ui.unit/Dp?, androidx.compose.ui.unit/Dp, androidx.compose.foundation.layout/PaddingValues?, androidx.compose.foundation.layout/PaddingValues?, androidx.compose.foundation.layout/PaddingValues?, androidx.compose.foundation.layout/PaddingValues.Absolute?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownPadding // com.mikepenz.markdown.model/markdownPadding|markdownPadding(androidx.compose.ui.unit.Dp;androidx.compose.ui.unit.Dp;androidx.compose.ui.unit.Dp;androidx.compose.ui.unit.Dp;androidx.compose.ui.unit.Dp?;androidx.compose.ui.unit.Dp;androidx.compose.foundation.layout.PaddingValues?;androidx.compose.foundation.layout.PaddingValues?;androidx.compose.foundation.layout.PaddingValues?;androidx.compose.foundation.layout.PaddingValues.Absolute?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
924+
final fun com.mikepenz.markdown.model/parseMarkdown(kotlin/String, kotlin/Boolean = ..., org.intellij.markdown.flavours/MarkdownFlavourDescriptor = ..., org.intellij.markdown.parser/MarkdownParser = ..., com.mikepenz.markdown.model/ReferenceLinkHandler = ...): com.mikepenz.markdown.model/State // com.mikepenz.markdown.model/parseMarkdown|parseMarkdown(kotlin.String;kotlin.Boolean;org.intellij.markdown.flavours.MarkdownFlavourDescriptor;org.intellij.markdown.parser.MarkdownParser;com.mikepenz.markdown.model.ReferenceLinkHandler){}[0]
924925
final fun com.mikepenz.markdown.model/parseMarkdownFlow(kotlin/String, kotlin/Boolean = ..., org.intellij.markdown.flavours/MarkdownFlavourDescriptor = ..., org.intellij.markdown.parser/MarkdownParser = ..., com.mikepenz.markdown.model/ReferenceLinkHandler = ...): kotlinx.coroutines.flow/Flow<com.mikepenz.markdown.model/State> // com.mikepenz.markdown.model/parseMarkdownFlow|parseMarkdownFlow(kotlin.String;kotlin.Boolean;org.intellij.markdown.flavours.MarkdownFlavourDescriptor;org.intellij.markdown.parser.MarkdownParser;com.mikepenz.markdown.model.ReferenceLinkHandler){}[0]
925926
final fun com.mikepenz.markdown.model/rememberMarkdownState(kotlin/Array<out kotlin/Any?>..., kotlin/Boolean, kotlin/Boolean, org.intellij.markdown.flavours/MarkdownFlavourDescriptor?, org.intellij.markdown.parser/MarkdownParser?, com.mikepenz.markdown.model/ReferenceLinkHandler?, kotlin.coroutines/SuspendFunction0<kotlin/String>, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownState // com.mikepenz.markdown.model/rememberMarkdownState|rememberMarkdownState(kotlin.Array<out|kotlin.Any?>...;kotlin.Boolean;kotlin.Boolean;org.intellij.markdown.flavours.MarkdownFlavourDescriptor?;org.intellij.markdown.parser.MarkdownParser?;com.mikepenz.markdown.model.ReferenceLinkHandler?;kotlin.coroutines.SuspendFunction0<kotlin.String>;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]
926927
final fun com.mikepenz.markdown.model/rememberMarkdownState(kotlin/String, kotlin/Boolean, kotlin/Boolean, org.intellij.markdown.flavours/MarkdownFlavourDescriptor?, org.intellij.markdown.parser/MarkdownParser?, com.mikepenz.markdown.model/ReferenceLinkHandler?, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownState // com.mikepenz.markdown.model/rememberMarkdownState|rememberMarkdownState(kotlin.String;kotlin.Boolean;kotlin.Boolean;org.intellij.markdown.flavours.MarkdownFlavourDescriptor?;org.intellij.markdown.parser.MarkdownParser?;com.mikepenz.markdown.model.ReferenceLinkHandler?;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0]

0 commit comments

Comments
 (0)