diff --git a/markdown/core/api/core.api b/markdown/core/api/core.api index b437efbbc..e732e11cf 100644 --- a/markdown/core/api/core.api +++ b/markdown/core/api/core.api @@ -1,9 +1,9 @@ public abstract interface class org/jetbrains/jewel/markdown/BlockWithInlineMarkdown { - public abstract fun getInlineContent ()Ljava/util/List; + public abstract fun getInlineContent ()Ljava/lang/Iterable; } public abstract interface class org/jetbrains/jewel/markdown/InlineMarkdown { - public abstract fun getChildren ()Ljava/util/Iterator; + public abstract fun getChildren ()Ljava/lang/Iterable; public abstract fun getNativeNode ()Lorg/commonmark/node/Node; } @@ -13,8 +13,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$Code : org/jetbra public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/Code;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/Code;Lorg/commonmark/node/Code;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/Code;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/Code;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/Code; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -30,8 +30,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$CustomNode : org/ public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/CustomNode;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/CustomNode;Lorg/commonmark/node/CustomNode;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/CustomNode;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/CustomNode;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/CustomNode; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -42,7 +42,7 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$CustomNode : org/ } public final class org/jetbrains/jewel/markdown/InlineMarkdown$DefaultImpls { - public static fun getChildren (Lorg/jetbrains/jewel/markdown/InlineMarkdown;)Ljava/util/Iterator; + public static fun getChildren (Lorg/jetbrains/jewel/markdown/InlineMarkdown;)Ljava/lang/Iterable; } public final class org/jetbrains/jewel/markdown/InlineMarkdown$Emphasis : org/jetbrains/jewel/markdown/InlineMarkdown { @@ -51,8 +51,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$Emphasis : org/je public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/Emphasis;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/Emphasis;Lorg/commonmark/node/Emphasis;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/Emphasis;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/Emphasis;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/Emphasis; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -68,8 +68,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$HardLineBreak : o public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/HardLineBreak;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/HardLineBreak;Lorg/commonmark/node/HardLineBreak;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/HardLineBreak;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/HardLineBreak;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/HardLineBreak; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -85,8 +85,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$HtmlInline : org/ public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/HtmlInline;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/HtmlInline;Lorg/commonmark/node/HtmlInline;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/HtmlInline;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/HtmlInline;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/HtmlInline; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -102,8 +102,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$Image : org/jetbr public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/Image;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/Image;Lorg/commonmark/node/Image;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/Image;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/Image;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/Image; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -119,8 +119,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$Link : org/jetbra public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/Link;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/Link;Lorg/commonmark/node/Link;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/Link;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/Link;)Ljava/lang/Iterable; public fun getNativeNode ()Lorg/commonmark/node/Link; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun hashCode ()I @@ -130,31 +130,14 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$Link : org/jetbra public final synthetic fun unbox-impl ()Lorg/commonmark/node/Link; } -public final class org/jetbrains/jewel/markdown/InlineMarkdown$Paragraph : org/jetbrains/jewel/markdown/InlineMarkdown { - public static final synthetic fun box-impl (Lorg/commonmark/node/Paragraph;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$Paragraph; - public static fun constructor-impl (Lorg/commonmark/node/Paragraph;)Lorg/commonmark/node/Paragraph; - public fun equals (Ljava/lang/Object;)Z - public static fun equals-impl (Lorg/commonmark/node/Paragraph;Ljava/lang/Object;)Z - public static final fun equals-impl0 (Lorg/commonmark/node/Paragraph;Lorg/commonmark/node/Paragraph;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/Paragraph;)Ljava/util/Iterator; - public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; - public fun getNativeNode ()Lorg/commonmark/node/Paragraph; - public fun hashCode ()I - public static fun hashCode-impl (Lorg/commonmark/node/Paragraph;)I - public fun toString ()Ljava/lang/String; - public static fun toString-impl (Lorg/commonmark/node/Paragraph;)Ljava/lang/String; - public final synthetic fun unbox-impl ()Lorg/commonmark/node/Paragraph; -} - public final class org/jetbrains/jewel/markdown/InlineMarkdown$SoftLineBreak : org/jetbrains/jewel/markdown/InlineMarkdown { public static final synthetic fun box-impl (Lorg/commonmark/node/SoftLineBreak;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$SoftLineBreak; public static fun constructor-impl (Lorg/commonmark/node/SoftLineBreak;)Lorg/commonmark/node/SoftLineBreak; public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/SoftLineBreak;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/SoftLineBreak;Lorg/commonmark/node/SoftLineBreak;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/SoftLineBreak;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/SoftLineBreak;)Ljava/lang/Iterable; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun getNativeNode ()Lorg/commonmark/node/SoftLineBreak; public fun hashCode ()I @@ -170,8 +153,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$StrongEmphasis : public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/StrongEmphasis;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/StrongEmphasis;Lorg/commonmark/node/StrongEmphasis;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/StrongEmphasis;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/StrongEmphasis;)Ljava/lang/Iterable; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun getNativeNode ()Lorg/commonmark/node/StrongEmphasis; public fun hashCode ()I @@ -187,8 +170,8 @@ public final class org/jetbrains/jewel/markdown/InlineMarkdown$Text : org/jetbra public fun equals (Ljava/lang/Object;)Z public static fun equals-impl (Lorg/commonmark/node/Text;Ljava/lang/Object;)Z public static final fun equals-impl0 (Lorg/commonmark/node/Text;Lorg/commonmark/node/Text;)Z - public fun getChildren ()Ljava/util/Iterator; - public static fun getChildren-impl (Lorg/commonmark/node/Text;)Ljava/util/Iterator; + public fun getChildren ()Ljava/lang/Iterable; + public static fun getChildren-impl (Lorg/commonmark/node/Text;)Ljava/lang/Iterable; public synthetic fun getNativeNode ()Lorg/commonmark/node/Node; public fun getNativeNode ()Lorg/commonmark/node/Text; public fun hashCode ()I @@ -251,17 +234,19 @@ public abstract interface class org/jetbrains/jewel/markdown/MarkdownBlock$Custo } public final class org/jetbrains/jewel/markdown/MarkdownBlock$Heading : org/jetbrains/jewel/markdown/BlockWithInlineMarkdown, org/jetbrains/jewel/markdown/MarkdownBlock { - public static final field $stable I - public fun (Ljava/util/List;I)V - public final fun component1 ()Ljava/util/List; - public final fun component2 ()I - public final fun copy (Ljava/util/List;I)Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading; - public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Ljava/util/List;IILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading; + public static final synthetic fun box-impl (Lorg/commonmark/node/Heading;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading; + public static fun constructor-impl (Lorg/commonmark/node/Heading;)Lorg/commonmark/node/Heading; public fun equals (Ljava/lang/Object;)Z - public fun getInlineContent ()Ljava/util/List; - public final fun getLevel ()I + public static fun equals-impl (Lorg/commonmark/node/Heading;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Lorg/commonmark/node/Heading;Lorg/commonmark/node/Heading;)Z + public fun getInlineContent ()Ljava/lang/Iterable; + public static fun getInlineContent-impl (Lorg/commonmark/node/Heading;)Ljava/lang/Iterable; + public static final fun getLevel-impl (Lorg/commonmark/node/Heading;)I public fun hashCode ()I + public static fun hashCode-impl (Lorg/commonmark/node/Heading;)I public fun toString ()Ljava/lang/String; + public static fun toString-impl (Lorg/commonmark/node/Heading;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Lorg/commonmark/node/Heading; } public final class org/jetbrains/jewel/markdown/MarkdownBlock$HtmlBlock : org/jetbrains/jewel/markdown/MarkdownBlock { @@ -328,15 +313,18 @@ public final class org/jetbrains/jewel/markdown/MarkdownBlock$ListItem : org/jet } public final class org/jetbrains/jewel/markdown/MarkdownBlock$Paragraph : org/jetbrains/jewel/markdown/BlockWithInlineMarkdown, org/jetbrains/jewel/markdown/MarkdownBlock { - public static final field $stable I - public fun (Ljava/util/List;)V - public final fun component1 ()Ljava/util/List; - public final fun copy (Ljava/util/List;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph; - public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph;Ljava/util/List;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph; + public static final synthetic fun box-impl (Lorg/commonmark/node/Paragraph;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph; + public static fun constructor-impl (Lorg/commonmark/node/Paragraph;)Lorg/commonmark/node/Paragraph; public fun equals (Ljava/lang/Object;)Z - public fun getInlineContent ()Ljava/util/List; + public static fun equals-impl (Lorg/commonmark/node/Paragraph;Ljava/lang/Object;)Z + public static final fun equals-impl0 (Lorg/commonmark/node/Paragraph;Lorg/commonmark/node/Paragraph;)Z + public fun getInlineContent ()Ljava/lang/Iterable; + public static fun getInlineContent-impl (Lorg/commonmark/node/Paragraph;)Ljava/lang/Iterable; public fun hashCode ()I + public static fun hashCode-impl (Lorg/commonmark/node/Paragraph;)I public fun toString ()Ljava/lang/String; + public static fun toString-impl (Lorg/commonmark/node/Paragraph;)Ljava/lang/String; + public final synthetic fun unbox-impl ()Lorg/commonmark/node/Paragraph; } public final class org/jetbrains/jewel/markdown/MarkdownBlock$ThematicBreak : org/jetbrains/jewel/markdown/MarkdownBlock { @@ -448,7 +436,7 @@ public class org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRendere public static final field Companion Lorg/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer$Companion; public fun (Ljava/util/List;)V public fun ([Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;)V - public fun renderAsAnnotatedString (Ljava/util/List;Lorg/jetbrains/jewel/markdown/rendering/InlinesStyling;)Landroidx/compose/ui/text/AnnotatedString; + public fun renderAsAnnotatedString (Ljava/lang/Iterable;Lorg/jetbrains/jewel/markdown/rendering/InlinesStyling;)Landroidx/compose/ui/text/AnnotatedString; } public final class org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer$Companion { @@ -462,21 +450,21 @@ public class org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCodeBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Code$Fenced;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$IndentedCodeBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Code$Indented;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Code;Landroidx/compose/runtime/Composer;I)V - public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading$HN;Landroidx/compose/runtime/Composer;I)V - public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$HtmlBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$HtmlBlock;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedList;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List$Ordered;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List$Unordered;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;Landroidx/compose/runtime/Composer;I)V - public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;Landroidx/compose/runtime/Composer;I)V public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock;Landroidx/compose/runtime/Composer;I)V + public fun render-mpq8F88 (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading$HN;Landroidx/compose/runtime/Composer;I)V + public fun render-mpq8F88 (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;Landroidx/compose/runtime/Composer;I)V + public fun render-wlAWB_Q (Lorg/commonmark/node/Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;Landroidx/compose/runtime/Composer;I)V public fun renderThematicBreak (Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$ThematicBreak;Landroidx/compose/runtime/Composer;I)V } public abstract interface class org/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer { public static final field Companion Lorg/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer$Companion; - public abstract fun renderAsAnnotatedString (Ljava/util/List;Lorg/jetbrains/jewel/markdown/rendering/InlinesStyling;)Landroidx/compose/ui/text/AnnotatedString; + public abstract fun renderAsAnnotatedString (Ljava/lang/Iterable;Lorg/jetbrains/jewel/markdown/rendering/InlinesStyling;)Landroidx/compose/ui/text/AnnotatedString; } public final class org/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer$Companion { @@ -510,15 +498,15 @@ public abstract interface class org/jetbrains/jewel/markdown/rendering/MarkdownB public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCodeBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Code$Fenced;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$IndentedCodeBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Code$Indented;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Code;Landroidx/compose/runtime/Composer;I)V - public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading$HN;Landroidx/compose/runtime/Composer;I)V - public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$HtmlBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$HtmlBlock;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedList;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List$Ordered;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List$Unordered;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;Landroidx/compose/runtime/Composer;I)V - public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;Landroidx/compose/runtime/Composer;I)V public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock;Landroidx/compose/runtime/Composer;I)V + public abstract fun render-mpq8F88 (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading$HN;Landroidx/compose/runtime/Composer;I)V + public abstract fun render-mpq8F88 (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;Landroidx/compose/runtime/Composer;I)V + public abstract fun render-wlAWB_Q (Lorg/commonmark/node/Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;Landroidx/compose/runtime/Composer;I)V public abstract fun renderThematicBreak (Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$ThematicBreak;Landroidx/compose/runtime/Composer;I)V } diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/InlineMarkdown.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/InlineMarkdown.kt index 3766664d5..b111e1cd5 100644 --- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/InlineMarkdown.kt +++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/InlineMarkdown.kt @@ -18,7 +18,6 @@ import org.commonmark.node.HardLineBreak as CMHardLineBreak import org.commonmark.node.HtmlInline as CMHtmlInline import org.commonmark.node.Image as CMImage import org.commonmark.node.Link as CMLink -import org.commonmark.node.Paragraph as CMParagraph import org.commonmark.node.SoftLineBreak as CMSoftLineBreak import org.commonmark.node.StrongEmphasis as CMStrongEmphasis import org.commonmark.node.Text as CMText @@ -52,9 +51,6 @@ public sealed interface InlineMarkdown { @JvmInline public value class Link(override val nativeNode: CMLink) : InlineMarkdown - @JvmInline - public value class Paragraph(override val nativeNode: CMParagraph) : InlineMarkdown - @JvmInline public value class SoftLineBreak(override val nativeNode: CMSoftLineBreak) : InlineMarkdown @@ -64,19 +60,22 @@ public sealed interface InlineMarkdown { @JvmInline public value class Text(override val nativeNode: CMText) : InlineMarkdown - public val children: Iterator - get() = object : Iterator { - var current = this@InlineMarkdown.nativeNode.firstChild - - override fun hasNext(): Boolean = current != null - - override fun next(): InlineMarkdown = - if (hasNext()) { - current.toInlineNode().also { - current = current.next - } - } else { - throw NoSuchElementException() + public val children: Iterable + get() = object : Iterable { + override fun iterator(): Iterator = + object : Iterator { + var current = this@InlineMarkdown.nativeNode.firstChild + + override fun hasNext(): Boolean = current != null + + override fun next(): InlineMarkdown = + if (hasNext()) { + current.toInlineNode().also { + current = current.next + } + } else { + throw NoSuchElementException() + } } } } diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/MarkdownBlock.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/MarkdownBlock.kt index 382fe864c..1b7ccdb32 100644 --- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/MarkdownBlock.kt +++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/MarkdownBlock.kt @@ -1,5 +1,9 @@ package org.jetbrains.jewel.markdown +import org.commonmark.node.Block +import org.commonmark.node.Heading as CMHeading +import org.commonmark.node.Paragraph as CMParagraph + public sealed interface MarkdownBlock { public data class BlockQuote(val children: List) : MarkdownBlock @@ -20,10 +24,17 @@ public sealed interface MarkdownBlock { public interface CustomBlock : MarkdownBlock - public data class Heading( - override val inlineContent: List, - val level: Int, - ) : MarkdownBlock, BlockWithInlineMarkdown + @JvmInline + public value class Heading( + private val nativeBlock: CMHeading, + ) : MarkdownBlock, BlockWithInlineMarkdown { + + override val inlineContent: Iterable + get() = nativeBlock.inlineContent() + + public val level: Int + get() = nativeBlock.level + } public data class HtmlBlock(val content: String) : MarkdownBlock @@ -52,11 +63,34 @@ public sealed interface MarkdownBlock { public object ThematicBreak : MarkdownBlock - public data class Paragraph(override val inlineContent: List) : - MarkdownBlock, BlockWithInlineMarkdown + @JvmInline + public value class Paragraph(private val nativeBlock: CMParagraph) : MarkdownBlock, BlockWithInlineMarkdown { + + override val inlineContent: Iterable + get() = nativeBlock.inlineContent() + } } public interface BlockWithInlineMarkdown { - public val inlineContent: List + public val inlineContent: Iterable } + +private fun Block.inlineContent(): Iterable = + object : Iterable { + override fun iterator(): Iterator = + object : Iterator { + var current = this@inlineContent.firstChild + + override fun hasNext(): Boolean = current != null + + override fun next(): InlineMarkdown = + if (hasNext()) { + current.toInlineNode().also { + current = current.next + } + } else { + throw NoSuchElementException() + } + } + } diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/MarkdownProcessor.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/MarkdownProcessor.kt index 001413e72..7c39b704f 100644 --- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/MarkdownProcessor.kt +++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/MarkdownProcessor.kt @@ -27,7 +27,6 @@ import org.jetbrains.jewel.markdown.MarkdownBlock.ListBlock import org.jetbrains.jewel.markdown.MimeType import org.jetbrains.jewel.markdown.extensions.MarkdownProcessorExtension import org.jetbrains.jewel.markdown.rendering.DefaultInlineMarkdownRenderer -import org.jetbrains.jewel.markdown.toInlineNode import org.commonmark.node.ListBlock as CMListBlock /** @@ -180,13 +179,13 @@ public class MarkdownProcessor( private fun Node.tryProcessMarkdownBlock(): MarkdownBlock? = // Non-Block children are ignored when (this) { - is Paragraph -> toMarkdownParagraphOrNull() + is Paragraph -> MarkdownBlock.Paragraph(this) is Heading -> toMarkdownHeadingOrNull() is BulletList -> toMarkdownListOrNull() is OrderedList -> toMarkdownListOrNull() + is BlockQuote -> toMarkdownBlockQuote() is FencedCodeBlock -> toMarkdownCodeBlockOrNull() is IndentedCodeBlock -> toMarkdownCodeBlockOrNull() - is BlockQuote -> toMarkdownBlockQuote() is ThematicBreak -> MarkdownBlock.ThematicBreak is HtmlBlock -> toMarkdownHtmlBlockOrNull() is CustomBlock -> { @@ -202,14 +201,7 @@ public class MarkdownProcessor( private fun Heading.toMarkdownHeadingOrNull(): MarkdownBlock.Heading? { if (level < 1 || level > 6) return null - return MarkdownBlock.Heading(contentsAsInlineMarkdown(), level) - } - - private fun Paragraph.toMarkdownParagraphOrNull(): MarkdownBlock.Paragraph? { - val inlineMarkdown = contentsAsInlineMarkdown() - - if (inlineMarkdown.isEmpty()) return null - return MarkdownBlock.Paragraph(inlineMarkdown) + return MarkdownBlock.Heading(this) } private fun FencedCodeBlock.toMarkdownCodeBlockOrNull(): CodeBlock.FencedCodeBlock = @@ -264,10 +256,4 @@ public class MarkdownProcessor( if (literal.isBlank()) return null return MarkdownBlock.HtmlBlock(content = literal.trimEnd('\n')) } - - private fun Node.contentsAsInlineMarkdown() = buildList { - forEachChild { - add(it.toInlineNode()) - } - } } diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt index 45ba51d49..a90780780 100644 --- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt +++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultInlineMarkdownRenderer.kt @@ -23,21 +23,17 @@ public open class DefaultInlineMarkdownRenderer(rendererExtensions: List, + inlineMarkdown: Iterable, styling: InlinesStyling, ): AnnotatedString = buildAnnotatedString { - appendInlineMarkdownFrom(inlineMarkdown.iterator(), styling) + appendInlineMarkdownFrom(inlineMarkdown, styling) } @OptIn(ExperimentalTextApi::class) - private fun Builder.appendInlineMarkdownFrom(inlineMarkdown: Iterator, styling: InlinesStyling) { + private fun Builder.appendInlineMarkdownFrom(inlineMarkdown: Iterable, styling: InlinesStyling) { for (child in inlineMarkdown) { when (child) { - is InlineMarkdown.Paragraph -> { - appendInlineMarkdownFrom(child.children, styling) - } - is InlineMarkdown.Text -> append(child.nativeNode.literal) is InlineMarkdown.Emphasis -> { diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer.kt index 210818511..fcfc4f3aa 100644 --- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer.kt +++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer.kt @@ -12,7 +12,7 @@ public interface InlineMarkdownRenderer { * Render the [inlineMarkdown] as an [AnnotatedString], using the [styling] * provided. */ - public fun renderAsAnnotatedString(inlineMarkdown: List, styling: InlinesStyling): AnnotatedString + public fun renderAsAnnotatedString(inlineMarkdown: Iterable, styling: InlinesStyling): AnnotatedString public companion object { diff --git a/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/TestUtils.kt b/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/TestUtils.kt index 5c3b85910..0ee134e7c 100644 --- a/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/TestUtils.kt +++ b/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/TestUtils.kt @@ -223,18 +223,18 @@ private fun inlineMarkdowns(content: String): List { private val inlineParser = InlineParserImpl(InlineParserContextImpl(emptyList(), LinkReferenceDefinitions())) fun paragraph(@Language("Markdown") content: String): Paragraph = Paragraph( - object : org.commonmark.node.CustomBlock() {}.let { block -> + org.commonmark.node.Paragraph().let { block -> inlineParser.parse(SourceLines.of(content.lines().map { SourceLine.of(it, null) }), block) block - }.children().map { x -> x.toInlineNode() }, + }, ) fun heading(level: Int, @Language("Markdown") content: String) = Heading( - object : org.commonmark.node.CustomBlock() {}.let { block -> + org.commonmark.node.Heading().let { block -> inlineParser.parse(SourceLines.of(SourceLine.of(content, null)), block) + block.level = level block - }.children().map { x -> x.toInlineNode() }, - level, + }, ) fun indentedCodeBlock(content: String) = IndentedCodeBlock(content) diff --git a/markdown/extension/autolink/src/test/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtensionTest.kt b/markdown/extension/autolink/src/test/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtensionTest.kt index 8e14e7aa5..87301bf39 100644 --- a/markdown/extension/autolink/src/test/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtensionTest.kt +++ b/markdown/extension/autolink/src/test/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtensionTest.kt @@ -13,8 +13,8 @@ class AutolinkProcessorExtensionTest { val processor = MarkdownProcessor(listOf(AutolinkProcessorExtension)) val rawMarkDown = "https://commonmark.org" val processed = processor.processMarkdownDocument(rawMarkDown) - val paragraph = processed[0] as MarkdownBlock.Paragraph + val paragraph = processed.first() as MarkdownBlock.Paragraph - assertTrue(paragraph.inlineContent[0] is InlineMarkdown.Link) + assertTrue(paragraph.inlineContent.first() is InlineMarkdown.Link) } }