No, but you can include simple code blocks by using backticks
Ok... I was asking because if that was possible, the code embedded in the documentation could be tested (picked from a test) and documentation would be correct :)
Do you think it is worthy to convert this to an issue?
And thanks for the information! :)
(adding my details to this)
Is your feature request related to a problem? Please describe
I'm using a .md file to document my package, as described at https://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentation
I'd like to include a code sample/snippet of how the classes in the package fit together.
Describe the solution you'd like
I'd like functionality similar to the @sample KDoc block tag, so that I can write code in a .kt file that gets compiled and tested, but then gets merged into the resulting documentation.
Describe alternatives you've considered
One option is to write the code sample inline as markdown. This has the downside of being untestable and having no code completion or refactoring support.
This can be slightly improved by maintaining 2 copies of the sample: one in the markdown, the other as code. However, it is then up to developers to know to update both locations when making changes.
Additional context
The DocFX tool supports this sort of code referencing
No, but you can include simple code blocks by using backticks
backticks do not work either, as of Gradle plugin version 1.4.0-rc
Most helpful comment
(adding my details to this)
Is your feature request related to a problem? Please describe
I'm using a
.mdfile to document my package, as described at https://kotlinlang.org/docs/reference/kotlin-doc.html#module-and-package-documentationI'd like to include a code sample/snippet of how the classes in the package fit together.
Describe the solution you'd like
I'd like functionality similar to the
@sampleKDoc block tag, so that I can write code in a.ktfile that gets compiled and tested, but then gets merged into the resulting documentation.Describe alternatives you've considered
One option is to write the code sample inline as markdown. This has the downside of being untestable and having no code completion or refactoring support.
This can be slightly improved by maintaining 2 copies of the sample: one in the markdown, the other as code. However, it is then up to developers to know to update both locations when making changes.
Additional context
The DocFX tool supports this sort of code referencing