Skip to content

Commit

Permalink
Improve dokka styling
Browse files Browse the repository at this point in the history
- Update dokka-style-tweaks-plugin to 1.1.0
- Add support for formatted footnotes & references to CSS
- Filter formatted references

Signed-off-by: solonovamax <[email protected]>
  • Loading branch information
solonovamax committed Sep 29, 2023
1 parent 6387d4e commit 9a7f035
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 5 deletions.
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Utilities.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ data class Repository(
}

var Project.repository: Repository
get() = project.extra["repo"] as Repository
get() = rootProject.extra["repo"] as Repository
set(value) {
project.extra["repo"] = value
rootProject.extra["repo"] = value
}

/**
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/kt-fuzzy.dokka.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ tasks {
filter { line ->
line.replace("", "<input type=\"checkbox\" readonly>")
.replace("", "<input type=\"checkbox\" readonly checked>")
.replace("\\[@ft-(\\w+)\\]".toRegex(), "<sup><a href=\"#footnote-\$1\">&#91;\$1&#93;</a></sup>")
.replace("\\[@ref-(\\d+)\\]".toRegex(), "<sup><a href=\"#reference-\$1\">&#91;\$1&#93;</a></sup>")
}
expand("project" to projectInfo)
}
Expand Down Expand Up @@ -101,6 +103,7 @@ tasks {
sectionTabTransition = true
improvedSectionTabBorder = true
disableCodeWrapping = true
sidebarWidth = "340px"
}

moduleName = project.name
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/kt-fuzzy.publishing.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ afterEvaluate {
val projectGroup = project.group.toStringOrEmpty()
val projectVersion = project.version.toStringOrEmpty()
val projectDescription = project.description.toStringOrEmpty()
val projectUrl = rootProject.repository.projectUrl
val projectBaseUri = rootProject.repository.projectBaseUri
val projectUrl = project.repository.projectUrl
val projectBaseUri = project.repository.projectBaseUri

val licenseName = "MIT"
val licenseUrl = "https://mit-license.org/"
Expand Down
48 changes: 48 additions & 0 deletions dokka/styles/dokka.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,54 @@
* SOFTWARE.
*/

/* Footnotes & References */
.footnotes-header, .references-header {
margin-bottom: 0;
font-size: 24px;
}

.references-header {
margin-top: 0;
}

.footnotes, .references {
padding: 0 16px 0 16px;
border-top: 1px solid var(--border-color);
line-height: 1.2;
}

.footnotes {
font-size: 13px;
color: color-mix(in hsl, var(--default-font-color) 80%, var(--background-color));
}

.references {
font-size: 16px;
}

.footnotes li, .references li {
margin-top: 16px;
margin-bottom: 16px;
}

.footnotes > ol, .references > ol {
counter-reset: list;
}

.footnotes > ol > li, .references > ol > li {
list-style: none;
counter-increment: list;
}

.footnotes > ol > li::marker {
content: "[" counter(list, lower-alpha) "]\a0";
}

.references > ol > li::marker {
content: "[" counter(list) "]\a0";
}

/* Disable checkboxes */
input[type='checkbox'][readonly] {
pointer-events: none;
}
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ dokka-base = { group = "org.jetbrains.dokka", name = "dokka-base", version.ref =
dokka-mathjax-plugin = { group = "org.jetbrains.dokka", name = "mathjax-plugin", version.ref = "dokka" }

dokka-plugin-script = { group = "ca.solo-studios", name = "dokka-script-plugin", version = "0.1.1" }
dokka-plugin-style-tweaks = { group = "ca.solo-studios", name = "dokka-style-tweaks-plugin", version = "0.1.2" }
dokka-plugin-style-tweaks = { group = "ca.solo-studios", name = "dokka-style-tweaks-plugin", version = "1.1.0" }

## Kotest
### A flexible and elegant multi-platform test framework for Kotlin
Expand Down

0 comments on commit 9a7f035

Please sign in to comment.