From f54597c754c9be6afb4ea374dc959dcc9fd551ce Mon Sep 17 00:00:00 2001 From: Jacob Wysko Date: Mon, 21 Feb 2022 10:30:59 -0500 Subject: Fix MathJax rendering bug (#2342) * Fix MathJax rendering bug (#2175) Fix a bug where using the `@usesMathJax` custom tag would cause the documentation to fail to render. --- plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'plugins/mathjax/src/main/kotlin') diff --git a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt index 6a00a3da..89c13202 100644 --- a/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt +++ b/plugins/mathjax/src/main/kotlin/MathjaxPlugin.kt @@ -16,6 +16,12 @@ class MathjaxPlugin : DokkaPlugin() { val transformer by extending { CoreExtensions.pageTransformer with MathjaxTransformer } + + val mathjaxTagContentProvider by extending { + plugin().customTagContentProvider with MathjaxTagContentProvider order { + before(plugin().sinceKotlinTagContentProvider) + } + } } private const val ANNOTATION = "usesMathJax" @@ -34,3 +40,15 @@ object MathjaxTransformer : PageTransformer { .orEmpty() .any { (it as? CustomTagWrapper)?.name == ANNOTATION } } + +object MathjaxTagContentProvider : CustomTagContentProvider { + + override fun isApplicable(customTag: CustomTagWrapper) = customTag.name == ANNOTATION + + override fun DocumentableContentBuilder.contentForDescription( + sourceSet: DokkaConfiguration.DokkaSourceSet, + customTag: CustomTagWrapper + ) { + comment(customTag.root, sourceSets = setOf(sourceSet)) + } +} \ No newline at end of file -- cgit