From aa59acbaf96e961d28e614a2932f100bea766b4f Mon Sep 17 00:00:00 2001 From: Ilya Ryzhenkov Date: Tue, 15 Jul 2014 20:05:55 +0400 Subject: Support tables in formatters and add proper escaping of html --- src/Formats/MarkdownFormatService.kt | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/Formats/MarkdownFormatService.kt') diff --git a/src/Formats/MarkdownFormatService.kt b/src/Formats/MarkdownFormatService.kt index 3768c3f1..60e38290 100644 --- a/src/Formats/MarkdownFormatService.kt +++ b/src/Formats/MarkdownFormatService.kt @@ -31,11 +31,11 @@ public open class MarkdownFormatService(locationService: LocationService, signat } override public fun appendLine(to: StringBuilder, text: String) { - to.appendln(formatText(text)) + to.appendln(text) } override public fun appendText(to: StringBuilder, text: String) { - to.append(formatText(text)) + to.append(text) } override public fun appendHeader(to: StringBuilder, text: String, level: Int) { @@ -59,6 +59,31 @@ public open class MarkdownFormatService(locationService: LocationService, signat appendLine(to, "```") } + override fun appendTable(to: StringBuilder, body: () -> Unit) { + to.appendln() + body() + to.appendln() + } + + override fun appendTableHeader(to: StringBuilder, body: () -> Unit) { + body() + } + + override fun appendTableBody(to: StringBuilder, body: () -> Unit) { + body() + } + + override fun appendTableRow(to: StringBuilder, body: () -> Unit) { + to.append("|") + body() + to.appendln() + } + + override fun appendTableCell(to: StringBuilder, body: () -> Unit) { + body() + to.append("|") + } + var outlineLevel = 0 override fun appendOutlineHeader(to: StringBuilder, node: DocumentationNode) { val indent = " ".repeat(outlineLevel) -- cgit