I am generating the documentation for my public API/functions. It works well. But now I want to include the samples (Example code) also in the documentation. I know we can achieve it using @sample, but somehow I am not able to do it.
/**
@sample com.example.samples.Samples.doStuffSample
*/
fun doStuff(path: String, deviceID: String, newName: String,): Operation {
// Do stuff here
}
This is my Sample class in which, I have the sample codes.
class Samples {
fun doStuffSample() {
Manager.doStuff("path", "deviceID", "newName", object : Delegate {
override fun onSuccess() {
// Success
}
override fun onError() {
// Error
}
})
}
}
This is build.gradle file.
dokkaJavadoc.configure {
dokkaSourceSets {
named("main") {
skipDeprecated.set(true)
skipEmptyPackages.set(true)
includeNonPublic.set(false)
reportUndocumented.set(true)
perPackageOption {
skipEmptyPackages.set(true)
includeNonPublic.set(false)
matchingRegex.set("//package name")
suppress.set(false)
matchingRegex.set("//package name")
suppress.set(true)
}
}
}
}
In generated documentation, I can only see "com.example.samples.Samples.doStuffSample" below the "Samples" header. How can I achieve this? Any help is appreciated.