org.jetbrains.dokka.gfm.GfmPlugin.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gfm-plugin Show documentation
Show all versions of gfm-plugin Show documentation
Dokka is an API documentation engine for Kotlin
package org.jetbrains.dokka.gfm
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.renderers.PackageListCreator
import org.jetbrains.dokka.base.renderers.RootCreator
import org.jetbrains.dokka.base.resolvers.shared.RecognizedLinkFormat
import org.jetbrains.dokka.gfm.location.MarkdownLocationProvider
import org.jetbrains.dokka.gfm.renderer.BriefCommentPreprocessor
import org.jetbrains.dokka.gfm.renderer.CommonmarkRenderer
import org.jetbrains.dokka.plugability.DokkaPlugin
import org.jetbrains.dokka.plugability.DokkaPluginApiPreview
import org.jetbrains.dokka.plugability.PluginApiPreviewAcknowledgement
import org.jetbrains.dokka.renderers.PostAction
import org.jetbrains.dokka.transformers.pages.PageTransformer
class GfmPlugin : DokkaPlugin() {
val gfmPreprocessors by extensionPoint()
private val dokkaBase by lazy { plugin() }
val renderer by extending {
CoreExtensions.renderer providing ::CommonmarkRenderer override dokkaBase.htmlRenderer
}
val locationProvider by extending {
dokkaBase.locationProviderFactory providing MarkdownLocationProvider::Factory override dokkaBase.locationProvider
}
val rootCreator by extending {
gfmPreprocessors with RootCreator
}
val briefCommentPreprocessor by extending {
gfmPreprocessors with BriefCommentPreprocessor()
}
val packageListCreator by extending {
(gfmPreprocessors
providing { PackageListCreator(it, RecognizedLinkFormat.DokkaGFM) }
order { after(rootCreator) })
}
internal val alphaVersionNotifier by extending {
CoreExtensions.postActions providing { ctx ->
PostAction {
ctx.logger.info(
"The GFM output format is still in Alpha so you may find bugs and experience migration " +
"issues when using it. You use it at your own risk."
)
}
}
}
@OptIn(DokkaPluginApiPreview::class)
override fun pluginApiPreviewAcknowledgement(): PluginApiPreviewAcknowledgement =
PluginApiPreviewAcknowledgement
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy