On this page
Resolving selfdoc's directives against Kotlin source: public declarations, KDoc comments and data class members, read without the Kotlin toolchain.
#internal/extractors/kotlin
#internal/extractors/kotlin
Package kotlin resolves selfdoc's directives against Kotlin source.
Nothing from the Kotlin toolchain is required: the file is read with patterns. The four directives it serves are ref, prose-desc, table-schema and table-config.
#Public by default
Kotlin's default visibility is public, so a declaration carrying no visibility keyword belongs on a reference page. What the scanner looks for is therefore the three keywords that take a declaration off it -- private, protected and internal -- with one exception: an internal declaration marked @PublishedApi is part of the published API by definition, and is rendered.
#KDoc
A KDoc block documents the declaration directly beneath it and nothing else: a blank line between them breaks the association, which is Kotlin's own rule and the one the scanner enforces. Every tag the language documents is rendered -- the @param and @property tags accumulate into their own sections, the rest render a bold label -- and the square-bracket links become code spans.
#Extractor
type Extractor structExtractor reads Kotlin source.
#New
func New() extractors.ExtractorNew builds the Kotlin extractor.
#Extractor.Detect
func (e *Extractor) Detect(dir string) boolDetect reports whether dir is a Kotlin project, by either Gradle build script.
#Extractor.FileExtensions
func (e *Extractor) FileExtensions() []string { return []string{".kt"} }FileExtensions is the one extension Kotlin source carries.
#Extractor.ResolvePath
func (e *Extractor) ResolvePath(pathArg string, sourcePaths []string, baseDir string) stringResolvePath resolves a directive's path argument to a Kotlin file or directory.
#Extractor.PublicSymbols
func (e *Extractor) PublicSymbols(file string) ([]string, error)PublicSymbols lists the symbols a Kotlin file exports.
#Extractor.ModuleDocstring
func (e *Extractor) ModuleDocstring(path string) (string, error)ModuleDocstring is the module-level KDoc comment at the top of a Kotlin file.
#Extractor.SymbolDetails
func (e *Extractor) SymbolDetails(file, symbol string) (*extractors.SymbolDetails, error)SymbolDetails reports what a Kotlin file says about one symbol's parameters and return value. A data class answers with its primary constructor, and a dotted name selects a member of a class, an object or an interface ("UserService.findUser").