Skip to content

Commit 6dd54d0

Browse files
committed
- slight optimisation to reduce lookup for block line height
1 parent 8717252 commit 6dd54d0

File tree

1 file changed

+2
-3
lines changed
  • multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements

1 file changed

+2
-3
lines changed

multiplatform-markdown-renderer/src/commonMain/kotlin/com/mikepenz/markdown/compose/elements/MarkdownBlockQuote.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ fun MarkdownBlockQuote(
5252
}
5353
.padding(blockQuote)
5454
) {
55+
val blockQuoteLineHeightInDp = with(LocalDensity.current) { LocalMarkdownTypography.current.quote.fontSize.toDp() }
5556
var priorNestedQuote = false
5657
node.children.onEachIndexed { index, child ->
5758
if (child.type == MarkdownElementTypes.BLOCK_QUOTE) {
@@ -60,9 +61,7 @@ fun MarkdownBlockQuote(
6061
MarkdownBlockQuote(content = content, node = child, style = style)
6162
priorNestedQuote = true
6263
} else if (child.type == EOL) {
63-
with(LocalDensity.current) {
64-
Spacer(Modifier.height(LocalMarkdownTypography.current.quote.fontSize.toDp()))
65-
}
64+
Spacer(Modifier.height(blockQuoteLineHeightInDp))
6665
} else {
6766
// if first item either completely, or after a nested quote, add top padding
6867
if (index == 0 || priorNestedQuote) Spacer(Modifier.height(blockQuoteText.calculateTopPadding()))

0 commit comments

Comments
 (0)