• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package org.jetbrains.dokka
2 
3 /**
4  * Provides facility for rendering [DocumentationNode] as a language-dependent declaration
5  */
6 interface LanguageService {
7     enum class RenderMode {
8         /** Brief signature (used in a list of all members of the class). */
9         SUMMARY,
10         /** Full signature (used in the page describing the member itself */
11         FULL
12     }
13 
14     /**
15      * Renders a [node] as a class, function, property or other signature in a target language.
16      * @param node A [DocumentationNode] to render
17      * @return [ContentNode] which is a root for a rich content tree suitable for formatting with [FormatService]
18      */
rendernull19     fun render(node: DocumentationNode, renderMode: RenderMode = RenderMode.FULL): ContentNode
20 
21     /**
22      * Tries to summarize the signatures of the specified documentation nodes in a compact representation.
23      * Returns the representation if successful, or null if the signatures could not be summarized.
24      */
25     fun summarizeSignatures(nodes: List<DocumentationNode>): ContentNode?
26 
27     /**
28      * Renders [node] as a named representation in the target language
29      *
30      * For example:
31      * ${code org.jetbrains.dokka.example}
32      *
33      * $node: A [DocumentationNode] to render
34      * $returns: [String] which is a string representation of the node's name
35      */
36     fun renderName(node: DocumentationNode): String
37 
38     fun renderNameWithOuterClass(node: DocumentationNode): String
39 }
40 
41 fun example(service: LanguageService, node: DocumentationNode) {
42     println("Node name: ${service.renderName(node)}")
43 }