diff options
Diffstat (limited to 'src/Formats/MarkdownFormatService.kt')
-rw-r--r-- | src/Formats/MarkdownFormatService.kt | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt new file mode 100644 index 00000000..032667dd --- /dev/null +++ b/src/Formats/MarkdownFormatService.kt @@ -0,0 +1,34 @@ +package org.jetbrains.dokka + +public class MarkdownFormatService(val locationService: LocationService, + val signatureGenerator: SignatureGenerator) : FormatService { + override val extension: String = "md" + override fun format(node: DocumentationNode, to: StringBuilder) { + with (to) { + appendln(node.path.map { "[${it.name}](${locationService.relativeLocation(node, it, extension)})" }.joinToString(" / ")) + appendln() + append("# ") + appendln(signatureGenerator.render(node)) + appendln() + appendln(node.doc.summary) + appendln() + for (section in node.doc.sections) { + append("### ") + appendln(section.label) + appendln(section.text) + } + + + appendln("### Members") + appendln("| Name | Signature | Summary |") + appendln("|------|-----------|---------|") + for (member in node.members.sortBy { it.name }) { + val relativePath = locationService.relativeLocation(node, member, extension) + append("|[${member.name}](${relativePath})") + append("|${signatureGenerator.render(member)}") + append("|${member.doc.summary} ") + appendln("|") + } + } + } +}
\ No newline at end of file |