From 02f30b142aa467d3a24cc52a1fe3f2fed7ea1e33 Mon Sep 17 00:00:00 2001 From: Ignat Beresnev Date: Thu, 31 Aug 2023 20:16:01 +0200 Subject: Enable explicit API mode (#3139) --- plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'plugins/mathjax/src/main') diff --git a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt index 0af9606c..2a7ed6a4 100644 --- a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt +++ b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt @@ -16,15 +16,17 @@ import org.jetbrains.dokka.pages.RootPageNode import org.jetbrains.dokka.pages.WithDocumentables import org.jetbrains.dokka.plugability.DokkaPlugin import org.jetbrains.dokka.plugability.DokkaPluginApiPreview +import org.jetbrains.dokka.plugability.Extension import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement import org.jetbrains.dokka.transformers.pages.PageTransformer -class MathjaxPlugin : DokkaPlugin() { - val transformer by extending { +public class MathjaxPlugin : DokkaPlugin() { + + public val transformer: Extension by extending { CoreExtensions.pageTransformer with MathjaxTransformer } - val mathjaxTagContentProvider by extending { + public val mathjaxTagContentProvider: Extension by extending { plugin().customTagContentProvider with MathjaxTagContentProvider order { before(plugin().sinceKotlinTagContentProvider) } @@ -38,8 +40,9 @@ class MathjaxPlugin : DokkaPlugin() { private const val ANNOTATION = "usesMathJax" internal const val LIB_PATH = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS_SVG&latest" -object MathjaxTransformer : PageTransformer { - override fun invoke(input: RootPageNode) = input.transformContentPagesTree { +public object MathjaxTransformer : PageTransformer { + + override fun invoke(input: RootPageNode): RootPageNode = input.transformContentPagesTree { it.modified( embeddedResources = it.embeddedResources + if (it.isNeedingMathjax) listOf(LIB_PATH) else emptyList() ) @@ -50,9 +53,10 @@ object MathjaxTransformer : PageTransformer { .flatMap { it.children } .any { (it as? CustomTagWrapper)?.name == ANNOTATION } } } -object MathjaxTagContentProvider : CustomTagContentProvider { - override fun isApplicable(customTag: CustomTagWrapper) = customTag.name == ANNOTATION +public object MathjaxTagContentProvider : CustomTagContentProvider { + + override fun isApplicable(customTag: CustomTagWrapper): Boolean = customTag.name == ANNOTATION override fun DocumentableContentBuilder.contentForDescription( sourceSet: DokkaConfiguration.DokkaSourceSet, -- cgit