From aa13ef293c3fd6d9784e928bc9a59796692ce44e Mon Sep 17 00:00:00 2001 From: IgnatBeresnev Date: Thu, 4 Aug 2022 15:50:12 +0200 Subject: [PATCH 1/2] Update dokka-customFormat-example to use up-to-date logo styles --- .../dokka-customFormat-example/README.md | 24 +++++++++++++++++++ .../build.gradle.kts | 3 +++ .../logo-styles.css | 22 +++++++++++++---- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 examples/gradle/dokka-customFormat-example/README.md diff --git a/examples/gradle/dokka-customFormat-example/README.md b/examples/gradle/dokka-customFormat-example/README.md new file mode 100644 index 0000000000..00dd668c27 --- /dev/null +++ b/examples/gradle/dokka-customFormat-example/README.md @@ -0,0 +1,24 @@ +## Dokka custom format example + +This example demonstrates a few things: + +1. How to override css styles and add custom images. +2. How to change logo used in the header. +3. How to register a custom `Dokka` task with its own independent configuration. + +### Running + +`dokkaCustomFormat` task has been created in the buildscript of this example project with a few configuration changes. + +In order to see the full effect of these changes, run `dokkaCustomFormat` task from your IDE or execute +the following command: + +```bash +./gradlew clean dokkaCustomFormat +``` + +--- + +If you run any other `Dokka` task, such as `dokkaHtml`, you'll see vanilla `Dokka` without any alterations. +This is because changes to configuration are applied only within `dokkaCustomFormat` task. This can be useful +if you want to generate multiple versions of documentation with different configuration settings. diff --git a/examples/gradle/dokka-customFormat-example/build.gradle.kts b/examples/gradle/dokka-customFormat-example/build.gradle.kts index 965593b10d..8f9b6d2eb7 100644 --- a/examples/gradle/dokka-customFormat-example/build.gradle.kts +++ b/examples/gradle/dokka-customFormat-example/build.gradle.kts @@ -20,6 +20,9 @@ repositories { */ tasks.register("dokkaCustomFormat") { pluginConfiguration { + // Dokka's stylesheets and assets with conflicting names will be overriden. + // In this particular case, logo-styles.css will be overriden and ktor-logo.png will + // be added as an additional image asset customStyleSheets = listOf(file("logo-styles.css")) customAssets = listOf(file("ktor-logo.png")) } diff --git a/examples/gradle/dokka-customFormat-example/logo-styles.css b/examples/gradle/dokka-customFormat-example/logo-styles.css index bde131cd4f..91e7306546 100644 --- a/examples/gradle/dokka-customFormat-example/logo-styles.css +++ b/examples/gradle/dokka-customFormat-example/logo-styles.css @@ -1,6 +1,20 @@ -#logo { +/* + * All Margins and sizes are custom for the ktor-logo.png file. + * You may need to modify it and find what works best for your case. + */ +.library-name a { + position: relative; + margin-left: 55px; +} + +.library-name a::before { + content: ''; background-image: url('../images/ktor-logo.png'); + background-repeat: no-repeat; background-size: 125px 50px; - padding-top: 12px; - height: 65px; -} \ No newline at end of file + position: absolute; + width: 52px; + height: 150px; + top: -18px; + left: -62px; +} From 3be354ea79bce086cba2fe1a65ffde804388ea05 Mon Sep 17 00:00:00 2001 From: IgnatBeresnev Date: Thu, 4 Aug 2022 15:52:31 +0200 Subject: [PATCH 2/2] Make height smaller --- examples/gradle/dokka-customFormat-example/logo-styles.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/gradle/dokka-customFormat-example/logo-styles.css b/examples/gradle/dokka-customFormat-example/logo-styles.css index 91e7306546..9558eb83fd 100644 --- a/examples/gradle/dokka-customFormat-example/logo-styles.css +++ b/examples/gradle/dokka-customFormat-example/logo-styles.css @@ -14,7 +14,7 @@ background-size: 125px 50px; position: absolute; width: 52px; - height: 150px; + height: 50px; top: -18px; left: -62px; }