Skip to content

Commit

Permalink
Improve styling for docs generated via dokka
Browse files Browse the repository at this point in the history
- Add dokka script plugin
- Add custom prism.js script to override the default one
  - All languages provided as components and loaded on-demand
- Clean up dokka styles
- Add dokka style tweaks plugin
  - Majority of dokka styles moved to dokka style tweaks plugin
- Replace checkboxes in markdown with real HTML checkboxes
- Update dokka base.ftl to match default
- Remove mathjax plugin (we weren't using it anyway)

Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
  • Loading branch information
solonovamax committed Sep 16, 2023
1 parent e6239a7 commit 6387d4e
Show file tree
Hide file tree
Showing 303 changed files with 466 additions and 50 deletions.
9 changes: 8 additions & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2023-2023 solonovamax <solonovamax@12oclockpoint.com>
*
* The file build.gradle.kts is part of kotlin-fuzzy
* Last modified on 08-08-2023 11:01 p.m.
* Last modified on 16-09-2023 04:38 p.m.
*
* MIT License
*
Expand Down Expand Up @@ -34,6 +34,10 @@ repositories {
mavenCentral()
// for kotlin-dsl plugin
gradlePluginPortal()

maven("https://maven.solo-studios.ca/releases/") {
name = "Solo Studios"
}
}

java {
Expand All @@ -56,6 +60,9 @@ kotlin {
dependencies {
implementation(libs.dokka.base)

implementation(libs.dokka.plugin.script)
implementation(libs.dokka.plugin.style.tweaks)

implementation(gradlePlugin(libs.plugins.kotest.multiplatform, libs.versions.kotest))

implementation(gradlePlugin(libs.plugins.dokka, libs.versions.dokka))
Expand Down
41 changes: 37 additions & 4 deletions buildSrc/src/main/kotlin/kt-fuzzy.dokka.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright (c) 2023-2023 solonovamax <solonovamax@12oclockpoint.com>
*
* The file kt-fuzzy.dokka.gradle.kts is part of kotlin-fuzzy
* Last modified on 07-08-2023 06:56 p.m.
* Last modified on 16-09-2023 04:49 p.m.
*
* MIT License
*
Expand All @@ -26,6 +26,10 @@
* SOFTWARE.
*/

import ca.solostudios.dokkascript.plugin.DokkaScriptsConfiguration
import ca.solostudios.dokkascript.plugin.DokkaScriptsPlugin
import ca.solostudios.dokkastyles.plugin.DokkaStyleTweaksConfiguration
import ca.solostudios.dokkastyles.plugin.DokkaStyleTweaksPlugin
import java.time.Year
import org.jetbrains.dokka.DokkaConfiguration.Visibility
import org.jetbrains.dokka.base.DokkaBase
Expand All @@ -40,7 +44,8 @@ plugins {
}

dependencies {
dokkaPlugin(libs.dokka.mathjax.plugin)
dokkaPlugin(libs.dokka.plugin.script)
dokkaPlugin(libs.dokka.plugin.style.tweaks)
}

tasks {
Expand All @@ -54,7 +59,16 @@ tasks {
from(dokkaDirectories.map { it.resolve("includes") })

doFirst {
val projectInfo = ProjectInfo(project.group.toStringOrEmpty(), project.name, project.version.toStringOrEmpty())
val projectInfo = ProjectInfo(
group = project.group.toStringOrEmpty(),
module = project.name,
version = project.version.toStringOrEmpty(),
)

filter { line ->
line.replace("", "<input type=\"checkbox\" readonly>")
.replace("", "<input type=\"checkbox\" readonly checked>")
}
expand("project" to projectInfo)
}

Expand All @@ -66,9 +80,28 @@ tasks {
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
footerMessage = "© ${Year.now()} Copyright solo-studios"
separateInheritedMembers = false
customStyleSheets = rootDokkaDirectory.resolve("styles").listFiles()?.toList() ?: listOf()
customStyleSheets = rootDokkaDirectory.resolve("styles").listFiles()?.toList().orEmpty()
customAssets = rootDokkaDirectory.resolve("assets").listFiles()?.toList().orEmpty()
templatesDir = rootDokkaDirectory.resolve("templates")
}
pluginConfiguration<DokkaScriptsPlugin, DokkaScriptsConfiguration> {
scripts = rootDokkaDirectory.resolve("scripts").listFiles()?.toList().orEmpty()
remoteScripts = listOf(
// MathJax
"https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js?config=TeX-AMS-MML_HTMLorMML&latest",
)
}
pluginConfiguration<DokkaStyleTweaksPlugin, DokkaStyleTweaksConfiguration> {
minimalScrollbar = true
darkPurpleHighlight = true
darkColorSchemeFix = true
improvedBlockquoteBorder = true
lighterBlockquoteText = true
sectionTabFontWeight = "500"
sectionTabTransition = true
improvedSectionTabBorder = true
disableCodeWrapping = true
}

moduleName = project.name
moduleVersion = project.version.toStringOrEmpty()
Expand Down
1 change: 1 addition & 0 deletions dokka/scripts/components/prism-abap.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dokka/scripts/components/prism-abnf.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dokka/scripts/components/prism-actionscript.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dokka/scripts/components/prism-ada.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dokka/scripts/components/prism-agda.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dokka/scripts/components/prism-al.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dokka/scripts/components/prism-antlr4.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 6387d4e

Please sign in to comment.