Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some questions and problems #2513

Closed
mahozad opened this issue May 26, 2022 · 3 comments
Closed

Some questions and problems #2513

mahozad opened this issue May 26, 2022 · 3 comments
Labels
question A user question, can be resolved if the question is answered/resolved

Comments

@mahozad
Copy link
Contributor

mahozad commented May 26, 2022

Question
I have a few questions.

  • How can I replace andoridJvm source string with something like GitHub in sources tab of the documentation?
    Screenshot (36)

  • How can I set a custom favicon (which may be different from the logo in the page header) for the document?
    My current solution is to name an image file logo-icon.svg and add it as an asset in the Dokka settings. But I want to name the image file something else like favicon.svg and also want to be able to use other formats like PNG as well.

  • Do you think it would be better for the methods in Dokka Gradle plugin to be converted to properties and also avoid double negative names?
    So, for example, noAndroidSdkLink.set(false) be renamed to something like useAndroidSdkLink = true or isAndroidSdkLinkEnabled = true or enableAndroidSdkLink = true or similar.

  • I really liked the previous theme of Dokka HTML. Can I somehow enable it for my docs?

  • Updating the files defined as custom assets or styles is not reflected in the output when I re-run the dokkaHtml task. So, I had to run Gradle clean and then run dokkaHtml again.

  • Configuring the plugin options is not easy. On Windows it is even harder because the paths should either be normalized or escaped:

    pluginsMapConfiguration.set(
        mapOf("org.jetbrains.dokka.base.DokkaBase" to
                    """{ 
                           "customStyleSheets": ["${file("dokka/logo-styles.css").path.replace('\\','/')}"],
                           "customAssets" : [
                               "${file("dokka/logo.svg").path.replace('\\', '/')}",
                               "${file("dokka/logo-icon.svg").path.replace('\\', '/')}"
                           ],
                           "separateInheritedMembers": true
                    }"""
        )
    )

    Is there any better way to do this?

  • Another problem:
    Screenshot (37)

Installation

  • Operating system: Windows 11
  • Build tool: Gradle v7.0.2
  • Dokka version: 1.6.21
@mahozad mahozad added the question A user question, can be resolved if the question is answered/resolved label May 26, 2022
@IgnatBeresnev
Copy link
Member

IgnatBeresnev commented May 30, 2022

Hi!

How can I replace andoridJvm source string with something like GitHub in sources tab of the documentation?

I believe this name is taken from DokkaSourceSet's displayName. It can be set like this:

tasks.withType<DokkaTask>().configureEach {
    dokkaSourceSets {
        named("main") {
            displayName.set("Your name here")
        }
    }
}

How can I set a custom favicon (which may be different from the logo in the page header) for the document?
My current solution is to name an image file logo-icon.svg and add it as an asset in the Dokka settings. But I want to name the image file something else like favicon.svg and also want to be able to use other formats like PNG as well.

Doesn't seem to be possible at the moment, unfortunately. You could do this by writing your own plugin and providing your own html templates with the desired favicon, but imho it's overkill for this simple feature :) Feel free to create an enhancement issue if you want, this should be pretty straightforward to implement, I can provide more details in the comments


Do you think it would be better for the methods in Dokka Gradle plugin to be converted to properties and also avoid double negative names?

Yes, I personally would very much love that, thank you for bringing this up. I'll try to push this before the stable release, but it'll take some time since current API will need to go through the full deprecation cycle. Feel free to create a separate enhancement issue if you want


I really liked the previous theme of Dokka HTML. Can I somehow enable it for my docs?

Unfortunately, not. You could write your own Dokka plugin and try to recreate the old UI, but I think this would require a lot of work.


Updating the files defined as custom assets or styles is not reflected in the output when I re-run the dokkaHtml task. So, I had to run Gradle clean and then run dokkaHtml again.

Yes, unfortunately this is a known issue #2286


Configuring the plugin options is not easy. On Windows it is even harder because the paths should either be normalized or escaped

If you are using kotlin dsl build scripts, you can use type-safe builders. For this you need to either have Dokka on the classpath or add a classpath dependency on dokka-core to your buildscript. There's some more info in documentation:

import org.jetbrains.dokka.base.DokkaBase
import org.jetbrains.dokka.base.DokkaBaseConfiguration

pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
    customAssets = listOf(file("<path to asset>"))
    customStyleSheets = listOf(file("<path to custom stylesheet>"))
}

Also, about escaping on Windows, try using invariantSeparatorsPath method on file. Like so:

..`["${file("../customResources/logo-styles.css").invariantSeparatorsPath}"`..

Documentation is being re-written now, I'll make sure to add this, thanks.


Another problem:

I don't see any existing issues for this, so feel free to create a separate one. I've written down this problem for myself, it's definitely something we should fix.


Hopefully I didn't miss anything. Let us know if you have any further questions :)

mahozad added a commit to mahozad/android-pie-chart that referenced this issue May 30, 2022
@mahozad
Copy link
Contributor Author

mahozad commented May 31, 2022

Thank you very much. Your solutions worked.

So, for the favicon, if you'd like, maybe I can implement it. I'd be glad to help if I can.

@IgnatBeresnev
Copy link
Member

Thanks for creating separate issues, I appreciate it!

I'll close this one and give my comments in the corresponding issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question A user question, can be resolved if the question is answered/resolved
Projects
None yet
Development

No branches or pull requests

2 participants