From e4a26b067bd7976cb482d99a3e70044bb9b97d5b Mon Sep 17 00:00:00 2001 From: Alexander Kuznetsov Date: Thu, 3 Jul 2025 16:45:19 +0200 Subject: [PATCH] [JEWEL-870] Render images in Markdown headers closes https://github.com/JetBrains/intellij-community/pull/3113 GitOrigin-RevId: 0138fd0e3d00072975fff9f6e6e904e2a89af8dd --- .../markdown/rendering/DefaultMarkdownBlockRenderer.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/platform/jewel/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt b/platform/jewel/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt index 33cfd2544d5b..f38568e3d847 100644 --- a/platform/jewel/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt +++ b/platform/jewel/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt @@ -187,6 +187,7 @@ public open class DefaultMarkdownBlockRenderer( ) { val renderedContent = rememberRenderedContent(block, styling.inlinesStyling, enabled, onUrlClick) Heading( + block, renderedContent, styling.inlinesStyling.textStyle, styling.padding, @@ -199,6 +200,7 @@ public open class DefaultMarkdownBlockRenderer( @Composable private fun Heading( + block: Heading, renderedContent: AnnotatedString, textStyle: TextStyle, paddingValues: PaddingValues, @@ -210,7 +212,12 @@ public open class DefaultMarkdownBlockRenderer( Column(modifier = modifier.padding(paddingValues)) { val textColor = textStyle.color.takeOrElse { LocalContentColor.current.takeOrElse { textStyle.color } } val mergedStyle = textStyle.merge(TextStyle(color = textColor)) - Text(text = renderedContent, style = mergedStyle, modifier = Modifier.focusProperties { canFocus = false }) + Text( + text = renderedContent, + style = mergedStyle, + modifier = Modifier.focusProperties { canFocus = false }, + inlineContent = renderedImages(block), + ) if (underlineWidth > 0.dp && underlineColor.isSpecified) { Spacer(Modifier.height(underlineGap))