diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a1a0c792..5c533d45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - name: Checkout the repo uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: 'zulu' java-version: | @@ -36,7 +36,7 @@ jobs: run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - name: Setup Gradle - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 - name: Cache konan uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 @@ -74,7 +74,7 @@ jobs: with: fetch-depth: 100 - - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: 'zulu' java-version: | @@ -82,13 +82,13 @@ jobs: 21 - name: Validate gradle wrapper - uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + uses: gradle/actions/wrapper-validation@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 - name: Copy CI gradle.properties run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - name: Setup Gradle - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 - name: Build Debug run: | @@ -101,7 +101,7 @@ jobs: - name: Publish Test Report if: false && (failure() || success()) && github.event_name == 'pull_request' - uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6.4.2 + uses: mikepenz/action-junit-report@b7b80d7ac5b1da46d6aaff9fb57ad50d8453bcb3 # v6.6.0 with: report_paths: '**/sample/android/build/test-results/testDebugUnitTest/TEST-*.xml' github_token: ${{ secrets.GITHUB_TOKEN }} @@ -134,8 +134,8 @@ jobs: done - name: Upload Lint SARIF - if: always() && github.event_name == 'pull_request' - uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7 + if: always() && github.event_name == 'pull_request' && hashFiles('sarif-reports/*.sarif') != '' + uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: sarif_file: 'sarif-reports' category: android-lint @@ -188,7 +188,7 @@ jobs: - name: Build Changelog id: github_release - uses: mikepenz/release-changelog-builder-action@c9bcd8238b6f41e05561348339429d360b1c0247 # v6.2.3 + uses: mikepenz/release-changelog-builder-action@aa013739bbc8e7067dbbecd4525ff11aeb51a84b # v6.4.0 with: configuration: ".github/config/configuration.json" ignorePreReleases: ${{ !contains(github.ref, '-') }} diff --git a/.github/workflows/gradle-dependency-submission.yml b/.github/workflows/gradle-dependency-submission.yml index 68cd239d..9bf1cc09 100644 --- a/.github/workflows/gradle-dependency-submission.yml +++ b/.github/workflows/gradle-dependency-submission.yml @@ -15,7 +15,7 @@ jobs: - name: 'Checkout Repository' uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: 'zulu' java-version: | @@ -26,6 +26,6 @@ jobs: run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties - name: Setup Gradle & Submit dependency graphs - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 with: dependency-graph: generate-and-submit \ No newline at end of file diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index 53407899..fb4cefeb 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -31,6 +31,6 @@ jobs: publish_results: true - name: "Upload to code scanning" - uses: github/codeql-action/upload-sarif@ff2f1c621b7f889edc0d3c761ac2e6a3f8cdb0dd # v4.37.7 + uses: github/codeql-action/upload-sarif@2892aa5e19bbd11bc0cff5427e3b750a04d9e3c2 # v4.38.2 with: sarif_file: results.sarif diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index c7788658..d464c213 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -33,14 +33,14 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 - name: Setup Pages uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 - - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + - uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1 with: distribution: 'zulu' java-version: | 17 21 - name: Setup Gradle - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + uses: gradle/actions/setup-gradle@3f5f9adaf7d9fecd50b5935e54106014257a94e6 # v6.4.0 - name: Build Page run: | ./gradlew sample:web:wasmJsBrowserDistribution --no-configuration-cache @@ -52,4 +52,4 @@ jobs: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 \ No newline at end of file + uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1 \ No newline at end of file diff --git a/MIGRATION.md b/MIGRATION.md index c2339fbc..486315d1 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -1,5 +1,20 @@ ### Upgrade Notes +#### Unreleased + +- **New Feature**: GFM `==highlight==` spans render with theme-aware foreground and background + colors, including nested inline formatting. Configure `highlightText` and `highlightBackground` + through `markdownColor(...)` (M2 + M3), or override `highlightSpanStyle` in `annotatorSettings(...)`. +- **Bug Fix**: Preserve literal equals signs parsed as `GFMTokenTypes.EQUALS` by JetBrains Markdown + 0.7.15 and later. +- **Breaking Change**: Custom `MarkdownColors` implementations must provide `highlightText` and + `highlightBackground`. Custom `AnnotatorSettings` implementations must provide `highlightSpanStyle`. + Direct callers of `DefaultMarkdownColors` and `DefaultAnnotatorSettings` must supply these values. +- **Signature Changes**: The M2/M3 `markdownColor(...)` and `annotatorSettings(...)` functions gain + trailing highlight parameters. Recompile consumers against the updated API. +- The deprecated `buildMarkdownAnnotatedString` overload keeps the base text style for highlights; + use the overload accepting `AnnotatorSettings` to configure a highlight background. + #### Version 0.45.0 - **Dependency Upgrade**: Coil 3.5.0 → 3.6.0 @@ -222,4 +237,4 @@ annotator = markdownAnnotator( Unfortunately no upgrade notes were provided for the releases prior to 0.32.0. See the release notes available on GitHub for more -details: https://github.com/mikepenz/multiplatform-markdown-renderer/releases \ No newline at end of file +details: https://github.com/mikepenz/multiplatform-markdown-renderer/releases diff --git a/gradle.properties b/gradle.properties index 39545685..ebb917e5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,7 @@ # Maven stuff GROUP=com.mikepenz -VERSION_NAME=0.45.0 -VERSION_CODE=4500 +VERSION_NAME=0.46.0 +VERSION_CODE=4600 # POM_URL=https://github.com/mikepenz/multiplatform-markdown-renderer POM_SCM_URL=https://github.com/mikepenz/multiplatform-markdown-renderer @@ -25,7 +25,6 @@ org.gradle.caching=true android.useAndroidX=true # kotlin.mpp.stability.nowarn=true -kotlin.mpp.androidSourceSetLayoutVersion=2 kotlin.native.ignoreDisabledTargets=true kotlin.native.enableKlibsCrossCompilation=true kotlin.suppressGradlePluginWarnings=IncorrectCompileOnlyDependencyWarning @@ -43,4 +42,4 @@ com.mikepenz.version-catalog-update.enabled=true com.mikepenz.compatPatrouille.enabled=false com.mikepenz.kotlin.version=2.2 com.mikepenz.kotlin.warningsAsErrors.enabled=false -com.mikepenz.java.version=21 \ No newline at end of file +com.mikepenz.java.version=21 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d4a9e0d0..e9cc2da2 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,16 +1,15 @@ [versions] androidx-activityCompose = "1.13.0" -coil = "3.6.0" +coil = "3.6.3" coil2 = "2.7.0" -markdown = "0.7.9" -ktor = "3.5.2" +markdown = "0.7.17" +ktor = "3.6.0" highlights = "1.1.0" [libraries] androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "androidx-activityCompose" } coil-core = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coil" } coil-svg = { module = "io.coil-kt.coil3:coil-svg", version.ref = "coil" } -coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coil" } coil-network-ktor = { module = "io.coil-kt.coil3:coil-network-ktor3", version.ref = "coil" } coil2-core = { module = "io.coil-kt:coil-compose", version.ref = "coil2" } markdown = { module = "org.jetbrains:markdown", version.ref = "markdown" } @@ -19,9 +18,3 @@ ktor-client-darwin = { module = "io.ktor:ktor-client-darwin", version.ref = "kto ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" } ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" } highlights = { module = "dev.snipme:highlights", version.ref = "highlights" } - -[bundles] -coil = [ - "coil-core", - "coil-network-okhttp", -] diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index eddabd2e..9fa7f288 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ad7845be..2e7bb9fd 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.8.1-bin.zip networkTimeout=10000 retries=0 retryBackOffMs=500 diff --git a/gradlew.bat b/gradlew.bat index 8508ef68..03754c4c 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -26,6 +26,33 @@ @rem Set local scope for the variables, and ensure extensions are enabled setlocal EnableExtensions +@rem Catch executions from older scripts and ensure they exit cleanly. +@rem This can be removed once we can be reasonably confident that few people +@rem will be migrating directly to this new wrapper. +goto afterSafetyNet +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +goto exitWithErrorLevel +:afterSafetyNet + set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @rem This is normally unused @@ -45,13 +72,14 @@ set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if %ERRORLEVEL% equ 0 goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. "%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -59,13 +87,14 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto execute -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 +1>&2 echo. +1>&2 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +1>&2 echo. +1>&2 echo Please set the JAVA_HOME variable in your environment to match the +1>&2 echo location of your Java installation. "%COMSPEC%" /c exit 1 +goto exitWithErrorLevel :execute @rem Setup the command line @@ -75,8 +104,9 @@ echo location of your Java installation. 1>&2 @rem Execute gradlew @rem endlocal doesn't take effect until after the line is parsed and variables are expanded @rem which allows us to clear the local environment before executing the java command -endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel & goto exitWithErrorLevel +@rem This label must not be changed. We rely on old scripts being able to jump to this point. :exitWithErrorLevel @rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts "%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/multiplatform-markdown-renderer-coil3/build.gradle.kts b/multiplatform-markdown-renderer-coil3/build.gradle.kts index 9734ccd8..c5e7c8cf 100644 --- a/multiplatform-markdown-renderer-coil3/build.gradle.kts +++ b/multiplatform-markdown-renderer-coil3/build.gradle.kts @@ -11,10 +11,7 @@ kotlin { sourceSets { commonMain.dependencies { api(projects.multiplatformMarkdownRenderer) - api(libs.coil.core.get().toString()) { - exclude(group = "org.jetbrains.compose.runtime") - } - compileOnly(baseLibs.jetbrains.compose.runtime) + api(libs.coil.core) } } } diff --git a/multiplatform-markdown-renderer-m2/api/jvm/multiplatform-markdown-renderer-m2.api b/multiplatform-markdown-renderer-m2/api/jvm/multiplatform-markdown-renderer-m2.api index 91002b3e..604ae8d7 100644 --- a/multiplatform-markdown-renderer-m2/api/jvm/multiplatform-markdown-renderer-m2.api +++ b/multiplatform-markdown-renderer-m2/api/jvm/multiplatform-markdown-renderer-m2.api @@ -11,7 +11,7 @@ public final class com/mikepenz/markdown/m2/ComposableSingletons$MarkdownKt { } public final class com/mikepenz/markdown/m2/MarkdownColorsKt { - public static final fun markdownColor-BI4oR5s (JJJJJZLcom/mikepenz/markdown/model/MarkdownAlertColors;Landroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/model/MarkdownColors; + public static final fun markdownColor-waQFBJk (JJJJJZLcom/mikepenz/markdown/model/MarkdownAlertColors;JJLandroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/model/MarkdownColors; } public final class com/mikepenz/markdown/m2/MarkdownKt { diff --git a/multiplatform-markdown-renderer-m2/api/multiplatform-markdown-renderer-m2.klib.api b/multiplatform-markdown-renderer-m2/api/multiplatform-markdown-renderer-m2.klib.api index 4295e5d2..3db23c3f 100644 --- a/multiplatform-markdown-renderer-m2/api/multiplatform-markdown-renderer-m2.klib.api +++ b/multiplatform-markdown-renderer-m2/api/multiplatform-markdown-renderer-m2.klib.api @@ -11,5 +11,5 @@ final fun com.mikepenz.markdown.m2/Markdown(com.mikepenz.markdown.model/Markdown final fun com.mikepenz.markdown.m2/Markdown(com.mikepenz.markdown.model/State, com.mikepenz.markdown.model/MarkdownColors?, com.mikepenz.markdown.model/MarkdownTypography?, androidx.compose.ui/Modifier?, com.mikepenz.markdown.model/MarkdownPadding?, com.mikepenz.markdown.model/MarkdownDimens?, com.mikepenz.markdown.model/ImageTransformer?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/MarkdownExtendedSpans?, com.mikepenz.markdown.model/MarkdownInlineContent?, com.mikepenz.markdown.compose.components/MarkdownComponents?, com.mikepenz.markdown.model/MarkdownAnimations?, kotlin/Function3?, kotlin/Function5?, kotlin/Function3?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // com.mikepenz.markdown.m2/Markdown|Markdown(com.mikepenz.markdown.model.State;com.mikepenz.markdown.model.MarkdownColors?;com.mikepenz.markdown.model.MarkdownTypography?;androidx.compose.ui.Modifier?;com.mikepenz.markdown.model.MarkdownPadding?;com.mikepenz.markdown.model.MarkdownDimens?;com.mikepenz.markdown.model.ImageTransformer?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.MarkdownExtendedSpans?;com.mikepenz.markdown.model.MarkdownInlineContent?;com.mikepenz.markdown.compose.components.MarkdownComponents?;com.mikepenz.markdown.model.MarkdownAnimations?;kotlin.Function3?;kotlin.Function5?;kotlin.Function3?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.m2/Markdown(com.mikepenz.markdown.model/StreamingMarkdownState, com.mikepenz.markdown.model/MarkdownColors?, com.mikepenz.markdown.model/MarkdownTypography?, androidx.compose.ui/Modifier?, com.mikepenz.markdown.model/MarkdownPadding?, com.mikepenz.markdown.model/MarkdownDimens?, com.mikepenz.markdown.model/ImageTransformer?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/MarkdownExtendedSpans?, com.mikepenz.markdown.model/MarkdownInlineContent?, com.mikepenz.markdown.compose.components/MarkdownComponents?, com.mikepenz.markdown.model/MarkdownAnimations?, kotlin/Function5?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // com.mikepenz.markdown.m2/Markdown|Markdown(com.mikepenz.markdown.model.StreamingMarkdownState;com.mikepenz.markdown.model.MarkdownColors?;com.mikepenz.markdown.model.MarkdownTypography?;androidx.compose.ui.Modifier?;com.mikepenz.markdown.model.MarkdownPadding?;com.mikepenz.markdown.model.MarkdownDimens?;com.mikepenz.markdown.model.ImageTransformer?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.MarkdownExtendedSpans?;com.mikepenz.markdown.model.MarkdownInlineContent?;com.mikepenz.markdown.compose.components.MarkdownComponents?;com.mikepenz.markdown.model.MarkdownAnimations?;kotlin.Function5?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.m2/Markdown(kotlin/String, com.mikepenz.markdown.model/MarkdownColors?, com.mikepenz.markdown.model/MarkdownTypography?, androidx.compose.ui/Modifier?, com.mikepenz.markdown.model/MarkdownPadding?, com.mikepenz.markdown.model/MarkdownDimens?, org.intellij.markdown.flavours/MarkdownFlavourDescriptor?, org.intellij.markdown.parser/MarkdownParser?, com.mikepenz.markdown.model/ImageTransformer?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/MarkdownExtendedSpans?, com.mikepenz.markdown.model/MarkdownInlineContent?, com.mikepenz.markdown.compose.components/MarkdownComponents?, com.mikepenz.markdown.model/MarkdownAnimations?, com.mikepenz.markdown.model/ReferenceLinkHandler?, kotlin/Function3?, kotlin/Function5?, kotlin/Function3?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // com.mikepenz.markdown.m2/Markdown|Markdown(kotlin.String;com.mikepenz.markdown.model.MarkdownColors?;com.mikepenz.markdown.model.MarkdownTypography?;androidx.compose.ui.Modifier?;com.mikepenz.markdown.model.MarkdownPadding?;com.mikepenz.markdown.model.MarkdownDimens?;org.intellij.markdown.flavours.MarkdownFlavourDescriptor?;org.intellij.markdown.parser.MarkdownParser?;com.mikepenz.markdown.model.ImageTransformer?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.MarkdownExtendedSpans?;com.mikepenz.markdown.model.MarkdownInlineContent?;com.mikepenz.markdown.compose.components.MarkdownComponents?;com.mikepenz.markdown.model.MarkdownAnimations?;com.mikepenz.markdown.model.ReferenceLinkHandler?;kotlin.Function3?;kotlin.Function5?;kotlin.Function3?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun com.mikepenz.markdown.m2/markdownColor(androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, kotlin/Boolean, com.mikepenz.markdown.model/MarkdownAlertColors?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownColors // com.mikepenz.markdown.m2/markdownColor|markdownColor(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;kotlin.Boolean;com.mikepenz.markdown.model.MarkdownAlertColors?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun com.mikepenz.markdown.m2/markdownColor(androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, kotlin/Boolean, com.mikepenz.markdown.model/MarkdownAlertColors?, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownColors // com.mikepenz.markdown.m2/markdownColor|markdownColor(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;kotlin.Boolean;com.mikepenz.markdown.model.MarkdownAlertColors?;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.m2/markdownTypography(androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextLinkStyles?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownTypography // com.mikepenz.markdown.m2/markdownTypography|markdownTypography(androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextLinkStyles?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] diff --git a/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/Markdown.kt b/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/Markdown.kt index c4e7f52d..32fd5f1c 100644 --- a/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/Markdown.kt +++ b/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/Markdown.kt @@ -33,6 +33,7 @@ import com.mikepenz.markdown.model.markdownInlineContent import com.mikepenz.markdown.model.markdownPadding import org.intellij.markdown.flavours.MarkdownFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser @@ -67,7 +68,7 @@ fun Markdown( padding: MarkdownPadding = markdownPadding(), dimens: MarkdownDimens = markdownDimens(), flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), - parser: MarkdownParser = MarkdownParser(flavour), + parser: MarkdownParser = MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable), imageTransformer: ImageTransformer = NoOpImageTransformerImpl(), annotator: MarkdownAnnotator = markdownAnnotator(), extendedSpans: MarkdownExtendedSpans = markdownExtendedSpans(), diff --git a/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/MarkdownColors.kt b/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/MarkdownColors.kt index 00cdf5d3..945da280 100644 --- a/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/MarkdownColors.kt +++ b/multiplatform-markdown-renderer-m2/src/commonMain/kotlin/com/mikepenz/markdown/m2/MarkdownColors.kt @@ -17,6 +17,8 @@ fun markdownColor( tableBackground: Color = MaterialTheme.colors.onBackground.copy(alpha = 0.02f), darkTheme: Boolean = !MaterialTheme.colors.isLight, alert: MarkdownAlertColors = markdownAlertColors(darkTheme), + highlightText: Color = MaterialTheme.colors.onSecondary, + highlightBackground: Color = MaterialTheme.colors.secondary, ): MarkdownColors = DefaultMarkdownColors( text = text, codeBackground = codeBackground, @@ -24,4 +26,6 @@ fun markdownColor( dividerColor = dividerColor, tableBackground = tableBackground, alert = alert, + highlightText = highlightText, + highlightBackground = highlightBackground, ) diff --git a/multiplatform-markdown-renderer-m3/api/jvm/multiplatform-markdown-renderer-m3.api b/multiplatform-markdown-renderer-m3/api/jvm/multiplatform-markdown-renderer-m3.api index 774a3e52..0e501b1e 100644 --- a/multiplatform-markdown-renderer-m3/api/jvm/multiplatform-markdown-renderer-m3.api +++ b/multiplatform-markdown-renderer-m3/api/jvm/multiplatform-markdown-renderer-m3.api @@ -11,7 +11,7 @@ public final class com/mikepenz/markdown/m3/ComposableSingletons$MarkdownKt { } public final class com/mikepenz/markdown/m3/MarkdownColorsKt { - public static final fun markdownColor-BI4oR5s (JJJJJZLcom/mikepenz/markdown/model/MarkdownAlertColors;Landroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/model/MarkdownColors; + public static final fun markdownColor-waQFBJk (JJJJJZLcom/mikepenz/markdown/model/MarkdownAlertColors;JJLandroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/model/MarkdownColors; } public final class com/mikepenz/markdown/m3/MarkdownKt { diff --git a/multiplatform-markdown-renderer-m3/api/multiplatform-markdown-renderer-m3.klib.api b/multiplatform-markdown-renderer-m3/api/multiplatform-markdown-renderer-m3.klib.api index ac1f2ab2..176ff4ae 100644 --- a/multiplatform-markdown-renderer-m3/api/multiplatform-markdown-renderer-m3.klib.api +++ b/multiplatform-markdown-renderer-m3/api/multiplatform-markdown-renderer-m3.klib.api @@ -11,5 +11,5 @@ final fun com.mikepenz.markdown.m3/Markdown(com.mikepenz.markdown.model/Markdown final fun com.mikepenz.markdown.m3/Markdown(com.mikepenz.markdown.model/State, com.mikepenz.markdown.model/MarkdownColors?, com.mikepenz.markdown.model/MarkdownTypography?, androidx.compose.ui/Modifier?, com.mikepenz.markdown.model/MarkdownPadding?, com.mikepenz.markdown.model/MarkdownDimens?, com.mikepenz.markdown.model/ImageTransformer?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/MarkdownExtendedSpans?, com.mikepenz.markdown.model/MarkdownInlineContent?, com.mikepenz.markdown.compose.components/MarkdownComponents?, com.mikepenz.markdown.model/MarkdownAnimations?, kotlin/Function3?, kotlin/Function5?, kotlin/Function3?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // com.mikepenz.markdown.m3/Markdown|Markdown(com.mikepenz.markdown.model.State;com.mikepenz.markdown.model.MarkdownColors?;com.mikepenz.markdown.model.MarkdownTypography?;androidx.compose.ui.Modifier?;com.mikepenz.markdown.model.MarkdownPadding?;com.mikepenz.markdown.model.MarkdownDimens?;com.mikepenz.markdown.model.ImageTransformer?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.MarkdownExtendedSpans?;com.mikepenz.markdown.model.MarkdownInlineContent?;com.mikepenz.markdown.compose.components.MarkdownComponents?;com.mikepenz.markdown.model.MarkdownAnimations?;kotlin.Function3?;kotlin.Function5?;kotlin.Function3?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.m3/Markdown(com.mikepenz.markdown.model/StreamingMarkdownState, com.mikepenz.markdown.model/MarkdownColors?, com.mikepenz.markdown.model/MarkdownTypography?, androidx.compose.ui/Modifier?, com.mikepenz.markdown.model/MarkdownPadding?, com.mikepenz.markdown.model/MarkdownDimens?, com.mikepenz.markdown.model/ImageTransformer?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/MarkdownExtendedSpans?, com.mikepenz.markdown.model/MarkdownInlineContent?, com.mikepenz.markdown.compose.components/MarkdownComponents?, com.mikepenz.markdown.model/MarkdownAnimations?, kotlin/Function5?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // com.mikepenz.markdown.m3/Markdown|Markdown(com.mikepenz.markdown.model.StreamingMarkdownState;com.mikepenz.markdown.model.MarkdownColors?;com.mikepenz.markdown.model.MarkdownTypography?;androidx.compose.ui.Modifier?;com.mikepenz.markdown.model.MarkdownPadding?;com.mikepenz.markdown.model.MarkdownDimens?;com.mikepenz.markdown.model.ImageTransformer?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.MarkdownExtendedSpans?;com.mikepenz.markdown.model.MarkdownInlineContent?;com.mikepenz.markdown.compose.components.MarkdownComponents?;com.mikepenz.markdown.model.MarkdownAnimations?;kotlin.Function5?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.m3/Markdown(kotlin/String, com.mikepenz.markdown.model/MarkdownColors?, com.mikepenz.markdown.model/MarkdownTypography?, androidx.compose.ui/Modifier?, com.mikepenz.markdown.model/MarkdownPadding?, com.mikepenz.markdown.model/MarkdownDimens?, org.intellij.markdown.flavours/MarkdownFlavourDescriptor?, org.intellij.markdown.parser/MarkdownParser?, com.mikepenz.markdown.model/ImageTransformer?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/MarkdownExtendedSpans?, com.mikepenz.markdown.model/MarkdownInlineContent?, com.mikepenz.markdown.compose.components/MarkdownComponents?, com.mikepenz.markdown.model/MarkdownAnimations?, com.mikepenz.markdown.model/ReferenceLinkHandler?, kotlin/Function3?, kotlin/Function5?, kotlin/Function3?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int) // com.mikepenz.markdown.m3/Markdown|Markdown(kotlin.String;com.mikepenz.markdown.model.MarkdownColors?;com.mikepenz.markdown.model.MarkdownTypography?;androidx.compose.ui.Modifier?;com.mikepenz.markdown.model.MarkdownPadding?;com.mikepenz.markdown.model.MarkdownDimens?;org.intellij.markdown.flavours.MarkdownFlavourDescriptor?;org.intellij.markdown.parser.MarkdownParser?;com.mikepenz.markdown.model.ImageTransformer?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.MarkdownExtendedSpans?;com.mikepenz.markdown.model.MarkdownInlineContent?;com.mikepenz.markdown.compose.components.MarkdownComponents?;com.mikepenz.markdown.model.MarkdownAnimations?;com.mikepenz.markdown.model.ReferenceLinkHandler?;kotlin.Function3?;kotlin.Function5?;kotlin.Function3?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] -final fun com.mikepenz.markdown.m3/markdownColor(androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, kotlin/Boolean, com.mikepenz.markdown.model/MarkdownAlertColors?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownColors // com.mikepenz.markdown.m3/markdownColor|markdownColor(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;kotlin.Boolean;com.mikepenz.markdown.model.MarkdownAlertColors?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun com.mikepenz.markdown.m3/markdownColor(androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, kotlin/Boolean, com.mikepenz.markdown.model/MarkdownAlertColors?, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownColors // com.mikepenz.markdown.m3/markdownColor|markdownColor(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;kotlin.Boolean;com.mikepenz.markdown.model.MarkdownAlertColors?;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.m3/markdownTypography(androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextLinkStyles?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int, kotlin/Int): com.mikepenz.markdown.model/MarkdownTypography // com.mikepenz.markdown.m3/markdownTypography|markdownTypography(androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextLinkStyles?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int;kotlin.Int){}[0] diff --git a/multiplatform-markdown-renderer-m3/build.gradle.kts b/multiplatform-markdown-renderer-m3/build.gradle.kts index 3d56142c..291f054b 100644 --- a/multiplatform-markdown-renderer-m3/build.gradle.kts +++ b/multiplatform-markdown-renderer-m3/build.gradle.kts @@ -20,9 +20,8 @@ kotlin { implementation(kotlin("test")) implementation(kotlin("test-junit")) implementation(compose.desktop.currentOs) - implementation(compose.material3) - @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) - implementation(compose.uiTest) + implementation(baseLibs.jetbrains.compose.material3) + implementation(baseLibs.jetbrains.compose.ui.test) } } } diff --git a/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/Markdown.kt b/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/Markdown.kt index a24cefea..7cde8936 100644 --- a/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/Markdown.kt +++ b/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/Markdown.kt @@ -33,6 +33,7 @@ import com.mikepenz.markdown.model.markdownInlineContent import com.mikepenz.markdown.model.markdownPadding import org.intellij.markdown.flavours.MarkdownFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser @@ -67,7 +68,7 @@ fun Markdown( padding: MarkdownPadding = markdownPadding(), dimens: MarkdownDimens = markdownDimens(), flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), - parser: MarkdownParser = MarkdownParser(flavour), + parser: MarkdownParser = MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable), imageTransformer: ImageTransformer = NoOpImageTransformerImpl(), annotator: MarkdownAnnotator = markdownAnnotator(), extendedSpans: MarkdownExtendedSpans = markdownExtendedSpans(), diff --git a/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/MarkdownColors.kt b/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/MarkdownColors.kt index 1a8e7809..e91620fc 100644 --- a/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/MarkdownColors.kt +++ b/multiplatform-markdown-renderer-m3/src/commonMain/kotlin/com/mikepenz/markdown/m3/MarkdownColors.kt @@ -19,6 +19,8 @@ fun markdownColor( /** Material 3 has no `isLight` flag; derive it from the background so alerts follow the theme. */ darkTheme: Boolean = MaterialTheme.colorScheme.background.luminance() < 0.5f, alert: MarkdownAlertColors = markdownAlertColors(darkTheme), + highlightText: Color = MaterialTheme.colorScheme.onSecondaryContainer, + highlightBackground: Color = MaterialTheme.colorScheme.secondaryContainer, ): MarkdownColors = DefaultMarkdownColors( text = text, codeBackground = codeBackground, @@ -26,4 +28,6 @@ fun markdownColor( dividerColor = dividerColor, tableBackground = tableBackground, alert = alert, + highlightText = highlightText, + highlightBackground = highlightBackground, ) diff --git a/multiplatform-markdown-renderer/api/jvm/multiplatform-markdown-renderer.api b/multiplatform-markdown-renderer/api/jvm/multiplatform-markdown-renderer.api index 634de473..8118d3e2 100644 --- a/multiplatform-markdown-renderer/api/jvm/multiplatform-markdown-renderer.api +++ b/multiplatform-markdown-renderer/api/jvm/multiplatform-markdown-renderer.api @@ -14,21 +14,23 @@ public final class com/mikepenz/markdown/annotator/AnnotatedStringKtxKt { public abstract interface class com/mikepenz/markdown/annotator/AnnotatorSettings { public abstract fun getAnnotator ()Lcom/mikepenz/markdown/model/MarkdownAnnotator; public abstract fun getCodeSpanStyle ()Landroidx/compose/ui/text/SpanStyle; + public abstract fun getHighlightSpanStyle ()Landroidx/compose/ui/text/SpanStyle; public abstract fun getLinkInteractionListener ()Landroidx/compose/ui/text/LinkInteractionListener; public abstract fun getLinkTextSpanStyle ()Landroidx/compose/ui/text/TextLinkStyles; public abstract fun getReferenceLinkHandler ()Lcom/mikepenz/markdown/model/ReferenceLinkHandler; } public final class com/mikepenz/markdown/annotator/AnnotatorSettingsKt { - public static final fun annotatorSettings (Landroidx/compose/ui/text/TextLinkStyles;Landroidx/compose/ui/text/SpanStyle;Lcom/mikepenz/markdown/model/MarkdownAnnotator;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;Landroidx/compose/ui/platform/UriHandler;Landroidx/compose/ui/text/LinkInteractionListener;Landroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/annotator/AnnotatorSettings; + public static final fun annotatorSettings (Landroidx/compose/ui/text/TextLinkStyles;Landroidx/compose/ui/text/SpanStyle;Lcom/mikepenz/markdown/model/MarkdownAnnotator;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;Landroidx/compose/ui/platform/UriHandler;Landroidx/compose/ui/text/LinkInteractionListener;Landroidx/compose/ui/text/SpanStyle;Landroidx/compose/runtime/Composer;II)Lcom/mikepenz/markdown/annotator/AnnotatorSettings; } public final class com/mikepenz/markdown/annotator/DefaultAnnotatorSettings : com/mikepenz/markdown/annotator/AnnotatorSettings { public static final field $stable I - public fun (Landroidx/compose/ui/text/TextLinkStyles;Landroidx/compose/ui/text/SpanStyle;Lcom/mikepenz/markdown/model/MarkdownAnnotator;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;Landroidx/compose/ui/text/LinkInteractionListener;)V - public synthetic fun (Landroidx/compose/ui/text/TextLinkStyles;Landroidx/compose/ui/text/SpanStyle;Lcom/mikepenz/markdown/model/MarkdownAnnotator;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;Landroidx/compose/ui/text/LinkInteractionListener;ILkotlin/jvm/internal/DefaultConstructorMarker;)V + public fun (Landroidx/compose/ui/text/TextLinkStyles;Landroidx/compose/ui/text/SpanStyle;Lcom/mikepenz/markdown/model/MarkdownAnnotator;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;Landroidx/compose/ui/text/LinkInteractionListener;Landroidx/compose/ui/text/SpanStyle;)V + public synthetic fun (Landroidx/compose/ui/text/TextLinkStyles;Landroidx/compose/ui/text/SpanStyle;Lcom/mikepenz/markdown/model/MarkdownAnnotator;Lcom/mikepenz/markdown/model/ReferenceLinkHandler;Landroidx/compose/ui/text/LinkInteractionListener;Landroidx/compose/ui/text/SpanStyle;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public fun getAnnotator ()Lcom/mikepenz/markdown/model/MarkdownAnnotator; public fun getCodeSpanStyle ()Landroidx/compose/ui/text/SpanStyle; + public fun getHighlightSpanStyle ()Landroidx/compose/ui/text/SpanStyle; public fun getLinkInteractionListener ()Landroidx/compose/ui/text/LinkInteractionListener; public fun getLinkTextSpanStyle ()Landroidx/compose/ui/text/TextLinkStyles; public fun getReferenceLinkHandler ()Lcom/mikepenz/markdown/model/ReferenceLinkHandler; @@ -290,6 +292,7 @@ public final class com/mikepenz/markdown/compose/extendedspans/ExtendedSpansKt { public final class com/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter : com/mikepenz/markdown/compose/extendedspans/ExtendedSpanPainter { public static final field $stable I public static final field Companion Lcom/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter$Companion; + public fun ()V public synthetic fun (JLcom/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter$Stroke;Lcom/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter$TextPaddingValues;JJILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (JLcom/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter$Stroke;Lcom/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter$TextPaddingValues;JJLkotlin/jvm/internal/DefaultConstructorMarker;)V public fun decorate (Landroidx/compose/ui/text/LinkAnnotation;IILandroidx/compose/ui/text/AnnotatedString;Landroidx/compose/ui/text/AnnotatedString$Builder;)Landroidx/compose/ui/text/LinkAnnotation; @@ -319,6 +322,7 @@ public final class com/mikepenz/markdown/compose/extendedspans/RoundedCornerSpan public final class com/mikepenz/markdown/compose/extendedspans/RoundedCornerSpanPainter$TextPaddingValues { public static final field $stable I + public fun ()V public synthetic fun (JJILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (JJLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-XSAIIZE ()J @@ -348,6 +352,7 @@ public final class com/mikepenz/markdown/compose/extendedspans/SquigglyUnderline public final class com/mikepenz/markdown/compose/extendedspans/SquigglyUnderlineSpanPainter : com/mikepenz/markdown/compose/extendedspans/ExtendedSpanPainter { public static final field $stable I public static final field Companion Lcom/mikepenz/markdown/compose/extendedspans/SquigglyUnderlineSpanPainter$Companion; + public fun ()V public synthetic fun (JJJJLcom/mikepenz/markdown/compose/extendedspans/SquigglyUnderlineAnimator;ILkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun (JJJJLcom/mikepenz/markdown/compose/extendedspans/SquigglyUnderlineAnimator;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public fun decorate (Landroidx/compose/ui/text/LinkAnnotation;IILandroidx/compose/ui/text/AnnotatedString;Landroidx/compose/ui/text/AnnotatedString$Builder;)Landroidx/compose/ui/text/LinkAnnotation; @@ -425,20 +430,24 @@ public final class com/mikepenz/markdown/model/DefaultMarkdownAnnotatorConfig : public final class com/mikepenz/markdown/model/DefaultMarkdownColors : com/mikepenz/markdown/model/MarkdownColors { public static final field $stable I - public synthetic fun (JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;ILkotlin/jvm/internal/DefaultConstructorMarker;)V - public synthetic fun (JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;Lkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;JJILkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;JJLkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-0d7_KjU ()J public final fun component2-0d7_KjU ()J public final fun component3-0d7_KjU ()J public final fun component4-0d7_KjU ()J public final fun component5-0d7_KjU ()J public final fun component6 ()Lcom/mikepenz/markdown/model/MarkdownAlertColors; - public final fun copy-EXAOFh0 (JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;)Lcom/mikepenz/markdown/model/DefaultMarkdownColors; - public static synthetic fun copy-EXAOFh0$default (Lcom/mikepenz/markdown/model/DefaultMarkdownColors;JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;ILjava/lang/Object;)Lcom/mikepenz/markdown/model/DefaultMarkdownColors; + public final fun component7-0d7_KjU ()J + public final fun component8-0d7_KjU ()J + public final fun copy-OA_Z_tI (JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;JJ)Lcom/mikepenz/markdown/model/DefaultMarkdownColors; + public static synthetic fun copy-OA_Z_tI$default (Lcom/mikepenz/markdown/model/DefaultMarkdownColors;JJJJJLcom/mikepenz/markdown/model/MarkdownAlertColors;JJILjava/lang/Object;)Lcom/mikepenz/markdown/model/DefaultMarkdownColors; public fun equals (Ljava/lang/Object;)Z public fun getAlert ()Lcom/mikepenz/markdown/model/MarkdownAlertColors; public fun getCodeBackground-0d7_KjU ()J public fun getDividerColor-0d7_KjU ()J + public fun getHighlightBackground-0d7_KjU ()J + public fun getHighlightText-0d7_KjU ()J public fun getInlineCodeBackground-0d7_KjU ()J public fun getTableBackground-0d7_KjU ()J public fun getText-0d7_KjU ()J @@ -751,6 +760,8 @@ public abstract interface class com/mikepenz/markdown/model/MarkdownColors { public abstract fun getAlert ()Lcom/mikepenz/markdown/model/MarkdownAlertColors; public abstract fun getCodeBackground-0d7_KjU ()J public abstract fun getDividerColor-0d7_KjU ()J + public abstract fun getHighlightBackground-0d7_KjU ()J + public abstract fun getHighlightText-0d7_KjU ()J public abstract fun getInlineCodeBackground-0d7_KjU ()J public abstract fun getTableBackground-0d7_KjU ()J public abstract fun getText-0d7_KjU ()J diff --git a/multiplatform-markdown-renderer/api/multiplatform-markdown-renderer.klib.api b/multiplatform-markdown-renderer/api/multiplatform-markdown-renderer.klib.api index fb54364a..b8222759 100644 --- a/multiplatform-markdown-renderer/api/multiplatform-markdown-renderer.klib.api +++ b/multiplatform-markdown-renderer/api/multiplatform-markdown-renderer.klib.api @@ -52,6 +52,8 @@ abstract interface com.mikepenz.markdown.annotator/AnnotatorSettings { // com.mi abstract fun (): com.mikepenz.markdown.model/MarkdownAnnotator // com.mikepenz.markdown.annotator/AnnotatorSettings.annotator.|(){}[0] abstract val codeSpanStyle // com.mikepenz.markdown.annotator/AnnotatorSettings.codeSpanStyle|{}codeSpanStyle[0] abstract fun (): androidx.compose.ui.text/SpanStyle // com.mikepenz.markdown.annotator/AnnotatorSettings.codeSpanStyle.|(){}[0] + abstract val highlightSpanStyle // com.mikepenz.markdown.annotator/AnnotatorSettings.highlightSpanStyle|{}highlightSpanStyle[0] + abstract fun (): androidx.compose.ui.text/SpanStyle // com.mikepenz.markdown.annotator/AnnotatorSettings.highlightSpanStyle.|(){}[0] abstract val linkInteractionListener // com.mikepenz.markdown.annotator/AnnotatorSettings.linkInteractionListener|{}linkInteractionListener[0] abstract fun (): androidx.compose.ui.text/LinkInteractionListener? // com.mikepenz.markdown.annotator/AnnotatorSettings.linkInteractionListener.|(){}[0] abstract val linkTextSpanStyle // com.mikepenz.markdown.annotator/AnnotatorSettings.linkTextSpanStyle|{}linkTextSpanStyle[0] @@ -205,6 +207,10 @@ abstract interface com.mikepenz.markdown.model/MarkdownColors { // com.mikepenz. abstract fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/MarkdownColors.codeBackground.|(){}[0] abstract val dividerColor // com.mikepenz.markdown.model/MarkdownColors.dividerColor|{}dividerColor[0] abstract fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/MarkdownColors.dividerColor.|(){}[0] + abstract val highlightBackground // com.mikepenz.markdown.model/MarkdownColors.highlightBackground|{}highlightBackground[0] + abstract fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/MarkdownColors.highlightBackground.|(){}[0] + abstract val highlightText // com.mikepenz.markdown.model/MarkdownColors.highlightText|{}highlightText[0] + abstract fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/MarkdownColors.highlightText.|(){}[0] abstract val inlineCodeBackground // com.mikepenz.markdown.model/MarkdownColors.inlineCodeBackground|{}inlineCodeBackground[0] abstract fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/MarkdownColors.inlineCodeBackground.|(){}[0] abstract val tableBackground // com.mikepenz.markdown.model/MarkdownColors.tableBackground|{}tableBackground[0] @@ -423,12 +429,14 @@ abstract class com.mikepenz.markdown.compose.extendedspans/ExtendedSpanPainter { } final class com.mikepenz.markdown.annotator/DefaultAnnotatorSettings : com.mikepenz.markdown.annotator/AnnotatorSettings { // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings|null[0] - constructor (androidx.compose.ui.text/TextLinkStyles, androidx.compose.ui.text/SpanStyle, com.mikepenz.markdown.model/MarkdownAnnotator, com.mikepenz.markdown.model/ReferenceLinkHandler? = ..., androidx.compose.ui.text/LinkInteractionListener? = ...) // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.|(androidx.compose.ui.text.TextLinkStyles;androidx.compose.ui.text.SpanStyle;com.mikepenz.markdown.model.MarkdownAnnotator;com.mikepenz.markdown.model.ReferenceLinkHandler?;androidx.compose.ui.text.LinkInteractionListener?){}[0] + constructor (androidx.compose.ui.text/TextLinkStyles, androidx.compose.ui.text/SpanStyle, com.mikepenz.markdown.model/MarkdownAnnotator, com.mikepenz.markdown.model/ReferenceLinkHandler? = ..., androidx.compose.ui.text/LinkInteractionListener? = ..., androidx.compose.ui.text/SpanStyle) // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.|(androidx.compose.ui.text.TextLinkStyles;androidx.compose.ui.text.SpanStyle;com.mikepenz.markdown.model.MarkdownAnnotator;com.mikepenz.markdown.model.ReferenceLinkHandler?;androidx.compose.ui.text.LinkInteractionListener?;androidx.compose.ui.text.SpanStyle){}[0] final val annotator // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.annotator|{}annotator[0] final fun (): com.mikepenz.markdown.model/MarkdownAnnotator // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.annotator.|(){}[0] final val codeSpanStyle // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.codeSpanStyle|{}codeSpanStyle[0] final fun (): androidx.compose.ui.text/SpanStyle // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.codeSpanStyle.|(){}[0] + final val highlightSpanStyle // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.highlightSpanStyle|{}highlightSpanStyle[0] + final fun (): androidx.compose.ui.text/SpanStyle // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.highlightSpanStyle.|(){}[0] final val linkInteractionListener // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.linkInteractionListener|{}linkInteractionListener[0] final fun (): androidx.compose.ui.text/LinkInteractionListener? // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.linkInteractionListener.|(){}[0] final val linkTextSpanStyle // com.mikepenz.markdown.annotator/DefaultAnnotatorSettings.linkTextSpanStyle|{}linkTextSpanStyle[0] @@ -592,7 +600,7 @@ final class com.mikepenz.markdown.model/DefaultMarkdownAnnotatorConfig : com.mik } final class com.mikepenz.markdown.model/DefaultMarkdownColors : com.mikepenz.markdown.model/MarkdownColors { // com.mikepenz.markdown.model/DefaultMarkdownColors|null[0] - constructor (androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, com.mikepenz.markdown.model/MarkdownAlertColors = ...) // com.mikepenz.markdown.model/DefaultMarkdownColors.|(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;com.mikepenz.markdown.model.MarkdownAlertColors){}[0] + constructor (androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, com.mikepenz.markdown.model/MarkdownAlertColors = ..., androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color) // com.mikepenz.markdown.model/DefaultMarkdownColors.|(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;com.mikepenz.markdown.model.MarkdownAlertColors;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color){}[0] final val alert // com.mikepenz.markdown.model/DefaultMarkdownColors.alert|{}alert[0] final fun (): com.mikepenz.markdown.model/MarkdownAlertColors // com.mikepenz.markdown.model/DefaultMarkdownColors.alert.|(){}[0] @@ -600,6 +608,10 @@ final class com.mikepenz.markdown.model/DefaultMarkdownColors : com.mikepenz.mar final fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.codeBackground.|(){}[0] final val dividerColor // com.mikepenz.markdown.model/DefaultMarkdownColors.dividerColor|{}dividerColor[0] final fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.dividerColor.|(){}[0] + final val highlightBackground // com.mikepenz.markdown.model/DefaultMarkdownColors.highlightBackground|{}highlightBackground[0] + final fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.highlightBackground.|(){}[0] + final val highlightText // com.mikepenz.markdown.model/DefaultMarkdownColors.highlightText|{}highlightText[0] + final fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.highlightText.|(){}[0] final val inlineCodeBackground // com.mikepenz.markdown.model/DefaultMarkdownColors.inlineCodeBackground|{}inlineCodeBackground[0] final fun (): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.inlineCodeBackground.|(){}[0] final val tableBackground // com.mikepenz.markdown.model/DefaultMarkdownColors.tableBackground|{}tableBackground[0] @@ -613,7 +625,9 @@ final class com.mikepenz.markdown.model/DefaultMarkdownColors : com.mikepenz.mar final fun component4(): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.component4|component4(){}[0] final fun component5(): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.component5|component5(){}[0] final fun component6(): com.mikepenz.markdown.model/MarkdownAlertColors // com.mikepenz.markdown.model/DefaultMarkdownColors.component6|component6(){}[0] - final fun copy(androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., com.mikepenz.markdown.model/MarkdownAlertColors = ...): com.mikepenz.markdown.model/DefaultMarkdownColors // com.mikepenz.markdown.model/DefaultMarkdownColors.copy|copy(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;com.mikepenz.markdown.model.MarkdownAlertColors){}[0] + final fun component7(): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.component7|component7(){}[0] + final fun component8(): androidx.compose.ui.graphics/Color // com.mikepenz.markdown.model/DefaultMarkdownColors.component8|component8(){}[0] + final fun copy(androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ..., com.mikepenz.markdown.model/MarkdownAlertColors = ..., androidx.compose.ui.graphics/Color = ..., androidx.compose.ui.graphics/Color = ...): com.mikepenz.markdown.model/DefaultMarkdownColors // com.mikepenz.markdown.model/DefaultMarkdownColors.copy|copy(androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;com.mikepenz.markdown.model.MarkdownAlertColors;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // com.mikepenz.markdown.model/DefaultMarkdownColors.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // com.mikepenz.markdown.model/DefaultMarkdownColors.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // com.mikepenz.markdown.model/DefaultMarkdownColors.toString|toString(){}[0] @@ -994,7 +1008,7 @@ final fun (org.intellij.markdown.ast/ASTNode).com.mikepenz.markdown.utils/findAl final fun (org.intellij.markdown.ast/ASTNode).com.mikepenz.markdown.utils/getUnescapedTextInNode(kotlin/CharSequence): kotlin/String // com.mikepenz.markdown.utils/getUnescapedTextInNode|getUnescapedTextInNode@org.intellij.markdown.ast.ASTNode(kotlin.CharSequence){}[0] final fun (org.intellij.markdown.ast/ASTNode).com.mikepenz.markdown.utils/resolveImageAlt(kotlin/String): kotlin/String? // com.mikepenz.markdown.utils/resolveImageAlt|resolveImageAlt@org.intellij.markdown.ast.ASTNode(kotlin.String){}[0] final fun (org.intellij.markdown.ast/ASTNode).com.mikepenz.markdown.utils/resolveImageLink(kotlin/String, com.mikepenz.markdown.model/ReferenceLinkHandler?): kotlin/String? // com.mikepenz.markdown.utils/resolveImageLink|resolveImageLink@org.intellij.markdown.ast.ASTNode(kotlin.String;com.mikepenz.markdown.model.ReferenceLinkHandler?){}[0] -final fun com.mikepenz.markdown.annotator/annotatorSettings(androidx.compose.ui.text/TextLinkStyles?, androidx.compose.ui.text/SpanStyle?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/ReferenceLinkHandler?, androidx.compose.ui.platform/UriHandler?, androidx.compose.ui.text/LinkInteractionListener?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.annotator/AnnotatorSettings // com.mikepenz.markdown.annotator/annotatorSettings|annotatorSettings(androidx.compose.ui.text.TextLinkStyles?;androidx.compose.ui.text.SpanStyle?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.ReferenceLinkHandler?;androidx.compose.ui.platform.UriHandler?;androidx.compose.ui.text.LinkInteractionListener?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun com.mikepenz.markdown.annotator/annotatorSettings(androidx.compose.ui.text/TextLinkStyles?, androidx.compose.ui.text/SpanStyle?, com.mikepenz.markdown.model/MarkdownAnnotator?, com.mikepenz.markdown.model/ReferenceLinkHandler?, androidx.compose.ui.platform/UriHandler?, androidx.compose.ui.text/LinkInteractionListener?, androidx.compose.ui.text/SpanStyle?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int): com.mikepenz.markdown.annotator/AnnotatorSettings // com.mikepenz.markdown.annotator/annotatorSettings|annotatorSettings(androidx.compose.ui.text.TextLinkStyles?;androidx.compose.ui.text.SpanStyle?;com.mikepenz.markdown.model.MarkdownAnnotator?;com.mikepenz.markdown.model.ReferenceLinkHandler?;androidx.compose.ui.platform.UriHandler?;androidx.compose.ui.text.LinkInteractionListener?;androidx.compose.ui.text.SpanStyle?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun com.mikepenz.markdown.annotator/com_mikepenz_markdown_annotator_DefaultAnnotatorSettings$stableprop_getter(): kotlin/Int // com.mikepenz.markdown.annotator/com_mikepenz_markdown_annotator_DefaultAnnotatorSettings$stableprop_getter|com_mikepenz_markdown_annotator_DefaultAnnotatorSettings$stableprop_getter(){}[0] final fun com.mikepenz.markdown.compose.components/com_mikepenz_markdown_compose_components_CurrentComponentsBridge$stableprop_getter(): kotlin/Int // com.mikepenz.markdown.compose.components/com_mikepenz_markdown_compose_components_CurrentComponentsBridge$stableprop_getter|com_mikepenz_markdown_compose_components_CurrentComponentsBridge$stableprop_getter(){}[0] final fun com.mikepenz.markdown.compose.components/com_mikepenz_markdown_compose_components_MarkdownComponentModel$stableprop_getter(): kotlin/Int // com.mikepenz.markdown.compose.components/com_mikepenz_markdown_compose_components_MarkdownComponentModel$stableprop_getter|com_mikepenz_markdown_compose_components_MarkdownComponentModel$stableprop_getter(){}[0] diff --git a/multiplatform-markdown-renderer/build.gradle.kts b/multiplatform-markdown-renderer/build.gradle.kts index 31a6ce28..9bf3a687 100644 --- a/multiplatform-markdown-renderer/build.gradle.kts +++ b/multiplatform-markdown-renderer/build.gradle.kts @@ -10,6 +10,11 @@ kotlin { } sourceSets { + androidMain.dependencies { + // D8 needs the Compose interfaces on the runtime classpath to desugar + // their calls consistently with the app when its minSdk is below 24. + runtimeOnly(baseLibs.jetbrains.compose.foundation) + } commonMain.dependencies { api(libs.markdown) api(baseLibs.kotlinx.coroutines.core) @@ -23,6 +28,13 @@ kotlin { implementation(kotlin("test")) implementation(baseLibs.kotlinx.coroutines.test) } + jvmTest.dependencies { + implementation(baseLibs.jetbrains.compose.runtime) + implementation(baseLibs.jetbrains.compose.ui) + implementation(baseLibs.jetbrains.compose.foundation) + implementation(baseLibs.jetbrains.compose.ui.test) + implementation(compose.desktop.currentOs) + } } } diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatedStringKtx.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatedStringKtx.kt index 3c13ee4d..e60ce5ee 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatedStringKtx.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatedStringKtx.kt @@ -29,6 +29,7 @@ import org.intellij.markdown.flavours.MarkdownFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMElementTypes import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMTokenTypes +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser /** @@ -62,6 +63,7 @@ fun String.buildMarkdownAnnotatedString( linkTextSpanStyle = TextLinkStyles(style = linkTextSpanStyle), codeSpanStyle = codeSpanStyle, annotator = annotator, + highlightSpanStyle = style.toSpanStyle(), referenceLinkHandler = referenceLinkHandler, linkInteractionListener = linkInteractionListener ), @@ -85,7 +87,10 @@ fun String.buildMarkdownAnnotatedString( flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), ): AnnotatedString { val content = this - val parsedTree = MarkdownParser(flavour).buildMarkdownTreeFromString(content) + val parsedTree = MarkdownParser( + flavour = flavour, + cancellationToken = CancellationToken.NonCancellable, + ).buildMarkdownTreeFromString(content as CharSequence) val textNode = parsedTree.children.firstOrNull { node -> node.type == MarkdownTokenTypes.TEXT || node.type == MarkdownElementTypes.PARAGRAPH } @@ -319,6 +324,14 @@ fun AnnotatedString.Builder.buildMarkdownAnnotatedString( GFMElementTypes.INLINE_MATH, GFMElementTypes.BLOCK_MATH -> append(child.getTextInNode(content)) + GFMElementTypes.HIGHLIGHT -> { + pushStyle(annotatorSettings.highlightSpanStyle) + // Each delimiter consists of two EQUALS tokens. Keep any equals signs + // inside the span, and recursively render its inline formatting. + buildMarkdownAnnotatedString(content, child.children.drop(2).dropLast(2), annotatorSettings) + pop() + } + // Token Types MarkdownTokenTypes.TEXT -> append(child.getUnescapedTextInNode(content)) MarkdownTokenTypes.EMAIL_AUTOLINK -> if (parentType == MarkdownElementTypes.LINK_TEXT) { @@ -330,6 +343,7 @@ fun AnnotatedString.Builder.buildMarkdownAnnotatedString( } else appendAutoLink(content, child, annotatorSettings) GFMTokenTypes.DOLLAR -> append('$') + GFMTokenTypes.EQUALS -> append('=') MarkdownTokenTypes.SINGLE_QUOTE -> append('\'') MarkdownTokenTypes.DOUBLE_QUOTE -> append('\"') diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatorSettings.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatorSettings.kt index 4912d09a..878c3b2e 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatorSettings.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/annotator/AnnotatorSettings.kt @@ -10,11 +10,13 @@ import androidx.compose.ui.text.LinkInteractionListener import androidx.compose.ui.text.SpanStyle import androidx.compose.ui.text.TextLinkStyles import com.mikepenz.markdown.compose.LocalMarkdownAnnotator +import com.mikepenz.markdown.compose.LocalMarkdownColors import com.mikepenz.markdown.compose.LocalMarkdownTypography import com.mikepenz.markdown.compose.LocalReferenceLinkHandler import com.mikepenz.markdown.model.MarkdownAnnotator import com.mikepenz.markdown.model.ReferenceLinkHandler import com.mikepenz.markdown.utils.codeSpanStyle +import com.mikepenz.markdown.utils.highlightSpanStyle @Stable interface AnnotatorSettings { @@ -24,6 +26,9 @@ interface AnnotatorSettings { /** Represents the [SpanStyle] applied onto code inline blocks within this annotated string */ val codeSpanStyle: SpanStyle + /** Represents the [SpanStyle] applied to GFM `==highlight==` spans. */ + val highlightSpanStyle: SpanStyle + /** Provides custom interception logic for building this annotated string */ val annotator: MarkdownAnnotator @@ -41,6 +46,7 @@ class DefaultAnnotatorSettings( override val annotator: MarkdownAnnotator, override val referenceLinkHandler: ReferenceLinkHandler? = null, override val linkInteractionListener: LinkInteractionListener? = null, + override val highlightSpanStyle: SpanStyle, ) : AnnotatorSettings @Composable @@ -62,10 +68,12 @@ fun annotatorSettings( } } }, + highlightSpanStyle: SpanStyle = LocalMarkdownColors.current.highlightSpanStyle, ): AnnotatorSettings = DefaultAnnotatorSettings( linkTextSpanStyle = linkTextSpanStyle, codeSpanStyle = codeSpanStyle, annotator = annotator, referenceLinkHandler = referenceLinkHandler, linkInteractionListener = linkInteractionListener, -) \ No newline at end of file + highlightSpanStyle = highlightSpanStyle, +) diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/Markdown.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/Markdown.kt index 88d1c0bb..a9d4b377 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/Markdown.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/Markdown.kt @@ -36,6 +36,7 @@ import com.mikepenz.markdown.model.rememberMarkdownState import com.mikepenz.markdown.utils.LogCompositions import org.intellij.markdown.flavours.MarkdownFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser @@ -99,7 +100,7 @@ fun Markdown( padding: MarkdownPadding = markdownPadding(), dimens: MarkdownDimens = markdownDimens(), flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), - parser: MarkdownParser = MarkdownParser(flavour), + parser: MarkdownParser = MarkdownParser(flavour = flavour, cancellationToken = CancellationToken.NonCancellable), imageTransformer: ImageTransformer = NoOpImageTransformerImpl(), annotator: MarkdownAnnotator = markdownAnnotator(), extendedSpans: MarkdownExtendedSpans = markdownExtendedSpans(), diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownTable.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownTable.kt index e3f79da7..b771aed1 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownTable.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownTable.kt @@ -258,6 +258,7 @@ fun MarkdownTableBasicText( MarkdownBasicText( text = text, modifier = Modifier.onPlaced { coords -> + if (!coords.isAttached) return@onPlaced coords.parentLayoutCoordinates?.also { containerSize.value = it.size.toSize() } }, style = style, diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt index b035e08a..0a5b0441 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownText.kt @@ -187,6 +187,7 @@ fun MarkdownText( // Pin descendants (text + inline link nodes) to source order. Without this, // TalkBack reorders interactive link nodes after non-interactive text — see #487. base.semantics { isTraversalGroup = true }.onPlaced { + if (!it.isAttached) return@onPlaced it.parentLayoutCoordinates?.also { coordinates -> containerSize.value = coordinates.size.toSize() } @@ -230,6 +231,7 @@ fun MarkdownText( } } else { textSegment(content, modifier.onPlaced { + if (!it.isAttached) return@onPlaced it.parentLayoutCoordinates?.also { coordinates -> containerSize.value = coordinates.size.toSize() } diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/extendedspans/ExtendedSpans.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/extendedspans/ExtendedSpans.kt index 43922c86..990731a0 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/extendedspans/ExtendedSpans.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/extendedspans/ExtendedSpans.kt @@ -1,8 +1,6 @@ // Copyright 2023, Saket Narayan // SPDX-License-Identifier: Apache-2.0 // https://github.com/saket/extended-spans -@file:OptIn(ExperimentalTextApi::class) - package com.mikepenz.markdown.compose.extendedspans import androidx.compose.runtime.Stable @@ -13,7 +11,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.draw.drawBehind import androidx.compose.ui.graphics.Color import androidx.compose.ui.text.AnnotatedString -import androidx.compose.ui.text.ExperimentalTextApi import androidx.compose.ui.text.LinkAnnotation import androidx.compose.ui.text.TextLayoutResult import androidx.compose.ui.text.buildAnnotatedString @@ -66,10 +63,6 @@ class ExtendedSpans( text.getTtsAnnotations(start = 0, end = text.length).fastForEach { addTtsAnnotation(it.item, it.start, it.end) } - @Suppress("DEPRECATION") - text.getUrlAnnotations(start = 0, end = text.length).fastForEach { - addUrlAnnotation(it.item, it.start, it.end) - } text.getLinkAnnotations(start = 0, end = text.length).fastForEach { range -> val decorated = painters.fastFold(initial = range.item) { updated, painter -> painter.decorate(updated, range.start, range.end, text = text, builder = this) diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownColors.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownColors.kt index c255468e..020afc0c 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownColors.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownColors.kt @@ -15,6 +15,12 @@ interface MarkdownColors { /** Represents the color used for the inline background of code. */ val inlineCodeBackground: Color + /** Represents the text color of highlighted spans. */ + val highlightText: Color + + /** Represents the background color of highlighted spans. */ + val highlightBackground: Color + /** Represents the color used for the color of dividers. */ val dividerColor: Color @@ -33,4 +39,6 @@ data class DefaultMarkdownColors( override val dividerColor: Color, override val tableBackground: Color, override val alert: MarkdownAlertColors = markdownAlertColors(), + override val highlightText: Color, + override val highlightBackground: Color, ) : MarkdownColors diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownState.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownState.kt index bf1fe56b..2e66684d 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownState.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/model/MarkdownState.kt @@ -24,6 +24,7 @@ import kotlinx.coroutines.withContext import org.intellij.markdown.ast.ASTNode import org.intellij.markdown.flavours.MarkdownFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser /** @@ -43,7 +44,9 @@ fun rememberMarkdownState( lookupLinks: Boolean = true, retainState: Boolean = false, flavour: MarkdownFlavourDescriptor = remember { GFMFlavourDescriptor() }, - parser: MarkdownParser = remember(flavour) { MarkdownParser(flavour) }, + parser: MarkdownParser = remember(flavour) { + MarkdownParser(flavour = flavour, cancellationToken = CancellationToken.NonCancellable) + }, referenceLinkHandler: ReferenceLinkHandler = remember { ReferenceLinkHandlerImpl() }, immediate: Boolean = LocalInspectionMode.current, ): MarkdownState { @@ -105,7 +108,9 @@ fun rememberMarkdownState( lookupLinks: Boolean = true, retainState: Boolean = false, flavour: MarkdownFlavourDescriptor = remember { GFMFlavourDescriptor() }, - parser: MarkdownParser = remember(flavour) { MarkdownParser(flavour) }, + parser: MarkdownParser = remember(flavour) { + MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable) + }, referenceLinkHandler: ReferenceLinkHandler = remember { ReferenceLinkHandlerImpl() }, block: suspend () -> String, ): MarkdownState { @@ -218,7 +223,7 @@ internal class MarkdownStateImpl( */ internal fun parseBlocking(): State { return try { - val parsedResult = input.parser.buildMarkdownTreeFromString(input.content) + val parsedResult = input.parser.buildMarkdownTreeFromString(input.content as CharSequence) if (input.lookupLinks) { val links = mutableMapOf() lookupLinkDefinition(links, parsedResult, input.content, recursive = true) @@ -250,7 +255,7 @@ fun parseMarkdownFlow( content: String, lookupLinks: Boolean = true, flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), - parser: MarkdownParser = MarkdownParser(flavour), + parser: MarkdownParser = MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable), referenceLinkHandler: ReferenceLinkHandler = ReferenceLinkHandlerImpl(), ) = flow { emit(State.Loading(referenceLinkHandler)) @@ -289,7 +294,7 @@ fun parseMarkdown( content: String, lookupLinks: Boolean = true, flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), - parser: MarkdownParser = MarkdownParser(flavour), + parser: MarkdownParser = MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable), referenceLinkHandler: ReferenceLinkHandler = ReferenceLinkHandlerImpl(), ): State { return MarkdownStateImpl( @@ -320,7 +325,7 @@ fun Flow.asMarkdownState( lookupLinks: Boolean = true, retainState: Boolean = false, flavour: MarkdownFlavourDescriptor = GFMFlavourDescriptor(), - parser: MarkdownParser = MarkdownParser(flavour), + parser: MarkdownParser = MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable), referenceLinkHandler: ReferenceLinkHandler = ReferenceLinkHandlerImpl(), ): Flow { val markdownState = MarkdownStateImpl( diff --git a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/utils/Extensions.kt b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/utils/Extensions.kt index 45e66004..f909e361 100644 --- a/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/utils/Extensions.kt +++ b/multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/utils/Extensions.kt @@ -7,6 +7,7 @@ import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnitType import com.mikepenz.markdown.compose.LocalMarkdownColors import com.mikepenz.markdown.model.MarkdownAlertType +import com.mikepenz.markdown.model.MarkdownColors import com.mikepenz.markdown.model.MarkdownTypography import com.mikepenz.markdown.model.ReferenceLinkHandler import org.intellij.markdown.IElementType @@ -205,3 +206,7 @@ val MarkdownTypography.codeSpanStyle: SpanStyle get() = inlineCode.copy( background = LocalMarkdownColors.current.inlineCodeBackground ).toSpanStyle() + +/** The highlight style defined by the markdown colors, preserving the surrounding typography. */ +internal val MarkdownColors.highlightSpanStyle: SpanStyle + get() = SpanStyle(color = highlightText, background = highlightBackground) diff --git a/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/model/StreamingMarkdownStateTest.kt b/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/model/StreamingMarkdownStateTest.kt index 8e79bc63..cb253695 100644 --- a/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/model/StreamingMarkdownStateTest.kt +++ b/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/model/StreamingMarkdownStateTest.kt @@ -9,6 +9,7 @@ import kotlinx.coroutines.test.runTest import org.intellij.markdown.MarkdownElementTypes import org.intellij.markdown.ast.ASTNode import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser import kotlin.test.Test import kotlin.test.assertEquals @@ -198,7 +199,7 @@ class StreamingMarkdownStateTest { content = "", lookupLinks = lookupLinks, flavour = flavour, - parser = MarkdownParser(flavour), + parser = MarkdownParser(flavour, cancellationToken = CancellationToken.NonCancellable), referenceLinkHandler = referenceLinkHandler, retainState = true, ) diff --git a/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/AlertAstShapeTest.kt b/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/AlertAstShapeTest.kt index eda567a5..c4587bc6 100644 --- a/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/AlertAstShapeTest.kt +++ b/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/AlertAstShapeTest.kt @@ -9,6 +9,7 @@ import org.intellij.markdown.ast.getTextInNode import org.intellij.markdown.flavours.gfm.GFMElementTypes import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMTokenTypes +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser import kotlin.test.Test import kotlin.test.assertEquals @@ -23,7 +24,10 @@ import kotlin.test.assertTrue class AlertAstShapeTest { private fun parse(input: String): ASTNode = - MarkdownParser(GFMFlavourDescriptor()).buildMarkdownTreeFromString(input) + MarkdownParser( + flavour = GFMFlavourDescriptor(), + cancellationToken = CancellationToken.NonCancellable, + ).buildMarkdownTreeFromString(input as CharSequence) private fun alerts(tree: ASTNode): List = tree.children.filter { it.type == GFMElementTypes.ALERT } diff --git a/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/TableAstShapeTest.kt b/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/TableAstShapeTest.kt index 6dc8c844..21d33052 100644 --- a/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/TableAstShapeTest.kt +++ b/multiplatform-markdown-renderer/src/commonTest/kotlin/com/mikepenz/markdown/parser/TableAstShapeTest.kt @@ -5,6 +5,7 @@ import org.intellij.markdown.ast.getTextInNode import org.intellij.markdown.flavours.gfm.GFMElementTypes import org.intellij.markdown.flavours.gfm.GFMFlavourDescriptor import org.intellij.markdown.flavours.gfm.GFMTokenTypes +import org.intellij.markdown.parser.CancellationToken import org.intellij.markdown.parser.MarkdownParser import kotlin.test.Test import kotlin.test.assertNotNull @@ -23,7 +24,10 @@ import kotlin.test.assertTrue class TableAstShapeTest { private fun parse(input: String): ASTNode = - MarkdownParser(GFMFlavourDescriptor()).buildMarkdownTreeFromString(input) + MarkdownParser( + flavour = GFMFlavourDescriptor(), + cancellationToken = CancellationToken.NonCancellable, + ).buildMarkdownTreeFromString(input as CharSequence) /** Pretty-print an AST subtree with text snippets. */ private fun dump(node: ASTNode, content: String, indent: String = ""): String { diff --git a/multiplatform-markdown-renderer/src/jvmTest/kotlin/com/mikepenz/markdown/compose/elements/DetachedPlacementTest.kt b/multiplatform-markdown-renderer/src/jvmTest/kotlin/com/mikepenz/markdown/compose/elements/DetachedPlacementTest.kt new file mode 100644 index 00000000..7d8ce364 --- /dev/null +++ b/multiplatform-markdown-renderer/src/jvmTest/kotlin/com/mikepenz/markdown/compose/elements/DetachedPlacementTest.kt @@ -0,0 +1,61 @@ +package com.mikepenz.markdown.compose.elements + +import androidx.compose.foundation.ExperimentalFoundationApi +import androidx.compose.foundation.layout.fillMaxSize +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.pager.HorizontalPager +import androidx.compose.foundation.pager.rememberPagerState +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.text.TextLinkStyles +import androidx.compose.ui.text.TextStyle +import androidx.compose.ui.test.ExperimentalTestApi +import androidx.compose.ui.test.runComposeUiTest +import androidx.compose.ui.unit.dp +import androidx.compose.ui.test.swipeRight +import androidx.compose.ui.test.swipeLeft +import androidx.compose.ui.test.swipeDown +import androidx.compose.ui.test.swipeUp +import androidx.compose.ui.test.performTouchInput +import androidx.compose.ui.test.onNodeWithTag +import androidx.compose.ui.platform.testTag +import com.mikepenz.markdown.compose.Markdown +import com.mikepenz.markdown.model.DefaultMarkdownColors +import com.mikepenz.markdown.model.DefaultMarkdownTypography +import kotlin.test.Test + +/** + * Regression test for #639: `onPlaced` read `parentLayoutCoordinates` on detached coordinates + * while lazy items / pager pages were recycled, throwing `IllegalStateException`. + */ +@OptIn(ExperimentalTestApi::class, ExperimentalFoundationApi::class) +class DetachedPlacementTest { + private val colors = DefaultMarkdownColors(Color.Black, Color.LightGray, Color.LightGray, Color.Gray, Color.White) + private val style = TextStyle.Default + private val typography = DefaultMarkdownTypography( + style, style, style, style, style, style, style, style, style, style, style, style, style, style, + TextLinkStyles(), style, + ) + private val content = "Some **bold** text and a [link](https://example.com) to recycle." + + @Test + fun pagerWithLazyMarkdownSurvivesRecycling() = runComposeUiTest { + setContent { + HorizontalPager(rememberPagerState { 2 }, Modifier.fillMaxSize().testTag("pager")) { page -> + LazyColumn(Modifier.fillMaxSize().testTag("list$page")) { + items(200) { Markdown(content, colors, typography, Modifier.height(48.dp), immediate = true) } + } + } + } + repeat(3) { + // recycle lazy items on the visible page, then swipe to the other page and back + repeat(5) { onNodeWithTag("pager").performTouchInput { swipeUp() } } + onNodeWithTag("pager").performTouchInput { swipeLeft() } + waitForIdle() + repeat(5) { onNodeWithTag("pager").performTouchInput { swipeDown() } } + onNodeWithTag("pager").performTouchInput { swipeRight() } + waitForIdle() + } + } +} diff --git a/sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/HighlightsTests.kt b/sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/HighlightsTests.kt new file mode 100644 index 00000000..3b1cb779 --- /dev/null +++ b/sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m2/HighlightsTests.kt @@ -0,0 +1,63 @@ +package com.mikepenz.markdown.ui.m2 + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalInspectionMode +import com.mikepenz.markdown.m2.Markdown +import com.mikepenz.markdown.m2.markdownColor +import com.mikepenz.markdown.model.rememberMarkdownState +import com.mikepenz.markdown.ui.annotation.DarkLightPreview +import com.mikepenz.markdown.ui.m2.theme.SampleTheme +import com.mikepenz.markdown.ui.m2.util.TestMarkdown + +@DarkLightPreview +@Composable +fun HighlightTest() = TestMarkdown( + """ + Before ==highlighted text== after. + + ==A highlighted sentence long enough to wrap onto another line while retaining its background.== + + ==First== and ==second== highlights. + """.trimIndent() +) + +@DarkLightPreview +@Composable +fun HighlightWithInlineFormattingTest() = TestMarkdown( + """ + ==**Bold**, *italic*, and ~~strikethrough~~==. + + ==A [link](https://example.com)== and ==a = b==. + + Literal equals: a = b, =text=, ===text===, ==a=b==, and \=escaped\=. + """.trimIndent() +) + +@DarkLightPreview +@Composable +fun HighlightInTableTest() = TestMarkdown( + """ + | Feature | ==Result== | + | --- | --- | + | Plain | ==highlighted== | + | Nested | ==**bold** and *italic*== | + | Equals | ==a = b== | + """.trimIndent() +) + +@DarkLightPreview +@Composable +fun HighlightWithCustomColorsTest() = SampleTheme(isSystemInDarkTheme()) { + CompositionLocalProvider(LocalInspectionMode provides true) { + Markdown( + rememberMarkdownState("Before ==custom colors== after.\n\n==**Bold** and *italic*==."), + colors = markdownColor( + highlightText = Color(0xFF6A1B9A), + highlightBackground = Color(0xFFFFF59D), + ), + ) + } +} diff --git a/sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/HighlightsTests.kt b/sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/HighlightsTests.kt new file mode 100644 index 00000000..7b9e39c4 --- /dev/null +++ b/sample/android/src/main/kotlin/com/mikepenz/markdown/ui/m3/HighlightsTests.kt @@ -0,0 +1,63 @@ +package com.mikepenz.markdown.ui.m3 + +import androidx.compose.foundation.isSystemInDarkTheme +import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.platform.LocalInspectionMode +import com.mikepenz.markdown.m3.Markdown +import com.mikepenz.markdown.m3.markdownColor +import com.mikepenz.markdown.model.rememberMarkdownState +import com.mikepenz.markdown.ui.annotation.DarkLightPreview +import com.mikepenz.markdown.ui.m3.theme.SampleTheme +import com.mikepenz.markdown.ui.m3.util.TestMarkdown + +@DarkLightPreview +@Composable +fun HighlightTest() = TestMarkdown( + """ + Before ==highlighted text== after. + + ==A highlighted sentence long enough to wrap onto another line while retaining its background.== + + ==First== and ==second== highlights. + """.trimIndent() +) + +@DarkLightPreview +@Composable +fun HighlightWithInlineFormattingTest() = TestMarkdown( + """ + ==**Bold**, *italic*, and ~~strikethrough~~==. + + ==A [link](https://example.com)== and ==a = b==. + + Literal equals: a = b, =text=, ===text===, ==a=b==, and \=escaped\=. + """.trimIndent() +) + +@DarkLightPreview +@Composable +fun HighlightInTableTest() = TestMarkdown( + """ + | Feature | ==Result== | + | --- | --- | + | Plain | ==highlighted== | + | Nested | ==**bold** and *italic*== | + | Equals | ==a = b== | + """.trimIndent() +) + +@DarkLightPreview +@Composable +fun HighlightWithCustomColorsTest() = SampleTheme(isSystemInDarkTheme()) { + CompositionLocalProvider(LocalInspectionMode provides true) { + Markdown( + rememberMarkdownState("Before ==custom colors== after.\n\n==**Bold** and *italic*==."), + colors = markdownColor( + highlightText = Color(0xFF6A1B9A), + highlightBackground = Color(0xFFFFF59D), + ), + ) + } +} diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightintabletest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightintabletest.dark_night.png new file mode 100644 index 00000000..dbcbf9a5 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightintabletest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightintabletest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightintabletest.light.png new file mode 100644 index 00000000..16ccfedb Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightintabletest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlighttest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlighttest.dark_night.png new file mode 100644 index 00000000..3360f078 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlighttest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlighttest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlighttest.light.png new file mode 100644 index 00000000..625b059d Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlighttest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithcustomcolorstest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithcustomcolorstest.dark_night.png new file mode 100644 index 00000000..5ad4b87b Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithcustomcolorstest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithcustomcolorstest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithcustomcolorstest.light.png new file mode 100644 index 00000000..cc4f4290 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithcustomcolorstest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithinlineformattingtest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithinlineformattingtest.dark_night.png new file mode 100644 index 00000000..eed7ac7a Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithinlineformattingtest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithinlineformattingtest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithinlineformattingtest.light.png new file mode 100644 index 00000000..16611c4c Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m2.highlightstestskt.highlightwithinlineformattingtest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightintabletest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightintabletest.dark_night.png new file mode 100644 index 00000000..8a7d7566 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightintabletest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightintabletest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightintabletest.light.png new file mode 100644 index 00000000..bb1ccff7 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightintabletest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlighttest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlighttest.dark_night.png new file mode 100644 index 00000000..becb0460 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlighttest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlighttest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlighttest.light.png new file mode 100644 index 00000000..dec14893 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlighttest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithcustomcolorstest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithcustomcolorstest.dark_night.png new file mode 100644 index 00000000..8b2e4002 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithcustomcolorstest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithcustomcolorstest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithcustomcolorstest.light.png new file mode 100644 index 00000000..f4f01b30 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithcustomcolorstest.light.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithinlineformattingtest.dark_night.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithinlineformattingtest.dark_night.png new file mode 100644 index 00000000..f792858c Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithinlineformattingtest.dark_night.png differ diff --git a/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithinlineformattingtest.light.png b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithinlineformattingtest.light.png new file mode 100644 index 00000000..77572973 Binary files /dev/null and b/sample/android/src/test/snapshots/images/Paparazzi_Preview_Test_com.mikepenz.markdown.ui.m3.highlightstestskt.highlightwithinlineformattingtest.light.png differ diff --git a/sample/shared/build.gradle.kts b/sample/shared/build.gradle.kts index 09bb204e..6eec2f8f 100644 --- a/sample/shared/build.gradle.kts +++ b/sample/shared/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } kotlin { - androidLibrary { + android { namespace = "com.mikepenz.markdown.sample.shared" experimentalProperties["android.experimental.kmp.enableAndroidResources"] = true } diff --git a/sample/shared/src/commonMain/composeResources/files/sample-tables.md b/sample/shared/src/commonMain/composeResources/files/sample-tables.md index cb312b2c..b32b49e9 100644 --- a/sample/shared/src/commonMain/composeResources/files/sample-tables.md +++ b/sample/shared/src/commonMain/composeResources/files/sample-tables.md @@ -12,6 +12,7 @@ demonstrates a different inline construct. | *italic* (asterisk) | *italic* text | | _italic_ (under) | _italic_ text | | ~~strikethrough~~ | ~~strike~~ here | +| highlight | ==highlight== and ==**bold** text== | | inline `code` | `val x = 1` | | inline link | [JetBrains](https://www.jetbrains.com) | | autolink | | diff --git a/sample/shared/src/commonMain/composeResources/files/sample.md b/sample/shared/src/commonMain/composeResources/files/sample.md index 96cf0497..5be35cf4 100644 --- a/sample/shared/src/commonMain/composeResources/files/sample.md +++ b/sample/shared/src/commonMain/composeResources/files/sample.md @@ -16,6 +16,12 @@ This is a paragraph with some *italic* and **bold** text. +## Highlight + +This is a paragraph with ==highlighted text==. + +Equals signs are preserved: a = b, =text=, ===text===, and ==a=b==. + This is a paragraph with some `inline code`. This is a paragraph with a [link](https://www.jetbrains.com/). diff --git a/settings.gradle.kts b/settings.gradle.kts index 81649005..5864a959 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -28,7 +28,7 @@ dependencyResolutionManagement { versionCatalogs { create("baseLibs") { - from("com.mikepenz:version-catalog:0.20.0") + from("com.mikepenz:version-catalog:0.22.0") } } }