Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency com.mikepenz:multiplatform-markdown-renderer to v0.16.0 #828

Merged
merged 4 commits into from Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Expand Up @@ -20,7 +20,7 @@ kotlin = "1.9.23"
kotlinPoet = "1.16.0"
ksp = "1.9.23-1.0.20"
ktfmt = "0.47"
markdown = "0.14.0"
markdown = "0.16.0"
mavenPublish = "0.28.0"
moshi = "1.15.1"
moshix = "0.25.1"
Expand Down
Expand Up @@ -82,9 +82,7 @@ private const val MARKDOWN =

The above was supposed to be a divider.

~~This is strikethrough with two tildes~~

~This is strikethrough~
~~This is strikethrough~~

This is an ordered list:
1. Item 1
Expand Down
Expand Up @@ -46,10 +46,14 @@ import androidx.compose.ui.unit.sp
import com.mikepenz.markdown.compose.LocalMarkdownColors
import com.mikepenz.markdown.compose.LocalMarkdownTypography
import com.mikepenz.markdown.compose.Markdown
import com.mikepenz.markdown.compose.extendedspans.ExtendedSpans
import com.mikepenz.markdown.compose.extendedspans.RoundedCornerSpanPainter
import com.mikepenz.markdown.compose.extendedspans.RoundedCornerSpanPainter.TextPaddingValues
import com.mikepenz.markdown.model.DefaultMarkdownColors
import com.mikepenz.markdown.model.DefaultMarkdownTypography
import com.mikepenz.markdown.model.MarkdownColors
import com.mikepenz.markdown.model.MarkdownTypography
import com.mikepenz.markdown.model.markdownExtendedSpans
import java.awt.Dimension
import javax.swing.JComponent
import org.jetbrains.jewel.foundation.theme.JewelTheme
Expand Down Expand Up @@ -96,6 +100,18 @@ fun MarkdownContent(modifier: Modifier = Modifier, computeMarkdown: suspend () -
markdown!!,
colors = LocalMarkdownColors.current,
typography = LocalMarkdownTypography.current,
extendedSpans =
markdownExtendedSpans {
remember {
// Pad out inline code blocks better
ExtendedSpans(
RoundedCornerSpanPainter(
cornerRadius = 4.sp,
padding = TextPaddingValues(1.sp, 4.sp),
)
)
}
},
)
}

Expand All @@ -114,12 +130,12 @@ private fun jewelMarkdownColor(
linkText: Color = JewelTheme.linkColor,
dividerColor: Color = JewelTheme.globalColors.borders.normal,
): MarkdownColors {
// TODO https://github.com/mikepenz/multiplatform-markdown-renderer/issues/130
val (codeText, codeBackground, _, inlineCodeBackground) =
val (codeText, codeBackground, inlineCodeText, inlineCodeBackground) =
rememberCodeBackground(JewelTheme.globalColors.paneBackground, text)
return DefaultMarkdownColors(
text = text,
codeText = codeText,
inlineCodeText = inlineCodeText,
linkText = linkText,
codeBackground = codeBackground,
inlineCodeBackground = inlineCodeBackground,
Expand Down