diff --git a/core/api/core.api b/core/api/core.api
index 96fe317a1e..46a4c3a561 100644
--- a/core/api/core.api
+++ b/core/api/core.api
@@ -3913,6 +3913,14 @@ public final class org/jetbrains/dokka/pages/HtmlContent : org/jetbrains/dokka/m
public abstract interface class org/jetbrains/dokka/pages/Kind {
}
+public final class org/jetbrains/dokka/pages/ListStyle : java/lang/Enum, org/jetbrains/dokka/pages/Style {
+ public static final field DescriptionDetails Lorg/jetbrains/dokka/pages/ListStyle;
+ public static final field DescriptionList Lorg/jetbrains/dokka/pages/ListStyle;
+ public static final field DescriptionTerm Lorg/jetbrains/dokka/pages/ListStyle;
+ public static fun valueOf (Ljava/lang/String;)Lorg/jetbrains/dokka/pages/ListStyle;
+ public static fun values ()[Lorg/jetbrains/dokka/pages/ListStyle;
+}
+
public abstract interface class org/jetbrains/dokka/pages/MemberPage : org/jetbrains/dokka/pages/ContentPage {
}
diff --git a/core/src/main/kotlin/pages/ContentNodes.kt b/core/src/main/kotlin/pages/ContentNodes.kt
index 0c262937d7..c1bb3b8cca 100644
--- a/core/src/main/kotlin/pages/ContentNodes.kt
+++ b/core/src/main/kotlin/pages/ContentNodes.kt
@@ -350,6 +350,28 @@ enum class ContentStyle : Style {
RowTitle, TabbedContent, WithExtraAttributes, RunnableSample, InDocumentationAnchor, Caption
}
+enum class ListStyle : Style {
+ /**
+ * Represents a list of groups of [DescriptionTerm] and [DescriptionDetails].
+ * Common uses for this element are to implement a glossary or to display
+ * metadata (a list of key-value pairs). Formatting example: see `
` html tag.
+ */
+ DescriptionList,
+
+ /**
+ * If used within [DescriptionList] context, specifies a term in a description
+ * or definition list, usually followed by [DescriptionDetails] for one or more
+ * terms. Formatting example: see `- ` html tag
+ */
+ DescriptionTerm,
+
+ /**
+ * If used within [DescriptionList] context, provides the definition or other
+ * related text associated with [DescriptionTerm]. Formatting example: see `
- ` html tag
+ */
+ DescriptionDetails
+}
+
object CommentTable : Style
object MultimoduleTable : Style
diff --git a/plugins/base/api/base.api b/plugins/base/api/base.api
index 5a7573eec8..9450476bd7 100644
--- a/plugins/base/api/base.api
+++ b/plugins/base/api/base.api
@@ -1398,6 +1398,8 @@ public class org/jetbrains/dokka/base/translators/documentables/PageContentBuild
public final fun cover (Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;Lkotlin/jvm/functions/Function1;)V
public static synthetic fun cover$default (Lorg/jetbrains/dokka/base/translators/documentables/PageContentBuilder$DocumentableContentBuilder;Ljava/lang/String;Ljava/util/Set;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
protected final fun createText (Ljava/lang/String;Lorg/jetbrains/dokka/pages/Kind;Ljava/util/Set;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;)Lorg/jetbrains/dokka/pages/ContentText;
+ public final fun descriptionList (Lorg/jetbrains/dokka/pages/Kind;Ljava/util/Set;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;Lkotlin/jvm/functions/Function1;)V
+ public static synthetic fun descriptionList$default (Lorg/jetbrains/dokka/base/translators/documentables/PageContentBuilder$DocumentableContentBuilder;Lorg/jetbrains/dokka/pages/Kind;Ljava/util/Set;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun divergentGroup (Lorg/jetbrains/dokka/pages/ContentDivergentGroup$GroupID;Ljava/util/Set;Lorg/jetbrains/dokka/pages/Kind;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;ZLkotlin/jvm/functions/Function1;)V
public static synthetic fun divergentGroup$default (Lorg/jetbrains/dokka/base/translators/documentables/PageContentBuilder$DocumentableContentBuilder;Lorg/jetbrains/dokka/pages/ContentDivergentGroup$GroupID;Ljava/util/Set;Lorg/jetbrains/dokka/pages/Kind;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;ZLkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
public final fun firstParagraphComment (Lorg/jetbrains/dokka/model/doc/DocTag;Lorg/jetbrains/dokka/pages/Kind;Ljava/util/Set;Ljava/util/Set;Lorg/jetbrains/dokka/model/properties/PropertyContainer;)V
diff --git a/plugins/base/base-test-utils/api/base-test-utils.api b/plugins/base/base-test-utils/api/base-test-utils.api
index c822d16bfd..d3db4866b6 100644
--- a/plugins/base/base-test-utils/api/base-test-utils.api
+++ b/plugins/base/base-test-utils/api/base-test-utils.api
@@ -108,10 +108,22 @@ public final class utils/Br : utils/Tag {
public static final field INSTANCE Lutils/Br;
}
+public final class utils/Dd : utils/Tag {
+ public fun ([Ljava/lang/Object;)V
+}
+
public final class utils/Div : utils/Tag {
public fun ([Ljava/lang/Object;)V
}
+public final class utils/Dl : utils/Tag {
+ public fun ([Ljava/lang/Object;)V
+}
+
+public final class utils/Dt : utils/Tag {
+ public fun ([Ljava/lang/Object;)V
+}
+
public final class utils/I : utils/Tag {
public fun ([Ljava/lang/Object;)V
}
diff --git a/plugins/base/base-test-utils/src/main/kotlin/renderers/JsoupUtils.kt b/plugins/base/base-test-utils/src/main/kotlin/renderers/JsoupUtils.kt
index 47c9608a7a..a4dadca4a5 100644
--- a/plugins/base/base-test-utils/src/main/kotlin/renderers/JsoupUtils.kt
+++ b/plugins/base/base-test-utils/src/main/kotlin/renderers/JsoupUtils.kt
@@ -29,6 +29,9 @@ class A(vararg matchers: Any) : Tag("a", *matchers)
class B(vararg matchers: Any) : Tag("b", *matchers)
class I(vararg matchers: Any) : Tag("i", *matchers)
class STRIKE(vararg matchers: Any) : Tag("strike", *matchers)
+class Dl(vararg matchers: Any) : Tag("dl", *matchers)
+class Dt(vararg matchers: Any) : Tag("dt", *matchers)
+class Dd(vararg matchers: Any) : Tag("dd", *matchers)
object Wbr : Tag("wbr")
object Br : Tag("br")
private fun Any.accepts(n: Node, ignoreSpan:Boolean = true) {
diff --git a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
index b61d513ad9..c3b157380f 100644
--- a/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
+++ b/plugins/base/src/main/kotlin/renderers/html/HtmlRenderer.kt
@@ -8,7 +8,6 @@ import org.jetbrains.dokka.base.DokkaBaseConfiguration
import org.jetbrains.dokka.base.DokkaBaseConfiguration.Companion.defaultFooterMessage
import org.jetbrains.dokka.base.renderers.*
import org.jetbrains.dokka.base.renderers.html.command.consumers.ImmediateResolutionTagConsumer
-import org.jetbrains.dokka.base.renderers.pageId
import org.jetbrains.dokka.base.resolvers.anchors.SymbolAnchorHint
import org.jetbrains.dokka.base.resolvers.local.DokkaBaseLocationProvider
import org.jetbrains.dokka.base.templating.*
@@ -112,6 +111,12 @@ open class HtmlRenderer(
) { childrenCallback() }
node.extra[InsertTemplateExtra] != null -> node.extra[InsertTemplateExtra]?.let { templateCommand(it.command) }
?: Unit
+ node.hasStyle(ListStyle.DescriptionTerm) -> DT(emptyMap(), consumer).visit {
+ this@wrapGroup.childrenCallback()
+ }
+ node.hasStyle(ListStyle.DescriptionDetails) -> DD(emptyMap(), consumer).visit {
+ this@wrapGroup.childrenCallback()
+ }
else -> childrenCallback()
}
}
@@ -295,8 +300,17 @@ open class HtmlRenderer(
node: ContentList,
pageContext: ContentPage,
sourceSetRestriction: Set?
- ) = if (node.ordered) ol { buildListItems(node.children, pageContext, sourceSetRestriction) }
- else ul { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ ) = when {
+ node.ordered -> {
+ ol { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ }
+ node.hasStyle(ListStyle.DescriptionList) -> {
+ dl { node.children.forEach { it.build(this, pageContext, sourceSetRestriction) } }
+ }
+ else -> {
+ ul { buildListItems(node.children, pageContext, sourceSetRestriction) }
+ }
+ }
open fun OL.buildListItems(
items: List,
diff --git a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
index 8c2e1c9900..c38edea864 100644
--- a/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
+++ b/plugins/base/src/main/kotlin/transformers/pages/comments/DocTagToContentConverter.kt
@@ -4,10 +4,10 @@ import org.intellij.markdown.MarkdownElementTypes
import org.jetbrains.dokka.DokkaConfiguration.DokkaSourceSet
import org.jetbrains.dokka.model.doc.*
import org.jetbrains.dokka.model.properties.PropertyContainer
+import org.jetbrains.dokka.model.properties.plus
import org.jetbrains.dokka.model.toDisplaySourceSets
import org.jetbrains.dokka.pages.*
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
-import org.jetbrains.dokka.model.properties.plus
open class DocTagToContentConverter : CommentsToContentConverter {
override fun buildContent(
@@ -39,14 +39,14 @@ open class DocTagToContentConverter : CommentsToContentConverter {
)
)
- fun buildList(ordered: Boolean, start: Int = 1) =
+ fun buildList(ordered: Boolean, newStyles: Set