From 9cd6147fd36f5be394035d37312fd834b0cae611 Mon Sep 17 00:00:00 2001
From: Sebastiano Poggi
Date: Thu, 18 Jul 2024 21:34:35 +0200
Subject: [PATCH] Add equals/hashcode to inline markdown entities, too
Tests have been updated to match the new behaviour, that's closer to the
CommonMark one.
Inline extensions are now possible, but not tested. This makes #325
possible, since the extension now can be moved to its own module.
Note: please don't look at the test changes. They're _verbose_ and are
only there to ensure CommonMark specs compliance.
---
markdown/core/api/core.api | 263 +-
.../jewel/markdown/InlineMarkdown.kt | 146 +-
.../jetbrains/jewel/markdown/MarkdownBlock.kt | 60 +-
.../jewel/markdown/WithInlineMarkdown.kt | 5 +
.../jewel/markdown/WithTextContent.kt | 5 +
.../MarkdownInlineProcessorExtension.kt | 25 +
.../extensions/MarkdownProcessorExtension.kt | 48 +-
.../markdown/processing/MarkdownProcessor.kt | 45 +-
.../markdown/processing/ProcessingUtil.kt | 126 +
.../DefaultInlineMarkdownRenderer.kt | 42 +-
.../rendering/DefaultMarkdownBlockRenderer.kt | 4 +-
.../markdown/rendering/MarkdownStyling.kt | 9 +
...rkdownProcessorDocumentParsingExtraTest.kt | 74 +-
.../MarkdownProcessorDocumentParsingTest.kt | 4908 ++++++++++-------
.../org/jetbrains/jewel/markdown/TestUtils.kt | 87 +-
markdown/extension/autolink/api/autolink.api | 3 +-
.../autolink/AutolinkProcessorExtension.kt | 14 +-
.../extension/gfm-alerts/api/gfm-alerts.api | 3 +-
.../alerts/GitHubAlertProcessorExtension.kt | 2 +-
.../bridge/styling/BridgeMarkdownStyling.kt | 2 +-
.../styling/IntUiMarkdownStyling.kt | 4 +-
21 files changed, 3445 insertions(+), 2430 deletions(-)
create mode 100644 markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithInlineMarkdown.kt
create mode 100644 markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithTextContent.kt
create mode 100644 markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension.kt
create mode 100644 markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/ProcessingUtil.kt
diff --git a/markdown/core/api/core.api b/markdown/core/api/core.api
index 4f2bf74a6..54fd53acc 100644
--- a/markdown/core/api/core.api
+++ b/markdown/core/api/core.api
@@ -1,188 +1,91 @@
-public abstract interface class org/jetbrains/jewel/markdown/BlockWithInlineMarkdown {
- public abstract fun getInlineContent ()Ljava/lang/Iterable;
-}
-
public abstract interface class org/jetbrains/jewel/markdown/InlineMarkdown {
- public abstract fun getChildren ()Ljava/lang/Iterable;
- public abstract fun getNativeNode ()Lorg/commonmark/node/Node;
}
public final class org/jetbrains/jewel/markdown/InlineMarkdown$Code : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/Code;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$Code;
- public static fun constructor-impl (Lorg/commonmark/node/Code;)Lorg/commonmark/node/Code;
- 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/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
- public static fun hashCode-impl (Lorg/commonmark/node/Code;)I
- public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/Code;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/Code;
-}
-
-public final class org/jetbrains/jewel/markdown/InlineMarkdown$CustomNode : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/CustomNode;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$CustomNode;
- public static fun constructor-impl (Lorg/commonmark/node/CustomNode;)Lorg/commonmark/node/CustomNode;
+ public static final field $stable I
+ public fun (Ljava/lang/String;)V
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/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 final fun getContent ()Ljava/lang/String;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/CustomNode;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/CustomNode;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/CustomNode;
}
-public final class org/jetbrains/jewel/markdown/InlineMarkdown$DefaultImpls {
- public static fun getChildren (Lorg/jetbrains/jewel/markdown/InlineMarkdown;)Ljava/lang/Iterable;
+public abstract interface class org/jetbrains/jewel/markdown/InlineMarkdown$CustomNode : org/jetbrains/jewel/markdown/InlineMarkdown {
}
-public final class org/jetbrains/jewel/markdown/InlineMarkdown$Emphasis : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/Emphasis;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$Emphasis;
- public static fun constructor-impl (Lorg/commonmark/node/Emphasis;)Lorg/commonmark/node/Emphasis;
+public final class org/jetbrains/jewel/markdown/InlineMarkdown$Emphasis : org/jetbrains/jewel/markdown/InlineMarkdown, org/jetbrains/jewel/markdown/WithInlineMarkdown {
+ public static final field $stable I
+ public fun (Ljava/lang/String;Ljava/util/List;)V
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/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 final fun getDelimiter ()Ljava/lang/String;
+ public fun getInlineContent ()Ljava/util/List;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/Emphasis;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/Emphasis;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/Emphasis;
}
public final class org/jetbrains/jewel/markdown/InlineMarkdown$HardLineBreak : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/HardLineBreak;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$HardLineBreak;
- public static fun constructor-impl (Lorg/commonmark/node/HardLineBreak;)Lorg/commonmark/node/HardLineBreak;
+ public static final field $stable I
+ public static final field INSTANCE Lorg/jetbrains/jewel/markdown/InlineMarkdown$HardLineBreak;
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/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
- public static fun hashCode-impl (Lorg/commonmark/node/HardLineBreak;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/HardLineBreak;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/HardLineBreak;
}
public final class org/jetbrains/jewel/markdown/InlineMarkdown$HtmlInline : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/HtmlInline;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$HtmlInline;
- public static fun constructor-impl (Lorg/commonmark/node/HtmlInline;)Lorg/commonmark/node/HtmlInline;
+ public static final field $stable I
+ public fun (Ljava/lang/String;)V
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/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 final fun getContent ()Ljava/lang/String;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/HtmlInline;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/HtmlInline;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/HtmlInline;
}
public final class org/jetbrains/jewel/markdown/InlineMarkdown$Image : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/Image;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$Image;
- public static fun constructor-impl (Lorg/commonmark/node/Image;)Lorg/commonmark/node/Image;
+ public static final field $stable I
+ public fun (Ljava/lang/String;Ljava/lang/String;)V
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/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 final fun getDestination ()Ljava/lang/String;
+ public final fun getTitle ()Ljava/lang/String;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/Image;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/Image;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/Image;
}
public final class org/jetbrains/jewel/markdown/InlineMarkdown$Link : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/Link;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$Link;
- public static fun constructor-impl (Lorg/commonmark/node/Link;)Lorg/commonmark/node/Link;
+ public static final field $stable I
+ public fun (Ljava/lang/String;Ljava/lang/String;Ljava/util/List;)V
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/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 final fun getChildren ()Ljava/util/List;
+ public final fun getDestination ()Ljava/lang/String;
+ public final fun getTitle ()Ljava/lang/String;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/Link;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/Link;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/Link;
}
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 static final field $stable I
+ public static final field INSTANCE Lorg/jetbrains/jewel/markdown/InlineMarkdown$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/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
- public static fun hashCode-impl (Lorg/commonmark/node/SoftLineBreak;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/SoftLineBreak;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/SoftLineBreak;
}
-public final class org/jetbrains/jewel/markdown/InlineMarkdown$StrongEmphasis : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/StrongEmphasis;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$StrongEmphasis;
- public static fun constructor-impl (Lorg/commonmark/node/StrongEmphasis;)Lorg/commonmark/node/StrongEmphasis;
+public final class org/jetbrains/jewel/markdown/InlineMarkdown$StrongEmphasis : org/jetbrains/jewel/markdown/InlineMarkdown, org/jetbrains/jewel/markdown/WithInlineMarkdown {
+ public static final field $stable I
+ public fun (Ljava/lang/String;Ljava/util/List;)V
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/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 final fun getDelimiter ()Ljava/lang/String;
+ public fun getInlineContent ()Ljava/util/List;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/StrongEmphasis;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/StrongEmphasis;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/StrongEmphasis;
}
public final class org/jetbrains/jewel/markdown/InlineMarkdown$Text : org/jetbrains/jewel/markdown/InlineMarkdown {
- public static final synthetic fun box-impl (Lorg/commonmark/node/Text;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$Text;
- public static fun constructor-impl (Lorg/commonmark/node/Text;)Lorg/commonmark/node/Text;
+ public static final field $stable I
+ public fun (Ljava/lang/String;)V
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/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 final fun getContent ()Ljava/lang/String;
public fun hashCode ()I
- public static fun hashCode-impl (Lorg/commonmark/node/Text;)I
public fun toString ()Ljava/lang/String;
- public static fun toString-impl (Lorg/commonmark/node/Text;)Ljava/lang/String;
- public final synthetic fun unbox-impl ()Lorg/commonmark/node/Text;
-}
-
-public final class org/jetbrains/jewel/markdown/InlineMarkdownKt {
- public static final fun toInlineNode (Lorg/commonmark/node/Node;)Lorg/jetbrains/jewel/markdown/InlineMarkdown;
}
public abstract interface class org/jetbrains/jewel/markdown/MarkdownBlock {
@@ -191,9 +94,7 @@ public abstract interface class org/jetbrains/jewel/markdown/MarkdownBlock {
public final class org/jetbrains/jewel/markdown/MarkdownBlock$BlockQuote : 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$BlockQuote;
- public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$BlockQuote;Ljava/util/List;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$BlockQuote;
+ public fun ([Lorg/jetbrains/jewel/markdown/MarkdownBlock;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getChildren ()Ljava/util/List;
public fun hashCode ()I
@@ -207,10 +108,6 @@ public abstract interface class org/jetbrains/jewel/markdown/MarkdownBlock$CodeB
public final class org/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCodeBlock : org/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock {
public static final field $stable I
public synthetic fun (Ljava/lang/String;Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
- public final fun component1 ()Ljava/lang/String;
- public final fun component2-EIRQHX8 ()Ljava/lang/String;
- public final fun copy-k5OzbWQ (Ljava/lang/String;Ljava/lang/String;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCodeBlock;
- public static synthetic fun copy-k5OzbWQ$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCodeBlock;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCodeBlock;
public fun equals (Ljava/lang/Object;)Z
public fun getContent ()Ljava/lang/String;
public final fun getMimeType-EIRQHX8 ()Ljava/lang/String;
@@ -221,9 +118,6 @@ public final class org/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$FencedCo
public final class org/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$IndentedCodeBlock : org/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock {
public static final field $stable I
public fun (Ljava/lang/String;)V
- public final fun component1 ()Ljava/lang/String;
- public final fun copy (Ljava/lang/String;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$IndentedCodeBlock;
- public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$IndentedCodeBlock;Ljava/lang/String;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$IndentedCodeBlock;
public fun equals (Ljava/lang/Object;)Z
public fun getContent ()Ljava/lang/String;
public fun hashCode ()I
@@ -233,28 +127,20 @@ public final class org/jetbrains/jewel/markdown/MarkdownBlock$CodeBlock$Indented
public abstract interface class org/jetbrains/jewel/markdown/MarkdownBlock$CustomBlock : org/jetbrains/jewel/markdown/MarkdownBlock {
}
-public final class org/jetbrains/jewel/markdown/MarkdownBlock$Heading : org/jetbrains/jewel/markdown/BlockWithInlineMarkdown, org/jetbrains/jewel/markdown/MarkdownBlock {
- 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 final class org/jetbrains/jewel/markdown/MarkdownBlock$Heading : org/jetbrains/jewel/markdown/MarkdownBlock, org/jetbrains/jewel/markdown/WithInlineMarkdown {
+ public static final field $stable I
+ public fun (I[Lorg/jetbrains/jewel/markdown/InlineMarkdown;)V
+ public fun (Ljava/util/List;I)V
public fun equals (Ljava/lang/Object;)Z
- 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 getInlineContent ()Ljava/util/List;
+ public final fun getLevel ()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 {
public static final field $stable I
public fun (Ljava/lang/String;)V
- public final fun component1 ()Ljava/lang/String;
- public final fun copy (Ljava/lang/String;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$HtmlBlock;
- public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$HtmlBlock;Ljava/lang/String;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$HtmlBlock;
public fun equals (Ljava/lang/Object;)Z
public final fun getContent ()Ljava/lang/String;
public fun hashCode ()I
@@ -269,12 +155,7 @@ public abstract interface class org/jetbrains/jewel/markdown/MarkdownBlock$ListB
public final class org/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedList : org/jetbrains/jewel/markdown/MarkdownBlock$ListBlock {
public static final field $stable I
public fun (Ljava/util/List;ZILjava/lang/String;)V
- public final fun component1 ()Ljava/util/List;
- public final fun component2 ()Z
- public final fun component3 ()I
- public final fun component4 ()Ljava/lang/String;
- public final fun copy (Ljava/util/List;ZILjava/lang/String;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedList;
- public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedList;Ljava/util/List;ZILjava/lang/String;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedList;
+ public fun (ZILjava/lang/String;[Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;)V
public fun equals (Ljava/lang/Object;)Z
public fun getChildren ()Ljava/util/List;
public final fun getDelimiter ()Ljava/lang/String;
@@ -287,11 +168,7 @@ public final class org/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$OrderedL
public final class org/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList : org/jetbrains/jewel/markdown/MarkdownBlock$ListBlock {
public static final field $stable I
public fun (Ljava/util/List;ZLjava/lang/String;)V
- public final fun component1 ()Ljava/util/List;
- public final fun component2 ()Z
- public final fun component3 ()Ljava/lang/String;
- public final fun copy (Ljava/util/List;ZLjava/lang/String;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList;
- public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList;Ljava/util/List;ZLjava/lang/String;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList;
+ public fun (ZLjava/lang/String;[Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;)V
public fun equals (Ljava/lang/Object;)Z
public fun getChildren ()Ljava/util/List;
public final fun getMarker ()Ljava/lang/String;
@@ -303,33 +180,29 @@ public final class org/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$Unordere
public final class org/jetbrains/jewel/markdown/MarkdownBlock$ListItem : 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$ListItem;
- public static synthetic fun copy$default (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;Ljava/util/List;ILjava/lang/Object;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;
+ public fun ([Lorg/jetbrains/jewel/markdown/MarkdownBlock;)V
public fun equals (Ljava/lang/Object;)Z
public final fun getChildren ()Ljava/util/List;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
}
-public final class org/jetbrains/jewel/markdown/MarkdownBlock$Paragraph : org/jetbrains/jewel/markdown/BlockWithInlineMarkdown, org/jetbrains/jewel/markdown/MarkdownBlock {
- 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 final class org/jetbrains/jewel/markdown/MarkdownBlock$Paragraph : org/jetbrains/jewel/markdown/MarkdownBlock, org/jetbrains/jewel/markdown/WithInlineMarkdown {
+ public static final field $stable I
+ public fun (Ljava/util/List;)V
+ public fun ([Lorg/jetbrains/jewel/markdown/InlineMarkdown;)V
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 getInlineContent ()Ljava/lang/Iterable;
- public static fun getInlineContent-impl (Lorg/commonmark/node/Paragraph;)Ljava/lang/Iterable;
+ public fun getInlineContent ()Ljava/util/List;
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 {
public static final field $stable I
public static final field INSTANCE Lorg/jetbrains/jewel/markdown/MarkdownBlock$ThematicBreak;
+ public fun equals (Ljava/lang/Object;)Z
+ public fun hashCode ()I
+ public fun toString ()Ljava/lang/String;
}
public final class org/jetbrains/jewel/markdown/MarkdownKt {
@@ -413,6 +286,10 @@ public final class org/jetbrains/jewel/markdown/SemanticsKt {
public static final fun setRawMarkdown (Landroidx/compose/ui/semantics/SemanticsPropertyReceiver;Ljava/lang/String;)V
}
+public abstract interface class org/jetbrains/jewel/markdown/WithInlineMarkdown {
+ public abstract fun getInlineContent ()Ljava/util/List;
+}
+
public abstract interface class org/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension {
public abstract fun canProcess (Lorg/commonmark/node/CustomBlock;)Z
public abstract fun processMarkdownBlock (Lorg/commonmark/node/CustomBlock;Lorg/jetbrains/jewel/markdown/processing/MarkdownProcessor;)Lorg/jetbrains/jewel/markdown/MarkdownBlock$CustomBlock;
@@ -423,6 +300,11 @@ public abstract interface class org/jetbrains/jewel/markdown/extensions/Markdown
public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$CustomBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownBlockRenderer;Lorg/jetbrains/jewel/markdown/rendering/InlineMarkdownRenderer;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
}
+public abstract interface class org/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension {
+ public abstract fun canProcess (Lorg/commonmark/node/CustomNode;)Z
+ public abstract fun processInlineMarkdown (Lorg/commonmark/node/CustomNode;Lorg/jetbrains/jewel/markdown/processing/MarkdownProcessor;)Lorg/jetbrains/jewel/markdown/InlineMarkdown$CustomNode;
+}
+
public final class org/jetbrains/jewel/markdown/extensions/MarkdownKt {
public static final fun getLocalMarkdownBlockRenderer ()Landroidx/compose/runtime/ProvidableCompositionLocal;
public static final fun getLocalMarkdownProcessor ()Landroidx/compose/runtime/ProvidableCompositionLocal;
@@ -433,11 +315,19 @@ public final class org/jetbrains/jewel/markdown/extensions/MarkdownKt {
}
public abstract interface class org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension {
+ public abstract fun getBlockProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
+ public abstract fun getInlineProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension;
public abstract fun getParserExtension ()Lorg/commonmark/parser/Parser$ParserExtension;
- public abstract fun getProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
public abstract fun getTextRendererExtension ()Lorg/commonmark/renderer/text/TextContentRenderer$TextContentRendererExtension;
}
+public final class org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension$DefaultImpls {
+ public static fun getBlockProcessorExtension (Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;)Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
+ public static fun getInlineProcessorExtension (Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;)Lorg/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension;
+ public static fun getParserExtension (Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;)Lorg/commonmark/parser/Parser$ParserExtension;
+ public static fun getTextRendererExtension (Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;)Lorg/commonmark/renderer/text/TextContentRenderer$TextContentRendererExtension;
+}
+
public abstract interface class org/jetbrains/jewel/markdown/extensions/MarkdownRendererExtension {
public abstract fun getBlockRenderer ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockRendererExtension;
}
@@ -454,8 +344,6 @@ public final class org/jetbrains/jewel/markdown/processing/MarkdownProcessor {
public fun ()V
public fun (Ljava/util/List;ZLorg/commonmark/parser/Parser;)V
public synthetic fun (Ljava/util/List;ZLorg/commonmark/parser/Parser;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
- public fun (Z[Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;)V
- public synthetic fun (Z[Lorg/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun processChildren (Lorg/commonmark/node/Node;)Ljava/util/List;
public final fun processMarkdownDocument (Ljava/lang/String;)Ljava/util/List;
}
@@ -480,15 +368,15 @@ 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;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
+ public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;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;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock$UnorderedList;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List$Unordered;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
+ public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
- public fun render-EPtGD7Q (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading$HN;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
- public fun render-EPtGD7Q (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
- public fun render-VUzZlgQ (Lorg/commonmark/node/Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public fun renderThematicBreak (Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$ThematicBreak;Landroidx/compose/runtime/Composer;I)V
}
@@ -522,6 +410,7 @@ public final class org/jetbrains/jewel/markdown/rendering/InlinesStyling {
public final fun getLinkVisited ()Landroidx/compose/ui/text/SpanStyle;
public final fun getRenderInlineHtml ()Z
public final fun getStrongEmphasis ()Landroidx/compose/ui/text/SpanStyle;
+ public final fun getTextLinkStyles ()Landroidx/compose/ui/text/TextLinkStyles;
public final fun getTextStyle ()Landroidx/compose/ui/text/TextStyle;
public fun hashCode ()I
public fun toString ()Ljava/lang/String;
@@ -537,15 +426,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;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
+ public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;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;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;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;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListBlock;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$List;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$ListItem;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
+ public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock$Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
public abstract fun render (Lorg/jetbrains/jewel/markdown/MarkdownBlock;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
- public abstract fun render-EPtGD7Q (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading$HN;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
- public abstract fun render-EPtGD7Q (Lorg/commonmark/node/Heading;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Heading;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;Landroidx/compose/runtime/Composer;I)V
- public abstract fun render-VUzZlgQ (Lorg/commonmark/node/Paragraph;Lorg/jetbrains/jewel/markdown/rendering/MarkdownStyling$Paragraph;ZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function0;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 1ec7ec3f9..ba54abe2b 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
@@ -1,96 +1,84 @@
package org.jetbrains.jewel.markdown
-import org.commonmark.node.Node
-import org.jetbrains.jewel.markdown.InlineMarkdown.Code
-import org.jetbrains.jewel.markdown.InlineMarkdown.CustomNode
-import org.jetbrains.jewel.markdown.InlineMarkdown.Emphasis
-import org.jetbrains.jewel.markdown.InlineMarkdown.HardLineBreak
-import org.jetbrains.jewel.markdown.InlineMarkdown.HtmlInline
-import org.jetbrains.jewel.markdown.InlineMarkdown.Image
-import org.jetbrains.jewel.markdown.InlineMarkdown.Link
-import org.jetbrains.jewel.markdown.InlineMarkdown.SoftLineBreak
-import org.jetbrains.jewel.markdown.InlineMarkdown.StrongEmphasis
-import org.jetbrains.jewel.markdown.InlineMarkdown.Text
-import org.commonmark.node.Code as CMCode
-import org.commonmark.node.CustomNode as CMCustomNode
-import org.commonmark.node.Emphasis as CMEmphasis
-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.SoftLineBreak as CMSoftLineBreak
-import org.commonmark.node.StrongEmphasis as CMStrongEmphasis
-import org.commonmark.node.Text as CMText
+import org.jetbrains.jewel.foundation.GenerateDataFunctions
/**
* A run of inline Markdown used as content for
* [block-level elements][MarkdownBlock].
*/
public sealed interface InlineMarkdown {
- public val nativeNode: Node
-
- @JvmInline
- public value class Code(override val nativeNode: CMCode) : InlineMarkdown
-
- @JvmInline
- public value class CustomNode(override val nativeNode: CMCustomNode) : InlineMarkdown
-
- @JvmInline
- public value class Emphasis(override val nativeNode: CMEmphasis) : InlineMarkdown
-
- @JvmInline
- public value class HardLineBreak(override val nativeNode: CMHardLineBreak) : InlineMarkdown
-
- @JvmInline
- public value class HtmlInline(override val nativeNode: CMHtmlInline) : InlineMarkdown
+ @GenerateDataFunctions
+ public class Code(override val content: String) : InlineMarkdown, WithTextContent
+
+ public interface CustomNode : InlineMarkdown {
+ /**
+ * If this custom node has a text-based representation, this function
+ * should return it. Otherwise, it should return null.
+ */
+ public fun contentOrNull(): String? = null
+ }
- @JvmInline
- public value class Image(override val nativeNode: CMImage) : InlineMarkdown
+ @GenerateDataFunctions
+ public class Emphasis(
+ public val delimiter: String,
+ override val inlineContent: List,
+ ) : InlineMarkdown, WithInlineMarkdown {
- @JvmInline
- public value class Link(override val nativeNode: CMLink) : InlineMarkdown
+ public constructor(
+ delimiter: String,
+ vararg inlineContent: InlineMarkdown,
+ ) : this(delimiter, inlineContent.toList())
+ }
- @JvmInline
- public value class SoftLineBreak(override val nativeNode: CMSoftLineBreak) : InlineMarkdown
+ public data object HardLineBreak : InlineMarkdown
+
+ @GenerateDataFunctions
+ public class HtmlInline(override val content: String) : InlineMarkdown, WithTextContent
+
+ @GenerateDataFunctions
+ public class Image(
+ public val source: String,
+ public val alt: String,
+ public val title: String?,
+ public val inlineContent: List,
+ ) : InlineMarkdown {
+
+ public constructor(
+ source: String,
+ alt: String,
+ title: String?,
+ vararg inlineContent: InlineMarkdown,
+ ) : this(source, alt, title, inlineContent.toList())
+ }
- @JvmInline
- public value class StrongEmphasis(override val nativeNode: CMStrongEmphasis) : InlineMarkdown
+ @GenerateDataFunctions
+ public class Link(
+ public val destination: String,
+ public val title: String?,
+ override val inlineContent: List,
+ ) : InlineMarkdown, WithInlineMarkdown {
+
+ public constructor(
+ destination: String,
+ title: String?,
+ vararg inlineContent: InlineMarkdown,
+ ) : this(destination, title, inlineContent.toList())
+ }
- @JvmInline
- public value class Text(override val nativeNode: CMText) : InlineMarkdown
+ public data object SoftLineBreak : InlineMarkdown
- public val children: Iterable
- get() =
- object : Iterable {
- override fun iterator(): Iterator =
- object : Iterator {
- var current = this@InlineMarkdown.nativeNode.firstChild
+ @GenerateDataFunctions
+ public class StrongEmphasis(
+ public val delimiter: String,
+ override val inlineContent: List,
+ ) : InlineMarkdown, WithInlineMarkdown {
- override fun hasNext(): Boolean = current != null
+ public constructor(
+ delimiter: String,
+ vararg inlineContent: InlineMarkdown,
+ ) : this(delimiter, inlineContent.toList())
+ }
- override fun next(): InlineMarkdown =
- if (hasNext()) {
- current.toInlineNode().also {
- current = current.next
- }
- } else {
- throw NoSuchElementException()
- }
- }
- }
+ @GenerateDataFunctions
+ public class Text(override val content: String) : InlineMarkdown, WithTextContent
}
-
-public fun Node.toInlineNode(): InlineMarkdown =
- when (this) {
- is CMText -> Text(this)
- is CMLink -> Link(this)
- is CMEmphasis -> Emphasis(this)
- is CMStrongEmphasis -> StrongEmphasis(this)
- is CMCode -> Code(this)
- is CMHtmlInline -> HtmlInline(this)
- is CMImage -> Image(this)
- is CMHardLineBreak -> HardLineBreak(this)
- is CMSoftLineBreak -> SoftLineBreak(this)
- is CMCustomNode -> CustomNode(this)
- else -> error("Unexpected block $this")
- }
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 f3f8d8f9e..99b7c2c5a 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,13 +1,12 @@
package org.jetbrains.jewel.markdown
-import org.commonmark.node.Block
import org.jetbrains.jewel.foundation.GenerateDataFunctions
-import org.jetbrains.jewel.foundation.InternalJewelApi
public sealed interface MarkdownBlock {
-
@GenerateDataFunctions
- public class BlockQuote(public val children: List) : MarkdownBlock
+ public class BlockQuote(public val children: List) : MarkdownBlock {
+ public constructor(vararg children: MarkdownBlock) : this(children.toList())
+ }
public sealed interface CodeBlock : MarkdownBlock {
public val content: String
@@ -28,7 +27,9 @@ public sealed interface MarkdownBlock {
public class Heading(
override val inlineContent: List,
public val level: Int,
- ) : MarkdownBlock, BlockWithInlineMarkdown
+ ) : MarkdownBlock, WithInlineMarkdown {
+ public constructor(level: Int, vararg inlineContent: InlineMarkdown) : this(inlineContent.toList(), level)
+ }
@GenerateDataFunctions
public class HtmlBlock(public val content: String) : MarkdownBlock
@@ -43,47 +44,40 @@ public sealed interface MarkdownBlock {
override val isTight: Boolean,
public val startFrom: Int,
public val delimiter: String,
- ) : ListBlock
+ ) : ListBlock {
+ public constructor(
+ isTight: Boolean,
+ startFrom: Int,
+ delimiter: String,
+ vararg children: ListItem,
+ ) : this(children.toList(), isTight, startFrom, delimiter)
+ }
@GenerateDataFunctions
public class UnorderedList(
override val children: List,
override val isTight: Boolean,
public val marker: String,
- ) : ListBlock
+ ) : ListBlock {
+ public constructor(
+ isTight: Boolean,
+ marker: String,
+ vararg children: ListItem,
+ ) : this(children.toList(), isTight, marker)
+ }
}
@GenerateDataFunctions
- public class ListItem(public val children: List) : MarkdownBlock
+ public class ListItem(public val children: List) : MarkdownBlock {
+ public constructor(vararg children: MarkdownBlock) : this(children.toList())
+ }
public data object ThematicBreak : MarkdownBlock
@GenerateDataFunctions
public class Paragraph(
override val inlineContent: List,
- ) : MarkdownBlock, BlockWithInlineMarkdown
-}
-
-public interface BlockWithInlineMarkdown {
- public val inlineContent: Iterable
-}
-
-@InternalJewelApi
-public fun Block.readInlineContent(): Iterable =
- object : Iterable {
- override fun iterator(): Iterator =
- object : Iterator {
- var current = this@readInlineContent.firstChild
-
- override fun hasNext(): Boolean = current != null
-
- override fun next(): InlineMarkdown =
- if (hasNext()) {
- current.toInlineNode().also {
- current = current.next
- }
- } else {
- throw NoSuchElementException()
- }
- }
+ ) : MarkdownBlock, WithInlineMarkdown {
+ public constructor(vararg inlineContent: InlineMarkdown) : this(inlineContent.toList())
}
+}
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithInlineMarkdown.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithInlineMarkdown.kt
new file mode 100644
index 000000000..6259e4b58
--- /dev/null
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithInlineMarkdown.kt
@@ -0,0 +1,5 @@
+package org.jetbrains.jewel.markdown
+
+public interface WithInlineMarkdown {
+ public val inlineContent: List
+}
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithTextContent.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithTextContent.kt
new file mode 100644
index 000000000..d06a8c6ae
--- /dev/null
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/WithTextContent.kt
@@ -0,0 +1,5 @@
+package org.jetbrains.jewel.markdown
+
+public interface WithTextContent {
+ public val content: String
+}
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension.kt
new file mode 100644
index 000000000..d9600fef0
--- /dev/null
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension.kt
@@ -0,0 +1,25 @@
+package org.jetbrains.jewel.markdown.extensions
+
+import org.commonmark.node.CustomNode
+import org.jetbrains.jewel.markdown.InlineMarkdown
+import org.jetbrains.jewel.markdown.processing.MarkdownProcessor
+
+public interface MarkdownInlineProcessorExtension {
+ /**
+ * Returns true if the [node] can be processed by this extension instance.
+ *
+ * @param node The [CustomNode] to parse
+ */
+ public fun canProcess(node: CustomNode): Boolean
+
+ /**
+ * Processes the [node] as a [InlineMarkdown.CustomNode], if possible. Note
+ * that you should always check that [canProcess] returns true for the same
+ * [node], as implementations might throw an exception for unsupported node
+ * types.
+ */
+ public fun processInlineMarkdown(
+ node: CustomNode,
+ processor: MarkdownProcessor,
+ ): InlineMarkdown.CustomNode?
+}
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension.kt
index 039f5c895..81f70e8ad 100644
--- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension.kt
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension.kt
@@ -1,36 +1,58 @@
package org.jetbrains.jewel.markdown.extensions
-import org.commonmark.node.CustomBlock
import org.commonmark.parser.Parser.ParserExtension
import org.commonmark.renderer.text.TextContentRenderer.TextContentRendererExtension
import org.jetbrains.jewel.foundation.ExperimentalJewelApi
-import org.jetbrains.jewel.markdown.MarkdownBlock
/** An extension for the Jewel Markdown processing engine. */
@ExperimentalJewelApi
public interface MarkdownProcessorExtension {
/**
* A CommonMark [ParserExtension] that will be used to parse the extended
- * syntax represented by this extension instance. Null in the case where
- * parsing is already handled by an existing [org.commonmark.parser.Parser].
+ * syntax represented by this extension instance.
+ *
+ * Can be null if all required processing is already handled by an existing
+ * [org.commonmark.parser.Parser].
*/
public val parserExtension: ParserExtension?
+ get() = null
/**
* A CommonMark [TextContentRendererExtension] that will be used to render
- * the text content of the CommonMark [CustomBlock] produced by the
- * [parserExtension]. Null in the case where rendering is already
- * handled by an existing [org.commonmark.renderer.Renderer].
+ * the text content of the CommonMark [org.commonmark.node.CustomBlock]
+ * produced by the [parserExtension].
+ *
+ * Can be null if all required processing is already handled by an existing
+ * [org.commonmark.renderer.Renderer].
*/
public val textRendererExtension: TextContentRendererExtension?
+ get() = null
/**
* An extension for
- * [`MarkdownParser`][org.jetbrains.jewel.markdown.parsing.MarkdownParser]
- * that will transform a supported [CustomBlock] into the corresponding
- * [MarkdownBlock.CustomBlock]. Null in the case where processing
- * is already be handled by [org.jetbrains.jewel.markdown.processing.MarkdownProcessor]
- * or another [org.jetbrains.jewel.markdown.extensions.MarkdownProcessorExtension].
+ * [`MarkdownProcessor`][org.jetbrains.jewel.markdown.processing.MarkdownProcessor]
+ * that will transform a supported [org.commonmark.node.CustomBlock] into
+ * the corresponding
+ * [org.jetbrains.jewel.markdown.MarkdownBlock.CustomBlock].
+ *
+ * Can be null if all required processing is already handled by
+ * [org.jetbrains.jewel.markdown.processing.MarkdownProcessor] or another
+ * [org.jetbrains.jewel.markdown.extensions.MarkdownProcessorExtension].
*/
- public val processorExtension: MarkdownBlockProcessorExtension?
+ public val blockProcessorExtension: MarkdownBlockProcessorExtension?
+ get() = null
+
+ /**
+ * An extension for
+ * [`MarkdownProcessor`][org.jetbrains.jewel.markdown.processing.MarkdownProcessor]
+ * that will transform a supported [org.commonmark.node.CustomNode] into
+ * the corresponding
+ * [org.jetbrains.jewel.markdown.InlineMarkdown.CustomNode].
+ *
+ * Can be null if all required processing is already handled by
+ * [org.jetbrains.jewel.markdown.processing.MarkdownProcessor] or another
+ * [org.jetbrains.jewel.markdown.extensions.MarkdownProcessorExtension].
+ */
+ public val inlineProcessorExtension: MarkdownInlineProcessorExtension?
+ get() = null
}
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 2985e1016..289aecfba 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
@@ -26,7 +26,6 @@ import org.jetbrains.jewel.markdown.MarkdownBlock.CodeBlock
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.readInlineContent
import org.jetbrains.jewel.markdown.rendering.DefaultInlineMarkdownRenderer
import org.commonmark.node.ListBlock as CMListBlock
@@ -73,18 +72,23 @@ public class MarkdownProcessor(
* @param rawMarkdown the raw Markdown string to process.
* @see DefaultInlineMarkdownRenderer
*/
- public fun processMarkdownDocument(@Language("Markdown") rawMarkdown: String): List {
- val blocks = if (optimizeEdits) {
- processWithQuickEdits(rawMarkdown)
- } else {
- parseRawMarkdown(rawMarkdown)
- }
+ public fun processMarkdownDocument(
+ @Language("Markdown") rawMarkdown: String,
+ ): List {
+ val blocks =
+ if (optimizeEdits) {
+ processWithQuickEdits(rawMarkdown)
+ } else {
+ parseRawMarkdown(rawMarkdown)
+ }
return blocks.mapNotNull { child -> child.tryProcessMarkdownBlock() }
}
@VisibleForTesting
- internal fun processWithQuickEdits(@Language("Markdown") rawMarkdown: String): List {
+ internal fun processWithQuickEdits(
+ @Language("Markdown") rawMarkdown: String,
+ ): List {
val (previousLines, previousBlocks, previousIndexes) = currentState
val newLines = rawMarkdown.lines()
val nLinesDelta = newLines.size - previousLines.size
@@ -163,7 +167,9 @@ public class MarkdownProcessor(
return newBlocks
}
- private fun parseRawMarkdown(@Language("Markdown") rawMarkdown: String): List {
+ private fun parseRawMarkdown(
+ @Language("Markdown") rawMarkdown: String,
+ ): List {
val document =
commonMarkParser.parse(rawMarkdown) as? Document
?: error("This doesn't look like a Markdown document")
@@ -186,24 +192,22 @@ public class MarkdownProcessor(
is ThematicBreak -> MarkdownBlock.ThematicBreak
is HtmlBlock -> toMarkdownHtmlBlockOrNull()
is CustomBlock -> {
- extensions.find { it.processorExtension?.canProcess(this) == true }
- ?.processorExtension?.processMarkdownBlock(this, this@MarkdownProcessor)
+ extensions.find { it.blockProcessorExtension?.canProcess(this) == true }
+ ?.blockProcessorExtension?.processMarkdownBlock(this, this@MarkdownProcessor)
}
else -> null
}
- private fun Paragraph.toMarkdownParagraph(): MarkdownBlock.Paragraph =
- MarkdownBlock.Paragraph(readInlineContent().toList())
+ private fun Paragraph.toMarkdownParagraph(): MarkdownBlock.Paragraph = MarkdownBlock.Paragraph(readInlineContent().toList())
- private fun BlockQuote.toMarkdownBlockQuote(): MarkdownBlock.BlockQuote =
- MarkdownBlock.BlockQuote(processChildren(this))
+ private fun BlockQuote.toMarkdownBlockQuote(): MarkdownBlock.BlockQuote = MarkdownBlock.BlockQuote(processChildren(this))
private fun Heading.toMarkdownHeadingOrNull(): MarkdownBlock.Heading? {
if (level < 1 || level > 6) return null
return MarkdownBlock.Heading(
inlineContent = readInlineContent().toList(),
- level = level
+ level = level,
)
}
@@ -213,8 +217,7 @@ public class MarkdownProcessor(
mimeType = MimeType.Known.fromMarkdownLanguageName(info),
)
- private fun IndentedCodeBlock.toMarkdownCodeBlockOrNull(): CodeBlock.IndentedCodeBlock =
- CodeBlock.IndentedCodeBlock(literal.trimEnd('\n'))
+ private fun IndentedCodeBlock.toMarkdownCodeBlockOrNull(): CodeBlock.IndentedCodeBlock = CodeBlock.IndentedCodeBlock(literal.trimEnd('\n'))
private fun BulletList.toMarkdownListOrNull(): ListBlock.UnorderedList? {
val children = processListItems()
@@ -223,7 +226,7 @@ public class MarkdownProcessor(
return ListBlock.UnorderedList(
children = children,
isTight = isTight,
- marker = marker
+ marker = marker,
)
}
@@ -235,7 +238,7 @@ public class MarkdownProcessor(
children = children,
isTight = isTight,
startFrom = markerStartNumber,
- delimiter = markerDelimiter
+ delimiter = markerDelimiter,
)
}
@@ -277,5 +280,7 @@ public class MarkdownProcessor(
return MarkdownBlock.HtmlBlock(literal.trimEnd('\n'))
}
+ private fun Block.readInlineContent() = readInlineContent(this@MarkdownProcessor, extensions)
+
private data class State(val lines: List, val blocks: List, val indexes: List>)
}
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/ProcessingUtil.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/ProcessingUtil.kt
new file mode 100644
index 000000000..a9f8cae5d
--- /dev/null
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/processing/ProcessingUtil.kt
@@ -0,0 +1,126 @@
+package org.jetbrains.jewel.markdown.processing
+
+import org.commonmark.node.Node
+import org.jetbrains.annotations.VisibleForTesting
+import org.jetbrains.jewel.markdown.InlineMarkdown
+import org.jetbrains.jewel.markdown.WithInlineMarkdown
+import org.jetbrains.jewel.markdown.WithTextContent
+import org.jetbrains.jewel.markdown.extensions.MarkdownProcessorExtension
+import org.commonmark.node.Code as CMCode
+import org.commonmark.node.CustomNode as CMCustomNode
+import org.commonmark.node.Emphasis as CMEmphasis
+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.SoftLineBreak as CMSoftLineBreak
+import org.commonmark.node.StrongEmphasis as CMStrongEmphasis
+import org.commonmark.node.Text as CMText
+
+@VisibleForTesting
+internal fun Node.readInlineContent(
+ markdownProcessor: MarkdownProcessor,
+ extensions: List,
+): List =
+ object : Iterable {
+ override fun iterator(): Iterator =
+ object : Iterator {
+ var current = this@readInlineContent.firstChild
+
+ override fun hasNext(): Boolean = current != null
+
+ override fun next(): InlineMarkdown {
+ while (hasNext()) {
+ val inline = current.toInlineMarkdownOrNull(markdownProcessor, extensions)
+
+ current = current.next
+
+ if (inline == null) {
+ continue
+ } else {
+ return inline
+ }
+ }
+
+ throw NoSuchElementException()
+ }
+ }
+ }.toList()
+
+@VisibleForTesting
+internal fun Node.toInlineMarkdownOrNull(
+ markdownProcessor: MarkdownProcessor,
+ extensions: List,
+) = when (this) {
+ is CMText -> InlineMarkdown.Text(literal)
+ is CMLink ->
+ InlineMarkdown.Link(
+ destination = destination,
+ title = title,
+ inlineContent = readInlineContent(markdownProcessor, extensions),
+ )
+
+ is CMEmphasis ->
+ InlineMarkdown.Emphasis(
+ delimiter = openingDelimiter,
+ inlineContent = readInlineContent(markdownProcessor, extensions),
+ )
+
+ is CMStrongEmphasis ->
+ InlineMarkdown.StrongEmphasis(
+ openingDelimiter,
+ readInlineContent(markdownProcessor, extensions),
+ )
+
+ is CMCode -> InlineMarkdown.Code(literal)
+ is CMHtmlInline -> InlineMarkdown.HtmlInline(literal)
+ is CMImage -> {
+ val inlineContent = readInlineContent(markdownProcessor, extensions)
+ InlineMarkdown.Image(
+ source = destination,
+ alt = inlineContent.renderAsSimpleText(),
+ title = title,
+ inlineContent = inlineContent
+ )
+ }
+
+ is CMHardLineBreak -> InlineMarkdown.HardLineBreak
+ is CMSoftLineBreak -> InlineMarkdown.SoftLineBreak
+ is CMCustomNode ->
+ extensions.find { it.inlineProcessorExtension?.canProcess(this) == true }
+ ?.inlineProcessorExtension?.processInlineMarkdown(this, markdownProcessor)
+
+ else -> error("Unexpected block $this")
+}
+
+/**
+ * Used to render content as simple plain text, used when creating image
+ * alt text.
+ */
+internal fun List.renderAsSimpleText(): String = buildString {
+ for ((index, node) in this@renderAsSimpleText.withIndex()) {
+ when (node) {
+ is WithInlineMarkdown -> append(node.inlineContent.renderAsSimpleText())
+ is WithTextContent -> {
+ if (index > 0 && this@renderAsSimpleText[index - 1] is WithTextContent) {
+ append(' ')
+ }
+ append(node.content.trim())
+ }
+
+ is InlineMarkdown.CustomNode -> {
+ val textContent = node.contentOrNull()
+ if (textContent != null) {
+ append(' ')
+ append(textContent)
+ }
+ }
+
+ is InlineMarkdown.HardLineBreak -> append('\n')
+ is InlineMarkdown.SoftLineBreak -> append(' ')
+ else -> {
+ // Ignore other nodes
+ }
+ }
+ }
+}.trim()
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 2ed53289c..f795e01d5 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
@@ -6,7 +6,6 @@ import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.AnnotatedString.Builder
import androidx.compose.ui.text.LinkAnnotation
import androidx.compose.ui.text.SpanStyle
-import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.buildAnnotatedString
import org.commonmark.renderer.text.TextContentRenderer
import org.jetbrains.jewel.foundation.ExperimentalJewelApi
@@ -41,23 +40,14 @@ public open class DefaultInlineMarkdownRenderer(
enabled: Boolean,
onUrlClicked: ((String) -> Unit)? = null,
) {
- // TODO move to InlineMarkdown to avoid recomputing after #416 is done
- val linkStyling =
- TextLinkStyles(
- styling.link,
- styling.linkFocused,
- styling.linkHovered,
- styling.linkPressed,
- )
-
for (child in inlineMarkdown) {
when (child) {
- is InlineMarkdown.Text -> append(child.nativeNode.literal)
+ is InlineMarkdown.Text -> append(child.content)
is InlineMarkdown.Emphasis -> {
withStyles(styling.emphasis.withEnabled(enabled), child) {
appendInlineMarkdownFrom(
- it.children,
+ it.inlineContent,
styling,
enabled,
)
@@ -65,32 +55,33 @@ public open class DefaultInlineMarkdownRenderer(
}
is InlineMarkdown.StrongEmphasis -> {
- withStyles(
- styling.strongEmphasis.withEnabled(enabled),
- child,
- ) { appendInlineMarkdownFrom(it.children, styling, enabled) }
+ withStyles(styling.strongEmphasis.withEnabled(enabled), child) {
+ appendInlineMarkdownFrom(it.inlineContent, styling, enabled)
+ }
}
is InlineMarkdown.Link -> {
val index =
if (enabled) {
- val destination = child.nativeNode.destination
+ val destination = child.destination
val link =
LinkAnnotation.Clickable(
tag = destination,
linkInteractionListener = { _ -> onUrlClicked?.invoke(destination) },
- styles = linkStyling,
+ styles = styling.textLinkStyles,
)
pushLink(link)
} else {
pushStyle(styling.linkDisabled)
}
- appendInlineMarkdownFrom(child.children, styling, enabled)
+ appendInlineMarkdownFrom(child.inlineContent, styling, enabled)
pop(index)
}
is InlineMarkdown.Code -> {
- withStyles(styling.inlineCode.withEnabled(enabled), child) { append(it.nativeNode.literal) }
+ withStyles(styling.inlineCode.withEnabled(enabled), child) {
+ append(it.content)
+ }
}
is InlineMarkdown.HardLineBreak -> appendLine()
@@ -101,14 +92,21 @@ public open class DefaultInlineMarkdownRenderer(
withStyles(
styling.inlineHtml.withEnabled(enabled),
child,
- ) { append(it.nativeNode.literal.trim()) }
+ ) { append(it.content.trim()) }
}
}
is InlineMarkdown.Image -> {
appendInlineContent(
INLINE_IMAGE,
- child.nativeNode.destination + "\n" + plainTextRenderer.render(child.nativeNode),
+ buildString {
+ appendLine(child.source)
+ append(child.alt)
+ if (!child.title.isNullOrBlank()) {
+ appendLine()
+ append(child.title)
+ }
+ },
)
}
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
index 10a657c67..e5d9c6e64 100644
--- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/DefaultMarkdownBlockRenderer.kt
@@ -51,7 +51,6 @@ import androidx.compose.ui.unit.dp
import org.jetbrains.jewel.foundation.ExperimentalJewelApi
import org.jetbrains.jewel.foundation.modifier.onHover
import org.jetbrains.jewel.foundation.theme.LocalContentColor
-import org.jetbrains.jewel.markdown.BlockWithInlineMarkdown
import org.jetbrains.jewel.markdown.MarkdownBlock
import org.jetbrains.jewel.markdown.MarkdownBlock.BlockQuote
import org.jetbrains.jewel.markdown.MarkdownBlock.CodeBlock
@@ -66,6 +65,7 @@ import org.jetbrains.jewel.markdown.MarkdownBlock.ListBlock.UnorderedList
import org.jetbrains.jewel.markdown.MarkdownBlock.ListItem
import org.jetbrains.jewel.markdown.MarkdownBlock.Paragraph
import org.jetbrains.jewel.markdown.MarkdownBlock.ThematicBreak
+import org.jetbrains.jewel.markdown.WithInlineMarkdown
import org.jetbrains.jewel.markdown.extensions.MarkdownRendererExtension
import org.jetbrains.jewel.ui.Orientation.Horizontal
import org.jetbrains.jewel.ui.component.Divider
@@ -477,7 +477,7 @@ public open class DefaultMarkdownBlockRenderer(
@Composable
private fun rememberRenderedContent(
- block: BlockWithInlineMarkdown,
+ block: WithInlineMarkdown,
styling: InlinesStyling,
enabled: Boolean,
onUrlClick: ((String) -> Unit)? = null,
diff --git a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/MarkdownStyling.kt b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/MarkdownStyling.kt
index 7ff64e74d..b04464f4b 100644
--- a/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/MarkdownStyling.kt
+++ b/markdown/core/src/main/kotlin/org/jetbrains/jewel/markdown/rendering/MarkdownStyling.kt
@@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.StrokeCap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.text.SpanStyle
+import androidx.compose.ui.text.TextLinkStyles
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.Dp
@@ -279,6 +280,14 @@ public class InlinesStyling(
public val inlineHtml: SpanStyle,
public val renderInlineHtml: Boolean,
) {
+ public val textLinkStyles: TextLinkStyles =
+ TextLinkStyles(
+ style = link,
+ focusedStyle = linkFocused,
+ hoveredStyle = linkHovered,
+ pressedStyle = linkPressed,
+ )
+
public companion object
}
diff --git a/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingExtraTest.kt b/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingExtraTest.kt
index d5b22672b..ae932c4b9 100644
--- a/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingExtraTest.kt
+++ b/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingExtraTest.kt
@@ -1,5 +1,10 @@
package org.jetbrains.jewel.markdown
+import org.jetbrains.jewel.markdown.InlineMarkdown.Emphasis
+import org.jetbrains.jewel.markdown.InlineMarkdown.Link
+import org.jetbrains.jewel.markdown.InlineMarkdown.StrongEmphasis
+import org.jetbrains.jewel.markdown.InlineMarkdown.Text
+import org.jetbrains.jewel.markdown.MarkdownBlock.Paragraph
import org.jetbrains.jewel.markdown.processing.MarkdownProcessor
import org.junit.Test
@@ -14,7 +19,7 @@ class MarkdownProcessorDocumentParsingExtraTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[](/bar* \"ti*tle\")"))
+ parsed.assertEquals(Paragraph(Link("/bar*", "ti*tle", emptyList())))
}
@Test
@@ -25,7 +30,18 @@ class MarkdownProcessorDocumentParsingExtraTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("*_foo *bar*_*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Emphasis(
+ "_",
+ Text("foo "),
+ Emphasis("*", Text("bar"))
+ )
+ )
+ )
+ )
}
@Test
@@ -36,7 +52,15 @@ class MarkdownProcessorDocumentParsingExtraTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("**foo *bar***"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Emphasis("*", Text("bar"))
+ )
+ )
+ )
}
@Test
@@ -47,7 +71,19 @@ class MarkdownProcessorDocumentParsingExtraTest {
* Expected HTML:
* foo bar a
*/
- parsed.assertEquals(paragraph("*_foo *bar* a_*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Emphasis(
+ "_",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ Text(" a"),
+ )
+ )
+ )
+ )
}
@Test
@@ -58,7 +94,16 @@ class MarkdownProcessorDocumentParsingExtraTest {
* Expected HTML:
* foo bar a
*/
- parsed.assertEquals(paragraph("**foo *bar* a**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ Text(" a"),
+ )
+ )
+ )
}
@Test
@@ -67,8 +112,23 @@ class MarkdownProcessorDocumentParsingExtraTest {
/*
* Expected HTML:
- * foo bar a
+ * foo bar a
*/
- parsed.assertEquals(paragraph("*_*foo *bar* a*_*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Emphasis(
+ "_",
+ Emphasis(
+ "*",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ Text(" a"),
+ )
+ )
+ )
+ )
+ )
}
}
diff --git a/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingTest.kt b/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingTest.kt
index af9d12100..96f7e422b 100644
--- a/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingTest.kt
+++ b/markdown/core/src/test/kotlin/org/jetbrains/jewel/markdown/MarkdownProcessorDocumentParsingTest.kt
@@ -1,13 +1,24 @@
package org.jetbrains.jewel.markdown
+import org.jetbrains.jewel.markdown.InlineMarkdown.Code
+import org.jetbrains.jewel.markdown.InlineMarkdown.Emphasis
+import org.jetbrains.jewel.markdown.InlineMarkdown.HardLineBreak
+import org.jetbrains.jewel.markdown.InlineMarkdown.HtmlInline
+import org.jetbrains.jewel.markdown.InlineMarkdown.Image
+import org.jetbrains.jewel.markdown.InlineMarkdown.Link
+import org.jetbrains.jewel.markdown.InlineMarkdown.SoftLineBreak
+import org.jetbrains.jewel.markdown.InlineMarkdown.StrongEmphasis
+import org.jetbrains.jewel.markdown.InlineMarkdown.Text
+import org.jetbrains.jewel.markdown.MarkdownBlock.Heading
+import org.jetbrains.jewel.markdown.MarkdownBlock.Paragraph
import org.jetbrains.jewel.markdown.processing.MarkdownProcessor
import org.junit.Ignore
import org.junit.Test
/**
- * This class tests that all the snippets in the CommonMark 0.31.2 specs are
- * rendered correctly into MarkdownBlocks, matching what the CommonMark
- * 0.20 HTML renderer tests also validate.
+ * This class tests that all the snippets in the CommonMark 0.31.2
+ * specs are rendered correctly into MarkdownBlocks, matching
+ * what the CommonMark 0.20 HTML renderer tests also validate.
*
*
* Note that the reference HTML output is only there as information; our
@@ -198,7 +209,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo
*/
- parsed.assertEquals(heading(level = 1, "Foo"))
+ parsed.assertEquals(heading(level = 1, Text("Foo")))
}
@Test
@@ -223,7 +234,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
*/
- parsed.assertEquals(paragraph("\\!\"#\$%&'\\(\\)\\*+,-./:;\\<=\\>?@\\[\\\\\\]^\\_\\`{|}\\~"))
+ parsed.assertEquals(paragraph("!\"#\$%&'()*+,-./:;<=>?@[\\]^_`{|}~"))
}
@Test
@@ -242,16 +253,16 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |\*not emphasized*
- |\
not a tag
- |\[not a link](/foo)
- |\`not code`
- |1\. not a list
- |\* not a list
- |\# not a heading
- |\[foo]: /url "not a reference"
- |\ö not a character entity
- """
+ |\*not emphasized*
+ |\
not a tag
+ |\[not a link](/foo)
+ |\`not code`
+ |1\. not a list
+ |\* not a list
+ |\# not a heading
+ |\[foo]: /url "not a reference"
+ |\ö not a character entity
+ """
.trimMargin(),
)
@@ -268,16 +279,24 @@ class MarkdownProcessorDocumentParsingTest {
* ö not a character entity
*/
parsed.assertEquals(
- paragraph(
- "\\*not emphasized\\* " +
- "\\
not a tag " +
- "\\[not a link\\]\\(/foo\\) " +
- "\\`not code\\` " +
- "1. not a list " +
- "\\* not a list " +
- "# not a heading " +
- "\\[foo\\]: /url \"not a reference\" " +
- "\\ö not a character entity",
+ Paragraph(
+ Text("*not emphasized*"),
+ SoftLineBreak,
+ Text("
not a tag"),
+ SoftLineBreak,
+ Text("[not a link](/foo)"),
+ SoftLineBreak,
+ Text("`not code`"),
+ SoftLineBreak,
+ Text("1. not a list"),
+ SoftLineBreak,
+ Text("* not a list"),
+ SoftLineBreak,
+ Text("# not a heading"),
+ SoftLineBreak,
+ Text("[foo]: /url \"not a reference\""),
+ SoftLineBreak,
+ Text("ö not a character entity"),
),
)
}
@@ -290,7 +309,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* \emphasis
*/
- parsed.assertEquals(paragraph("\\\\*emphasis*"))
+ parsed.assertEquals(Paragraph(Text("\\"), Emphasis("*", Text("emphasis"))))
}
@Test
@@ -298,9 +317,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |foo\
- |bar
- """
+ |foo\
+ |bar
+ """
.trimMargin(),
)
@@ -309,7 +328,7 @@ class MarkdownProcessorDocumentParsingTest {
* foo
* bar
*/
- parsed.assertEquals(paragraph("foo \nbar"))
+ parsed.assertEquals(Paragraph(Text("foo"), HardLineBreak, Text("bar")))
}
@Test
@@ -320,7 +339,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* \[\`
*/
- parsed.assertEquals(paragraph("`` \\[\\` ``"))
+ parsed.assertEquals(Paragraph(Code("\\[\\`")))
}
@Test
@@ -340,10 +359,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~
- |\[\]
- |~~~
- """
+ |~~~
+ |\[\]
+ |~~~
+ """
.trimMargin(),
)
@@ -363,7 +382,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* https://example.com?find=\*
*/
- parsed.assertEquals(paragraph("[https://example.com?find=\\\\*](https://example.com?find=\\\\*)"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(
+ "https://example.com?find=\\*",
+ title = null,
+ Text("https://example.com?find=\\*")
+ )
+ )
+ )
}
@Test
@@ -385,7 +412,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/bar* \"ti*tle\")"))
+ parsed.assertEquals(Paragraph(Link("/bar*", "ti*tle", Text("foo"))))
}
@Test
@@ -393,10 +420,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]
- |
- |[foo]: /bar\* "ti\*tle"
- """
+ |[foo]
+ |
+ |[foo]: /bar\* "ti\*tle"
+ """
.trimMargin(),
)
@@ -404,7 +431,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/bar* \"ti*tle\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/bar*", title = "ti*tle", Text("foo"))))
}
@Test
@@ -412,10 +439,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``` foo\+bar
- |foo
- |```
- """
+ |``` foo\+bar
+ |foo
+ |```
+ """
.trimMargin(),
)
@@ -433,10 +460,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | & © Æ Ď
- |¾ ℋ ⅆ
- |∲ ≧̸
- """
+ | & © Æ Ď
+ |¾ ℋ ⅆ
+ |∲ ≧̸
+ """
.trimMargin(),
)
@@ -446,7 +473,15 @@ class MarkdownProcessorDocumentParsingTest {
* ¾ ℋ ⅆ
* ∲ ≧̸
*/
- parsed.assertEquals(paragraph(" & © Æ Ď ¾ ℋ ⅆ ∲ ≧̸"))
+ parsed.assertEquals(
+ Paragraph(
+ Text(" & © Æ Ď"),
+ SoftLineBreak,
+ Text("¾ ℋ ⅆ"),
+ SoftLineBreak,
+ Text("∲ ≧̸")
+ )
+ )
}
@Test
@@ -477,11 +512,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |  &x;
- |
- |abcdef0;
- |&ThisIsNotDefined; &hi?;
- """
+ |  &x;
+ |
+ |abcdef0;
+ |&ThisIsNotDefined; &hi?;
+ """
.trimMargin(),
)
@@ -493,7 +528,15 @@ class MarkdownProcessorDocumentParsingTest {
* &ThisIsNotDefined; &hi?;
*/
parsed.assertEquals(
- paragraph("  &x; abcdef0; &ThisIsNotDefined; &hi?;"),
+ Paragraph(
+ Text("  &x; "),
+ SoftLineBreak,
+ Text(""),
+ SoftLineBreak,
+ Text("abcdef0;"),
+ SoftLineBreak,
+ Text("&ThisIsNotDefined; &hi?;"),
+ )
)
}
@@ -539,7 +582,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/föö \"föö\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/föö", title = "föö", Text("foo"))))
}
@Test
@@ -547,10 +590,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]
- |
- |[foo]: /föö "föö"
- """
+ |[foo]
+ |
+ |[foo]: /föö "föö"
+ """
.trimMargin(),
)
@@ -559,7 +602,7 @@ class MarkdownProcessorDocumentParsingTest {
* foo
*/
- parsed.assertEquals(paragraph("[foo](/föö \"föö\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/föö", title = "föö", Text("foo"))))
}
@Test
@@ -567,10 +610,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``` föö
- |foo
- |```
- """
+ |``` föö
+ |foo
+ |```
+ """
.trimMargin(),
)
@@ -590,7 +633,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* föö
*/
- parsed.assertEquals(paragraph("`föö`"))
+ parsed.assertEquals(Paragraph(Code("föö")))
}
@Test
@@ -614,7 +657,13 @@ class MarkdownProcessorDocumentParsingTest {
* *foo*
* foo
*/
- parsed.assertEquals(paragraph("\\*foo\\* *foo*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*foo*"),
+ SoftLineBreak,
+ Emphasis("*", Text("foo")),
+ )
+ )
}
@Test
@@ -622,10 +671,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |* foo
- |
- |* foo
- """
+ |* foo
+ |
+ |* foo
+ """
.trimMargin(),
)
@@ -637,7 +686,7 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- paragraph("\\* foo"),
+ paragraph("* foo"),
unorderedList(listItem(paragraph("foo")), marker = "*"),
)
}
@@ -674,7 +723,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [a](url "tit")
*/
- parsed.assertEquals(paragraph("\\[a\\]\\(url \"tit\"\\)"))
+ parsed.assertEquals(paragraph("[a](url \"tit\")"))
}
@Test
@@ -682,9 +731,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- `one
- |- two`
- """
+ |- `one
+ |- two`
+ """
.trimMargin(),
)
@@ -697,8 +746,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
unorderedList(
- listItem(paragraph("\\`one")),
- listItem(paragraph("two\\`")),
+ listItem(paragraph("`one")),
+ listItem(paragraph("two`")),
),
)
}
@@ -708,10 +757,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |***
- |---
- |___
- """
+ |***
+ |---
+ |___
+ """
.trimMargin(),
)
@@ -755,10 +804,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |--
- |**
- |__
- """
+ |--
+ |**
+ |__
+ """
.trimMargin(),
)
@@ -768,7 +817,15 @@ class MarkdownProcessorDocumentParsingTest {
* **
* __
*/
- parsed.assertEquals(paragraph("-- \\*\\* \\_\\_"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("--"),
+ SoftLineBreak,
+ Text("**"),
+ SoftLineBreak,
+ Text("__"),
+ )
+ )
}
@Test
@@ -776,10 +833,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ***
- | ***
- | ***
- """
+ | ***
+ | ***
+ | ***
+ """
.trimMargin(),
)
@@ -813,9 +870,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- | ***
- """
+ |Foo
+ | ***
+ """
.trimMargin(),
)
@@ -824,7 +881,7 @@ class MarkdownProcessorDocumentParsingTest {
* Foo
* ***
*/
- parsed.assertEquals(paragraph("Foo \\*\\*\\*"))
+ parsed.assertEquals(Paragraph(Text("Foo"), SoftLineBreak, Text("***")))
}
@Test
@@ -887,12 +944,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |_ _ _ _ a
- |
- |a------
- |
- |---a---
- """
+ |_ _ _ _ a
+ |
+ |a------
+ |
+ |---a---
+ """
.trimMargin(),
)
@@ -903,7 +960,7 @@ class MarkdownProcessorDocumentParsingTest {
* ---a---
*/
parsed.assertEquals(
- paragraph("\\_ \\_ \\_ \\_ a"),
+ paragraph("_ _ _ _ a"),
paragraph("a------"),
paragraph("---a---"),
)
@@ -917,7 +974,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* -
*/
- parsed.assertEquals(paragraph("*-*"))
+ parsed.assertEquals(Paragraph(Emphasis("*", Text("-"))))
}
@Test
@@ -925,10 +982,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |***
- |- bar
- """
+ |- foo
+ |***
+ |- bar
+ """
.trimMargin(),
)
@@ -954,10 +1011,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |***
- |bar
- """
+ |Foo
+ |***
+ |bar
+ """
.trimMargin(),
)
@@ -979,10 +1036,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |---
- |bar
- """
+ |Foo
+ |---
+ |bar
+ """
.trimMargin(),
)
@@ -992,7 +1049,7 @@ class MarkdownProcessorDocumentParsingTest {
* bar
*/
parsed.assertEquals(
- heading(2, "Foo"),
+ heading(2, Text("Foo")),
paragraph("bar"),
)
}
@@ -1002,10 +1059,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |* Foo
- |* * *
- |* Bar
- """
+ |* Foo
+ |* * *
+ |* Bar
+ """
.trimMargin(),
)
@@ -1031,9 +1088,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- Foo
- |- * * *
- """
+ |- Foo
+ |- * * *
+ """
.trimMargin(),
)
@@ -1059,13 +1116,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |# foo
- |## foo
- |### foo
- |#### foo
- |##### foo
- |###### foo
- """
+ |# foo
+ |## foo
+ |### foo
+ |#### foo
+ |##### foo
+ |###### foo
+ """
.trimMargin(),
)
@@ -1079,12 +1136,12 @@ class MarkdownProcessorDocumentParsingTest {
* foo
*/
parsed.assertEquals(
- heading(1, "foo"),
- heading(2, "foo"),
- heading(3, "foo"),
- heading(4, "foo"),
- heading(5, "foo"),
- heading(6, "foo"),
+ heading(1, Text("foo")),
+ heading(2, Text("foo")),
+ heading(3, Text("foo")),
+ heading(4, Text("foo")),
+ heading(5, Text("foo")),
+ heading(6, Text("foo")),
)
}
@@ -1104,10 +1161,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |#5 bolt
- |
- |#hashtag
- """
+ |#5 bolt
+ |
+ |#hashtag
+ """
.trimMargin(),
)
@@ -1142,7 +1199,12 @@ class MarkdownProcessorDocumentParsingTest {
* foo bar *baz*
*/
parsed.assertEquals(
- heading(level = 1, "foo *bar* \\*baz\\*"),
+ heading(
+ level = 1,
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ Text(" *baz*"),
+ )
)
}
@@ -1154,7 +1216,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(heading(level = 1, "foo"))
+ parsed.assertEquals(heading(level = 1, Text("foo")))
}
@Test
@@ -1162,10 +1224,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ### foo
- | ## foo
- | # foo
- """
+ | ### foo
+ | ## foo
+ | # foo
+ """
.trimMargin(),
)
@@ -1176,9 +1238,9 @@ class MarkdownProcessorDocumentParsingTest {
* foo
*/
parsed.assertEquals(
- heading(level = 3, "foo"),
- heading(level = 2, "foo"),
- heading(level = 1, "foo"),
+ heading(level = 3, Text("foo")),
+ heading(level = 2, Text("foo")),
+ heading(level = 1, Text("foo")),
)
}
@@ -1199,9 +1261,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |foo
- | # bar
- """
+ |foo
+ | # bar
+ """
.trimMargin(),
)
@@ -1210,7 +1272,7 @@ class MarkdownProcessorDocumentParsingTest {
* foo
* # bar
*/
- parsed.assertEquals(paragraph("foo # bar"))
+ parsed.assertEquals(Paragraph(Text("foo"), SoftLineBreak, Text("# bar")))
}
@Test
@@ -1218,9 +1280,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |## foo ##
- | ### bar ###
- """
+ |## foo ##
+ | ### bar ###
+ """
.trimMargin(),
)
@@ -1230,8 +1292,8 @@ class MarkdownProcessorDocumentParsingTest {
* bar
*/
parsed.assertEquals(
- heading(level = 2, "foo"),
- heading(level = 3, "bar"),
+ heading(level = 2, Text("foo")),
+ heading(level = 3, Text("bar")),
)
}
@@ -1240,9 +1302,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |# foo ##################################
- |##### foo ##
- """
+ |# foo ##################################
+ |##### foo ##
+ """
.trimMargin(),
)
@@ -1252,8 +1314,8 @@ class MarkdownProcessorDocumentParsingTest {
* foo
*/
parsed.assertEquals(
- heading(level = 1, "foo"),
- heading(level = 5, "foo"),
+ heading(level = 1, Text("foo")),
+ heading(level = 5, Text("foo")),
)
}
@@ -1265,7 +1327,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(heading(level = 3, "foo"))
+ parsed.assertEquals(heading(level = 3, Text("foo")))
}
@Test
@@ -1276,7 +1338,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo ### b
*/
- parsed.assertEquals(heading(level = 3, "foo ### b"))
+ parsed.assertEquals(heading(level = 3, Text("foo ### b")))
}
@Test
@@ -1287,7 +1349,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo#
*/
- parsed.assertEquals(heading(level = 1, "foo#"))
+ parsed.assertEquals(heading(level = 1, Text("foo#")))
}
@Test
@@ -1295,10 +1357,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |### foo \###
- |## foo #\##
- |# foo \#
- """
+ |### foo \###
+ |## foo #\##
+ |# foo \#
+ """
.trimMargin(),
)
@@ -1309,9 +1371,9 @@ class MarkdownProcessorDocumentParsingTest {
* foo #
*/
parsed.assertEquals(
- heading(level = 3, "foo ###"),
- heading(level = 2, "foo ###"),
- heading(level = 1, "foo #"),
+ heading(level = 3, Text("foo ###")),
+ heading(level = 2, Text("foo ###")),
+ heading(level = 1, Text("foo #")),
)
}
@@ -1320,10 +1382,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |****
- |## foo
- |****
- """
+ |****
+ |## foo
+ |****
+ """
.trimMargin(),
)
@@ -1335,7 +1397,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
thematicBreak(),
- heading(level = 2, "foo"),
+ heading(level = 2, Text("foo")),
thematicBreak(),
)
}
@@ -1345,10 +1407,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo bar
- |# baz
- |Bar foo
- """
+ |Foo bar
+ |# baz
+ |Bar foo
+ """
.trimMargin(),
)
@@ -1360,7 +1422,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
paragraph("Foo bar"),
- heading(level = 1, "baz"),
+ heading(level = 1, Text("baz")),
paragraph("Bar foo"),
)
}
@@ -1370,10 +1432,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |##
- |#
- |### ###
- """
+ |##
+ |#
+ |### ###
+ """
.trimMargin(),
)
@@ -1384,9 +1446,9 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- heading(level = 2, ""),
- heading(level = 1, ""),
- heading(level = 3, ""),
+ Heading(emptyList(), level = 2),
+ Heading(emptyList(), level = 1),
+ Heading(emptyList(), level = 3),
)
}
@@ -1395,12 +1457,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo *bar*
- |=========
- |
- |Foo *bar*
- |---------
- """
+ |Foo *bar*
+ |=========
+ |
+ |Foo *bar*
+ |---------
+ """
.trimMargin(),
)
@@ -1411,8 +1473,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
- heading(level = 1, "Foo *bar*"),
- heading(level = 2, "Foo *bar*"),
+ heading(level = 1, Text("Foo "), Emphasis("*", Text("bar"))),
+ heading(level = 2, Text("Foo "), Emphasis("*", Text("bar"))),
)
}
@@ -1421,10 +1483,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo *bar
- |baz*
- |====
- """
+ |Foo *bar
+ |baz*
+ |====
+ """
.trimMargin(),
)
@@ -1433,7 +1495,13 @@ class MarkdownProcessorDocumentParsingTest {
* Foo bar
* baz
*/
- parsed.assertEquals(heading(level = 1, "Foo *bar baz*"))
+ parsed.assertEquals(
+ heading(
+ level = 1,
+ Text("Foo "),
+ Emphasis("*", Text("bar"), SoftLineBreak, Text("baz"))
+ )
+ )
}
@Test
@@ -1445,7 +1513,14 @@ class MarkdownProcessorDocumentParsingTest {
* Foo bar
* baz
*/
- parsed.assertEquals(heading(level = 1, "Foo *bar baz*"))
+ parsed.assertEquals(
+ heading(
+ level = 1,
+ Text("Foo "),
+ Emphasis("*", Text("bar"), SoftLineBreak, Text("baz")),
+ Text(""),
+ )
+ )
}
@Test
@@ -1453,12 +1528,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |-------------------------
- |
- |Foo
- |=
- """
+ |Foo
+ |-------------------------
+ |
+ |Foo
+ |=
+ """
.trimMargin(),
)
@@ -1468,8 +1543,8 @@ class MarkdownProcessorDocumentParsingTest {
* Foo
*/
parsed.assertEquals(
- heading(level = 2, "Foo"),
- heading(level = 1, "Foo"),
+ heading(level = 2, Text("Foo")),
+ heading(level = 1, Text("Foo")),
)
}
@@ -1478,15 +1553,15 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | Foo
- |---
- |
- | Foo
- |-----
- |
- | Foo
- | ===
- """
+ | Foo
+ |---
+ |
+ | Foo
+ |-----
+ |
+ | Foo
+ | ===
+ """
.trimMargin(),
)
@@ -1497,9 +1572,9 @@ class MarkdownProcessorDocumentParsingTest {
* Foo
*/
parsed.assertEquals(
- heading(level = 2, "Foo"),
- heading(level = 2, "Foo"),
- heading(level = 1, "Foo"),
+ heading(level = 2, Text("Foo")),
+ heading(level = 2, Text("Foo")),
+ heading(level = 1, Text("Foo")),
)
}
@@ -1508,12 +1583,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | Foo
- | ---
- |
- | Foo
- |---
- """
+ | Foo
+ | ---
+ |
+ | Foo
+ |---
+ """
.trimMargin(),
)
@@ -1537,9 +1612,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- | ----
- """
+ |Foo
+ | ----
+ """
.trimMargin(),
)
@@ -1547,7 +1622,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo
*/
- parsed.assertEquals(heading(level = 2, "Foo"))
+ parsed.assertEquals(heading(level = 2, Text("Foo")))
}
@Test
@@ -1555,9 +1630,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- | ---
- """
+ |Foo
+ | ---
+ """
.trimMargin(),
)
@@ -1566,7 +1641,7 @@ class MarkdownProcessorDocumentParsingTest {
* Foo
* ---
*/
- parsed.assertEquals(paragraph("Foo ---"))
+ parsed.assertEquals(Paragraph(Text("Foo"), SoftLineBreak, Text("---")))
}
@Test
@@ -1574,12 +1649,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |= =
- |
- |Foo
- |--- -
- """
+ |Foo
+ |= =
+ |
+ |Foo
+ |--- -
+ """
.trimMargin(),
)
@@ -1591,7 +1666,7 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- paragraph("Foo = ="),
+ Paragraph(Text("Foo"), SoftLineBreak, Text("= =")),
paragraph("Foo"),
thematicBreak(),
)
@@ -1602,9 +1677,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |-----
- """
+ |Foo
+ |-----
+ """
.trimMargin(),
)
@@ -1612,7 +1687,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo
*/
- parsed.assertEquals(heading(level = 2, "Foo"))
+ parsed.assertEquals(heading(level = 2, Text("Foo")))
}
@Test
@@ -1620,9 +1695,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo\
- |----
- """
+ |Foo\
+ |----
+ """
.trimMargin(),
)
@@ -1630,7 +1705,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo\
*/
- parsed.assertEquals(heading(level = 2, "Foo\\"))
+ parsed.assertEquals(heading(level = 2, Text("Foo\\")))
}
@Test
@@ -1638,14 +1713,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |`Foo
- |----
- |`
- |
- |
- """
+ |`Foo
+ |----
+ |`
+ |
+ |
+ """
.trimMargin(),
)
@@ -1657,10 +1732,10 @@ class MarkdownProcessorDocumentParsingTest {
* of dashes"/>
*/
parsed.assertEquals(
- heading(level = 2, "\\`Foo"),
- paragraph("\\`"),
- heading(level = 2, "\\"),
+ heading(level = 2, Text("`Foo")),
+ paragraph("`"),
+ heading(level = 2, Text(""),
)
}
@@ -1669,9 +1744,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> Foo
- |---
- """
+ |> Foo
+ |---
+ """
.trimMargin(),
)
@@ -1693,10 +1768,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- |bar
- |===
- """
+ |> foo
+ |bar
+ |===
+ """
.trimMargin(),
)
@@ -1708,7 +1783,17 @@ class MarkdownProcessorDocumentParsingTest {
* ===
*
*/
- parsed.assertEquals(blockQuote(paragraph("foo bar ===")))
+ parsed.assertEquals(
+ blockQuote(
+ Paragraph(
+ Text("foo"),
+ SoftLineBreak,
+ Text("bar"),
+ SoftLineBreak,
+ Text("==="),
+ )
+ )
+ )
}
@Test
@@ -1716,9 +1801,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- Foo
- |---
- """
+ |- Foo
+ |---
+ """
.trimMargin(),
)
@@ -1740,10 +1825,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |Bar
- |---
- """
+ |Foo
+ |Bar
+ |---
+ """
.trimMargin(),
)
@@ -1752,7 +1837,7 @@ class MarkdownProcessorDocumentParsingTest {
* Foo
* Bar
*/
- parsed.assertEquals(heading(level = 2, "Foo Bar"))
+ parsed.assertEquals(heading(level = 2, Text("Foo"), SoftLineBreak, Text("Bar")))
}
@Test
@@ -1760,13 +1845,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |---
- |Foo
- |---
- |Bar
- |---
- |Baz
- """
+ |---
+ |Foo
+ |---
+ |Bar
+ |---
+ |Baz
+ """
.trimMargin(),
)
@@ -1779,8 +1864,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
thematicBreak(),
- heading(level = 2, "Foo"),
- heading(level = 2, "Bar"),
+ heading(level = 2, Text("Foo")),
+ heading(level = 2, Text("Bar")),
paragraph("Baz"),
)
}
@@ -1790,9 +1875,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |====
- """
+ |
+ |====
+ """
.trimMargin(),
)
@@ -1808,9 +1893,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |---
- |---
- """
+ |---
+ |---
+ """
.trimMargin(),
)
@@ -1830,9 +1915,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |-----
- """
+ |- foo
+ |-----
+ """
.trimMargin(),
)
@@ -1854,9 +1939,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | foo
- |---
- """
+ | foo
+ |---
+ """
.trimMargin(),
)
@@ -1877,9 +1962,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- |-----
- """
+ |> foo
+ |-----
+ """
.trimMargin(),
)
@@ -1901,9 +1986,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |\> foo
- |------
- """
+ |\> foo
+ |------
+ """
.trimMargin(),
)
@@ -1911,7 +1996,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* > foo
*/
- parsed.assertEquals(heading(level = 2, "\\> foo"))
+ parsed.assertEquals(heading(level = 2, Text("> foo")))
}
@Test
@@ -1919,12 +2004,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |
- |bar
- |---
- |baz
- """
+ |Foo
+ |
+ |bar
+ |---
+ |baz
+ """
.trimMargin(),
)
@@ -1936,7 +2021,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
paragraph("Foo"),
- heading(level = 2, "bar"),
+ heading(level = 2, Text("bar")),
paragraph("baz"),
)
}
@@ -1946,13 +2031,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |bar
- |
- |---
- |
- |baz
- """
+ |Foo
+ |bar
+ |
+ |---
+ |
+ |baz
+ """
.trimMargin(),
)
@@ -1964,7 +2049,7 @@ class MarkdownProcessorDocumentParsingTest {
* baz
*/
parsed.assertEquals(
- paragraph("Foo bar"),
+ Paragraph(Text("Foo"), SoftLineBreak, Text("bar")),
thematicBreak(),
paragraph("baz"),
)
@@ -1975,11 +2060,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |bar
- |* * *
- |baz
- """
+ |Foo
+ |bar
+ |* * *
+ |baz
+ """
.trimMargin(),
)
@@ -1991,7 +2076,7 @@ class MarkdownProcessorDocumentParsingTest {
* baz
*/
parsed.assertEquals(
- paragraph("Foo bar"),
+ Paragraph(Text("Foo"), SoftLineBreak, Text("bar")),
thematicBreak(),
paragraph("baz"),
)
@@ -2002,11 +2087,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |bar
- |\---
- |baz
- """
+ |Foo
+ |bar
+ |\---
+ |baz
+ """
.trimMargin(),
)
@@ -2017,7 +2102,17 @@ class MarkdownProcessorDocumentParsingTest {
* ---
* baz
*/
- parsed.assertEquals(paragraph("Foo bar --- baz"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("Foo"),
+ SoftLineBreak,
+ Text("bar"),
+ SoftLineBreak,
+ Text("---"),
+ SoftLineBreak,
+ Text("baz")
+ )
+ )
}
@Test
@@ -2025,9 +2120,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | a simple
- | indented code block
- """
+ | a simple
+ | indented code block
+ """
.trimMargin(),
)
@@ -2045,10 +2140,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | - foo
- |
- | bar
- """
+ | - foo
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -2074,10 +2169,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. foo
- |
- | - bar
- """
+ |1. foo
+ |
+ | - bar
+ """
.trimMargin(),
)
@@ -2108,11 +2203,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- | *hi*
- |
- | - one
- """
+ |
+ | *hi*
+ |
+ | - one
+ """
.trimMargin(),
)
@@ -2132,14 +2227,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | chunk1
- |
- | chunk2
- |
- |
- |
- | chunk3
- """
+ | chunk1
+ |
+ | chunk2
+ |
+ |
+ |
+ | chunk3
+ """
.trimMargin(),
)
@@ -2176,9 +2271,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- | bar
- """
+ |Foo
+ | bar
+ """
.trimMargin(),
)
@@ -2187,7 +2282,7 @@ class MarkdownProcessorDocumentParsingTest {
* Foo
* bar
*/
- parsed.assertEquals(paragraph("Foo bar"))
+ parsed.assertEquals(Paragraph(Text("Foo"), SoftLineBreak, Text("bar")))
}
@Test
@@ -2195,9 +2290,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | foo
- |bar
- """
+ | foo
+ |bar
+ """
.trimMargin(),
)
@@ -2218,13 +2313,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |# Heading
- | foo
- |Heading
- |------
- | foo
- |----
- """
+ |# Heading
+ | foo
+ |Heading
+ |------
+ | foo
+ |----
+ """
.trimMargin(),
)
@@ -2239,9 +2334,9 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- heading(level = 1, "Heading"),
+ heading(level = 1, Text("Heading")),
indentedCodeBlock("foo"),
- heading(level = 2, "Heading"),
+ heading(level = 2, Text("Heading")),
indentedCodeBlock("foo"),
thematicBreak(),
)
@@ -2252,9 +2347,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | foo
- | bar
- """
+ | foo
+ | bar
+ """
.trimMargin(),
)
@@ -2272,11 +2367,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- | foo
- |
- """
+ |
+ |
+ | foo
+ |
+ """
.trimMargin(),
)
@@ -2305,11 +2400,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |<
- | >
- |```
- """
+ |```
+ |<
+ | >
+ |```
+ """
.trimMargin(),
)
@@ -2327,11 +2422,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~
- |<
- | >
- |~~~
- """
+ |~~~
+ |<
+ | >
+ |~~~
+ """
.trimMargin(),
)
@@ -2349,10 +2444,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``
- |foo
- |``
- """
+ |``
+ |foo
+ |``
+ """
.trimMargin(),
)
@@ -2360,7 +2455,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("`foo`"))
+ parsed.assertEquals(Paragraph(Code("foo")))
}
@Test
@@ -2368,11 +2463,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |aaa
- |~~~
- |```
- """
+ |```
+ |aaa
+ |~~~
+ |```
+ """
.trimMargin(),
)
@@ -2390,11 +2485,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~
- |aaa
- |```
- |~~~
- """
+ |~~~
+ |aaa
+ |```
+ |~~~
+ """
.trimMargin(),
)
@@ -2412,11 +2507,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |````
- |aaa
- |```
- |``````
- """
+ |````
+ |aaa
+ |```
+ |``````
+ """
.trimMargin(),
)
@@ -2434,11 +2529,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~~
- |aaa
- |~~~
- |~~~~
- """
+ |~~~~
+ |aaa
+ |~~~
+ |~~~~
+ """
.trimMargin(),
)
@@ -2467,11 +2562,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |`````
- |
- |```
- |aaa
- """
+ |`````
+ |
+ |```
+ |aaa
+ """
.trimMargin(),
)
@@ -2490,11 +2585,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> ```
- |> aaa
- |
- |bbb
- """
+ |> ```
+ |> aaa
+ |
+ |bbb
+ """
.trimMargin(),
)
@@ -2517,11 +2612,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |
- |
- |```
- """
+ |```
+ |
+ |
+ |```
+ """
.trimMargin(),
)
@@ -2539,9 +2634,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |```
- """
+ |```
+ |```
+ """
.trimMargin(),
)
@@ -2557,11 +2652,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ```
- | aaa
- |aaa
- |```
- """
+ | ```
+ | aaa
+ |aaa
+ |```
+ """
.trimMargin(),
)
@@ -2579,12 +2674,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ```
- |aaa
- | aaa
- |aaa
- | ```
- """
+ | ```
+ |aaa
+ | aaa
+ |aaa
+ | ```
+ """
.trimMargin(),
)
@@ -2603,12 +2698,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ```
- | aaa
- | aaa
- | aaa
- | ```
- """
+ | ```
+ | aaa
+ | aaa
+ | aaa
+ | ```
+ """
.trimMargin(),
)
@@ -2627,10 +2722,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ```
- | aaa
- | ```
- """
+ | ```
+ | aaa
+ | ```
+ """
.trimMargin(),
)
@@ -2649,10 +2744,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |aaa
- | ```
- """
+ |```
+ |aaa
+ | ```
+ """
.trimMargin(),
)
@@ -2669,10 +2764,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | ```
- |aaa
- | ```
- """
+ | ```
+ |aaa
+ | ```
+ """
.trimMargin(),
)
@@ -2689,10 +2784,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |aaa
- | ```
- """
+ |```
+ |aaa
+ | ```
+ """
.trimMargin(),
)
@@ -2710,9 +2805,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``` ```
- |aaa
- """
+ |``` ```
+ |aaa
+ """
.trimMargin(),
)
@@ -2721,7 +2816,7 @@ class MarkdownProcessorDocumentParsingTest {
*
* aaa
*/
- parsed.assertEquals(paragraph("` ` aaa"))
+ parsed.assertEquals(Paragraph(Code(" "), SoftLineBreak, Text("aaa")))
}
@Test
@@ -2729,10 +2824,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~~~~
- |aaa
- |~~~ ~~
- """
+ |~~~~~~
+ |aaa
+ |~~~ ~~
+ """
.trimMargin(),
)
@@ -2750,12 +2845,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |foo
- |```
- |bar
- |```
- |baz
- """
+ |foo
+ |```
+ |bar
+ |```
+ |baz
+ """
.trimMargin(),
)
@@ -2778,13 +2873,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |foo
- |---
- |~~~
- |bar
- |~~~
- |# baz
- """
+ |foo
+ |---
+ |~~~
+ |bar
+ |~~~
+ |# baz
+ """
.trimMargin(),
)
@@ -2796,9 +2891,9 @@ class MarkdownProcessorDocumentParsingTest {
* baz
*/
parsed.assertEquals(
- heading(level = 2, "foo"),
+ heading(level = 2, Text("foo")),
fencedCodeBlock("bar"),
- heading(level = 1, "baz"),
+ heading(level = 1, Text("baz")),
)
}
@@ -2807,12 +2902,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```ruby
- |def foo(x)
- | return 3
- |end
- |```
- """
+ |```ruby
+ |def foo(x)
+ | return 3
+ |end
+ |```
+ """
.trimMargin(),
)
@@ -2836,12 +2931,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~~ ruby startline=3 $%@#$
- |def foo(x)
- | return 3
- |end
- |~~~~~~~
- """
+ |~~~~ ruby startline=3 $%@#$
+ |def foo(x)
+ | return 3
+ |end
+ |~~~~~~~
+ """
.trimMargin(),
)
@@ -2865,9 +2960,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |````;
- |````
- """
+ |````;
+ |````
+ """
.trimMargin(),
)
@@ -2888,9 +2983,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``` aa ```
- |foo
- """
+ |``` aa ```
+ |foo
+ """
.trimMargin(),
)
@@ -2899,7 +2994,7 @@ class MarkdownProcessorDocumentParsingTest {
* aa
* foo
*/
- parsed.assertEquals(paragraph("`aa` foo"))
+ parsed.assertEquals(Paragraph(Code("aa"), SoftLineBreak, Text("foo")))
}
@Test
@@ -2907,10 +3002,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |~~~ aa ``` ~~~
- |foo
- |~~~
- """
+ |~~~ aa ``` ~~~
+ |foo
+ |~~~
+ """
.trimMargin(),
)
@@ -2932,10 +3027,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |``` aaa
- |```
- """
+ |```
+ |``` aaa
+ |```
+ """
.trimMargin(),
)
@@ -2952,14 +3047,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |**Hello**,
- |
- |_world_.
- |
- | |
- """
+ |
+ |
+ |**Hello**,
+ |
+ |_world_.
+ |
+ | |
+ """
.trimMargin(),
)
@@ -2974,7 +3069,12 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock("\n\n**Hello**,"),
- paragraph("_world_. "),
+ Paragraph(
+ Emphasis("_", Text("world")),
+ Text("."),
+ SoftLineBreak,
+ HtmlInline("")
+ ),
htmlBlock(" |
"),
)
}
@@ -2984,16 +3084,16 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |
- | hi
- | |
- |
- |
- |
- |okay.
- """
+ |
+ |
+ |
+ | hi
+ | |
+ |
+ |
+ |
+ |okay.
+ """
.trimMargin(),
)
@@ -3011,14 +3111,14 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |
- |
- | hi
- | |
- |
- |
- """
+ |
+ |
+ |
+ | hi
+ | |
+ |
+ |
+ """
.trimMargin(),
),
paragraph("okay."),
@@ -3030,10 +3130,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
+ |*foo*
+ """
.trimMargin(),
)
@@ -3070,12 +3170,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |*Markdown*
- |
- |
- """
+ |
+ |
+ |*Markdown*
+ |
+ |
+ """
.trimMargin(),
)
@@ -3087,7 +3187,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock(""),
- paragraph("*Markdown*"),
+ Paragraph(Emphasis("*", Text("Markdown"))),
htmlBlock("
"),
)
}
@@ -3097,10 +3197,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- """
+ |
+ |
+ """
.trimMargin(),
)
@@ -3113,10 +3213,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |
- """
+ |
+ |
+ """
.trimMargin(),
),
)
@@ -3127,10 +3227,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- """
+ |
+ |
+ """
.trimMargin(),
)
@@ -3143,10 +3243,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |
- """
+ |
+ |
+ """
.trimMargin(),
),
)
@@ -3157,11 +3257,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*foo*
- |
- |*bar*
- """
+ |
+ |*foo*
+ |
+ |*bar*
+ """
.trimMargin(),
)
@@ -3173,7 +3273,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock("
\n*foo*"),
- paragraph("*bar*"),
+ Paragraph(Emphasis("*", Text("bar"))),
)
}
@@ -3182,9 +3282,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |foo
- | |
- """
+ |
+ """
.trimMargin(),
)
@@ -3266,10 +3366,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- """
+ |
+ """
.trimMargin(),
),
)
@@ -3280,11 +3380,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |``` c
- |int x = 33;
- |```
- """
+ |
+ |``` c
+ |int x = 33;
+ |```
+ """
.trimMargin(),
)
@@ -3298,11 +3398,11 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |``` c
- |int x = 33;
- |```
- """
+ |
+ |``` c
+ |int x = 33;
+ |```
+ """
.trimMargin(),
),
)
@@ -3313,10 +3413,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*bar*
- |
- """
+ |
+ |*bar*
+ |
+ """
.trimMargin(),
)
@@ -3329,10 +3429,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |*bar*
- |
- """
+ |
+ |*bar*
+ |
+ """
.trimMargin(),
),
)
@@ -3343,10 +3443,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*bar*
- |
- """
+ |
+ |*bar*
+ |
+ """
.trimMargin(),
)
@@ -3359,10 +3459,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |*bar*
- |
- """
+ |
+ |*bar*
+ |
+ """
.trimMargin(),
),
)
@@ -3373,10 +3473,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*bar*
- |
- """
+ |
+ |*bar*
+ |
+ """
.trimMargin(),
)
@@ -3389,10 +3489,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |*bar*
- |
- """
+ |
+ |*bar*
+ |
+ """
.trimMargin(),
),
)
@@ -3403,9 +3503,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*bar*
- """
+ |
+ |*bar*
+ """
.trimMargin(),
)
@@ -3417,9 +3517,9 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |*bar*
- """
+ |
+ |*bar*
+ """
.trimMargin(),
),
)
@@ -3430,10 +3530,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*foo*
- |
- """
+ |
+ |*foo*
+ |
+ """
.trimMargin(),
)
@@ -3446,10 +3546,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |*foo*
- |
- """
+ |
+ |*foo*
+ |
+ """
.trimMargin(),
),
)
@@ -3460,12 +3560,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |*foo*
- |
- |
- """
+ |
+ |
+ |*foo*
+ |
+ |
+ """
.trimMargin(),
)
@@ -3477,7 +3577,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock("
"),
- paragraph("*foo*"),
+ Paragraph(Emphasis("*", Text("foo"))),
htmlBlock(""),
)
}
@@ -3490,7 +3590,13 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
foo
*/
- parsed.assertEquals(paragraph("
*foo*"))
+ parsed.assertEquals(
+ Paragraph(
+ HtmlInline("
"),
+ Emphasis("*", Text("foo")),
+ HtmlInline(""),
+ )
+ )
}
@Test
@@ -3498,14 +3604,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |import Text.HTML.TagSoup
- |
- |main :: IO ()
- |main = print $ parseTags tags
- |
- |okay
- """
+ |
+ |import Text.HTML.TagSoup
+ |
+ |main :: IO ()
+ |main = print $ parseTags tags
+ |
+ |okay
+ """
.trimMargin(),
)
@@ -3522,13 +3628,13 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |import Text.HTML.TagSoup
- |
- |main :: IO ()
- |main = print $ parseTags tags
- |
- """
+ |
+ |import Text.HTML.TagSoup
+ |
+ |main :: IO ()
+ |main = print $ parseTags tags
+ |
+ """
.trimMargin(),
),
paragraph("okay"),
@@ -3540,13 +3646,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |okay
- """
+ |
+ |okay
+ """
.trimMargin(),
)
@@ -3562,12 +3668,12 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- """
+ |
+ """
.trimMargin(),
),
paragraph("okay"),
@@ -3579,14 +3685,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- """
+ |
+ """
.trimMargin(),
)
@@ -3603,14 +3709,14 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- """
+ |
+ """
.trimMargin(),
),
)
@@ -3621,14 +3727,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |okay
- """
+ |
+ |okay
+ """
.trimMargin(),
)
@@ -3645,13 +3751,13 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- """
+ |
+ """
.trimMargin(),
),
paragraph("okay"),
@@ -3663,11 +3769,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*foo*
- """
+ |
+ |*foo*
+ """
.trimMargin(),
)
@@ -3764,7 +3870,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock(""),
- paragraph("*foo*"),
+ Paragraph(Emphasis("*", Text("foo"))),
)
}
@@ -3773,9 +3879,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |*bar*
- |*baz*
- """
+ |*bar*
+ |*baz*
+ """
.trimMargin(),
)
@@ -3786,7 +3892,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock("*bar*"),
- paragraph("*baz*"),
+ Paragraph(Emphasis("*", Text("baz"))),
)
}
@@ -3795,10 +3901,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. *bar*
- """
+ |1. *bar*
+ """
.trimMargin(),
)
@@ -3811,10 +3917,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |1. *bar*
- """
+ |1. *bar*
+ """
.trimMargin(),
),
)
@@ -3825,12 +3931,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |okay
- """
+ |
+ |okay
+ """
.trimMargin(),
)
@@ -3845,11 +3951,11 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- """
+ |
+ """
.trimMargin(),
),
paragraph("okay"),
@@ -3861,13 +3967,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |';
- |
- |?>
- |okay
- """
+ |';
+ |
+ |?>
+ |okay
+ """
.trimMargin(),
)
@@ -3883,12 +3989,12 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |';
- |
- |?>
- """
+ |';
+ |
+ |?>
+ """
.trimMargin(),
),
paragraph("okay"),
@@ -3911,20 +4017,20 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |okay
- """
+ |
+ |okay
+ """
.trimMargin(),
)
@@ -3947,19 +4053,19 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- """
+ |
+ """
.trimMargin(),
),
paragraph("okay"),
@@ -3971,10 +4077,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |
- """
+ |
+ |
+ |
+ """
.trimMargin(),
)
@@ -3995,10 +4101,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |
- """
+ |
+ |
+ |
+ """
.trimMargin(),
)
@@ -4019,11 +4125,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |
- |bar
- |
- """
+ |Foo
+ |
+ |bar
+ |
+ """
.trimMargin(),
)
@@ -4038,10 +4144,10 @@ class MarkdownProcessorDocumentParsingTest {
paragraph("Foo"),
htmlBlock(
"""
- |
- |bar
- |
- """
+ |
+ |bar
+ |
+ """
.trimMargin(),
),
)
@@ -4052,11 +4158,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |bar
- |
- |*foo*
- """
+ |
+ |bar
+ |
+ |*foo*
+ """
.trimMargin(),
)
@@ -4070,11 +4176,11 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |bar
- |
- |*foo*
- """
+ |
+ |bar
+ |
+ |*foo*
+ """
.trimMargin(),
),
)
@@ -4085,10 +4191,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |
- |baz
- """
+ |Foo
+ |
+ |baz
+ """
.trimMargin(),
)
@@ -4098,7 +4204,15 @@ class MarkdownProcessorDocumentParsingTest {
*
* baz
*/
- parsed.assertEquals(paragraph("Foo baz"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("Foo"),
+ SoftLineBreak,
+ HtmlInline(""),
+ SoftLineBreak,
+ Text("baz"),
+ )
+ )
}
@Test
@@ -4106,12 +4220,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |*Emphasized* text.
- |
- |
- """
+ |
+ |
+ |*Emphasized* text.
+ |
+ |
+ """
.trimMargin(),
)
@@ -4123,7 +4237,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
htmlBlock(""),
- paragraph("*Emphasized* text."),
+ Paragraph(Emphasis("*", Text("Emphasized")), Text(" text.")),
htmlBlock("
"),
)
}
@@ -4133,10 +4247,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |*Emphasized* text.
- |
- """
+ |
+ |*Emphasized* text.
+ |
+ """
.trimMargin(),
)
@@ -4149,10 +4263,10 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
htmlBlock(
"""
- |
- |*Emphasized* text.
- |
- """
+ |
+ |*Emphasized* text.
+ |
+ """
.trimMargin(),
),
)
@@ -4163,18 +4277,18 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |
- |
- |
- |Hi
- | |
- |
- |
- |
- |
- """
+ |
+ |
+ |
+ |
+ |
+ |Hi
+ | |
+ |
+ |
+ |
+ |
+ """
.trimMargin(),
)
@@ -4202,18 +4316,18 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |
- |
- |
- | Hi
- | |
- |
- |
- |
- |
- """
+ |
+ |
+ |
+ |
+ |
+ | Hi
+ | |
+ |
+ |
+ |
+ |
+ """
.trimMargin(),
)
@@ -4242,10 +4356,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url "title"
- |
- |[foo]
- """
+ |[foo]: /url "title"
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4253,7 +4367,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
foo
*/
- parsed.assertEquals(paragraph("[foo](/url \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "title", Text("foo"))))
}
@Test
@@ -4261,12 +4375,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | [foo]:
- | /url
- | 'the title'
- |
- |[foo]
- """
+ | [foo]:
+ | /url
+ | 'the title'
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4274,7 +4388,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
foo
*/
- parsed.assertEquals(paragraph("[foo](/url \"the title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "the title", Text("foo"))))
}
@Test
@@ -4282,10 +4396,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[Foo*bar\]]:my_(url) 'title (with parens)'
- |
- |[Foo*bar\]]
- """
+ |[Foo*bar\]]:my_(url) 'title (with parens)'
+ |
+ |[Foo*bar\]]
+ """
.trimMargin(),
)
@@ -4293,7 +4407,9 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
Foo*bar]
*/
- parsed.assertEquals(paragraph("[Foo\\*bar\\]](my_\\(url\\) \"title (with parens)\")"))
+ parsed.assertEquals(
+ Paragraph(Link(destination = "my_(url)", title = "title (with parens)", Text("Foo*bar]")))
+ )
}
@Test
@@ -4301,12 +4417,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[Foo bar]:
- |
- |'title'
- |
- |[Foo bar]
- """
+ |[Foo bar]:
+ |
+ |'title'
+ |
+ |[Foo bar]
+ """
.trimMargin(),
)
@@ -4314,7 +4430,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo bar
*/
- parsed.assertEquals(paragraph("[Foo bar]( \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "my url", title = "title", Text("Foo bar"))))
}
@Test
@@ -4322,14 +4438,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url '
- |title
- |line1
- |line2
- |'
- |
- |[foo]
- """
+ |[foo]: /url '
+ |title
+ |line1
+ |line2
+ |'
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4341,7 +4457,7 @@ class MarkdownProcessorDocumentParsingTest {
* line2
* ">foo
*/
- parsed.assertEquals(paragraph("[foo](/url \" title\nline1\nline2 \")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "\ntitle\nline1\nline2\n", Text("foo"))))
}
@Test
@@ -4349,12 +4465,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url 'title
- |
- |with blank line'
- |
- |[foo]
- """
+ |[foo]: /url 'title
+ |
+ |with blank line'
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4365,9 +4481,9 @@ class MarkdownProcessorDocumentParsingTest {
* [foo]
*/
parsed.assertEquals(
- paragraph("\\[foo\\]: /url 'title"),
+ paragraph("[foo]: /url 'title"),
paragraph("with blank line'"),
- paragraph("\\[foo\\]"),
+ paragraph("[foo]"),
)
}
@@ -4376,11 +4492,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]:
- |/url
- |
- |[foo]
- """
+ |[foo]:
+ |/url
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4388,7 +4504,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/url)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = null, Text("foo"))))
}
@Test
@@ -4396,10 +4512,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]:
- |
- |[foo]
- """
+ |[foo]:
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4409,8 +4525,8 @@ class MarkdownProcessorDocumentParsingTest {
* [foo]
*/
parsed.assertEquals(
- paragraph("\\[foo\\]:"),
- paragraph("\\[foo\\]"),
+ paragraph("[foo]:"),
+ paragraph("[foo]"),
)
}
@@ -4419,10 +4535,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: <>
- |
- |[foo]
- """
+ |[foo]: <>
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4430,7 +4546,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo]()"))
+ parsed.assertEquals(Paragraph(Link(destination = "", title = null, Text("foo"))))
}
@Test
@@ -4438,10 +4554,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: (baz)
- |
- |[foo]
- """
+ |[foo]: (baz)
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4451,8 +4567,8 @@ class MarkdownProcessorDocumentParsingTest {
* [foo]
*/
parsed.assertEquals(
- paragraph("\\[foo\\]: \\(baz\\)"),
- paragraph("\\[foo\\]"),
+ Paragraph(Text("[foo]: "), HtmlInline(""), Text("(baz)")),
+ paragraph("[foo]"),
)
}
@@ -4461,10 +4577,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url\bar\*baz "foo\"bar\baz"
- |
- |[foo]
- """
+ |[foo]: /url\bar\*baz "foo\"bar\baz"
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4472,7 +4588,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/url\\bar*baz \"foo\\\"bar\\baz\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url\\bar*baz", title = "foo\"bar\\baz", Text("foo"))))
}
@Test
@@ -4480,10 +4596,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]
- |
- |[foo]: url
- """
+ |[foo]
+ |
+ |[foo]: url
+ """
.trimMargin(),
)
@@ -4491,7 +4607,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](url)"))
+ parsed.assertEquals(Paragraph(Link(destination = "url", title = null, Text("foo"))))
}
@Test
@@ -4499,11 +4615,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]
- |
- |[foo]: first
- |[foo]: second
- """
+ |[foo]
+ |
+ |[foo]: first
+ |[foo]: second
+ """
.trimMargin(),
)
@@ -4511,7 +4627,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](first)"))
+ parsed.assertEquals(Paragraph(Link(destination = "first", title = null, Text("foo"))))
}
@Test
@@ -4519,10 +4635,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[FOO]: /url
- |
- |[Foo]
- """
+ |[FOO]: /url
+ |
+ |[Foo]
+ """
.trimMargin(),
)
@@ -4530,7 +4646,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo
*/
- parsed.assertEquals(paragraph("[Foo](/url)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = null, Text("Foo"))))
}
@Test
@@ -4538,10 +4654,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[ΑΓΩ]: /φου
- |
- |[αγω]
- """
+ |[ΑΓΩ]: /φου
+ |
+ |[αγω]
+ """
.trimMargin(),
)
@@ -4549,7 +4665,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* αγω
*/
- parsed.assertEquals(paragraph("[αγω](/φου)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/φου", title = null, Text("αγω"))))
}
@Test
@@ -4568,11 +4684,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[
- |foo
- |]: /url
- |bar
- """
+ |[
+ |foo
+ |]: /url
+ |bar
+ """
.trimMargin(),
)
@@ -4591,7 +4707,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo]: /url "title" ok
*/
- parsed.assertEquals(paragraph("\\[foo\\]: /url \"title\" ok"))
+ parsed.assertEquals(paragraph("[foo]: /url \"title\" ok"))
}
@Test
@@ -4599,9 +4715,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url
- |"title" ok
- """
+ |[foo]: /url
+ |"title" ok
+ """
.trimMargin(),
)
@@ -4617,10 +4733,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | [foo]: /url "title"
- |
- |[foo]
- """
+ | [foo]: /url "title"
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4632,7 +4748,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
indentedCodeBlock("[foo]: /url \"title\""),
- paragraph("\\[foo\\]"),
+ paragraph("[foo]"),
)
}
@@ -4641,12 +4757,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |```
- |[foo]: /url
- |```
- |
- |[foo]
- """
+ |```
+ |[foo]: /url
+ |```
+ |
+ |[foo]
+ """
.trimMargin(),
)
@@ -4658,7 +4774,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
fencedCodeBlock("[foo]: /url"),
- paragraph("\\[foo\\]"),
+ paragraph("[foo]"),
)
}
@@ -4667,11 +4783,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |[bar]: /baz
- |
- |[bar]
- """
+ |Foo
+ |[bar]: /baz
+ |
+ |[bar]
+ """
.trimMargin(),
)
@@ -4682,8 +4798,12 @@ class MarkdownProcessorDocumentParsingTest {
* [bar]
*/
parsed.assertEquals(
- paragraph("Foo \\[bar\\]: /baz"),
- paragraph("\\[bar\\]"),
+ Paragraph(
+ Text("Foo"),
+ SoftLineBreak,
+ Text("[bar]: /baz"),
+ ),
+ paragraph("[bar]"),
)
}
@@ -4692,10 +4812,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |# [Foo]
- |[foo]: /url
- |> bar
- """
+ |# [Foo]
+ |[foo]: /url
+ |> bar
+ """
.trimMargin(),
)
@@ -4707,7 +4827,7 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- heading(level = 1, "[Foo](/url)"),
+ heading(level = 1, Link(destination = "/url", title = null, Text("Foo"))),
blockQuote(paragraph("bar")),
)
}
@@ -4717,11 +4837,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url
- |bar
- |===
- |[foo]
- """
+ |[foo]: /url
+ |bar
+ |===
+ |[foo]
+ """
.trimMargin(),
)
@@ -4731,8 +4851,8 @@ class MarkdownProcessorDocumentParsingTest {
* foo
*/
parsed.assertEquals(
- heading(level = 1, "bar"),
- paragraph("[foo](/url)"),
+ heading(level = 1, Text("bar")),
+ Paragraph(Link(destination = "/url", title = null, Text("foo"))),
)
}
@@ -4741,10 +4861,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url
- |===
- |[foo]
- """
+ |[foo]: /url
+ |===
+ |[foo]
+ """
.trimMargin(),
)
@@ -4753,7 +4873,13 @@ class MarkdownProcessorDocumentParsingTest {
* ===
* foo
*/
- parsed.assertEquals(paragraph("=== [foo](/url)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("==="),
+ SoftLineBreak,
+ Link(destination = "/url", title = null, Text("foo"))
+ )
+ )
}
@Test
@@ -4761,15 +4887,15 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /foo-url "foo"
- |[bar]: /bar-url
- | "bar"
- |[baz]: /baz-url
- |
- |[foo],
- |[bar],
- |[baz]
- """
+ |[foo]: /foo-url "foo"
+ |[bar]: /bar-url
+ | "bar"
+ |[baz]: /baz-url
+ |
+ |[foo],
+ |[bar],
+ |[baz]
+ """
.trimMargin(),
)
@@ -4780,7 +4906,15 @@ class MarkdownProcessorDocumentParsingTest {
* baz
*/
parsed.assertEquals(
- paragraph("[foo](/foo-url \"foo\"), [bar](/bar-url \"bar\"), [baz](/baz-url)"),
+ Paragraph(
+ Link(destination = "/foo-url", title = "foo", Text("foo")),
+ Text(","),
+ SoftLineBreak,
+ Link(destination = "/bar-url", title = "bar", Text("bar")),
+ Text(","),
+ SoftLineBreak,
+ Link(destination = "/baz-url", title = null, Text("baz")),
+ )
)
}
@@ -4789,10 +4923,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]
- |
- |> [foo]: /url
- """
+ |[foo]
+ |
+ |> [foo]: /url
+ """
.trimMargin(),
)
@@ -4803,7 +4937,7 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- paragraph("[foo](/url)"),
+ Paragraph(Link(destination = "/url", title = null, Text("foo"))),
blockQuote(),
)
}
@@ -4813,10 +4947,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |aaa
- |
- |bbb
- """
+ |aaa
+ |
+ |bbb
+ """
.trimMargin(),
)
@@ -4836,12 +4970,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |aaa
- |bbb
- |
- |ccc
- |ddd
- """
+ |aaa
+ |bbb
+ |
+ |ccc
+ |ddd
+ """
.trimMargin(),
)
@@ -4853,8 +4987,9 @@ class MarkdownProcessorDocumentParsingTest {
* ddd
*/
parsed.assertEquals(
- paragraph("aaa bbb"),
- paragraph("ccc ddd"),
+ Paragraph(Text("aaa"), SoftLineBreak, Text("bbb")),
+
+ Paragraph(Text("ccc"), SoftLineBreak, Text("ddd")),
)
}
@@ -4863,11 +4998,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |aaa
- |
- |
- |bbb
- """
+ |aaa
+ |
+ |
+ |bbb
+ """
.trimMargin(),
)
@@ -4887,9 +5022,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | aaa
- | bbb
- """
+ | aaa
+ | bbb
+ """
.trimMargin(),
)
@@ -4898,7 +5033,7 @@ class MarkdownProcessorDocumentParsingTest {
* aaa
* bbb
*/
- parsed.assertEquals(paragraph("aaa bbb"))
+ parsed.assertEquals(Paragraph(Text("aaa"), SoftLineBreak, Text("bbb")))
}
@Test
@@ -4906,10 +5041,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |aaa
- | bbb
- | ccc
- """
+ |aaa
+ | bbb
+ | ccc
+ """
.trimMargin(),
)
@@ -4919,7 +5054,15 @@ class MarkdownProcessorDocumentParsingTest {
* bbb
* ccc
*/
- parsed.assertEquals(paragraph("aaa bbb ccc"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("aaa"),
+ SoftLineBreak,
+ Text("bbb"),
+ SoftLineBreak,
+ Text("ccc")
+ )
+ )
}
@Test
@@ -4927,9 +5070,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | aaa
- |bbb
- """
+ | aaa
+ |bbb
+ """
.trimMargin(),
)
@@ -4938,7 +5081,7 @@ class MarkdownProcessorDocumentParsingTest {
* aaa
* bbb
*/
- parsed.assertEquals(paragraph("aaa bbb"))
+ parsed.assertEquals(Paragraph(Text("aaa"), SoftLineBreak, Text("bbb")))
}
@Test
@@ -4946,9 +5089,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | aaa
- |bbb
- """
+ | aaa
+ |bbb
+ """
.trimMargin(),
)
@@ -4969,9 +5112,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |aaa
- |bbb
- """
+ |aaa
+ |bbb
+ """
.trimMargin(),
)
@@ -4980,7 +5123,7 @@ class MarkdownProcessorDocumentParsingTest {
* aaa
* bbb
*/
- parsed.assertEquals(paragraph("aaa \nbbb"))
+ parsed.assertEquals(Paragraph(Text("aaa"), HardLineBreak, Text("bbb")))
}
@Test
@@ -4988,15 +5131,15 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |
- |
- |aaa
- |
- |
- |# aaa
- |
- |
- """
+ |
+ |
+ |aaa
+ |
+ |
+ |# aaa
+ |
+ |
+ """
.trimMargin(),
)
@@ -5007,7 +5150,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
paragraph("aaa"),
- heading(level = 1, "aaa"),
+ heading(level = 1, Text("aaa")),
)
}
@@ -5016,10 +5159,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> # Foo
- |> bar
- |> baz
- """
+ |> # Foo
+ |> bar
+ |> baz
+ """
.trimMargin(),
)
@@ -5033,8 +5176,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
blockQuote(
- heading(level = 1, "Foo"),
- paragraph("bar baz"),
+ heading(level = 1, Text("Foo")),
+ Paragraph(Text("bar"), SoftLineBreak, Text("baz")),
),
)
}
@@ -5044,10 +5187,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |># Foo
- |>bar
- |> baz
- """
+ |># Foo
+ |>bar
+ |> baz
+ """
.trimMargin(),
)
@@ -5061,8 +5204,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
blockQuote(
- heading(level = 1, "Foo"),
- paragraph("bar baz"),
+ heading(level = 1, Text("Foo")),
+ Paragraph(Text("bar"), SoftLineBreak, Text("baz")),
),
)
}
@@ -5072,10 +5215,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | > # Foo
- | > bar
- | > baz
- """
+ | > # Foo
+ | > bar
+ | > baz
+ """
.trimMargin(),
)
@@ -5089,8 +5232,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
blockQuote(
- heading(level = 1, "Foo"),
- paragraph("bar baz"),
+ heading(level = 1, Text("Foo")),
+ Paragraph(Text("bar"), SoftLineBreak, Text("baz")),
),
)
}
@@ -5100,10 +5243,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | > # Foo
- | > bar
- | > baz
- """
+ | > # Foo
+ | > bar
+ | > baz
+ """
.trimMargin(),
)
@@ -5122,10 +5265,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> # Foo
- |> bar
- |baz
- """
+ |> # Foo
+ |> bar
+ |baz
+ """
.trimMargin(),
)
@@ -5139,8 +5282,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
blockQuote(
- heading(level = 1, "Foo"),
- paragraph("bar baz"),
+ heading(level = 1, Text("Foo")),
+ Paragraph(Text("bar"), SoftLineBreak, Text("baz")),
),
)
}
@@ -5150,10 +5293,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> bar
- |baz
- |> foo
- """
+ |> bar
+ |baz
+ |> foo
+ """
.trimMargin(),
)
@@ -5165,7 +5308,17 @@ class MarkdownProcessorDocumentParsingTest {
* foo
*
*/
- parsed.assertEquals(blockQuote(paragraph("bar baz foo")))
+ parsed.assertEquals(
+ blockQuote(
+ Paragraph(
+ Text("bar"),
+ SoftLineBreak,
+ Text("baz"),
+ SoftLineBreak,
+ Text("foo")
+ )
+ )
+ )
}
@Test
@@ -5173,9 +5326,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- |---
- """
+ |> foo
+ |---
+ """
.trimMargin(),
)
@@ -5197,9 +5350,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> - foo
- |- bar
- """
+ |> - foo
+ |- bar
+ """
.trimMargin(),
)
@@ -5225,9 +5378,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- | bar
- """
+ |> foo
+ | bar
+ """
.trimMargin(),
)
@@ -5251,10 +5404,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> ```
- |foo
- |```
- """
+ |> ```
+ |foo
+ |```
+ """
.trimMargin(),
)
@@ -5278,9 +5431,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- | - bar
- """
+ |> foo
+ | - bar
+ """
.trimMargin(),
)
@@ -5291,7 +5444,7 @@ class MarkdownProcessorDocumentParsingTest {
* - bar
*
*/
- parsed.assertEquals(blockQuote(paragraph("foo - bar")))
+ parsed.assertEquals(blockQuote(Paragraph(Text("foo"), SoftLineBreak, Text("- bar"))))
}
@Test
@@ -5311,10 +5464,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |>
- |>
- |>
- """
+ |>
+ |>
+ |>
+ """
.trimMargin(),
)
@@ -5331,10 +5484,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |>
- |> foo
- |>
- """
+ |>
+ |> foo
+ |>
+ """
.trimMargin(),
)
@@ -5352,10 +5505,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- |
- |> bar
- """
+ |> foo
+ |
+ |> bar
+ """
.trimMargin(),
)
@@ -5379,8 +5532,8 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- |> bar
+ |> foo
+ |> bar
"""
.trimMargin(),
)
@@ -5392,7 +5545,7 @@ class MarkdownProcessorDocumentParsingTest {
* bar
*
*/
- parsed.assertEquals(blockQuote(paragraph("foo bar")))
+ parsed.assertEquals(blockQuote(Paragraph(Text("foo"), SoftLineBreak, Text("bar"))))
}
@Test
@@ -5400,10 +5553,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> foo
- |>
- |> bar
- """
+ |> foo
+ |>
+ |> bar
+ """
.trimMargin(),
)
@@ -5427,9 +5580,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |foo
- |> bar
- """
+ |foo
+ |> bar
+ """
.trimMargin(),
)
@@ -5451,10 +5604,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> aaa
- |***
- |> bbb
- """
+ |> aaa
+ |***
+ |> bbb
+ """
.trimMargin(),
)
@@ -5480,9 +5633,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> bar
- |baz
- """
+ |> bar
+ |baz
+ """
.trimMargin(),
)
@@ -5493,7 +5646,7 @@ class MarkdownProcessorDocumentParsingTest {
* baz
*
*/
- parsed.assertEquals(blockQuote(paragraph("bar baz")))
+ parsed.assertEquals(blockQuote(Paragraph(Text("bar"), SoftLineBreak, Text("baz"))))
}
@Test
@@ -5501,10 +5654,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> bar
- |
- |baz
- """
+ |> bar
+ |
+ |baz
+ """
.trimMargin(),
)
@@ -5526,10 +5679,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> bar
- |>
- |baz
- """
+ |> bar
+ |>
+ |baz
+ """
.trimMargin(),
)
@@ -5551,9 +5704,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> > > foo
- |bar
- """
+ |> > > foo
+ |bar
+ """
.trimMargin(),
)
@@ -5571,7 +5724,7 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
blockQuote(
blockQuote(
- blockQuote(paragraph("foo bar")),
+ blockQuote(Paragraph(Text("foo"), SoftLineBreak, Text("bar"))),
),
),
)
@@ -5582,10 +5735,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |>>> foo
- |> bar
- |>>baz
- """
+ |>>> foo
+ |> bar
+ |>>baz
+ """
.trimMargin(),
)
@@ -5604,7 +5757,15 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
blockQuote(
blockQuote(
- blockQuote(paragraph("foo bar baz")),
+ blockQuote(
+ Paragraph(
+ Text("foo"),
+ SoftLineBreak,
+ Text("bar"),
+ SoftLineBreak,
+ Text("baz")
+ )
+ ),
),
),
)
@@ -5615,10 +5776,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> code
- |
- |> not code
- """
+ |> code
+ |
+ |> not code
+ """
.trimMargin(),
)
@@ -5643,13 +5804,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |A paragraph
- |with two lines.
- |
- | indented code
- |
- |> A block quote.
- """
+ |A paragraph
+ |with two lines.
+ |
+ | indented code
+ |
+ |> A block quote.
+ """
.trimMargin(),
)
@@ -5664,7 +5825,7 @@ class MarkdownProcessorDocumentParsingTest {
*
*/
parsed.assertEquals(
- paragraph("A paragraph with two lines."),
+ Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines.")),
indentedCodeBlock("indented code"),
blockQuote(paragraph("A block quote.")),
)
@@ -5702,7 +5863,7 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
orderedList(
listItem(
- paragraph("A paragraph with two lines."),
+ Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines.")),
indentedCodeBlock("indented code"),
blockQuote(paragraph("A block quote.")),
),
@@ -5716,10 +5877,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- one
- |
- | two
- """
+ |- one
+ |
+ | two
+ """
.trimMargin(),
)
@@ -5741,10 +5902,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- one
- |
- | two
- """
+ |- one
+ |
+ | two
+ """
.trimMargin(),
)
@@ -5770,10 +5931,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | - one
- |
- | two
- """
+ | - one
+ |
+ | two
+ """
.trimMargin(),
)
@@ -5796,10 +5957,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | - one
- |
- | two
- """
+ | - one
+ |
+ | two
+ """
.trimMargin(),
)
@@ -5825,10 +5986,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | > > 1. one
- |>>
- |>> two
- """
+ | > > 1. one
+ |>>
+ |>> two
+ """
.trimMargin(),
)
@@ -5862,10 +6023,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |>>- one
- |>>
- | > > two
- """
+ |>>- one
+ |>>
+ | > > two
+ """
.trimMargin(),
)
@@ -5895,10 +6056,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |-one
- |
- |2.two
- """
+ |-one
+ |
+ |2.two
+ """
.trimMargin(),
)
@@ -5918,11 +6079,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |
- |
- | bar
- """
+ |- foo
+ |
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -5951,16 +6112,16 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. foo
- |
- | ```
- | bar
- | ```
- |
- | baz
- |
- | > bam
- """
+ |1. foo
+ |
+ | ```
+ | bar
+ | ```
+ |
+ | baz
+ |
+ | > bam
+ """
.trimMargin(),
)
@@ -5996,13 +6157,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- Foo
- |
- | bar
- |
- |
- | baz
- """
+ |- Foo
+ |
+ | bar
+ |
+ |
+ | baz
+ """
.trimMargin(),
)
@@ -6093,10 +6254,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |
- | bar
- """
+ |- foo
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -6123,10 +6284,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 10. foo
- |
- | bar
- """
+ | 10. foo
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -6154,12 +6315,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | indented code
- |
- |paragraph
- |
- | more code
- """
+ | indented code
+ |
+ |paragraph
+ |
+ | more code
+ """
.trimMargin(),
)
@@ -6183,12 +6344,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. indented code
- |
- | paragraph
- |
- | more code
- """
+ |1. indented code
+ |
+ | paragraph
+ |
+ | more code
+ """
.trimMargin(),
)
@@ -6221,12 +6382,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. indented code
- |
- | paragraph
- |
- | more code
- """
+ |1. indented code
+ |
+ | paragraph
+ |
+ | more code
+ """
.trimMargin(),
)
@@ -6259,10 +6420,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | foo
- |
- |bar
- """
+ | foo
+ |
+ |bar
+ """
.trimMargin(),
)
@@ -6282,10 +6443,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |
- | bar
- """
+ |- foo
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -6307,10 +6468,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |
- | bar
- """
+ |- foo
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -6336,15 +6497,15 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |-
- | foo
- |-
- | ```
- | bar
- | ```
- |-
- | baz
- """
+ |-
+ | foo
+ |-
+ | ```
+ | bar
+ | ```
+ |-
+ | baz
+ """
.trimMargin(),
)
@@ -6376,9 +6537,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |-
- | foo
- """
+ |-
+ | foo
+ """
.trimMargin(),
)
@@ -6396,10 +6557,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |-
- |
- | foo
- """
+ |-
+ |
+ | foo
+ """
.trimMargin(),
)
@@ -6421,10 +6582,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |-
- |- bar
- """
+ |- foo
+ |-
+ |- bar
+ """
.trimMargin(),
)
@@ -6450,10 +6611,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |-
- |- bar
- """
+ |- foo
+ |-
+ |- bar
+ """
.trimMargin(),
)
@@ -6479,10 +6640,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. foo
- |2.
- |3. bar
- """
+ |1. foo
+ |2.
+ |3. bar
+ """
.trimMargin(),
)
@@ -6521,12 +6682,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |foo
- |*
- |
- |foo
- |1.
- """
+ |foo
+ |*
+ |
+ |foo
+ |1.
+ """
.trimMargin(),
)
@@ -6538,8 +6699,8 @@ class MarkdownProcessorDocumentParsingTest {
* 1.
*/
parsed.assertEquals(
- paragraph("foo \\*"),
- paragraph("foo 1."),
+ Paragraph(Text("foo"), SoftLineBreak, Text("*")),
+ Paragraph(Text("foo"), SoftLineBreak, Text("1.")),
)
}
@@ -6548,13 +6709,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 1. A paragraph
- | with two lines.
- |
- | indented code
- |
- | > A block quote.
- """
+ | 1. A paragraph
+ | with two lines.
+ |
+ | indented code
+ |
+ | > A block quote.
+ """
.trimMargin(),
)
@@ -6575,7 +6736,7 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
orderedList(
listItem(
- paragraph("A paragraph with two lines."),
+ Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines.")),
indentedCodeBlock("indented code"),
blockQuote(paragraph("A block quote.")),
),
@@ -6589,13 +6750,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 1. A paragraph
- | with two lines.
- |
- | indented code
- |
- | > A block quote.
- """
+ | 1. A paragraph
+ | with two lines.
+ |
+ | indented code
+ |
+ | > A block quote.
+ """
.trimMargin(),
)
@@ -6616,7 +6777,7 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
orderedList(
listItem(
- paragraph("A paragraph with two lines."),
+ Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines.")),
indentedCodeBlock("indented code"),
blockQuote(paragraph("A block quote.")),
),
@@ -6630,13 +6791,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 1. A paragraph
- | with two lines.
- |
- | indented code
- |
- | > A block quote.
- """
+ | 1. A paragraph
+ | with two lines.
+ |
+ | indented code
+ |
+ | > A block quote.
+ """
.trimMargin(),
)
@@ -6657,7 +6818,7 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
orderedList(
listItem(
- paragraph("A paragraph with two lines."),
+ Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines.")),
indentedCodeBlock("indented code"),
blockQuote(paragraph("A block quote.")),
),
@@ -6671,13 +6832,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 1. A paragraph
- | with two lines.
- |
- | indented code
- |
- | > A block quote.
- """
+ | 1. A paragraph
+ | with two lines.
+ |
+ | indented code
+ |
+ | > A block quote.
+ """
.trimMargin(),
)
@@ -6694,13 +6855,13 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
indentedCodeBlock(
"""
- |1. A paragraph
- | with two lines.
- |
- | indented code
- |
- | > A block quote.
- """
+ |1. A paragraph
+ | with two lines.
+ |
+ | indented code
+ |
+ | > A block quote.
+ """
.trimMargin(),
),
)
@@ -6711,13 +6872,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 1. A paragraph
- |with two lines.
- |
- | indented code
- |
- | > A block quote.
- """
+ | 1. A paragraph
+ |with two lines.
+ |
+ | indented code
+ |
+ | > A block quote.
+ """
.trimMargin(),
)
@@ -6738,7 +6899,7 @@ class MarkdownProcessorDocumentParsingTest {
parsed.assertEquals(
orderedList(
listItem(
- paragraph("A paragraph with two lines."),
+ Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines.")),
indentedCodeBlock("indented code"),
blockQuote(paragraph("A block quote.")),
),
@@ -6752,9 +6913,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- | 1. A paragraph
- | with two lines.
- """
+ | 1. A paragraph
+ | with two lines.
+ """
.trimMargin(),
)
@@ -6767,7 +6928,7 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
orderedList(
- listItem(paragraph("A paragraph with two lines.")),
+ listItem(Paragraph(Text("A paragraph"), SoftLineBreak, Text("with two lines."))),
),
)
}
@@ -6777,9 +6938,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> 1. > Blockquote
- |continued here.
- """
+ |> 1. > Blockquote
+ |continued here.
+ """
.trimMargin(),
)
@@ -6798,7 +6959,11 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
blockQuote(
- orderedList(listItem(blockQuote(paragraph("Blockquote continued here.")))),
+ orderedList(
+ listItem(
+ blockQuote(Paragraph(Text("Blockquote"), SoftLineBreak, Text("continued here.")))
+ )
+ ),
),
)
}
@@ -6808,9 +6973,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |> 1. > Blockquote
- |> continued here.
- """
+ |> 1. > Blockquote
+ |> continued here.
+ """
.trimMargin(),
)
@@ -6829,7 +6994,11 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
blockQuote(
- orderedList(listItem(blockQuote(paragraph("Blockquote continued here.")))),
+ orderedList(
+ listItem(
+ blockQuote(Paragraph(Text("Blockquote"), SoftLineBreak, Text("continued here.")))
+ )
+ ),
),
)
}
@@ -6839,11 +7008,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- | - bar
- | - baz
- | - boo
- """
+ |- foo
+ | - bar
+ | - baz
+ | - boo
+ """
.trimMargin(),
)
@@ -6890,11 +7059,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- | - bar
- | - baz
- | - boo
- """
+ |- foo
+ | - bar
+ | - baz
+ | - boo
+ """
.trimMargin(),
)
@@ -6922,9 +7091,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |10) foo
- | - bar
- """
+ |10) foo
+ | - bar
+ """
.trimMargin(),
)
@@ -6955,9 +7124,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |10) foo
- | - bar
- """
+ |10) foo
+ | - bar
+ """
.trimMargin(),
)
@@ -7042,11 +7211,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- # Foo
- |- Bar
- | ---
- | baz
- """
+ |- # Foo
+ |- Bar
+ | ---
+ | baz
+ """
.trimMargin(),
)
@@ -7063,8 +7232,8 @@ class MarkdownProcessorDocumentParsingTest {
*/
parsed.assertEquals(
unorderedList(
- listItem(heading(level = 1, "Foo")),
- listItem(heading(level = 2, "Bar"), paragraph("baz")),
+ listItem(heading(level = 1, Text("Foo"))),
+ listItem(heading(level = 2, Text("Bar")), paragraph("baz")),
),
)
}
@@ -7074,10 +7243,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |- bar
- |+ baz
- """
+ |- foo
+ |- bar
+ |+ baz
+ """
.trimMargin(),
)
@@ -7108,10 +7277,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. foo
- |2. bar
- |3) baz
- """
+ |1. foo
+ |2. bar
+ |3) baz
+ """
.trimMargin(),
)
@@ -7143,10 +7312,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |Foo
- |- bar
- |- baz
- """
+ |Foo
+ |- bar
+ |- baz
+ """
.trimMargin(),
)
@@ -7172,9 +7341,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |The number of windows in my house is
- |14. The number of doors is 6.
- """
+ |The number of windows in my house is
+ |14. The number of doors is 6.
+ """
.trimMargin(),
)
@@ -7184,7 +7353,11 @@ class MarkdownProcessorDocumentParsingTest {
* 14. The number of doors is 6.
*/
parsed.assertEquals(
- paragraph("The number of windows in my house is 14. The number of doors is 6."),
+ Paragraph(
+ Text("The number of windows in my house is"),
+ SoftLineBreak,
+ Text("14. The number of doors is 6."),
+ )
)
}
@@ -7193,9 +7366,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |The number of windows in my house is
- |1. The number of doors is 6.
- """
+ |The number of windows in my house is
+ |1. The number of doors is 6.
+ """
.trimMargin(),
)
@@ -7217,13 +7390,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |
- |- bar
- |
- |
- |- baz
- """
+ |- foo
+ |
+ |- bar
+ |
+ |
+ |- baz
+ """
.trimMargin(),
)
@@ -7256,13 +7429,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- | - bar
- | - baz
- |
- |
- | bim
- """
+ |- foo
+ | - bar
+ | - baz
+ |
+ |
+ | bim
+ """
.trimMargin(),
)
@@ -7309,14 +7482,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |- bar
- |
- |
- |
- |- baz
- |- bim
- """
+ |- foo
+ |- bar
+ |
+ |
+ |
+ |- baz
+ |- bim
+ """
.trimMargin(),
)
@@ -7350,16 +7523,16 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- foo
- |
- | notcode
- |
- |- foo
- |
- |
- |
- | code
- """
+ |- foo
+ |
+ | notcode
+ |
+ |- foo
+ |
+ |
+ |
+ | code
+ """
.trimMargin(),
)
@@ -7394,14 +7567,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- | - b
- | - c
- | - d
- | - e
- | - f
- |- g
- """
+ |- a
+ | - b
+ | - c
+ | - d
+ | - e
+ | - f
+ |- g
+ """
.trimMargin(),
)
@@ -7435,12 +7608,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. a
- |
- | 2. b
- |
- | 3. c
- """
+ |1. a
+ |
+ | 2. b
+ |
+ | 3. c
+ """
.trimMargin(),
)
@@ -7473,12 +7646,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- | - b
- | - c
- | - d
- | - e
- """
+ |- a
+ | - b
+ | - c
+ | - d
+ | - e
+ """
.trimMargin(),
)
@@ -7497,7 +7670,7 @@ class MarkdownProcessorDocumentParsingTest {
listItem(paragraph("a")),
listItem(paragraph("b")),
listItem(paragraph("c")),
- listItem(paragraph("d - e")),
+ listItem(Paragraph(Text("d"), SoftLineBreak, Text("- e"))),
),
)
}
@@ -7507,12 +7680,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. a
- |
- | 2. b
- |
- | 3. c
- """
+ |1. a
+ |
+ | 2. b
+ |
+ | 3. c
+ """
.trimMargin(),
)
@@ -7544,11 +7717,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- |- b
- |
- |- c
- """
+ |- a
+ |- b
+ |
+ |- c
+ """
.trimMargin(),
)
@@ -7581,11 +7754,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |* a
- |*
- |
- |* c
- """
+ |* a
+ |*
+ |
+ |* c
+ """
.trimMargin(),
)
@@ -7617,12 +7790,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- |- b
- |
- | c
- |- d
- """
+ |- a
+ |- b
+ |
+ | c
+ |- d
+ """
.trimMargin(),
)
@@ -7656,12 +7829,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- |- b
- |
- | [ref]: /url
- |- d
- """
+ |- a
+ |- b
+ |
+ | [ref]: /url
+ |- d
+ """
.trimMargin(),
)
@@ -7694,14 +7867,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- |- ```
- | b
- |
- |
- | ```
- |- c
- """
+ |- a
+ |- ```
+ | b
+ |
+ |
+ | ```
+ |- c
+ """
.trimMargin(),
)
@@ -7732,12 +7905,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- | - b
- |
- | c
- |- d
- """
+ |- a
+ | - b
+ |
+ | c
+ |- d
+ """
.trimMargin(),
)
@@ -7777,11 +7950,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |* a
- | > b
- | >
- |* c
- """
+ |* a
+ | > b
+ | >
+ |* c
+ """
.trimMargin(),
)
@@ -7810,13 +7983,13 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- | > b
- | ```
- | c
- | ```
- |- d
- """
+ |- a
+ | > b
+ | ```
+ | c
+ | ```
+ |- d
+ """
.trimMargin(),
)
@@ -7863,9 +8036,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- | - b
- """
+ |- a
+ | - b
+ """
.trimMargin(),
)
@@ -7894,12 +8067,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |1. ```
- | foo
- | ```
- |
- | bar
- """
+ |1. ```
+ | foo
+ | ```
+ |
+ | bar
+ """
.trimMargin(),
)
@@ -7929,11 +8102,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |* foo
- | * bar
- |
- | baz
- """
+ |* foo
+ | * bar
+ |
+ | baz
+ """
.trimMargin(),
)
@@ -7970,14 +8143,14 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |- a
- | - b
- | - c
- |
- |- d
- | - e
- | - f
- """
+ |- a
+ | - b
+ | - c
+ |
+ |- d
+ | - e
+ | - f
+ """
.trimMargin(),
)
@@ -8029,7 +8202,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* hi
lo`
*/
- parsed.assertEquals(paragraph("`hi`lo\\`"))
+ parsed.assertEquals(Paragraph(Code("hi"), Text("lo`")))
}
@Test
@@ -8040,7 +8213,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("`foo`"))
+ parsed.assertEquals(Paragraph(Code("foo")))
}
@Test
@@ -8051,7 +8224,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo ` bar
*/
- parsed.assertEquals(paragraph("``foo ` bar``"))
+ parsed.assertEquals(Paragraph(Code("foo ` bar")))
}
@Test
@@ -8062,7 +8235,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ``
*/
- parsed.assertEquals(paragraph("``
"))
+ parsed.assertEquals(Paragraph(Code("``")))
}
@Test
@@ -8073,7 +8246,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ``
*/
- parsed.assertEquals(paragraph(" ``
"))
+ parsed.assertEquals(Paragraph(Code(" `` ")))
}
@Test
@@ -8084,7 +8257,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a
*/
- parsed.assertEquals(paragraph("` a`"))
+ parsed.assertEquals(Paragraph(Code(" a")))
}
@Test
@@ -8095,7 +8268,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* b
*/
- parsed.assertEquals(paragraph("` b `"))
+ parsed.assertEquals(Paragraph(Code(" b ")))
}
@Test
@@ -8103,9 +8276,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |` `
- |` `
- """
+ |` `
+ |` `
+ """
.trimMargin(),
)
@@ -8114,7 +8287,7 @@ class MarkdownProcessorDocumentParsingTest {
*
*
*/
- parsed.assertEquals(paragraph("` ` ` `"))
+ parsed.assertEquals(Paragraph(Code(" "), SoftLineBreak, Code(" ")))
}
@Test
@@ -8122,12 +8295,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``
- |foo
- |bar
- |baz
- |``
- """
+ |``
+ |foo
+ |bar
+ |baz
+ |``
+ """
.trimMargin(),
)
@@ -8135,7 +8308,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("`foo bar baz`"))
+ parsed.assertEquals(Paragraph(Code("foo bar baz")))
}
@Test
@@ -8143,10 +8316,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |``
- |foo
- |``
- """
+ |``
+ |foo
+ |``
+ """
.trimMargin(),
)
@@ -8154,7 +8327,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("`foo `"))
+ parsed.assertEquals(Paragraph(Code("foo ")))
}
@Test
@@ -8162,9 +8335,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |`foo bar
- |baz`
- """
+ |`foo bar
+ |baz`
+ """
.trimMargin(),
)
@@ -8172,7 +8345,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("`foo bar baz`"))
+ parsed.assertEquals(Paragraph(Code("foo bar baz")))
}
@Test
@@ -8183,7 +8356,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo\
bar`
*/
- parsed.assertEquals(paragraph("`foo\\`bar\\`"))
+ parsed.assertEquals(Paragraph(Code("foo\\"), Text("bar`")))
}
@Test
@@ -8194,7 +8367,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo`bar
*/
- parsed.assertEquals(paragraph("``foo`bar``"))
+ parsed.assertEquals(Paragraph(Code("foo`bar")))
}
@Test
@@ -8205,7 +8378,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo `` bar
*/
- parsed.assertEquals(paragraph("```foo `` bar```"))
+ parsed.assertEquals(Paragraph(Code("foo `` bar")))
}
@Test
@@ -8216,7 +8389,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo*
*/
- parsed.assertEquals(paragraph("\\*foo`*`"))
+ parsed.assertEquals(Paragraph(Text("*foo"), Code("*")))
}
@Test
@@ -8227,7 +8400,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [not a link](/foo
)
*/
- parsed.assertEquals(paragraph("\\[not a `link](/foo`\\)"))
+ parsed.assertEquals(Paragraph(Text("[not a "), Code("link](/foo"), Text(")")))
}
@Test
@@ -8238,7 +8411,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* <a href="
">`
*/
- parsed.assertEquals(paragraph("`\\`"))
+ parsed.assertEquals(Paragraph(Code("`")))
}
@Test
@@ -8249,7 +8422,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* `
*/
- parsed.assertEquals(paragraph("\\`"))
+ parsed.assertEquals(Paragraph(HtmlInline(""), Text("`")))
}
@Test
@@ -8260,7 +8433,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* <https://foo.bar.
baz>`
*/
- parsed.assertEquals(paragraph("`\\`"))
+ parsed.assertEquals(Paragraph(Code("`")))
}
@Test
@@ -8271,7 +8444,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* https://foo.bar.`baz`
*/
- parsed.assertEquals(paragraph("[https://foo.bar.\\`baz](https://foo.bar.`baz)\\`"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(destination = "https://foo.bar.`baz", title = null, Text("https://foo.bar.`baz")),
+ Text("`"),
+ )
+ )
}
@Test
@@ -8282,7 +8460,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ```foo``
*/
- parsed.assertEquals(paragraph("\\`\\`\\`foo\\`\\`"))
+ parsed.assertEquals(paragraph("```foo``"))
}
@Test
@@ -8293,7 +8471,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* `foo
*/
- parsed.assertEquals(paragraph("\\`foo"))
+ parsed.assertEquals(paragraph("`foo"))
}
@Test
@@ -8304,7 +8482,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* `foobar
*/
- parsed.assertEquals(paragraph("\\`foo`bar`"))
+ parsed.assertEquals(Paragraph(Text("`foo"), Code("bar")))
}
@Test
@@ -8315,7 +8493,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("*foo bar*"))
+ parsed.assertEquals(Paragraph(Emphasis("*", Text(("foo bar")))))
}
@Test
@@ -8326,7 +8504,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a * foo bar*
*/
- parsed.assertEquals(paragraph("a \\* foo bar\\*"))
+ parsed.assertEquals(paragraph("a * foo bar*"))
}
@Test
@@ -8337,7 +8515,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a*"foo"*
*/
- parsed.assertEquals(paragraph("a\\*\"foo\"\\*"))
+ parsed.assertEquals(paragraph("a*\"foo\"*"))
}
@Test
@@ -8348,7 +8526,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* * a *
*/
- parsed.assertEquals(paragraph("\\* a \\*"))
+ parsed.assertEquals(paragraph("* a *"))
}
@Test
@@ -8356,12 +8534,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |*$*alpha.
- |
- |*£*bravo.
- |
- |*€*charlie.
- """.trimMargin(),
+ |*$*alpha.
+ |
+ |*£*bravo.
+ |
+ |*€*charlie.
+ """.trimMargin(),
)
/*
@@ -8370,7 +8548,11 @@ class MarkdownProcessorDocumentParsingTest {
* *£*bravo.
* *€*charlie.
*/
- parsed.assertEquals(paragraph("*$*alpha."), paragraph("*£*bravo."), paragraph("*€*charlie."))
+ parsed.assertEquals(
+ paragraph("*$*alpha."),
+ paragraph("*£*bravo."),
+ paragraph("*€*charlie.")
+ )
}
@Test
@@ -8381,7 +8563,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobar
*/
- parsed.assertEquals(paragraph("foo*bar*"))
+ parsed.assertEquals(Paragraph(Text("foo"), Emphasis("*", Text("bar"))))
}
@Test
@@ -8392,7 +8574,13 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* 5678
*/
- parsed.assertEquals(paragraph("5*6*78"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("5"),
+ Emphasis("*", Text("6")),
+ Text("78")
+ )
+ )
}
@Test
@@ -8403,7 +8591,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("_foo bar_"))
+ parsed.assertEquals(Paragraph(Emphasis("_", Text("foo bar"))))
}
@Test
@@ -8414,7 +8602,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _ foo bar_
*/
- parsed.assertEquals(paragraph("\\_ foo bar\\_"))
+ parsed.assertEquals(paragraph("_ foo bar_"))
}
@Test
@@ -8425,7 +8613,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a_"foo"_
*/
- parsed.assertEquals(paragraph("a\\_\"foo\"\\_"))
+ parsed.assertEquals(paragraph("a_\"foo\"_"))
}
@Test
@@ -8436,7 +8624,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo_bar_
*/
- parsed.assertEquals(paragraph("foo\\_bar\\_"))
+ parsed.assertEquals(paragraph("foo_bar_"))
}
@Test
@@ -8447,7 +8635,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* 5_6_78
*/
- parsed.assertEquals(paragraph("5\\_6\\_78"))
+ parsed.assertEquals(paragraph("5_6_78"))
}
@Test
@@ -8458,7 +8646,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* пристаням_стремятся_
*/
- parsed.assertEquals(paragraph("пристаням\\_стремятся\\_"))
+ parsed.assertEquals(paragraph("пристаням_стремятся_"))
}
@Test
@@ -8469,7 +8657,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* aa_"bb"_cc
*/
- parsed.assertEquals(paragraph("aa\\_\"bb\"\\_cc"))
+ parsed.assertEquals(paragraph("aa_\"bb\"_cc"))
}
@Test
@@ -8480,7 +8668,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo-(bar)
*/
- parsed.assertEquals(paragraph("foo-_\\(bar\\)_"))
+ parsed.assertEquals(Paragraph(Text("foo-"), Emphasis("_", Text("(bar)"))))
}
@Test
@@ -8491,7 +8679,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _foo*
*/
- parsed.assertEquals(paragraph("\\_foo\\*"))
+ parsed.assertEquals(paragraph("_foo*"))
}
@Test
@@ -8502,7 +8690,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo bar *
*/
- parsed.assertEquals(paragraph("\\*foo bar \\*"))
+ parsed.assertEquals(paragraph("*foo bar *"))
}
@Test
@@ -8510,9 +8698,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |*foo bar
- |*
- """
+ |*foo bar
+ |*
+ """
.trimMargin(),
)
@@ -8521,7 +8709,7 @@ class MarkdownProcessorDocumentParsingTest {
* *foo bar
* *
*/
- parsed.assertEquals(paragraph("\\*foo bar \\*"))
+ parsed.assertEquals(Paragraph(Text("*foo bar"), SoftLineBreak, Text("*")))
}
@Test
@@ -8532,7 +8720,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *(*foo)
*/
- parsed.assertEquals(paragraph("\\*\\(\\*foo\\)"))
+ parsed.assertEquals(paragraph("*(*foo)"))
}
@Test
@@ -8543,7 +8731,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* (foo)
*/
- parsed.assertEquals(paragraph("*\\(*foo*\\)*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("("),
+ Emphasis("*", Text("foo")),
+ Text(")")
+ )
+ )
+ )
}
@Test
@@ -8554,7 +8751,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobar
*/
- parsed.assertEquals(paragraph("*foo*bar"))
+ parsed.assertEquals(Paragraph(Emphasis("*", Text("foo")), Text("bar")))
}
@Test
@@ -8565,7 +8762,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _foo bar _
*/
- parsed.assertEquals(paragraph("\\_foo bar \\_"))
+ parsed.assertEquals(paragraph("_foo bar _"))
}
@Test
@@ -8576,7 +8773,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _(_foo)
*/
- parsed.assertEquals(paragraph("\\_\\(\\_foo\\)"))
+ parsed.assertEquals(paragraph("_(_foo)"))
}
@Test
@@ -8587,7 +8784,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* (foo)
*/
- parsed.assertEquals(paragraph("_\\(_foo_\\)_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Text("("),
+ Emphasis("_", Text("foo")),
+ Text(")")
+ )
+ )
+ )
}
@Test
@@ -8598,7 +8804,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _foo_bar
*/
- parsed.assertEquals(paragraph("\\_foo\\_bar"))
+ parsed.assertEquals(paragraph("_foo_bar"))
}
@Test
@@ -8609,7 +8815,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _пристаням_стремятся
*/
- parsed.assertEquals(paragraph("\\_пристаням\\_стремятся"))
+ parsed.assertEquals(paragraph("_пристаням_стремятся"))
}
@Test
@@ -8620,7 +8826,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo_bar_baz
*/
- parsed.assertEquals(paragraph("_foo\\_bar\\_baz_"))
+ parsed.assertEquals(Paragraph(Emphasis("_", Text("foo_bar_baz"))))
}
@Test
@@ -8631,7 +8837,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* (bar).
*/
- parsed.assertEquals(paragraph("_\\(bar\\)_."))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis("_", Text("(bar)")),
+ Text("."),
+ )
+ )
}
@Test
@@ -8642,7 +8853,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("**foo bar**"))
+ parsed.assertEquals(Paragraph(StrongEmphasis("**", Text("foo bar"))))
}
@Test
@@ -8653,7 +8864,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ** foo bar**
*/
- parsed.assertEquals(paragraph("\\*\\* foo bar\\*\\*"))
+ parsed.assertEquals(paragraph("** foo bar**"))
}
@Test
@@ -8664,7 +8875,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a**"foo"**
*/
- parsed.assertEquals(paragraph("a\\*\\*\"foo\"\\*\\*"))
+ parsed.assertEquals(paragraph("a**\"foo\"**"))
}
@Test
@@ -8675,7 +8886,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobar
*/
- parsed.assertEquals(paragraph("foo**bar**"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo"),
+ StrongEmphasis("**", Text("bar")),
+ )
+ )
}
@Test
@@ -8686,7 +8902,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("__foo bar__"))
+ parsed.assertEquals(Paragraph(StrongEmphasis("__", Text("foo bar"))))
}
@Test
@@ -8697,7 +8913,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __ foo bar__
*/
- parsed.assertEquals(paragraph("\\_\\_ foo bar\\_\\_"))
+ parsed.assertEquals(paragraph("__ foo bar__"))
}
@Test
@@ -8705,9 +8921,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |__
- |foo bar__
- """
+ |__
+ |foo bar__
+ """
.trimMargin(),
)
@@ -8716,7 +8932,7 @@ class MarkdownProcessorDocumentParsingTest {
* __
* foo bar__
*/
- parsed.assertEquals(paragraph("\\_\\_ foo bar\\_\\_"))
+ parsed.assertEquals(Paragraph(Text("__"), SoftLineBreak, Text("foo bar__")))
}
@Test
@@ -8727,7 +8943,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a__"foo"__
*/
- parsed.assertEquals(paragraph("a\\_\\_\"foo\"\\_\\_"))
+ parsed.assertEquals(paragraph("a__\"foo\"__"))
}
@Test
@@ -8738,7 +8954,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo__bar__
*/
- parsed.assertEquals(paragraph("foo\\_\\_bar\\_\\_"))
+ parsed.assertEquals(paragraph("foo__bar__"))
}
@Test
@@ -8749,7 +8965,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* 5__6__78
*/
- parsed.assertEquals(paragraph("5\\_\\_6\\_\\_78"))
+ parsed.assertEquals(paragraph("5__6__78"))
}
@Test
@@ -8760,7 +8976,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* пристаням__стремятся__
*/
- parsed.assertEquals(paragraph("пристаням\\_\\_стремятся\\_\\_"))
+ parsed.assertEquals(paragraph("пристаням__стремятся__"))
}
@Test
@@ -8771,7 +8987,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo, bar, baz
*/
- parsed.assertEquals(paragraph("__foo, __bar__, baz__"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ Text("foo, "),
+ StrongEmphasis("__", Text("bar")),
+ Text(", baz"),
+ )
+ )
+ )
}
@Test
@@ -8782,7 +9007,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo-(bar)
*/
- parsed.assertEquals(paragraph("foo-__\\(bar\\)__"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo-"),
+ StrongEmphasis("__", Text("(bar)")),
+ )
+ )
}
@Test
@@ -8793,7 +9023,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* **foo bar **
*/
- parsed.assertEquals(paragraph("\\*\\*foo bar \\*\\*"))
+ parsed.assertEquals(paragraph("**foo bar **"))
}
@Test
@@ -8804,7 +9034,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* **(**foo)
*/
- parsed.assertEquals(paragraph("\\*\\*\\(\\*\\*foo\\)"))
+ parsed.assertEquals(paragraph("**(**foo)"))
}
@Test
@@ -8815,7 +9045,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* (foo)
*/
- parsed.assertEquals(paragraph("*\\(**foo**\\)*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("("),
+ StrongEmphasis("**", Text("foo")),
+ Text(")"),
+ )
+ )
+ )
}
@Test
@@ -8823,9 +9062,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |**Gomphocarpus (*Gomphocarpus physocarpus*, syn.
- |*Asclepias physocarpa*)**
- """
+ |**Gomphocarpus (*Gomphocarpus physocarpus*, syn.
+ |*Asclepias physocarpa*)**
+ """
.trimMargin(),
)
@@ -8835,9 +9074,17 @@ class MarkdownProcessorDocumentParsingTest {
* Asclepias physocarpa)
*/
parsed.assertEquals(
- paragraph(
- "**Gomphocarpus \\(*Gomphocarpus physocarpus*, syn. *Asclepias physocarpa*\\)**",
- ),
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("Gomphocarpus ("),
+ Emphasis("*", Text("Gomphocarpus physocarpus")),
+ Text(", syn."),
+ SoftLineBreak,
+ Emphasis("*", Text("Asclepias physocarpa")),
+ Text(")"),
+ )
+ )
)
}
@@ -8849,7 +9096,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo "bar" foo
*/
- parsed.assertEquals(paragraph("**foo \"*bar*\" foo**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo \""),
+ Emphasis("*", Text("bar")),
+ Text("\" foo"),
+ )
+ )
+ )
}
@Test
@@ -8860,7 +9116,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobar
*/
- parsed.assertEquals(paragraph("**foo**bar"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis("**", Text("foo")),
+ Text("bar"),
+ )
+ )
}
@Test
@@ -8871,7 +9132,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __foo bar __
*/
- parsed.assertEquals(paragraph("\\_\\_foo bar \\_\\_"))
+ parsed.assertEquals(paragraph("__foo bar __"))
}
@Test
@@ -8882,7 +9143,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __(__foo)
*/
- parsed.assertEquals(paragraph("\\_\\_\\(\\_\\_foo\\)"))
+ parsed.assertEquals(paragraph("__(__foo)"))
}
@Test
@@ -8893,7 +9154,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* (foo)
*/
- parsed.assertEquals(paragraph("_\\(__foo__\\)_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Text("("),
+ StrongEmphasis("__", Text("foo")),
+ Text(")"),
+ )
+ )
+ )
}
@Test
@@ -8904,7 +9174,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __foo__bar
*/
- parsed.assertEquals(paragraph("\\_\\_foo\\_\\_bar"))
+ parsed.assertEquals(paragraph("__foo__bar"))
}
@Test
@@ -8915,7 +9185,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __пристаням__стремятся
*/
- parsed.assertEquals(paragraph("\\_\\_пристаням\\_\\_стремятся"))
+ parsed.assertEquals(paragraph("__пристаням__стремятся"))
}
@Test
@@ -8926,7 +9196,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo__bar__baz
*/
- parsed.assertEquals(paragraph("__foo\\_\\_bar\\_\\_baz__"))
+ parsed.assertEquals(Paragraph(StrongEmphasis("__", Text("foo__bar__baz"))))
}
@Test
@@ -8937,7 +9207,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* (bar).
*/
- parsed.assertEquals(paragraph("__\\(bar\\)__."))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis("__", Text("(bar)")),
+ Text("."),
+ )
+ )
}
@Test
@@ -8948,7 +9223,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("*foo [bar](/url)*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ Link(destination = "/url", title = null, Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -8956,9 +9239,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |*foo
- |bar*
- """
+ |*foo
+ |bar*
+ """
.trimMargin(),
)
@@ -8967,7 +9250,16 @@ class MarkdownProcessorDocumentParsingTest {
* foo
* bar
*/
- parsed.assertEquals(paragraph("*foo bar*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo"),
+ SoftLineBreak,
+ Text("bar"),
+ )
+ )
+ )
}
@Test
@@ -8978,7 +9270,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("_foo __bar__ baz_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Text("foo "),
+ StrongEmphasis("__", Text("bar")),
+ Text(" baz"),
+ )
+ )
+ )
}
@Test
@@ -8989,7 +9290,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("_foo _bar_ baz_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Text("foo "),
+ Emphasis("_", Text("bar")),
+ Text(" baz"),
+ )
+ )
+ )
}
@Test
@@ -9000,7 +9310,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("__foo_ bar_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Emphasis("_", Text("foo")),
+ Text(" bar"),
+ )
+ )
+ )
}
@Test
@@ -9011,7 +9329,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("*foo *bar**"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -9022,7 +9348,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("*foo **bar** baz*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ StrongEmphasis("**", Text("bar")),
+ Text(" baz"),
+ )
+ )
+ )
}
@Test
@@ -9033,7 +9368,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobarbaz
*/
- parsed.assertEquals(paragraph("*foo**bar**baz*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo"),
+ StrongEmphasis("**", Text("bar")),
+ Text("baz"),
+ )
+ )
+ )
}
@Test
@@ -9044,7 +9388,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo**bar
*/
- parsed.assertEquals(paragraph("*foo\\*\\*bar*"))
+ parsed.assertEquals(Paragraph(Emphasis("*", Text("foo**bar"))))
}
@Test
@@ -9055,7 +9399,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("***foo** bar*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ StrongEmphasis("**", Text("foo")),
+ Text(" bar"),
+ )
+ )
+ )
}
@Test
@@ -9066,7 +9418,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("*foo **bar***"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ StrongEmphasis("**", Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -9077,7 +9437,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobar
*/
- parsed.assertEquals(paragraph("*foo**bar***"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo"),
+ StrongEmphasis("**", Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -9088,7 +9456,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobarbaz
*/
- parsed.assertEquals(paragraph("foo***bar***baz"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo"),
+ Emphasis(
+ "*",
+ StrongEmphasis("**", Text("bar")),
+ ),
+ Text("baz"),
+ )
+ )
}
@Test
@@ -9099,7 +9476,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobar***baz
*/
- parsed.assertEquals(paragraph("foo******bar******\\*\\*\\*baz"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo"),
+ StrongEmphasis(
+ "**",
+ StrongEmphasis("**", StrongEmphasis("**", Text("bar"))),
+ ),
+ Text("***baz"),
+ )
+ )
}
@Test
@@ -9110,7 +9496,21 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz bim bop
*/
- parsed.assertEquals(paragraph("*foo **bar *baz* bim** bop*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ StrongEmphasis(
+ "**",
+ Text("bar "),
+ Emphasis("*", Text("baz")),
+ Text(" bim"),
+ ),
+ Text(" bop"),
+ ),
+ )
+ )
}
@Test
@@ -9121,7 +9521,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("*foo [*bar*](/url)*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ Link(destination = "/url", title = null, Emphasis("*", Text("bar"))),
+ ),
+ )
+ )
}
@Test
@@ -9132,7 +9540,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ** is not an empty emphasis
*/
- parsed.assertEquals(paragraph("\\*\\* is not an empty emphasis"))
+ parsed.assertEquals(paragraph("** is not an empty emphasis"))
}
@Test
@@ -9143,7 +9551,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* **** is not an empty strong emphasis
*/
- parsed.assertEquals(paragraph("\\*\\*\\*\\* is not an empty strong emphasis"))
+ parsed.assertEquals(paragraph("**** is not an empty strong emphasis"))
}
@Test
@@ -9154,7 +9562,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("**foo [bar](/url)**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Link(destination = "/url", title = null, Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -9162,9 +9578,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |**foo
- |bar**
- """
+ |**foo
+ |bar**
+ """
.trimMargin(),
)
@@ -9173,7 +9589,16 @@ class MarkdownProcessorDocumentParsingTest {
* foo
* bar
*/
- parsed.assertEquals(paragraph("**foo bar**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo"),
+ SoftLineBreak,
+ Text("bar"),
+ )
+ )
+ )
}
@Test
@@ -9184,7 +9609,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("__foo _bar_ baz__"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ Text("foo "),
+ Emphasis("_", Text("bar")),
+ Text(" baz"),
+ )
+ )
+ )
}
@Test
@@ -9195,7 +9629,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("__foo __bar__ baz__"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ Text("foo "),
+ StrongEmphasis("__", Text("bar")),
+ Text(" baz"),
+ )
+ )
+ )
}
@Test
@@ -9206,7 +9649,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("____foo__ bar__"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ StrongEmphasis("__", Text("foo")),
+ Text(" bar"),
+ )
+ )
+ )
}
@Test
@@ -9217,7 +9668,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("**foo **bar****"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ StrongEmphasis("**", Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -9228,7 +9687,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar baz
*/
- parsed.assertEquals(paragraph("**foo *bar* baz**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ Text(" baz"),
+ )
+ )
+ )
}
@Test
@@ -9239,7 +9707,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foobarbaz
*/
- parsed.assertEquals(paragraph("**foo*bar*baz**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo"),
+ Emphasis("*", Text("bar")),
+ Text("baz"),
+ )
+ )
+ )
}
@Test
@@ -9250,7 +9727,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("***foo* bar**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Emphasis("*", Text("foo")),
+ Text(" bar"),
+ )
+ )
+ )
}
@Test
@@ -9261,7 +9746,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("**foo *bar***"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ )
+ )
+ )
}
@Test
@@ -9269,9 +9762,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |**foo *bar **baz**
- |bim* bop**
- """
+ |**foo *bar **baz**
+ |bim* bop**
+ """
.trimMargin(),
)
@@ -9280,7 +9773,22 @@ class MarkdownProcessorDocumentParsingTest {
* foo bar baz
* bim bop
*/
- parsed.assertEquals(paragraph("**foo *bar **baz** bim* bop**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Emphasis(
+ "*",
+ Text("bar "),
+ StrongEmphasis("**", Text("baz")),
+ SoftLineBreak,
+ Text("bim")
+ ),
+ Text(" bop"),
+ )
+ )
+ )
}
@Test
@@ -9291,7 +9799,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("**foo [*bar*](/url)**"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ Text("foo "),
+ Link(destination = "/url", title = null, Emphasis("*", Text("bar"))),
+ )
+ )
+ )
}
@Test
@@ -9302,7 +9818,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __ is not an empty emphasis
*/
- parsed.assertEquals(paragraph("\\_\\_ is not an empty emphasis"))
+ parsed.assertEquals(paragraph("__ is not an empty emphasis"))
}
@Test
@@ -9313,7 +9829,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ____ is not an empty strong emphasis
*/
- parsed.assertEquals(paragraph("\\_\\_\\_\\_ is not an empty strong emphasis"))
+ parsed.assertEquals(paragraph("____ is not an empty strong emphasis"))
}
@Test
@@ -9324,7 +9840,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo ***
*/
- parsed.assertEquals(paragraph("foo \\*\\*\\*"))
+ parsed.assertEquals(paragraph("foo ***"))
}
@Test
@@ -9335,7 +9851,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *
*/
- parsed.assertEquals(paragraph("foo *\\**"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ Emphasis("*", Text("*")),
+ )
+ )
}
@Test
@@ -9346,7 +9867,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo _
*/
- parsed.assertEquals(paragraph("foo *\\_*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ Emphasis("*", Text("_")),
+ )
+ )
}
@Test
@@ -9357,7 +9883,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *****
*/
- parsed.assertEquals(paragraph("foo \\*\\*\\*\\*\\*"))
+ parsed.assertEquals(paragraph("foo *****"))
}
@Test
@@ -9368,7 +9894,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *
*/
- parsed.assertEquals(paragraph("foo **\\***"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ StrongEmphasis("**", Text("*")),
+ )
+ )
}
@Test
@@ -9379,7 +9910,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo _
*/
- parsed.assertEquals(paragraph("foo **\\_**"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ StrongEmphasis("**", Text("_")),
+ )
+ )
}
@Test
@@ -9390,7 +9926,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo
*/
- parsed.assertEquals(paragraph("\\**foo*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*"),
+ Emphasis("*", Text("foo")),
+ )
+ )
}
@Test
@@ -9401,7 +9942,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo*
*/
- parsed.assertEquals(paragraph("*foo*\\*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis("*", Text("foo")),
+ Text("*"),
+ )
+ )
}
@Test
@@ -9412,7 +9958,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo
*/
- parsed.assertEquals(paragraph("\\***foo**"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*"),
+ StrongEmphasis("**", Text("foo")),
+ )
+ )
}
@Test
@@ -9423,7 +9974,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ***foo
*/
- parsed.assertEquals(paragraph("\\*\\*\\**foo*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("***"),
+ Emphasis("*", Text("foo")),
+ )
+ )
}
@Test
@@ -9434,8 +9990,13 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo*
*/
- parsed.assertEquals(paragraph("**foo**\\*"))
- }
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis("**", Text("foo")),
+ Text("*"),
+ )
+ )
+ }
@Test
fun `should parse spec sample 447 correctly {Emphasis and strong emphasis}`() {
@@ -9445,7 +10006,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo***
*/
- parsed.assertEquals(paragraph("*foo*\\*\\*\\*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis("*", Text("foo")),
+ Text("***"),
+ )
+ )
}
@Test
@@ -9456,7 +10022,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo ___
*/
- parsed.assertEquals(paragraph("foo \\_\\_\\_"))
+ parsed.assertEquals(paragraph("foo ___"))
}
@Test
@@ -9467,7 +10033,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo _
*/
- parsed.assertEquals(paragraph("foo _\\__"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ Emphasis("_", Text("_")),
+ )
+ )
}
@Test
@@ -9478,7 +10049,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *
*/
- parsed.assertEquals(paragraph("foo _\\*_"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ Emphasis("_", Text("*")),
+ )
+ )
}
@Test
@@ -9489,7 +10065,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo _____
*/
- parsed.assertEquals(paragraph("foo \\_\\_\\_\\_\\_"))
+ parsed.assertEquals(paragraph("foo _____"))
}
@Test
@@ -9500,7 +10076,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo _
*/
- parsed.assertEquals(paragraph("foo __\\___"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ StrongEmphasis("__", Text("_")),
+ )
+ )
}
@Test
@@ -9511,7 +10092,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *
*/
- parsed.assertEquals(paragraph("foo __\\*__"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("foo "),
+ StrongEmphasis("__", Text("*")),
+ )
+ )
}
@Test
@@ -9522,7 +10108,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _foo
*/
- parsed.assertEquals(paragraph("\\__foo_"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("_"),
+ Emphasis("_", Text("foo")),
+ )
+ )
}
@Test
@@ -9533,7 +10124,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo_
*/
- parsed.assertEquals(paragraph("_foo_\\_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis("_", Text("foo")),
+ Text("_"),
+ )
+ )
}
@Test
@@ -9544,7 +10140,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _foo
*/
- parsed.assertEquals(paragraph("\\___foo__"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("_"),
+ StrongEmphasis("__", Text("foo")),
+ )
+ )
}
@Test
@@ -9555,7 +10156,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ___foo
*/
- parsed.assertEquals(paragraph("\\_\\_\\__foo_"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("___"),
+ Emphasis("_", Text("foo")),
+ )
+ )
}
@Test
@@ -9566,7 +10172,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo_
*/
- parsed.assertEquals(paragraph("__foo__\\_"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis("__", Text("foo")),
+ Text("_"),
+ )
+ )
}
@Test
@@ -9577,7 +10188,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo___
*/
- parsed.assertEquals(paragraph("_foo_\\_\\_\\_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis("_", Text("foo")),
+ Text("___"),
+ )
+ )
}
@Test
@@ -9588,7 +10204,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("**foo**"))
+ parsed.assertEquals(Paragraph(StrongEmphasis("**", Text("foo"))))
}
@Test
@@ -9599,7 +10215,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("*_foo_*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Emphasis("_", Text("foo"))
+ ),
+ )
+ )
}
@Test
@@ -9610,18 +10233,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("__foo__"))
- }
-
- @Test
- fun `should parse spec sample 463 correctly {Emphasis and strong emphasis}`() {
- val parsed = processor.processMarkdownDocument("_*foo*_")
-
- /*
- * Expected HTML:
- * foo
- */
- parsed.assertEquals(paragraph("_*foo*_"))
+ parsed.assertEquals(Paragraph(StrongEmphasis("__", Text("foo"))))
}
@Test
@@ -9632,7 +10244,18 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("_*foo _bar_*_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Emphasis(
+ "*",
+ Text("foo "),
+ Emphasis("_", Text("bar"))
+ )
+ )
+ )
+ )
}
@Test
@@ -9643,7 +10266,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("__foo _bar___"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ Text("foo "),
+ Emphasis("_", Text("bar")),
+ ),
+ )
+ )
}
@Test
@@ -9654,7 +10285,19 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar a
*/
- parsed.assertEquals(paragraph("_*foo _bar_ a*_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Emphasis(
+ "*",
+ Text("foo "),
+ Emphasis("_", Text("bar")),
+ Text(" a"),
+ )
+ ),
+ )
+ )
}
@Test
@@ -9665,7 +10308,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar a
*/
- parsed.assertEquals(paragraph("__foo _bar_ a__"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ Text("foo "),
+ Emphasis("_", Text("bar")),
+ Text(" a"),
+ )
+ )
+ )
}
@Test
@@ -9676,7 +10328,37 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar a
*/
- parsed.assertEquals(paragraph("_*foo *bar* a*_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Emphasis(
+ "*",
+ Text("foo "),
+ Emphasis("*", Text("bar")),
+ Text(" a"),
+ )
+ ),
+ )
+ )
+ }
+
+ @Test
+ fun `should parse spec sample 463 correctly {Emphasis and strong emphasis}`() {
+ val parsed = processor.processMarkdownDocument("_*foo*_")
+
+ /*
+ * Expected HTML:
+ * foo
+ */
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Emphasis("*", Text("foo"))
+ )
+ )
+ )
}
@Test
@@ -9687,7 +10369,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("****foo****"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ StrongEmphasis("**", Text("foo")),
+ ),
+ )
+ )
}
@Test
@@ -9698,7 +10387,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("____foo____"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "__",
+ StrongEmphasis("__", Text("foo")),
+ ),
+ )
+ )
}
@Test
@@ -9709,7 +10405,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("******foo******"))
+ parsed.assertEquals(
+ Paragraph(
+ StrongEmphasis(
+ "**",
+ StrongEmphasis("**", StrongEmphasis("**", Text("foo"))),
+ ),
+ )
+ )
}
@Test
@@ -9720,7 +10423,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("***foo***"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ StrongEmphasis("**", Text("foo")),
+ ),
+ )
+ )
}
@Test
@@ -9731,7 +10441,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("_____foo_____"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ StrongEmphasis("__", StrongEmphasis("__", Text("foo"))),
+ ),
+ )
+ )
}
@Test
@@ -9742,7 +10459,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo _bar baz_
*/
- parsed.assertEquals(paragraph("*foo \\_bar* baz\\_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis("*", Text("foo _bar")),
+ Text(" baz_"),
+ )
+ )
}
@Test
@@ -9753,7 +10475,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar *baz bim bam
*/
- parsed.assertEquals(paragraph("*foo __bar \\*baz bim__ bam*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo "),
+ StrongEmphasis("__", Text("bar *baz bim")),
+ Text(" bam"),
+ ),
+ )
+ )
}
@Test
@@ -9764,7 +10495,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* **foo bar baz
*/
- parsed.assertEquals(paragraph("\\*\\*foo **bar baz**"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("**foo "),
+ StrongEmphasis("**", Text("bar baz")),
+ )
+ )
}
@Test
@@ -9775,7 +10511,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo bar baz
*/
- parsed.assertEquals(paragraph("\\*foo *bar baz*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*foo "),
+ Emphasis("*", Text("bar baz")),
+ )
+ )
}
@Test
@@ -9786,7 +10527,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *bar*
*/
- parsed.assertEquals(paragraph("\\*[bar\\*](/url)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*"),
+ Link(destination = "/url", title = null, Text("bar*"))
+ )
+ )
}
@Test
@@ -9797,7 +10543,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* _foo bar_
*/
- parsed.assertEquals(paragraph("\\_foo [bar\\_](/url)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("_foo "),
+ Link(destination = "/url", title = null, Text("bar_"))
+ )
+ )
}
@Test
@@ -9808,7 +10559,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *
*/
- parsed.assertEquals(paragraph("\\*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*"),
+ HtmlInline("")
+ )
+ )
}
@Test
@@ -9819,7 +10575,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* **
*/
- parsed.assertEquals(paragraph("\\*\\*"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("**"),
+ HtmlInline("")
+ )
+ )
}
@Test
@@ -9830,7 +10591,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __
*/
- parsed.assertEquals(paragraph("\\_\\_"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("__"),
+ HtmlInline("")
+ )
+ )
}
@Test
@@ -9841,7 +10607,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a *
*/
- parsed.assertEquals(paragraph("*a `*`*"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("a "),
+ Code("*"),
+ ),
+ )
+ )
}
@Test
@@ -9852,7 +10626,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a _
*/
- parsed.assertEquals(paragraph("_a `_`_"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "_",
+ Text("a "),
+ Code("_"),
+ ),
+ )
+ )
}
@Test
@@ -9863,7 +10645,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* **ahttps://foo.bar/?q=**
*/
- parsed.assertEquals(paragraph("\\*\\*a[https://foo.bar/?q=\\*\\*](https://foo.bar/?q=**)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("**a"),
+ Link(destination = "https://foo.bar/?q=**", title = null, Text("https://foo.bar/?q=**"))
+ )
+ )
}
@Test
@@ -9874,7 +10661,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* __ahttps://foo.bar/?q=__
*/
- parsed.assertEquals(paragraph("\\_\\_a[https://foo.bar/?q=\\_\\_](https://foo.bar/?q=__)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("__a"),
+ Link(destination = "https://foo.bar/?q=__", title = null, Text("https://foo.bar/?q=__"))
+ )
+ )
}
@Test
@@ -9885,7 +10677,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](/uri \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = "title", Text("link"))))
}
@Test
@@ -9896,7 +10688,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("link"))))
}
@Test
@@ -9907,7 +10699,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
*/
- parsed.assertEquals(paragraph("[](./target.md)"))
+ parsed.assertEquals(Paragraph(Link(destination = "./target.md", title = null)))
}
@Test
@@ -9918,7 +10710,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link]()"))
+ parsed.assertEquals(Paragraph(Link(destination = "", title = null, Text("link"))))
}
@Test
@@ -9929,7 +10721,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link]()"))
+ parsed.assertEquals(Paragraph(Link(destination = "", title = null, Text("link"))))
}
@Test
@@ -9940,7 +10732,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
*/
- parsed.assertEquals(paragraph("[]()"))
+ parsed.assertEquals(Paragraph(Link(destination = "", title = null)))
}
@Test
@@ -9951,7 +10743,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link](/my uri)
*/
- parsed.assertEquals(paragraph("\\[link\\]\\(/my uri\\)"))
+ parsed.assertEquals(Paragraph(Text("[link](/my uri)")))
}
@Test
@@ -9962,7 +10754,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link]()"))
+ parsed.assertEquals(Paragraph(Link(destination = "/my uri", title = null, Text("link"))))
}
@Test
@@ -9970,9 +10762,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link](foo
- |bar)
- """
+ |[link](foo
+ |bar)
+ """
.trimMargin(),
)
@@ -9981,7 +10773,7 @@ class MarkdownProcessorDocumentParsingTest {
* [link](foo
* bar)
*/
- parsed.assertEquals(paragraph("\\[link\\]\\(foo bar\\)"))
+ parsed.assertEquals(Paragraph(Text("[link](foo"), SoftLineBreak, Text("bar)")))
}
@Test
@@ -9989,9 +10781,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link]()
- """
+ |[link]()
+ """
.trimMargin(),
)
@@ -10000,7 +10792,7 @@ class MarkdownProcessorDocumentParsingTest {
* [link]()
*/
- parsed.assertEquals(paragraph("\\[link\\]\\(\\)"))
+ parsed.assertEquals(Paragraph(Text("[link]("), HtmlInline(""), Text(")")))
}
@Test
@@ -10011,7 +10803,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* a
*/
- parsed.assertEquals(paragraph("[a](b\\)c)"))
+ parsed.assertEquals(Paragraph(Link(destination = "b)c", title = null, Text("a"))))
}
@Test
@@ -10022,7 +10814,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link](<foo>)
*/
- parsed.assertEquals(paragraph("\\[link\\]\\(\\\\)"))
+ parsed.assertEquals(paragraph("[link]()"))
}
@Test
@@ -10030,10 +10822,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[a](
- |[a](c)
- """
+ |[a](
+ |[a](c)
+ """
.trimMargin(),
)
@@ -10044,9 +10836,15 @@ class MarkdownProcessorDocumentParsingTest {
* [a](c)
*/
parsed.assertEquals(
- paragraph(
- "\\[a\\]\\(\\ \\[a\\]\\(c\\)",
- ),
+ Paragraph(
+ Text(content = "[a]("),
+ SoftLineBreak,
+ Text(content = "[a]("),
+ HtmlInline(content = ""),
+ Text(content = "c)")
+ )
)
}
@@ -10058,7 +10856,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](\\(foo\\))"))
+ parsed.assertEquals(Paragraph(Link(destination = "(foo)", title = null, Text("link"))))
}
@Test
@@ -10069,7 +10867,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](foo\\(and\\(bar\\)\\))"))
+ parsed.assertEquals(Paragraph(Link(destination = "foo(and(bar))", title = null, Text("link"))))
}
@Test
@@ -10080,7 +10878,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link](foo(and(bar))
*/
- parsed.assertEquals(paragraph("\\[link\\]\\(foo\\(and\\(bar\\)\\)"))
+ parsed.assertEquals(paragraph("[link](foo(and(bar))"))
}
@Test
@@ -10091,7 +10889,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](foo\\(and\\(bar\\))"))
+ parsed.assertEquals(Paragraph(Link(destination = "foo(and(bar)", title = null, Text("link"))))
}
@Test
@@ -10102,7 +10900,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](foo\\(and\\(bar\\))"))
+ parsed.assertEquals(Paragraph(Link(destination = "foo(and(bar)", title = null, Text("link"))))
}
@Test
@@ -10113,7 +10911,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](foo\\):)"))
+ parsed.assertEquals(Paragraph(Link(destination = "foo):", title = null, Text("link"))))
}
@Test
@@ -10121,12 +10919,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link](#fragment)
- |
- |[link](https://example.com#fragment)
- |
- |[link](https://example.com?foo=3#frag)
- """
+ |[link](#fragment)
+ |
+ |[link](https://example.com#fragment)
+ |
+ |[link](https://example.com?foo=3#frag)
+ """
.trimMargin(),
)
@@ -10137,9 +10935,9 @@ class MarkdownProcessorDocumentParsingTest {
* link
*/
parsed.assertEquals(
- paragraph("[link](#fragment)"),
- paragraph("[link](https://example.com#fragment)"),
- paragraph("[link](https://example.com?foo=3#frag)"),
+ Paragraph(Link(destination = "#fragment", title = null, Text("link"))),
+ Paragraph(Link(destination = "https://example.com#fragment", title = null, Text("link"))),
+ Paragraph(Link(destination = "https://example.com?foo=3#frag", title = null, Text("link"))),
)
}
@@ -10151,7 +10949,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](foo\\bar)"))
+ parsed.assertEquals(Paragraph(Link(destination = "foo\\bar", title = null, Text("link"))))
}
@Test
@@ -10162,7 +10960,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](foo%20bä)"))
+ parsed.assertEquals(Paragraph(Link(destination = "foo%20bä", title = null, Text("link"))))
}
@Test
@@ -10173,7 +10971,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](\"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "\"title\"", title = null, Text("link"))))
}
@Test
@@ -10181,10 +10979,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link](/url "title")
- |[link](/url 'title')
- |[link](/url (title))
- """
+ |[link](/url "title")
+ |[link](/url 'title')
+ |[link](/url (title))
+ """
.trimMargin(),
)
@@ -10195,7 +10993,13 @@ class MarkdownProcessorDocumentParsingTest {
* link
*/
parsed.assertEquals(
- paragraph("[link](/url \"title\") [link](/url \"title\") [link](/url \"title\")"),
+ Paragraph(
+ Link(destination = "/url", title = "title", Text("link")),
+ SoftLineBreak,
+ Link(destination = "/url", title = "title", Text("link")),
+ SoftLineBreak,
+ Link(destination = "/url", title = "title", Text("link")),
+ ),
)
}
@@ -10207,7 +11011,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](/url \"title \\\"\\\"\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "title \"\"", Text("link"))))
}
@Test
@@ -10218,7 +11022,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link]()"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url \"title\"", title = null, Text("link"))))
}
@Test
@@ -10229,7 +11033,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link](/url "title "and" title")
*/
- parsed.assertEquals(paragraph("\\[link\\]\\(/url \"title \"and\" title\"\\)"))
+ parsed.assertEquals(paragraph("[link](/url \"title \"and\" title\")"))
}
@Test
@@ -10240,7 +11044,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](/url \"title \\\"and\\\" title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "title \"and\" title", Text("link"))))
}
@Test
@@ -10248,9 +11052,9 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link]( /uri
- | "title" )
- """
+ |[link]( /uri
+ | "title" )
+ """
.trimMargin(),
)
@@ -10258,7 +11062,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link
*/
- parsed.assertEquals(paragraph("[link](/uri \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = "title", Text("link"))))
}
@Test
@@ -10269,7 +11073,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link] (/uri)
*/
- parsed.assertEquals(paragraph("\\[link\\] \\(/uri\\)"))
+ parsed.assertEquals(paragraph("[link] (/uri)"))
}
@Test
@@ -10280,7 +11084,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link [foo [bar]]
*/
- parsed.assertEquals(paragraph("[link \\[foo \\[bar\\]\\]](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("link [foo [bar]]"))))
}
@Test
@@ -10291,7 +11095,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link] bar](/uri)
*/
- parsed.assertEquals(paragraph("\\[link\\] bar\\]\\(/uri\\)"))
+ parsed.assertEquals(paragraph("[link] bar](/uri)"))
}
@Test
@@ -10302,7 +11106,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [link bar
*/
- parsed.assertEquals(paragraph("\\[link [bar](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[link "),
+ Link(destination = "/uri", title = null, Text("bar")),
+ )
+ )
}
@Test
@@ -10313,7 +11122,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link [bar
*/
- parsed.assertEquals(paragraph("[link \\[bar](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("link [bar"))))
}
@Test
@@ -10324,7 +11133,22 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link foo bar #
*/
- parsed.assertEquals(paragraph("[link *foo **bar** `#`*](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(
+ destination = "/uri",
+ title = null,
+ Text("link "),
+ Emphasis(
+ "*",
+ Text("foo "),
+ StrongEmphasis("**", Text("bar")),
+ Text(" "),
+ Code("#"),
+ ),
+ )
+ )
+ )
}
@Test
@@ -10335,7 +11159,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
*/
- parsed.assertEquals(paragraph("[![moon](moon.jpg)](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(
+ destination = "/uri",
+ title = null,
+ Image(source = "moon.jpg", alt = "moon", title = null, Text("moon"))
+ )
+ )
+ )
}
@Test
@@ -10346,7 +11178,13 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo bar](/uri)
*/
- parsed.assertEquals(paragraph("\\[foo [bar](/uri)\\]\\(/uri\\)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo "),
+ Link(destination = "/uri", title = null, Text("bar")),
+ Text("](/uri)"),
+ )
+ )
}
@Test
@@ -10357,10 +11195,20 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo [bar baz](/uri)](/uri)
*/
- parsed.assertEquals(paragraph("\\[foo *\\[bar [baz](/uri)\\]\\(/uri\\)*\\]\\(/uri\\)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo "),
+ Emphasis(
+ "*",
+ Text("[bar "),
+ Link(destination = "/uri", title = null, Text("baz")),
+ Text("](/uri)"),
+ ),
+ Text("](/uri)"),
+ )
+ )
}
- @Ignore
@Test
fun `should parse spec sample 520 correctly {Links}`() {
val parsed = processor.processMarkdownDocument("![[[foo](uri1)](uri2)](uri3)")
@@ -10369,7 +11217,18 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
*/
- parsed.assertEquals(paragraph("![\\[\"foo\" (uri1)\\]\\(uri2\\)](uri3)"))
+ parsed.assertEquals(
+ Paragraph(
+ Image(
+ source = "uri3",
+ alt = "[foo](uri2)",
+ title = null,
+ Text("["),
+ Link(destination = "uri1", title = null, Text("foo")),
+ Text("](uri2)"),
+ )
+ )
+ )
}
@Test
@@ -10380,7 +11239,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo*
*/
- parsed.assertEquals(paragraph("\\*[foo\\*](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*"),
+ Link(destination = "/uri", title = null, Text("foo*"))
+ )
+ )
}
@Test
@@ -10391,7 +11255,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *bar
*/
- parsed.assertEquals(paragraph("[foo \\*bar](baz*)"))
+ parsed.assertEquals(Paragraph(Link(destination = "baz*", title = null, Text("foo *bar"))))
}
@Test
@@ -10402,7 +11266,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo [bar baz]
*/
- parsed.assertEquals(paragraph("*foo \\[bar* baz\\]"))
+ parsed.assertEquals(
+ Paragraph(
+ Emphasis(
+ "*",
+ Text("foo [bar"),
+ ),
+ Text(" baz]"),
+ )
+ )
}
@Test
@@ -10413,7 +11285,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo
*/
- parsed.assertEquals(paragraph("\\[foo "))
+ parsed.assertEquals(Paragraph(Text("[foo "), HtmlInline("")))
}
@Test
@@ -10424,7 +11296,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo](/uri)
*/
- parsed.assertEquals(paragraph("\\[foo`](/uri)`"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo"),
+ Code("](/uri)"),
+ )
+ )
}
@Test
@@ -10436,9 +11313,14 @@ class MarkdownProcessorDocumentParsingTest {
* [foohttps://example.com/?search=](uri)
*/
parsed.assertEquals(
- paragraph(
- "\\[foo[https://example.com/?search=\\]\\(uri\\)](https://example.com/?search=]\\(uri\\))",
- ),
+ Paragraph(
+ Text("[foo"),
+ Link(
+ destination = "https://example.com/?search=](uri)",
+ title = null,
+ Text("https://example.com/?search=](uri)")
+ )
+ )
)
}
@@ -10447,10 +11329,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo][bar]
- |
- |[bar]: /url "title"
- """
+ |[foo][bar]
+ |
+ |[bar]: /url "title"
+ """
.trimMargin(),
)
@@ -10458,7 +11340,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/url \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "title", Text("foo"))))
}
@Test
@@ -10466,10 +11348,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link [foo [bar]]][ref]
- |
- |[ref]: /uri
- """
+ |[link [foo [bar]]][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10477,7 +11359,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link [foo [bar]]
*/
- parsed.assertEquals(paragraph("[link \\[foo \\[bar\\]\\]](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("link [foo [bar]]"))))
}
@Test
@@ -10485,10 +11367,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link \[bar][ref]
- |
- |[ref]: /uri
- """
+ |[link \[bar][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10496,7 +11378,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link [bar
*/
- parsed.assertEquals(paragraph("[link \\[bar](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("link [bar"))))
}
@Test
@@ -10504,10 +11386,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[link *foo **bar** `#`*][ref]
- |
- |[ref]: /uri
- """
+ |[link *foo **bar** `#`*][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10515,7 +11397,22 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* link foo bar #
*/
- parsed.assertEquals(paragraph("[link *foo **bar** `#`*](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(
+ destination = "/uri",
+ title = null,
+ Text("link "),
+ Emphasis(
+ "*",
+ Text("foo "),
+ StrongEmphasis("**", Text("bar")),
+ Text(" "),
+ Code("#"),
+ )
+ )
+ )
+ )
}
@Test
@@ -10523,10 +11420,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[![moon](moon.jpg)][ref]
- |
- |[ref]: /uri
- """
+ |[![moon](moon.jpg)][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10534,7 +11431,15 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
*
*/
- parsed.assertEquals(paragraph("[![moon](moon.jpg)](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(
+ destination = "/uri",
+ title = null,
+ Image(source = "moon.jpg", alt = "moon", title = null, Text("moon"))
+ )
+ )
+ )
}
@Test
@@ -10542,10 +11447,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo [bar](/uri)][ref]
- |
- |[ref]: /uri
- """
+ |[foo [bar](/uri)][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10553,7 +11458,14 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo bar]ref
*/
- parsed.assertEquals(paragraph("\\[foo [bar](/uri)\\][ref](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo "),
+ Link(destination = "/uri", title = null, Text("bar")),
+ Text("]"),
+ Link(destination = "/uri", title = null, Text("ref")),
+ )
+ )
}
@Test
@@ -10561,10 +11473,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo *bar [baz][ref]*][ref]
- |
- |[ref]: /uri
- """
+ |[foo *bar [baz][ref]*][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10572,7 +11484,18 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo bar baz]ref
*/
- parsed.assertEquals(paragraph("\\[foo *bar [baz](/uri)*\\][ref](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo "),
+ Emphasis(
+ "*",
+ Text("bar "),
+ Link("/uri", null, Text("baz"))
+ ),
+ Text("]"),
+ Link(destination = "/uri", title = null, Text("ref")),
+ )
+ )
}
@Test
@@ -10580,10 +11503,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |*[foo*][ref]
- |
- |[ref]: /uri
- """
+ |*[foo*][ref]
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10591,7 +11514,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* *foo*
*/
- parsed.assertEquals(paragraph("\\*[foo\\*](/uri)"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("*"),
+ Link(destination = "/uri", title = null, Text("foo*")),
+ )
+ )
}
@Test
@@ -10599,10 +11527,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo *bar][ref]*
- |
- |[ref]: /uri
- """
+ |[foo *bar][ref]*
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10610,7 +11538,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo *bar*
*/
- parsed.assertEquals(paragraph("[foo \\*bar](/uri)\\*"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(destination = "/uri", title = null, Text("foo *bar")),
+ Text("*"),
+ )
+ )
}
@Test
@@ -10618,10 +11551,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo
- |
- |[ref]: /uri
- """
+ |[foo
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10629,7 +11562,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo
*/
- parsed.assertEquals(paragraph("\\[foo "))
+ parsed.assertEquals(Paragraph(Text(content = "[foo "), HtmlInline("")))
}
@Test
@@ -10637,10 +11570,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo`][ref]`
- |
- |[ref]: /uri
- """
+ |[foo`][ref]`
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10648,7 +11581,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo][ref]
*/
- parsed.assertEquals(paragraph("\\[foo`][ref]`"))
+ parsed.assertEquals(Paragraph(Text(content = "[foo"), Code("][ref]")))
}
@Test
@@ -10656,10 +11589,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo
- |
- |[ref]: /uri
- """
+ |[foo
+ |
+ |[ref]: /uri
+ """
.trimMargin(),
)
@@ -10668,9 +11601,14 @@ class MarkdownProcessorDocumentParsingTest {
* [foohttps://example.com/?search=][ref]
*/
parsed.assertEquals(
- paragraph(
- "\\[foo[https://example.com/?search=\\]\\[ref\\]](https://example.com/?search=][ref])",
- ),
+ Paragraph(
+ Text(content = "[foo"),
+ Link(
+ destination = "https://example.com/?search=][ref]",
+ title = null,
+ Text("https://example.com/?search=][ref]")
+ )
+ )
)
}
@@ -10679,10 +11617,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo][BaR]
- |
- |[bar]: /url "title"
- """
+ |[foo][BaR]
+ |
+ |[bar]: /url "title"
+ """
.trimMargin(),
)
@@ -10690,7 +11628,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/url \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "title", Text("foo"))))
}
@Test
@@ -10698,10 +11636,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[ẞ]
- |
- |[SS]: /url
- """
+ |[ẞ]
+ |
+ |[SS]: /url
+ """
.trimMargin(),
)
@@ -10709,7 +11647,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* ẞ
*/
- parsed.assertEquals(paragraph("[ẞ](/url)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = null, Text("ẞ"))))
}
@Test
@@ -10717,11 +11655,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[Foo
- | bar]: /url
- |
- |[Baz][Foo bar]
- """
+ |[Foo
+ | bar]: /url
+ |
+ |[Baz][Foo bar]
+ """
.trimMargin(),
)
@@ -10729,7 +11667,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Baz
*/
- parsed.assertEquals(paragraph("[Baz](/url)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = null, Text("Baz"))))
}
@Test
@@ -10737,10 +11675,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo] [bar]
- |
- |[bar]: /url "title"
- """
+ |[foo] [bar]
+ |
+ |[bar]: /url "title"
+ """
.trimMargin(),
)
@@ -10748,7 +11686,12 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [foo] bar
*/
- parsed.assertEquals(paragraph("\\[foo\\] [bar](/url \"title\")"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo] "),
+ Link(destination = "/url", title = "title", Text("bar"))
+ )
+ )
}
@Test
@@ -10756,11 +11699,11 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]
- |[bar]
- |
- |[bar]: /url "title"
- """
+ |[foo]
+ |[bar]
+ |
+ |[bar]: /url "title"
+ """
.trimMargin(),
)
@@ -10769,7 +11712,13 @@ class MarkdownProcessorDocumentParsingTest {
* [foo]
* bar
*/
- parsed.assertEquals(paragraph("\\[foo\\] [bar](/url \"title\")"))
+ parsed.assertEquals(
+ Paragraph(
+ Text("[foo]"),
+ SoftLineBreak,
+ Link(destination = "/url", title = "title", Text("bar"))
+ )
+ )
}
@Test
@@ -10777,12 +11726,12 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo]: /url1
- |
- |[foo]: /url2
- |
- |[bar][foo]
- """
+ |[foo]: /url1
+ |
+ |[foo]: /url2
+ |
+ |[bar][foo]
+ """
.trimMargin(),
)
@@ -10790,7 +11739,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* bar
*/
- parsed.assertEquals(paragraph("[bar](/url1)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url1", title = null, Text("bar"))))
}
@Test
@@ -10798,10 +11747,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[bar][foo\!]
- |
- |[foo!]: /url
- """
+ |[bar][foo\!]
+ |
+ |[foo!]: /url
+ """
.trimMargin(),
)
@@ -10809,7 +11758,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* [bar][foo!]
*/
- parsed.assertEquals(paragraph("\\[bar\\]\\[foo\\!\\]"))
+ parsed.assertEquals(paragraph("[bar][foo!]"))
}
@Test
@@ -10817,10 +11766,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo][ref[]
- |
- |[ref[]: /uri
- """
+ |[foo][ref[]
+ |
+ |[ref[]: /uri
+ """
.trimMargin(),
)
@@ -10830,8 +11779,8 @@ class MarkdownProcessorDocumentParsingTest {
* [ref[]: /uri
*/
parsed.assertEquals(
- paragraph("\\[foo\\]\\[ref\\[\\]"),
- paragraph("\\[ref\\[\\]: /uri"),
+ paragraph("[foo][ref[]"),
+ paragraph("[ref[]: /uri"),
)
}
@@ -10840,10 +11789,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo][ref[bar]]
- |
- |[ref[bar]]: /uri
- """
+ |[foo][ref[bar]]
+ |
+ |[ref[bar]]: /uri
+ """
.trimMargin(),
)
@@ -10853,8 +11802,8 @@ class MarkdownProcessorDocumentParsingTest {
* [ref[bar]]: /uri
*/
parsed.assertEquals(
- paragraph("\\[foo\\]\\[ref\\[bar\\]\\]"),
- paragraph("\\[ref\\[bar\\]\\]: /uri"),
+ paragraph("[foo][ref[bar]]"),
+ paragraph("[ref[bar]]: /uri"),
)
}
@@ -10863,10 +11812,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[[[foo]]]
- |
- |[[[foo]]]: /url
- """
+ |[[[foo]]]
+ |
+ |[[[foo]]]: /url
+ """
.trimMargin(),
)
@@ -10876,8 +11825,8 @@ class MarkdownProcessorDocumentParsingTest {
* [[[foo]]]: /url
*/
parsed.assertEquals(
- paragraph("\\[\\[\\[foo\\]\\]\\]"),
- paragraph("\\[\\[\\[foo\\]\\]\\]: /url"),
+ paragraph("[[[foo]]]"),
+ paragraph("[[[foo]]]: /url"),
)
}
@@ -10886,10 +11835,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo][ref\[]
- |
- |[ref\[]: /uri
- """
+ |[foo][ref\[]
+ |
+ |[ref\[]: /uri
+ """
.trimMargin(),
)
@@ -10897,7 +11846,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("foo"))))
}
@Test
@@ -10905,10 +11854,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[bar\\]: /uri
- |
- |[bar\\]
- """
+ |[bar\\]: /uri
+ |
+ |[bar\\]
+ """
.trimMargin(),
)
@@ -10916,7 +11865,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* bar\
*/
- parsed.assertEquals(paragraph("[bar\\\\](/uri)"))
+ parsed.assertEquals(Paragraph(Link(destination = "/uri", title = null, Text("bar\\"))))
}
@Test
@@ -10924,10 +11873,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[]
- |
- |[]: /uri
- """
+ |[]
+ |
+ |[]: /uri
+ """
.trimMargin(),
)
@@ -10937,8 +11886,8 @@ class MarkdownProcessorDocumentParsingTest {
* []: /uri
*/
parsed.assertEquals(
- paragraph("\\[\\]"),
- paragraph("\\[\\]: /uri"),
+ paragraph("[]"),
+ paragraph("[]: /uri"),
)
}
@@ -10964,8 +11913,8 @@ class MarkdownProcessorDocumentParsingTest {
* ]: /uri
*/
parsed.assertEquals(
- paragraph("\\[ \\]"),
- paragraph("\\[ \\]: /uri"),
+ Paragraph(Text("["), SoftLineBreak, Text("]")),
+ Paragraph(Text("["), SoftLineBreak, Text("]: /uri")),
)
}
@@ -10974,10 +11923,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[foo][]
- |
- |[foo]: /url "title"
- """
+ |[foo][]
+ |
+ |[foo]: /url "title"
+ """
.trimMargin(),
)
@@ -10985,7 +11934,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(paragraph("[foo](/url \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination = "/url", title = "title", Text("foo"))))
}
@Test
@@ -10993,10 +11942,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[*foo* bar][]
- |
- |[*foo* bar]: /url "title"
- """
+ |[*foo* bar][]
+ |
+ |[*foo* bar]: /url "title"
+ """
.trimMargin(),
)
@@ -11004,7 +11953,16 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo bar
*/
- parsed.assertEquals(paragraph("[*foo* bar](/url \"title\")"))
+ parsed.assertEquals(
+ Paragraph(
+ Link(
+ destination = "/url",
+ title = "title",
+ Emphasis("*", Text("foo")),
+ Text(" bar"),
+ )
+ )
+ )
}
@Test
@@ -11012,10 +11970,10 @@ class MarkdownProcessorDocumentParsingTest {
val parsed =
processor.processMarkdownDocument(
"""
- |[Foo][]
- |
- |[foo]: /url "title"
- """
+ |[Foo][]
+ |
+ |[foo]: /url "title"
+ """
.trimMargin(),
)
@@ -11023,7 +11981,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* Foo
*/
- parsed.assertEquals(paragraph("[Foo](/url \"title\")"))
+ parsed.assertEquals(Paragraph(Link(destination="/url", title="title", Text("Foo"))))
}
@Test
@@ -12434,7 +13392,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo\
*/
- parsed.assertEquals(heading(level = 3, "foo\\"))
+ parsed.assertEquals(heading(level = 3, Text("foo\\")))
}
@Test
@@ -12445,7 +13403,7 @@ class MarkdownProcessorDocumentParsingTest {
* Expected HTML:
* foo
*/
- parsed.assertEquals(heading(level = 3, "foo"))
+ parsed.assertEquals(heading(level = 3, Text("foo")))
}
@Test
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 2718fa4c6..5f1939448 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
@@ -1,15 +1,5 @@
package org.jetbrains.jewel.markdown
-import org.commonmark.internal.InlineParserContextImpl
-import org.commonmark.internal.InlineParserImpl
-import org.commonmark.internal.LinkReferenceDefinitions
-import org.commonmark.node.Block
-import org.commonmark.node.Node
-import org.commonmark.parser.Parser
-import org.commonmark.parser.SourceLine
-import org.commonmark.parser.SourceLines
-import org.commonmark.renderer.html.HtmlRenderer
-import org.intellij.lang.annotations.Language
import org.jetbrains.jewel.markdown.MarkdownBlock.BlockQuote
import org.jetbrains.jewel.markdown.MarkdownBlock.CodeBlock
import org.jetbrains.jewel.markdown.MarkdownBlock.CodeBlock.FencedCodeBlock
@@ -23,8 +13,6 @@ import org.jetbrains.jewel.markdown.MarkdownBlock.ListItem
import org.jetbrains.jewel.markdown.MarkdownBlock.Paragraph
import org.jetbrains.jewel.markdown.MarkdownBlock.ThematicBreak
import org.junit.Assert
-import org.commonmark.node.Heading as CMHeading
-import org.commonmark.node.Paragraph as CMParagraph
fun List.assertEquals(vararg expected: MarkdownBlock) {
val differences = findDifferences(expected.toList(), indentSize = 0)
@@ -88,28 +76,16 @@ private fun MarkdownBlock.findDifferenceWith(
}
}
-private var htmlRenderer = HtmlRenderer.builder().build()
-
-fun BlockWithInlineMarkdown.toHtml() =
- buildString {
- for (node in this@toHtml.inlineContent) {
- // new lines are rendered as spaces in tests
- append(htmlRenderer.render(node.nativeNode).replace("\n", " "))
- }
- }
-
private fun diffParagraph(
actual: Paragraph,
expected: MarkdownBlock,
indent: String,
) = buildList {
- val actualInlineHtml = actual.toHtml()
- val expectedInlineHtml = (expected as Paragraph).toHtml()
- if (actualInlineHtml != expectedInlineHtml) {
+ if (actual != expected) {
add(
"$indent * Paragraph raw content mismatch.\n\n" +
- "$indent Actual: $actualInlineHtml\n" +
- "$indent Expected: $expectedInlineHtml\n",
+ "$indent Actual: $actual\n" +
+ "$indent Expected: $expected\n",
)
}
}
@@ -169,13 +145,11 @@ private fun diffHeading(
expected: MarkdownBlock,
indent: String,
) = buildList {
- val actualInlineHtml = actual.toHtml()
- val expectedInlineHtml = (expected as Heading).toHtml()
- if (actualInlineHtml != expectedInlineHtml) {
+ if (actual != expected) {
add(
"$indent * Heading raw content mismatch.\n\n" +
- "$indent Actual: $actualInlineHtml\n" +
- "$indent Expected: $expectedInlineHtml",
+ "$indent Actual: $actual\n" +
+ "$indent Expected: $expected",
)
}
}
@@ -227,52 +201,19 @@ private fun diffList(
}
}
-private val parser = Parser.builder().build()
-
-private fun Node.children() =
- buildList {
- var child = firstChild
- while (child != null) {
- add(child)
- child = child.next
- }
- }
-
-/** skip root Document and Paragraph nodes */
-private fun inlineMarkdowns(content: String): List {
- val document = parser.parse(content).firstChild ?: return emptyList()
- return if (document.firstChild is CMParagraph) {
- document.firstChild
- } else {
- document
- }.children().map { x -> x.toInlineNode() }
-}
-
-private val inlineParser = InlineParserImpl(InlineParserContextImpl(emptyList(), LinkReferenceDefinitions()))
-
-fun paragraph(
- @Language("Markdown") content: String,
-) =
- Paragraph(CMParagraph().parseInline(content))
+fun paragraph(content: String) = Paragraph(InlineMarkdown.Text(content))
fun heading(
level: Int,
- @Language("Markdown") content: String,
-) =
- Heading(inlineContent = CMHeading().parseInline(content), level = level)
-
-private fun Block.parseInline(content: String): List {
- inlineParser.parse(SourceLines.of(SourceLine.of(content, null)), this)
- return readInlineContent().toList()
-}
+ vararg inlineContent: InlineMarkdown,
+) = Heading(inlineContent = inlineContent, level = level)
fun indentedCodeBlock(content: String) = IndentedCodeBlock(content)
fun fencedCodeBlock(
content: String,
mimeType: MimeType? = null,
-) =
- FencedCodeBlock(content, mimeType)
+) = FencedCodeBlock(content, mimeType)
fun blockQuote(vararg contents: MarkdownBlock) = BlockQuote(contents.toList())
@@ -280,18 +221,16 @@ fun unorderedList(
vararg items: ListItem,
isTight: Boolean = true,
marker: String = "-",
-) =
- UnorderedList(items.toList(), isTight, marker)
+) = UnorderedList(items.toList(), isTight, marker)
fun orderedList(
vararg items: ListItem,
isTight: Boolean = true,
startFrom: Int = 1,
delimiter: String = ".",
-) =
- OrderedList(items.toList(), isTight, startFrom, delimiter)
+) = OrderedList(items.toList(), isTight, startFrom, delimiter)
-fun listItem(vararg items: MarkdownBlock) = ListItem(items.toList())
+fun listItem(vararg items: MarkdownBlock) = ListItem(*items)
fun htmlBlock(content: String) = HtmlBlock(content)
diff --git a/markdown/extension/autolink/api/autolink.api b/markdown/extension/autolink/api/autolink.api
index 70461da1d..56b2b87c6 100644
--- a/markdown/extension/autolink/api/autolink.api
+++ b/markdown/extension/autolink/api/autolink.api
@@ -1,8 +1,9 @@
public final class org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtension : org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension {
public static final field $stable I
public static final field INSTANCE Lorg/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtension;
+ public fun getBlockProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
+ public fun getInlineProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension;
public fun getParserExtension ()Lorg/commonmark/parser/Parser$ParserExtension;
- public fun getProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
public fun getTextRendererExtension ()Lorg/commonmark/renderer/text/TextContentRenderer$TextContentRendererExtension;
}
diff --git a/markdown/extension/autolink/src/main/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtension.kt b/markdown/extension/autolink/src/main/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtension.kt
index ad8161dea..8e57aefa9 100644
--- a/markdown/extension/autolink/src/main/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtension.kt
+++ b/markdown/extension/autolink/src/main/kotlin/org/jetbrains/jewel/markdown/extension/autolink/AutolinkProcessorExtension.kt
@@ -2,19 +2,9 @@ package org.jetbrains.jewel.markdown.extension.autolink
import org.commonmark.ext.autolink.AutolinkExtension
import org.commonmark.parser.Parser.ParserExtension
-import org.commonmark.renderer.text.TextContentRenderer
-import org.jetbrains.jewel.markdown.extensions.MarkdownBlockProcessorExtension
import org.jetbrains.jewel.markdown.extensions.MarkdownProcessorExtension
public object AutolinkProcessorExtension : MarkdownProcessorExtension {
- override val parserExtension: ParserExtension
- get() = AutolinkExtension.create() as ParserExtension
-
- /**
- * Rendering and processing is already handled by [org.jetbrains.jewel.markdown.rendering.DefaultInlineMarkdownRenderer]
- */
- override val textRendererExtension: TextContentRenderer.TextContentRendererExtension?
- get() = null
- override val processorExtension: MarkdownBlockProcessorExtension?
- get() = null
+ override val parserExtension: ParserExtension =
+ AutolinkExtension.create() as ParserExtension
}
diff --git a/markdown/extension/gfm-alerts/api/gfm-alerts.api b/markdown/extension/gfm-alerts/api/gfm-alerts.api
index 5b42b42b0..ccef99f5b 100644
--- a/markdown/extension/gfm-alerts/api/gfm-alerts.api
+++ b/markdown/extension/gfm-alerts/api/gfm-alerts.api
@@ -122,8 +122,9 @@ public final class org/jetbrains/jewel/markdown/extensions/github/alerts/GitHubA
public final class org/jetbrains/jewel/markdown/extensions/github/alerts/GitHubAlertProcessorExtension : org/jetbrains/jewel/markdown/extensions/MarkdownProcessorExtension {
public static final field $stable I
public static final field INSTANCE Lorg/jetbrains/jewel/markdown/extensions/github/alerts/GitHubAlertProcessorExtension;
+ public fun getBlockProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
+ public fun getInlineProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownInlineProcessorExtension;
public fun getParserExtension ()Lorg/commonmark/parser/Parser$ParserExtension;
- public fun getProcessorExtension ()Lorg/jetbrains/jewel/markdown/extensions/MarkdownBlockProcessorExtension;
public fun getTextRendererExtension ()Lorg/commonmark/renderer/text/TextContentRenderer$TextContentRendererExtension;
}
diff --git a/markdown/extension/gfm-alerts/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/github/alerts/GitHubAlertProcessorExtension.kt b/markdown/extension/gfm-alerts/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/github/alerts/GitHubAlertProcessorExtension.kt
index c366b7a6e..97acfd6b5 100644
--- a/markdown/extension/gfm-alerts/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/github/alerts/GitHubAlertProcessorExtension.kt
+++ b/markdown/extension/gfm-alerts/src/main/kotlin/org/jetbrains/jewel/markdown/extensions/github/alerts/GitHubAlertProcessorExtension.kt
@@ -33,7 +33,7 @@ public object GitHubAlertProcessorExtension : MarkdownProcessorExtension {
override val textRendererExtension: TextContentRendererExtension =
GitHubAlertCommonMarkExtension
- override val processorExtension: MarkdownBlockProcessorExtension = GitHubAlertProcessorExtension
+ override val blockProcessorExtension: MarkdownBlockProcessorExtension = GitHubAlertProcessorExtension
private object GitHubAlertProcessorExtension : MarkdownBlockProcessorExtension {
override fun canProcess(block: CustomBlock): Boolean = block is AlertBlock
diff --git a/markdown/ide-laf-bridge-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/bridge/styling/BridgeMarkdownStyling.kt b/markdown/ide-laf-bridge-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/bridge/styling/BridgeMarkdownStyling.kt
index bf4a01996..b1b99cf9d 100644
--- a/markdown/ide-laf-bridge-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/bridge/styling/BridgeMarkdownStyling.kt
+++ b/markdown/ide-laf-bridge-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/bridge/styling/BridgeMarkdownStyling.kt
@@ -387,7 +387,7 @@ public fun InlinesStyling.Companion.create(
emphasis: SpanStyle = textStyle.copy(fontStyle = FontStyle.Italic).toSpanStyle(),
strongEmphasis: SpanStyle = textStyle.copy(fontWeight = FontWeight.Bold).toSpanStyle(),
inlineHtml: SpanStyle = textStyle.toSpanStyle(),
- renderInlineHtml: Boolean = false,
+ renderInlineHtml: Boolean = true,
): InlinesStyling =
InlinesStyling(
textStyle = textStyle,
diff --git a/markdown/int-ui-standalone-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/standalone/styling/IntUiMarkdownStyling.kt b/markdown/int-ui-standalone-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/standalone/styling/IntUiMarkdownStyling.kt
index 60db3f9aa..366ad61f5 100644
--- a/markdown/int-ui-standalone-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/standalone/styling/IntUiMarkdownStyling.kt
+++ b/markdown/int-ui-standalone-styling/src/main/kotlin/org/jetbrains/jewel/intui/markdown/standalone/styling/IntUiMarkdownStyling.kt
@@ -662,7 +662,7 @@ public fun InlinesStyling.Companion.light(
emphasis: SpanStyle = textStyle.copy(fontStyle = FontStyle.Italic).toSpanStyle(),
strongEmphasis: SpanStyle = textStyle.copy(fontWeight = FontWeight.Bold).toSpanStyle(),
inlineHtml: SpanStyle = textStyle.toSpanStyle(),
- renderInlineHtml: Boolean = false,
+ renderInlineHtml: Boolean = true,
): InlinesStyling =
InlinesStyling(
textStyle = textStyle,
@@ -698,7 +698,7 @@ public fun InlinesStyling.Companion.dark(
emphasis: SpanStyle = textStyle.copy(fontStyle = FontStyle.Italic).toSpanStyle(),
strongEmphasis: SpanStyle = textStyle.copy(fontWeight = FontWeight.Bold).toSpanStyle(),
inlineHtml: SpanStyle = textStyle.toSpanStyle(),
- renderInlineHtml: Boolean = false,
+ renderInlineHtml: Boolean = true,
): InlinesStyling =
InlinesStyling(
textStyle = textStyle,