blob: c4f7f2c709ebae31d71d9fdc62697fe059a95e94 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package org.jetbrains.dokka.jekyll
import org.jetbrains.dokka.CoreExtensions
import org.jetbrains.dokka.gfm.CommonmarkRenderer
import org.jetbrains.dokka.pages.*
import org.jetbrains.dokka.plugability.DokkaContext
import org.jetbrains.dokka.plugability.DokkaPlugin
import java.lang.StringBuilder
class JekyllPlugin : DokkaPlugin() {
val renderer by extending {
CoreExtensions.renderer providing { JekyllRenderer(it) } applyIf { format == "jekyll" }
}
}
class JekyllRenderer(
context: DokkaContext
) : CommonmarkRenderer(context) {
override fun buildPage(page: ContentPage, content: (StringBuilder, ContentPage) -> Unit): String {
val builder = StringBuilder()
builder.append("---\n")
builder.append("title: ${page.name} -\n")
builder.append("---\n")
content(builder, page)
return builder.toString()
}
}
|