diff options
Diffstat (limited to 'plugins/mathjax')
-rw-r--r-- | plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt | 18 |
1 files changed, 11 insertions, 7 deletions
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<PageTransformer, *, *> by extending { CoreExtensions.pageTransformer with MathjaxTransformer } - val mathjaxTagContentProvider by extending { + public val mathjaxTagContentProvider: Extension<CustomTagContentProvider, *, *> by extending { plugin<DokkaBase>().customTagContentProvider with MathjaxTagContentProvider order { before(plugin<DokkaBase>().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, |