diff options
Diffstat (limited to 'core/src/main/kotlin/Formats')
-rw-r--r-- | core/src/main/kotlin/Formats/StructuredFormatService.kt | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt index 3cfc96a2..6e887c05 100644 --- a/core/src/main/kotlin/Formats/StructuredFormatService.kt +++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt @@ -153,12 +153,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder, is ContentBlockSampleCode, is ContentBlockCode -> { content as ContentBlockCode fun ContentBlockCode.appendBlockCodeContent() { - for ((index, contentNode) in this.children.withIndex()) { - appendContent(contentNode) - if (index < this.children.size - 1) { - to.append("\n") - } - } + children + .dropWhile { it is ContentText && it.text.isBlank() } + .forEach { appendContent(it) } } when (content) { is ContentBlockSampleCode -> |