aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2016-07-04 19:48:27 +0200
committerDmitry Jemerov <yole@jetbrains.com>2016-07-04 19:48:27 +0200
commitc0064d2b43ec30237d0d39bf5a9aaa4ce5e14744 (patch)
tree603144496856c6730ef3e1076f5ecc4cc94a11f4
parent625ea7d5d679399a24877d4f6988d58ce2662a8c (diff)
downloaddokka-c0064d2b43ec30237d0d39bf5a9aaa4ce5e14744.tar.gz
dokka-c0064d2b43ec30237d0d39bf5a9aaa4ce5e14744.tar.bz2
dokka-c0064d2b43ec30237d0d39bf5a9aaa4ce5e14744.zip
Rewrite output generation; much cleaner Markdown and HTML generated. Resolves #71, #72
-rw-r--r--core/src/main/kotlin/Formats/GFMFormatService.kt29
-rw-r--r--core/src/main/kotlin/Formats/HtmlFormatService.kt122
-rw-r--r--core/src/main/kotlin/Formats/HtmlTemplateService.kt3
-rw-r--r--core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt81
-rw-r--r--core/src/main/kotlin/Formats/MarkdownFormatService.kt187
-rw-r--r--core/src/main/kotlin/Formats/StructuredFormatService.kt397
-rw-r--r--core/src/main/kotlin/Java/JavadocParser.kt2
-rw-r--r--core/src/test/kotlin/format/GFMFormatTest.kt4
-rw-r--r--core/src/test/kotlin/model/JavaTest.kt4
-rw-r--r--core/testdata/format/accessor.md8
-rw-r--r--core/testdata/format/annotatedTypeParameter.md5
-rw-r--r--core/testdata/format/annotationClass.md4
-rw-r--r--core/testdata/format/annotationClass.package.md3
-rw-r--r--core/testdata/format/annotationParams.md5
-rw-r--r--core/testdata/format/annotations.md10
-rw-r--r--core/testdata/format/arrayAverage.md15
-rw-r--r--core/testdata/format/bracket.html4
-rw-r--r--core/testdata/format/brokenLink.html4
-rw-r--r--core/testdata/format/classWithCompanionObject.html4
-rw-r--r--core/testdata/format/classWithCompanionObject.md8
-rw-r--r--core/testdata/format/codeBlock.md14
-rw-r--r--core/testdata/format/codeSpan.html4
-rw-r--r--core/testdata/format/companionObjectExtension.md11
-rw-r--r--core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html7
-rw-r--r--core/testdata/format/deprecated.class.html6
-rw-r--r--core/testdata/format/emptyDescription.md3
-rw-r--r--core/testdata/format/entity.html7
-rw-r--r--core/testdata/format/enumClass.md4
-rw-r--r--core/testdata/format/enumClass.value.md5
-rw-r--r--core/testdata/format/exceptionClass.md6
-rw-r--r--core/testdata/format/exceptionClass.package.md5
-rw-r--r--core/testdata/format/extensionFunctionParameter.md5
-rw-r--r--core/testdata/format/extensionWithDocumentedReceiver.md4
-rw-r--r--core/testdata/format/extensions.class.md13
-rw-r--r--core/testdata/format/extensions.package.md3
-rw-r--r--core/testdata/format/functionWithDefaultParameter.md5
-rw-r--r--core/testdata/format/genericInheritedExtensions.md12
-rw-r--r--core/testdata/format/gfm/listInTableCell.kt8
-rw-r--r--core/testdata/format/gfm/listInTableCell.md17
-rw-r--r--core/testdata/format/gfm/sample.md19
-rw-r--r--core/testdata/format/htmlEscaping.html4
-rw-r--r--core/testdata/format/inapplicableExtensionFunctions.md10
-rw-r--r--core/testdata/format/inheritedCompanionObjectProperties.md14
-rw-r--r--core/testdata/format/inheritedExtensions.md12
-rw-r--r--core/testdata/format/inheritedMembers.md14
-rw-r--r--core/testdata/format/javaCodeInParam.md14
-rw-r--r--core/testdata/format/javaCodeLiteralTags.md22
-rw-r--r--core/testdata/format/javaDeprecated.html4
-rw-r--r--core/testdata/format/javaLinkTag.html9
-rw-r--r--core/testdata/format/javaLinkTagWithLabel.html9
-rw-r--r--core/testdata/format/javaSeeTag.html8
-rw-r--r--core/testdata/format/javaSpaceInAuthor.md13
-rw-r--r--core/testdata/format/javaSupertype.html4
-rw-r--r--core/testdata/format/javadocHtml.md30
-rw-r--r--core/testdata/format/javadocOrderedList.md15
-rw-r--r--core/testdata/format/jdkLinks.md12
-rw-r--r--core/testdata/format/linkWithLabel.html7
-rw-r--r--core/testdata/format/linkWithStarProjection.html4
-rw-r--r--core/testdata/format/markdownInLinks.html4
-rw-r--r--core/testdata/format/multipleTypeParameterConstraints.md5
-rw-r--r--core/testdata/format/nullability.md10
-rw-r--r--core/testdata/format/operatorOverloading.md5
-rw-r--r--core/testdata/format/orderedList.html14
-rw-r--r--core/testdata/format/overloads.html3
-rw-r--r--core/testdata/format/overloadsWithDescription.html11
-rw-r--r--core/testdata/format/overloadsWithDifferentDescriptions.html27
-rw-r--r--core/testdata/format/overridingFunction.md3
-rw-r--r--core/testdata/format/paramTag.md7
-rw-r--r--core/testdata/format/parameterAnchor.html9
-rw-r--r--core/testdata/format/parenthesis.html4
-rw-r--r--core/testdata/format/propertyVar.md5
-rw-r--r--core/testdata/format/receiverParameterTypeBound.md8
-rw-r--r--core/testdata/format/reifiedTypeParameter.md5
-rw-r--r--core/testdata/format/returnWithLink.html4
-rw-r--r--core/testdata/format/see.html13
-rw-r--r--core/testdata/format/shadowedExtensionFunctions.md13
-rw-r--r--core/testdata/format/starProjection.md4
-rw-r--r--core/testdata/format/summarizeSignatures.md13
-rw-r--r--core/testdata/format/summarizeSignaturesProperty.md13
-rw-r--r--core/testdata/format/throwsTag.md5
-rw-r--r--core/testdata/format/tripleBackticks.html7
-rw-r--r--core/testdata/format/typeLink.html4
-rw-r--r--core/testdata/format/typeParameterBounds.md8
-rw-r--r--core/testdata/format/typeParameterVariance.md6
-rw-r--r--core/testdata/format/typeProjectionVariance.md4
-rw-r--r--core/testdata/format/uninterpretedEmphasisCharacters.html4
-rw-r--r--core/testdata/format/varargsFunction.md5
-rw-r--r--core/testdata/format/website/returnTag.md7
-rw-r--r--core/testdata/format/website/sample.md14
89 files changed, 658 insertions, 848 deletions
diff --git a/core/src/main/kotlin/Formats/GFMFormatService.kt b/core/src/main/kotlin/Formats/GFMFormatService.kt
index b57fa932..cfb7fc03 100644
--- a/core/src/main/kotlin/Formats/GFMFormatService.kt
+++ b/core/src/main/kotlin/Formats/GFMFormatService.kt
@@ -9,11 +9,38 @@ open class GFMOutputBuilder(to: StringBuilder,
extension: String)
: MarkdownOutputBuilder(to, location, locationService, languageService, extension)
{
- override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) {
+ override fun appendTable(vararg columns: String, body: () -> Unit) {
to.appendln(columns.joinToString(" | ", "| ", " |"))
to.appendln("|" + "---|".repeat(columns.size))
body()
}
+
+ override fun appendUnorderedList(body: () -> Unit) {
+ if (inTableCell) {
+ wrapInTag("ul", body)
+ }
+ else {
+ super.appendUnorderedList(body)
+ }
+ }
+
+ override fun appendOrderedList(body: () -> Unit) {
+ if (inTableCell) {
+ wrapInTag("ol", body)
+ }
+ else {
+ super.appendOrderedList(body)
+ }
+ }
+
+ override fun appendListItem(body: () -> Unit) {
+ if (inTableCell) {
+ wrapInTag("li", body)
+ }
+ else {
+ super.appendListItem(body)
+ }
+ }
}
open class GFMFormatService(locationService: LocationService,
diff --git a/core/src/main/kotlin/Formats/HtmlFormatService.kt b/core/src/main/kotlin/Formats/HtmlFormatService.kt
index fff8f553..de41d4c6 100644
--- a/core/src/main/kotlin/Formats/HtmlFormatService.kt
+++ b/core/src/main/kotlin/Formats/HtmlFormatService.kt
@@ -14,108 +14,77 @@ open class HtmlOutputBuilder(to: StringBuilder,
val templateService: HtmlTemplateService)
: StructuredOutputBuilder(to, location, locationService, languageService, extension)
{
- override fun formatText(text: String): String {
- return text.htmlEscape()
+ override fun appendText(text: String) {
+ to.append(text.htmlEscape())
}
- override fun formatSymbol(text: String): String {
- return "<span class=\"symbol\">${formatText(text)}</span>"
+ override fun appendSymbol(text: String) {
+ to.append("<span class=\"symbol\">${text.htmlEscape()}</span>")
}
- override fun formatKeyword(text: String): String {
- return "<span class=\"keyword\">${formatText(text)}</span>"
+ override fun appendKeyword(text: String) {
+ to.append("<span class=\"keyword\">${text.htmlEscape()}</span>")
}
- override fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String {
+ override fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) {
val id = signature?.let { " id=\"$it\"" }.orEmpty()
- return "<span class=\"identifier\"$id>${formatText(text)}</span>"
+ to.append("<span class=\"identifier\"$id>${text.htmlEscape()}</span>")
}
- override fun appendBlockCode(to: StringBuilder, lines: List<String>, language: String) {
- to.append("<pre><code>")
- to.append(lines.joinToString("\n"))
- to.append("</code></pre>")
- }
-
- override fun appendHeader(to: StringBuilder, text: String, level: Int) {
- to.appendln("<h$level>${text}</h$level>")
- }
+ override fun appendBlockCode(language: String, body: () -> Unit) = wrap("<pre><code>", "</code></pre>", body)
- override fun appendParagraph(to: StringBuilder, text: String) {
- to.appendln("<p>${text}</p>")
- }
+ override fun appendHeader(level: Int, body: () -> Unit) =
+ wrapInTag("h$level", body, newlineBeforeOpen = true, newlineAfterClose = true)
+ override fun appendParagraph(body: () -> Unit) =
+ wrapInTag("p", body, newlineBeforeOpen = true, newlineAfterClose = true)
- override fun appendLine(to: StringBuilder, text: String) {
- to.appendln("$text<br/>")
+ override fun appendLine() {
+ to.appendln("<br/>")
}
- override fun appendAnchor(to: StringBuilder, anchor: String) {
+ override fun appendAnchor(anchor: String) {
to.appendln("<a name=\"${anchor.htmlEscape()}\"></a>")
}
- override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) {
- to.appendln("<table>")
- body()
- to.appendln("</table>")
- }
-
- override fun appendTableBody(to: StringBuilder, body: () -> Unit) {
- to.appendln("<tbody>")
- body()
- to.appendln("</tbody>")
- }
-
- override fun appendTableRow(to: StringBuilder, body: () -> Unit) {
- to.appendln("<tr>")
- body()
- to.appendln("</tr>")
- }
-
- override fun appendTableCell(to: StringBuilder, body: () -> Unit) {
- to.appendln("<td>")
- body()
- to.appendln("</td>")
- }
-
- override fun formatLink(text: String, href: String): String {
- return "<a href=\"${href}\">${text}</a>"
- }
-
- override fun formatStrong(text: String): String {
- return "<strong>${text}</strong>"
- }
-
- override fun formatEmphasis(text: String): String {
- return "<emph>${text}</emph>"
- }
+ override fun appendTable(vararg columns: String, body: () -> Unit) =
+ wrapInTag("table", body, newlineAfterOpen = true, newlineAfterClose = true)
+ override fun appendTableBody(body: () -> Unit) =
+ wrapInTag("tbody", body, newlineAfterOpen = true, newlineAfterClose = true)
+ override fun appendTableRow(body: () -> Unit) =
+ wrapInTag("tr", body, newlineAfterOpen = true, newlineAfterClose = true)
+ override fun appendTableCell(body: () -> Unit) =
+ wrapInTag("td", body, newlineAfterOpen = true, newlineAfterClose = true)
- override fun formatStrikethrough(text: String): String {
- return "<s>${text}</s>"
- }
+ override fun appendLink(href: String, body: () -> Unit) = wrap("<a href=\"$href\">", "</a>", body)
- override fun formatCode(code: String): String {
- return "<code>${code}</code>"
- }
+ override fun appendStrong(body: () -> Unit) = wrapInTag("strong", body)
+ override fun appendEmphasis(body: () -> Unit) = wrapInTag("emph", body)
+ override fun appendStrikethrough(body: () -> Unit) = wrapInTag("s", body)
+ override fun appendCode(body: () -> Unit) = wrapInTag("code", body)
- override fun formatUnorderedList(text: String): String = "<ul>${text}</ul>"
- override fun formatOrderedList(text: String): String = "<ol>${text}</ol>"
+ override fun appendUnorderedList(body: () -> Unit) = wrapInTag("ul", body, newlineAfterClose = true)
+ override fun appendOrderedList(body: () -> Unit) = wrapInTag("ol", body, newlineAfterClose = true)
+ override fun appendListItem(body: () -> Unit) = wrapInTag("li", body, newlineAfterClose = true)
- override fun formatListItem(text: String, kind: ListKind): String {
- return "<li>${text}</li>"
+ override fun appendBreadcrumbSeparator() {
+ to.append("&nbsp;/&nbsp;")
}
- override fun formatBreadcrumbs(items: Iterable<FormatLink>): String {
- return items.map { formatLink(it) }.joinToString("&nbsp;/&nbsp;")
- }
-
-
override fun appendNodes(nodes: Iterable<DocumentationNode>) {
templateService.appendHeader(to, getPageTitle(nodes), locationService.calcPathToRoot(location))
super.appendNodes(nodes)
templateService.appendFooter(to)
}
- override fun formatNonBreakingSpace(): String = "&nbsp;"
+ override fun appendNonBreakingSpace() {
+ to.append("&nbsp;")
+ }
+
+ override fun ensureParagraph() {
+ if (!to.endsWith("<p>") && !to.endsWith("</p>")) {
+ to.append("\n<p>")
+ }
+ }
}
open class HtmlFormatService @Inject constructor(@Named("folders") locationService: LocationService,
@@ -143,8 +112,9 @@ open class HtmlFormatService @Inject constructor(@Named("folders") locationServi
override fun appendOutlineHeader(location: Location, node: DocumentationNode, to: StringBuilder) {
val link = ContentNodeDirectLink(node)
link.append(languageService.render(node, LanguageService.RenderMode.FULL))
- val signature = createOutputBuilder(to, location).formatText(location, link)
- to.appendln("<a href=\"${location.path}\">${signature}</a><br/>")
+ val tempBuilder = StringBuilder()
+ createOutputBuilder(tempBuilder, location).appendContent(link)
+ to.appendln("<a href=\"${location.path}\">${tempBuilder.toString()}</a><br/>")
}
override fun appendOutlineLevel(to: StringBuilder, body: () -> Unit) {
diff --git a/core/src/main/kotlin/Formats/HtmlTemplateService.kt b/core/src/main/kotlin/Formats/HtmlTemplateService.kt
index 13587b05..7efb94a1 100644
--- a/core/src/main/kotlin/Formats/HtmlTemplateService.kt
+++ b/core/src/main/kotlin/Formats/HtmlTemplateService.kt
@@ -10,6 +10,9 @@ interface HtmlTemplateService {
fun default(css: String? = null): HtmlTemplateService {
return object : HtmlTemplateService {
override fun appendFooter(to: StringBuilder) {
+ if (!to.endsWith('\n')) {
+ to.append('\n')
+ }
to.appendln("</BODY>")
to.appendln("</HTML>")
}
diff --git a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt
index e3229523..03cf7fc8 100644
--- a/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt
+++ b/core/src/main/kotlin/Formats/KotlinWebsiteFormatService.kt
@@ -18,21 +18,17 @@ class KotlinWebsiteOutputBuilder(to: StringBuilder,
to.appendln("layout: api")
}
- override fun formatBreadcrumbs(items: Iterable<FormatLink>): String {
- items.drop(1)
-
- if (items.count() > 1) {
- return "<div class='api-docs-breadcrumbs'>" +
- items.map { formatLink(it) }.joinToString(" / ") +
- "</div>"
+ override fun appendBreadcrumbs(path: Iterable<FormatLink>) {
+ if (path.count() > 1) {
+ to.append("<div class='api-docs-breadcrumbs'>")
+ super.appendBreadcrumbs(path)
+ to.append("</div>")
}
-
- return ""
}
- override fun formatCode(code: String): String = if (code.length > 0) "<code>$code</code>" else ""
+ override fun appendCode(body: () -> Unit) = wrapIfNotEmpty("<code>", "</code>", body)
- override fun formatStrikethrough(text: String): String = "<s>$text</s>"
+ override fun appendStrikethrough(body: () -> Unit) = wrapInTag("s", body)
private fun div(to: StringBuilder, cssClass: String, block: () -> Unit) {
to.append("<div class=\"$cssClass\">")
@@ -42,7 +38,7 @@ class KotlinWebsiteOutputBuilder(to: StringBuilder,
to.append("</div>\n")
}
- override fun appendAsSignature(to: StringBuilder, node: ContentNode, block: () -> Unit) {
+ override fun appendAsSignature(node: ContentNode, block: () -> Unit) {
val contentLength = node.textLength
if (contentLength == 0) return
div(to, "signature") {
@@ -60,84 +56,81 @@ class KotlinWebsiteOutputBuilder(to: StringBuilder,
to.append("<div class=\"overload-group\"></div>")
}
- override fun formatLink(text: String, href: String): String {
- return "<a href=\"${href}\">${text}</a>"
- }
+ override fun appendLink(href: String, body: () -> Unit) = wrap("<a href=\"$href\">", "</a>", body)
- override fun appendHeader(to: StringBuilder, text: String, level: Int) {
+ override fun appendHeader(level: Int, body: () -> Unit) {
if (insideDiv > 0) {
- to.appendln("<h$level>${text}</h$level>")
+ wrapInTag("p", body, newlineAfterClose = true)
}
else {
- super.appendHeader(to, text, level)
+ super.appendHeader(level, body)
}
}
- override fun appendLine(to: StringBuilder, text: String) {
+ override fun appendLine() {
if (insideDiv > 0) {
- to.appendln("$text<br/>")
+ to.appendln("<br/>")
}
else {
- super.appendLine(to, text)
+ super.appendLine()
}
}
- override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) {
+ override fun appendTable(vararg columns: String, body: () -> Unit) {
to.appendln("<table class=\"api-docs-table\">")
body()
to.appendln("</table>")
}
- override fun appendTableBody(to: StringBuilder, body: () -> Unit) {
+ override fun appendTableBody(body: () -> Unit) {
to.appendln("<tbody>")
body()
to.appendln("</tbody>")
}
- override fun appendTableRow(to: StringBuilder, body: () -> Unit) {
+ override fun appendTableRow(body: () -> Unit) {
to.appendln("<tr>")
body()
to.appendln("</tr>")
}
- override fun appendTableCell(to: StringBuilder, body: () -> Unit) {
+ override fun appendTableCell(body: () -> Unit) {
to.appendln("<td markdown=\"1\">")
body()
to.appendln("\n</td>")
}
- override fun appendBlockCode(to: StringBuilder, lines: List<String>, language: String) {
+ override fun appendBlockCode(language: String, body: () -> Unit) {
if (language.isNotEmpty()) {
- super.appendBlockCode(to, lines, language)
+ super.appendBlockCode(language, body)
} else {
- to.append("<pre markdown=\"1\">")
- to.append(lines.joinToString { "\n" }.trimStart())
- to.append("</pre>")
+ wrap("<pre markdown=\"1\">", "</pre>", body)
}
}
- override fun formatSymbol(text: String): String {
- return "<span class=\"symbol\">${formatText(text)}</span>"
+ override fun appendSymbol(text: String) {
+ to.append("<span class=\"symbol\">${text.htmlEscape()}</span>")
}
- override fun formatKeyword(text: String): String {
- return "<span class=\"keyword\">${formatText(text)}</span>"
+ override fun appendKeyword(text: String) {
+ to.append("<span class=\"keyword\">${text.htmlEscape()}</span>")
}
- override fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String {
+ override fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) {
val id = signature?.let { " id=\"$it\"" }.orEmpty()
- return "<span class=\"${identifierClassName(kind)}\">${formatText(text)}</span>"
+ to.append("<span class=\"${identifierClassName(kind)}\"$id>${text.htmlEscape()}</span>")
}
- override fun formatSoftLineBreak(): String = if (needHardLineBreaks)
- "<br/>"
- else
- ""
+ override fun appendSoftLineBreak() {
+ if (needHardLineBreaks)
+ to.append("<br/>")
- override fun formatIndentedSoftLineBreak(): String = if (needHardLineBreaks)
- "<br/>&nbsp;&nbsp;&nbsp;&nbsp;"
- else
- ""
+ }
+ override fun appendIndentedSoftLineBreak() {
+ if (needHardLineBreaks) {
+ to.append("<br/>&nbsp;&nbsp;&nbsp;&nbsp;")
+ }
+ }
private fun identifierClassName(kind: IdentifierKind) = when(kind) {
IdentifierKind.ParameterName -> "parameterName"
diff --git a/core/src/main/kotlin/Formats/MarkdownFormatService.kt b/core/src/main/kotlin/Formats/MarkdownFormatService.kt
index 5ddb7f1f..6f2ab327 100644
--- a/core/src/main/kotlin/Formats/MarkdownFormatService.kt
+++ b/core/src/main/kotlin/Formats/MarkdownFormatService.kt
@@ -1,7 +1,12 @@
package org.jetbrains.dokka
import com.google.inject.Inject
+import java.util.*
+enum class ListKind {
+ Ordered,
+ Unordered
+}
open class MarkdownOutputBuilder(to: StringBuilder,
location: Location,
@@ -10,94 +15,178 @@ open class MarkdownOutputBuilder(to: StringBuilder,
extension: String)
: StructuredOutputBuilder(to, location, locationService, languageService, extension)
{
- override fun formatBreadcrumbs(items: Iterable<FormatLink>): String {
- return items.map { formatLink(it) }.joinToString(" / ")
- }
-
- override fun formatText(text: String): String = text.htmlEscape()
- override fun formatSymbol(text: String): String = text.htmlEscape()
- override fun formatKeyword(text: String): String = text.htmlEscape()
- override fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String = text.htmlEscape()
-
- override fun formatCode(code: String): String {
- return "`$code`"
+ private val listKindStack = Stack<ListKind>()
+ protected var inTableCell = false
+ protected var inCodeBlock = false
+ private var lastTableCellStart = -1
+
+ private fun appendNewline() {
+ while (to.endsWith(' ')) {
+ to.setLength(to.length - 1)
+ }
+ to.appendln()
}
- override fun formatUnorderedList(text: String): String = text + "\n"
- override fun formatOrderedList(text: String): String = text + "\n"
-
- override fun formatListItem(text: String, kind: ListKind): String {
- val itemText = if (text.endsWith("\n")) text else text + "\n"
- return if (kind == ListKind.Unordered) "* $itemText" else "1. $itemText"
+ private fun ensureNewline() {
+ if (inTableCell && listKindStack.isEmpty()) {
+ if (to.length != lastTableCellStart && !to.endsWith("<br>")) {
+ to.append("<br>")
+ }
+ }
+ else {
+ if (!endsWithNewline()) {
+ appendNewline()
+ }
+ }
+ }
+
+ private fun endsWithNewline(): Boolean {
+ var index = to.length - 1
+ while (index > 0) {
+ val c = to[index]
+ if (c != ' ') {
+ return c == '\n'
+ }
+ index--
+ }
+ return false
+ }
+
+ override fun ensureParagraph() {
+ if (!to.endsWith("\n\n")) {
+ if (!to.endsWith('\n')) {
+ appendNewline()
+ }
+ appendNewline()
+ }
+ }
+ override fun appendBreadcrumbSeparator() {
+ to.append(" / ")
+ }
+
+ override fun appendText(text: String) {
+ if (inCodeBlock) {
+ to.append(text)
+ }
+ else {
+ to.append(text.htmlEscape())
+ }
+ }
+
+ override fun appendCode(body: () -> Unit) {
+ inCodeBlock = true
+ wrapIfNotEmpty("`", "`", body, checkEndsWith = true)
+ inCodeBlock = false
+ }
+
+ override fun appendUnorderedList(body: () -> Unit) {
+ listKindStack.push(ListKind.Unordered)
+ body()
+ listKindStack.pop()
+ ensureNewline()
}
- override fun formatStrong(text: String): String {
- return "**$text**"
+ override fun appendOrderedList(body: () -> Unit) {
+ listKindStack.push(ListKind.Ordered)
+ body()
+ listKindStack.pop()
+ ensureNewline()
}
- override fun formatEmphasis(text: String): String {
- return "*$text*"
+ override fun appendListItem(body: () -> Unit) {
+ ensureNewline()
+ to.append(if (listKindStack.peek() == ListKind.Unordered) "* " else "1. ")
+ body()
+ ensureNewline()
}
- override fun formatStrikethrough(text: String): String {
- return "~~$text~~"
- }
+ override fun appendStrong(body: () -> Unit) = wrap("**", "**", body)
+ override fun appendEmphasis(body: () -> Unit) = wrap("*", "*", body)
+ override fun appendStrikethrough(body: () -> Unit) = wrap("~~", "~~", body)
- override fun formatLink(text: String, href: String): String {
- return "[$text]($href)"
+ override fun appendLink(href: String, body: () -> Unit) {
+ if (inCodeBlock) {
+ wrap("`[`", "`]($href)`", body)
+ }
+ else {
+ wrap("[", "]($href)", body)
+ }
}
- override fun appendLine(to: StringBuilder, text: String) {
- to.appendln(text)
+ override fun appendLine() {
+ if (inTableCell) {
+ to.append("<br>")
+ }
+ else {
+ appendNewline()
+ }
}
- override fun appendAnchor(to: StringBuilder, anchor: String) {
+ override fun appendAnchor(anchor: String) {
// no anchors in Markdown
}
- override fun appendParagraph(to: StringBuilder, text: String) {
- to.appendln()
- to.appendln(text)
- to.appendln()
+ override fun appendParagraph(body: () -> Unit) {
+ if (inTableCell) {
+ ensureNewline()
+ body()
+ }
+ else {
+ ensureParagraph()
+ body()
+ ensureParagraph()
+ }
}
- override fun appendHeader(to: StringBuilder, text: String, level: Int) {
- appendLine(to)
- appendLine(to, "${"#".repeat(level)} $text")
- appendLine(to)
+ override fun appendHeader(level: Int, body: () -> Unit) {
+ ensureParagraph()
+ to.append("${"#".repeat(level)} ")
+ body()
+ ensureParagraph()
}
- override fun appendBlockCode(to: StringBuilder, lines: List<String>, language: String) {
- appendLine(to)
+ override fun appendBlockCode(language: String, body: () -> Unit) {
+ ensureParagraph()
to.appendln(if (language.isEmpty()) "```" else "``` $language")
- to.appendln(lines.joinToString("\n"))
+ body()
+ ensureNewline()
to.appendln("```")
- appendLine(to)
+ appendLine()
}
- override fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit) {
- to.appendln()
+ override fun appendTable(vararg columns: String, body: () -> Unit) {
+ ensureParagraph()
body()
- to.appendln()
+ ensureParagraph()
}
- override fun appendTableBody(to: StringBuilder, body: () -> Unit) {
+ override fun appendTableBody(body: () -> Unit) {
body()
}
- override fun appendTableRow(to: StringBuilder, body: () -> Unit) {
+ override fun appendTableRow(body: () -> Unit) {
to.append("|")
body()
- to.appendln()
+ appendNewline()
}
- override fun appendTableCell(to: StringBuilder, body: () -> Unit) {
+ override fun appendTableCell(body: () -> Unit) {
to.append(" ")
+ inTableCell = true
+ lastTableCellStart = to.length
body()
+ inTableCell = false
to.append(" |")
}
- override fun formatNonBreakingSpace(): String = "&nbsp;"
+ override fun appendNonBreakingSpace() {
+ if (inCodeBlock) {
+ to.append(" ")
+ }
+ else {
+ to.append("&nbsp;")
+ }
+ }
}
open class MarkdownFormatService(locationService: LocationService,
diff --git a/core/src/main/kotlin/Formats/StructuredFormatService.kt b/core/src/main/kotlin/Formats/StructuredFormatService.kt
index 407c7018..f24c9c2d 100644
--- a/core/src/main/kotlin/Formats/StructuredFormatService.kt
+++ b/core/src/main/kotlin/Formats/StructuredFormatService.kt
@@ -5,95 +5,162 @@ import java.util.*
data class FormatLink(val text: String, val href: String)
-enum class ListKind {
- Ordered,
- Unordered
-}
-
abstract class StructuredOutputBuilder(val to: StringBuilder,
val location: Location,
val locationService: LocationService,
val languageService: LanguageService,
val extension: String) : FormattedOutputBuilder {
- abstract fun appendBlockCode(to: StringBuilder, lines: List<String>, language: String)
- abstract fun appendHeader(to: StringBuilder, text: String, level: Int = 1)
- abstract fun appendParagraph(to: StringBuilder, text: String)
- abstract fun appendLine(to: StringBuilder, text: String = "")
- abstract fun appendAnchor(to: StringBuilder, anchor: String)
-
- abstract fun appendTable(to: StringBuilder, vararg columns: String, body: () -> Unit)
- abstract fun appendTableBody(to: StringBuilder, body: () -> Unit)
- abstract fun appendTableRow(to: StringBuilder, body: () -> Unit)
- abstract fun appendTableCell(to: StringBuilder, body: () -> Unit)
-
- abstract fun formatText(text: String): String
- abstract fun formatSymbol(text: String): String
- abstract fun formatKeyword(text: String): String
- abstract fun formatIdentifier(text: String, kind: IdentifierKind, signature: String?): String
- fun formatEntity(text: String): String = text
- abstract fun formatLink(text: String, href: String): String
- open fun formatLink(link: FormatLink): String = formatLink(formatText(link.text), link.href)
- abstract fun formatStrong(text: String): String
- abstract fun formatStrikethrough(text: String): String
- abstract fun formatEmphasis(text: String): String
- abstract fun formatCode(code: String): String
- abstract fun formatUnorderedList(text: String): String
- abstract fun formatOrderedList(text: String): String
- abstract fun formatListItem(text: String, kind: ListKind): String
- abstract fun formatBreadcrumbs(items: Iterable<FormatLink>): String
- abstract fun formatNonBreakingSpace(): String
- open fun formatSoftLineBreak(): String = ""
- open fun formatIndentedSoftLineBreak(): String = ""
-
- open fun formatText(location: Location, nodes: Iterable<ContentNode>, listKind: ListKind = ListKind.Unordered): String {
- return nodes.map { formatText(location, it, listKind) }.joinToString("")
+ protected fun wrap(prefix: String, suffix: String, body: () -> Unit) {
+ to.append(prefix)
+ body()
+ to.append(suffix)
+ }
+
+ protected fun wrapIfNotEmpty(prefix: String, suffix: String, body: () -> Unit, checkEndsWith: Boolean = false) {
+ val startLength = to.length
+ to.append(prefix)
+ body()
+ if (checkEndsWith && to.endsWith(suffix)) {
+ to.setLength(to.length - suffix.length)
+ }
+ else if (to.length > startLength + prefix.length) {
+ to.append(suffix)
+ }
+ else {
+ to.setLength(startLength)
+ }
+ }
+
+ protected fun wrapInTag(tag: String,
+ body: () -> Unit,
+ newlineBeforeOpen: Boolean = false,
+ newlineAfterOpen: Boolean = false,
+ newlineAfterClose: Boolean = false) {
+ if (newlineBeforeOpen && !to.endsWith('\n')) to.appendln()
+ to.append("<$tag>")
+ if (newlineAfterOpen) to.appendln()
+ body()
+ to.append("</$tag>")
+ if (newlineAfterClose) to.appendln()
+ }
+
+ protected abstract fun ensureParagraph()
+
+ abstract fun appendBlockCode(language: String, body: () -> Unit)
+ abstract fun appendHeader(level: Int = 1, body: () -> Unit)
+ abstract fun appendParagraph(body: () -> Unit)
+ abstract fun appendLine()
+ abstract fun appendAnchor(anchor: String)
+
+ abstract fun appendTable(vararg columns: String, body: () -> Unit)
+ abstract fun appendTableBody(body: () -> Unit)
+ abstract fun appendTableRow(body: () -> Unit)
+ abstract fun appendTableCell(body: () -> Unit)
+
+ abstract fun appendText(text: String)
+
+ open fun appendSymbol(text: String) {
+ appendText(text)
+ }
+
+ open fun appendKeyword(text: String) {
+ appendText(text)
+ }
+
+ open fun appendIdentifier(text: String, kind: IdentifierKind, signature: String?) {
+ appendText(text)
+ }
+
+ fun appendEntity(text: String) {
+ to.append(text)
+ }
+
+ abstract fun appendLink(href: String, body: () -> Unit)
+
+ open fun appendLink(link: FormatLink) {
+ appendLink(link.href) { appendText(link.text) }
+ }
+
+ abstract fun appendStrong(body: () -> Unit)
+ abstract fun appendStrikethrough(body: () -> Unit)
+ abstract fun appendEmphasis(body: () -> Unit)
+ abstract fun appendCode(body: () -> Unit)
+ abstract fun appendUnorderedList(body: () -> Unit)
+ abstract fun appendOrderedList(body: () -> Unit)
+ abstract fun appendListItem(body: () -> Unit)
+
+ abstract fun appendBreadcrumbSeparator()
+ abstract fun appendNonBreakingSpace()
+ open fun appendSoftLineBreak() {
+ }
+
+ open fun appendIndentedSoftLineBreak() {
}
- fun formatText(location: Location, content: ContentNode, listKind: ListKind = ListKind.Unordered): String {
- return StringBuilder().apply { formatText(location, content, this, listKind) }.toString()
+ fun appendContent(content: List<ContentNode>) {
+ for (contentNode in content) {
+ appendContent(contentNode)
+ }
}
- open fun formatText(location: Location, content: ContentNode, to: StringBuilder, listKind: ListKind = ListKind.Unordered) {
+ open fun appendContent(content: ContentNode) {
when (content) {
- is ContentText -> to.append(formatText(content.text))
- is ContentSymbol -> to.append(formatSymbol(content.text))
- is ContentKeyword -> to.append(formatKeyword(content.text))
- is ContentIdentifier -> to.append(formatIdentifier(content.text, content.kind, content.signature))
- is ContentNonBreakingSpace -> to.append(formatNonBreakingSpace())
- is ContentSoftLineBreak -> to.append(formatSoftLineBreak())
- is ContentIndentedSoftLineBreak -> to.append(formatIndentedSoftLineBreak())
- is ContentEntity -> to.append(formatEntity(content.text))
- is ContentStrong -> to.append(formatStrong(formatText(location, content.children)))
- is ContentStrikethrough -> to.append(formatStrikethrough(formatText(location, content.children)))
- is ContentCode -> to.append(formatCode(formatText(location, content.children)))
- is ContentEmphasis -> to.append(formatEmphasis(formatText(location, content.children)))
- is ContentUnorderedList -> to.append(formatUnorderedList(formatText(location, content.children, ListKind.Unordered)))
- is ContentOrderedList -> to.append(formatOrderedList(formatText(location, content.children, ListKind.Ordered)))
- is ContentListItem -> to.append(formatListItem(formatText(location, content.children), listKind))
+ is ContentText -> appendText(content.text)
+ is ContentSymbol -> appendSymbol(content.text)
+ is ContentKeyword -> appendKeyword(content.text)
+ is ContentIdentifier -> appendIdentifier(content.text, content.kind, content.signature)
+ is ContentNonBreakingSpace -> appendNonBreakingSpace()
+ is ContentSoftLineBreak -> appendSoftLineBreak()
+ is ContentIndentedSoftLineBreak -> appendIndentedSoftLineBreak()
+ is ContentEntity -> appendEntity(content.text)
+ is ContentStrong -> appendStrong { appendContent(content.children) }
+ is ContentStrikethrough -> appendStrikethrough { appendContent(content.children) }
+ is ContentCode -> appendCode { appendContent(content.children) }
+ is ContentEmphasis -> appendEmphasis { appendContent(content.children) }
+ is ContentUnorderedList -> appendUnorderedList { appendContent(content.children) }
+ is ContentOrderedList -> appendOrderedList { appendContent(content.children) }
+ is ContentListItem -> appendListItem {
+ val child = content.children.singleOrNull()
+ if (child is ContentParagraph) {
+ appendContent(child.children)
+ }
+ else {
+ appendContent(content.children)
+ }
+ }
is ContentNodeLink -> {
val node = content.node
val linkTo = if (node != null) locationHref(location, node) else "#"
- val linkText = formatText(location, content.children)
- if (linkTo == ".") {
- to.append(linkText)
- } else {
- to.append(formatLink(linkText, linkTo))
+ appendLinkIfNotThisPage(linkTo, content)
+ }
+ is ContentExternalLink -> appendLinkIfNotThisPage(content.href, content)
+
+ is ContentParagraph -> {
+ if (!content.isEmpty()) {
+ appendParagraph { appendContent(content.children) }
}
}
- is ContentExternalLink -> {
- val linkText = formatText(location, content.children)
- if (content.href == ".") {
- to.append(linkText)
- } else {
- to.append(formatLink(linkText, content.href))
+
+ is ContentBlockCode -> appendBlockCode(content.language) {
+ for ((index, contentNode) in content.children.withIndex()) {
+ appendContent(contentNode)
+ if (index < content.children.size - 1) {
+ to.append("\n")
+ }
}
}
- is ContentParagraph -> appendParagraph(to, formatText(location, content.children))
- is ContentBlockCode -> appendBlockCode(to, content.children.map { formatText(location, it) }, content.language)
- is ContentHeading -> appendHeader(to, formatText(location, content.children), content.level)
- is ContentBlock -> to.append(formatText(location, content.children))
+ is ContentHeading -> appendHeader(content.level) { appendContent(content.children) }
+ is ContentBlock -> appendContent(content.children)
+ }
+ }
+
+ private fun appendLinkIfNotThisPage(href: String, content: ContentBlock) {
+ if (href == ".") {
+ appendContent(content.children)
+ } else {
+ appendLink(href) { appendContent(content.children) }
}
}
@@ -120,7 +187,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
private fun DocumentationNode.isModuleOrPackage(): Boolean =
kind == NodeKind.Module || kind == NodeKind.Package
- protected open fun appendAsSignature(to: StringBuilder, node: ContentNode, block: () -> Unit) {
+ protected open fun appendAsSignature(node: ContentNode, block: () -> Unit) {
block()
}
@@ -128,29 +195,40 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
block()
}
+ protected open fun appendBreadcrumbs(path: Iterable<FormatLink>) {
+ for ((index, item) in path.withIndex()) {
+ if (index > 0) {
+ appendBreadcrumbSeparator()
+
+ }
+ appendLink(item)
+ }
+ }
+
fun Content.getSectionsWithSubjects(): Map<String, List<ContentSection>> =
sections.filter { it.subjectName != null }.groupBy { it.tag }
- private fun ContentNode.signatureToText(location: Location): String {
- return if (this is ContentBlock && this.isEmpty()) {
- ""
- } else {
- val signatureAsCode = ContentCode()
- signatureAsCode.append(this)
- formatText(location, signatureAsCode)
+ private fun ContentNode.appendSignature() {
+ if (this is ContentBlock && this.isEmpty()) {
+ return
}
+
+ val signatureAsCode = ContentCode()
+ signatureAsCode.append(this)
+ appendContent(signatureAsCode)
}
open inner class PageBuilder(val nodes: Iterable<DocumentationNode>) {
open fun build() {
val breakdownByLocation = nodes.groupBy { node ->
- formatBreadcrumbs(node.path.filterNot { it.name.isEmpty() }.map { link(node, it) })
+ node.path.filterNot { it.name.isEmpty() }.map { link(node, it) }
}
- for ((breadcrumbs, items) in breakdownByLocation) {
- appendLine(to, breadcrumbs)
- appendLine(to)
- appendLocation(items.filter { it.kind != NodeKind.ExternalClass })
+ for ((path, nodes) in breakdownByLocation) {
+ appendBreadcrumbs(path)
+ appendLine()
+ appendLine()
+ appendLocation(nodes.filter { it.kind != NodeKind.ExternalClass })
}
}
@@ -159,13 +237,13 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
if (singleNode != null && singleNode.isModuleOrPackage()) {
if (singleNode.kind == NodeKind.Package) {
val packageName = if (singleNode.name.isEmpty()) "<root>" else singleNode.name
- appendHeader(to, "Package " + formatText(packageName), 2)
+ appendHeader(2) { appendText("Package $packageName") }
}
- formatText(location, singleNode.content, to)
+ appendContent(singleNode.content)
} else {
val breakdownByName = nodes.groupBy { node -> node.name }
for ((name, items) in breakdownByName) {
- appendHeader(to, formatText(name))
+ appendHeader { appendText(name) }
appendDocumentation(items)
}
}
@@ -178,6 +256,7 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
formatOverloadGroup(breakdownBySummary.values.single())
} else {
for ((summary, items) in breakdownBySummary) {
+ ensureParagraph()
appendAsOverloadGroup(to) {
formatOverloadGroup(items)
}
@@ -186,44 +265,43 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
}
private fun formatOverloadGroup(items: List<DocumentationNode>) {
- items.forEach {
- val rendered = languageService.render(it)
- it.detailOrNull(NodeKind.Signature)?.let {
- appendAnchor(to, it.name)
+ for ((index, item) in items.withIndex()) {
+ if (index > 0) appendLine()
+ val rendered = languageService.render(item)
+ item.detailOrNull(NodeKind.Signature)?.let {
+ appendAnchor(it.name)
}
- appendAsSignature(to, rendered) {
- to.append(formatCode(formatText(location, rendered)))
- it.appendSourceLink()
+ appendAsSignature(rendered) {
+ appendCode { appendContent(rendered) }
+ item.appendSourceLink()
}
- it.appendOverrides()
- it.appendDeprecation()
+ item.appendOverrides()
+ item.appendDeprecation()
}
// All items have exactly the same documentation, so we can use any item to render it
val item = items.first()
item.details(NodeKind.OverloadGroupNote).forEach {
- formatText(location, it.content, to)
+ appendContent(it.content)
}
- formatText(location, item.content.summary, to)
+ appendContent(item.content.summary)
item.appendDescription()
- appendLine(to)
- appendLine(to)
}
private fun DocumentationNode.appendSourceLink() {
val sourceUrl = details(NodeKind.SourceUrl).firstOrNull()
if (sourceUrl != null) {
to.append(" ")
- appendLine(to, formatLink("(source)", sourceUrl.name))
- } else {
- appendLine(to)
+ appendLink(sourceUrl.name) { to.append("(source)") }
}
}
private fun DocumentationNode.appendOverrides() {
overrides.forEach {
- to.append("Overrides ")
- val location = locationService.relativePathToLocation(this, it)
- appendLine(to, formatLink(FormatLink(it.owner!!.name + "." + it.name, location)))
+ appendParagraph {
+ to.append("Overrides ")
+ val location = locationService.relativePathToLocation(this, it)
+ appendLink(FormatLink(it.owner!!.name + "." + it.name, location))
+ }
}
}
@@ -231,55 +309,52 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
if (deprecation != null) {
val deprecationParameter = deprecation!!.details(NodeKind.Parameter).firstOrNull()
val deprecationValue = deprecationParameter?.details(NodeKind.Value)?.firstOrNull()
+ appendLine()
if (deprecationValue != null) {
- to.append(formatStrong("Deprecated:")).append(" ")
- appendLine(to, formatText(deprecationValue.name.removeSurrounding("\"")))
- appendLine(to)
+ appendStrong { to.append("Deprecated:") }
+ appendText(" " + deprecationValue.name.removeSurrounding("\""))
+ appendLine()
+ appendLine()
} else if (deprecation?.content != Content.Empty) {
- to.append(formatStrong("Deprecated:")).append(" ")
- formatText(location, deprecation!!.content, to)
+ appendStrong { to.append("Deprecated:") }
+ to.append(" ")
+ appendContent(deprecation!!.content)
} else {
- appendLine(to, formatStrong("Deprecated"))
- appendLine(to)
+ appendStrong { to.append("Deprecated") }
+ appendLine()
+ appendLine()
}
}
}
private fun DocumentationNode.appendDescription() {
if (content.description != ContentEmpty) {
- appendLine(to, formatText(location, content.description))
- appendLine(to)
+ appendContent(content.description)
}
content.getSectionsWithSubjects().forEach {
appendSectionWithSubject(it.key, it.value)
}
for (section in content.sections.filter { it.subjectName == null }) {
- val sectionText = buildString {
- appendLine(this, formatStrong(formatText(section.tag)))
- append(formatText(location, section))
+ appendParagraph {
+ appendStrong { appendText(section.tag) }
+ appendLine()
+ appendContent(section)
}
- appendParagraph(to, sectionText)
}
}
fun appendSectionWithSubject(title: String, subjectSections: List<ContentSection>) {
- appendHeader(to, title, 3)
- var first: Boolean = true
+ appendHeader(3) { appendText(title) }
subjectSections.forEach {
val subjectName = it.subjectName
if (subjectName != null) {
- if (first) {
- first = false
- }
- else {
- appendLine(to)
- }
+ ensureParagraph()
- appendAnchor(to, subjectName)
- to.append(formatCode(subjectName)).append(" - ")
- formatText(location, it, to)
- appendLine(to)
+ appendAnchor(subjectName)
+ appendCode { to.append(subjectName) }
+ to.append(" - ")
+ appendContent(it)
}
}
}
@@ -340,9 +415,9 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
node.inheritors.filter { it.kind != NodeKind.EnumItem })
if (node.kind == NodeKind.Module) {
- appendHeader(to, "Index", 3)
+ appendHeader(3) { to.append("Index") }
node.members(NodeKind.AllTypes).singleOrNull()?.let { allTypes ->
- to.append(formatLink(link(node, allTypes, { "All Types" })))
+ appendLink(link(node, allTypes, { "All Types" }))
}
}
}
@@ -350,25 +425,23 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
private fun appendSection(caption: String, members: List<DocumentationNode>, sortMembers: Boolean = true) {
if (members.isEmpty()) return
- appendHeader(to, caption, 3)
+ appendHeader(3) { appendText(caption) }
val children = if (sortMembers) members.sortedBy { it.name } else members
val membersMap = children.groupBy { link(node, it) }
- appendTable(to, "Name", "Summary") {
- appendTableBody(to) {
+ appendTable("Name", "Summary") {
+ appendTableBody() {
for ((memberLocation, members) in membersMap) {
- appendTableRow(to) {
- appendTableCell(to) {
- to.append(formatLink(memberLocation))
+ appendTableRow() {
+ appendTableCell {
+ appendLink(memberLocation)
}
- appendTableCell(to) {
- val breakdownBySummary = members.groupBy { formatText(location, it.summary) }
+ appendTableCell {
+ val breakdownBySummary = members.groupBy { it.summary }
for ((summary, items) in breakdownBySummary) {
appendSummarySignatures(items)
- if (!summary.isEmpty()) {
- to.append(summary)
- }
+ appendContent(summary)
}
}
}
@@ -380,19 +453,20 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
private fun appendSummarySignatures(items: List<DocumentationNode>) {
val summarySignature = languageService.summarizeSignatures(items)
if (summarySignature != null) {
- appendAsSignature(to, summarySignature) {
- appendLine(to, summarySignature.signatureToText(location))
+ appendAsSignature(summarySignature) {
+ summarySignature.appendSignature()
}
return
}
val renderedSignatures = items.map { languageService.render(it, RenderMode.SUMMARY) }
renderedSignatures.subList(0, renderedSignatures.size - 1).forEach {
- appendAsSignature(to, it) {
- appendLine(to, it.signatureToText(location))
+ appendAsSignature(it) {
+ it.appendSignature()
}
+ appendLine()
}
- appendAsSignature(to, renderedSignatures.last()) {
- to.append(renderedSignatures.last().signatureToText(location))
+ appendAsSignature(renderedSignatures.last()) {
+ renderedSignatures.last().appendSignature()
}
}
}
@@ -401,26 +475,26 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
: PageBuilder(listOf(node)) {
override fun build() {
- to.append(formatText(location, node.owner!!.summary))
- appendHeader(to, "All Types", 3)
+ appendContent(node.owner!!.summary)
+ appendHeader(3) { to.append("All Types") }
- appendTable(to, "Name", "Summary") {
- appendTableBody(to) {
+ appendTable("Name", "Summary") {
+ appendTableBody() {
for (type in node.members) {
- appendTableRow(to) {
- appendTableCell(to) {
- to.append(formatLink(link(node, type) {
+ appendTableRow() {
+ appendTableCell {
+ appendLink(link(node, type) {
if (it.kind == NodeKind.ExternalClass) it.name else it.qualifiedName()
- }))
+ })
if (type.kind == NodeKind.ExternalClass) {
val packageName = type.owner?.name
if (packageName != null) {
- to.append(formatText(" (extensions in package $packageName)"))
+ appendText(" (extensions in package $packageName)")
}
}
}
- appendTableCell(to) {
- to.append(formatText(location, type.summary))
+ appendTableCell {
+ appendContent(type.summary)
}
}
}
@@ -443,12 +517,11 @@ abstract class StructuredOutputBuilder(val to: StringBuilder,
PageBuilder(nodes).build()
}
}
-
}
abstract class StructuredFormatService(locationService: LocationService,
val languageService: LanguageService,
override val extension: String,
- val linkExtension: String = extension) : FormatService {
+ linkExtension: String = extension) : FormatService {
val locationService: LocationService = locationService.withExtension(linkExtension)
}
diff --git a/core/src/main/kotlin/Java/JavadocParser.kt b/core/src/main/kotlin/Java/JavadocParser.kt
index 1378a5a7..0fb98230 100644
--- a/core/src/main/kotlin/Java/JavadocParser.kt
+++ b/core/src/main/kotlin/Java/JavadocParser.kt
@@ -64,7 +64,7 @@ class JavadocParser(private val refGraph: NodeReferenceGraph) : JavaDocumentatio
htmlBuilder.append(it.text)
}
}
- val doc = Jsoup.parse(htmlBuilder.toString().trimStart())
+ val doc = Jsoup.parse(htmlBuilder.toString().trim())
doc.body().childNodes().forEach {
convertHtmlNode(it)
}
diff --git a/core/src/test/kotlin/format/GFMFormatTest.kt b/core/src/test/kotlin/format/GFMFormatTest.kt
index d21885d3..5327c9dc 100644
--- a/core/src/test/kotlin/format/GFMFormatTest.kt
+++ b/core/src/test/kotlin/format/GFMFormatTest.kt
@@ -11,6 +11,10 @@ class GFMFormatTest {
verifyGFMNodeByName("sample", "Foo")
}
+ @Test fun listInTableCell() {
+ verifyGFMNodeByName("listInTableCell", "Foo")
+ }
+
private fun verifyGFMNodeByName(fileName: String, name: String) {
verifyOutput("testdata/format/gfm/$fileName.kt", ".md") { model, output ->
gfmService.createOutputBuilder(output, tempLocation).appendNodes(model.members.single().members.filter { it.name == name })
diff --git a/core/src/test/kotlin/model/JavaTest.kt b/core/src/test/kotlin/model/JavaTest.kt
index a3a3f772..a89b7a11 100644
--- a/core/src/test/kotlin/model/JavaTest.kt
+++ b/core/src/test/kotlin/model/JavaTest.kt
@@ -17,12 +17,12 @@ public class JavaTest {
with(content.sections[0]) {
assertEquals("Parameters", tag)
assertEquals("name", subjectName)
- assertEquals("is String parameter ", toTestString())
+ assertEquals("is String parameter", toTestString())
}
with(content.sections[1]) {
assertEquals("Parameters", tag)
assertEquals("value", subjectName)
- assertEquals("is int parameter ", toTestString())
+ assertEquals("is int parameter", toTestString())
}
with(content.sections[2]) {
assertEquals("Author", tag)
diff --git a/core/testdata/format/accessor.md b/core/testdata/format/accessor.md
index eb326727..dcdef0f8 100644
--- a/core/testdata/format/accessor.md
+++ b/core/testdata/format/accessor.md
@@ -1,6 +1,5 @@
[test](test/index) / [C](test/-c/index) / [x](test/-c/x)
-
# x
`var x: String`
@@ -9,14 +8,7 @@
The getter returns an empty string.
-
-
-
**Setter**
The setter does nothing.
-
-
-
-
diff --git a/core/testdata/format/annotatedTypeParameter.md b/core/testdata/format/annotatedTypeParameter.md
index 7d26a162..0aa1b9d7 100644
--- a/core/testdata/format/annotatedTypeParameter.md
+++ b/core/testdata/format/annotatedTypeParameter.md
@@ -1,8 +1,5 @@
[test](test/index) / [containsAll](test/contains-all)
-
# containsAll
-`fun &lt;E&gt; containsAll(elements:&nbsp;Collection&lt;@UnsafeVariance E&gt;): @UnsafeVariance E`
-
-
+`fun <E> containsAll(elements: Collection<@UnsafeVariance E>): @UnsafeVariance E` \ No newline at end of file
diff --git a/core/testdata/format/annotationClass.md b/core/testdata/format/annotationClass.md
index 03548aa3..2f4da736 100644
--- a/core/testdata/format/annotationClass.md
+++ b/core/testdata/format/annotationClass.md
@@ -1,14 +1,10 @@
[test](test/index) / [fancy](test/fancy/index)
-
# fancy
`annotation class fancy`
-
-
### Constructors
-
| [&lt;init&gt;](test/fancy/-init-) | `fancy()` |
diff --git a/core/testdata/format/annotationClass.package.md b/core/testdata/format/annotationClass.package.md
index f7c8405d..f52b28b6 100644
--- a/core/testdata/format/annotationClass.package.md
+++ b/core/testdata/format/annotationClass.package.md
@@ -1,11 +1,8 @@
[test](test/index)
-
## Package &lt;root&gt;
-
### Annotations
-
| [fancy](test/fancy/index) | `annotation class fancy` |
diff --git a/core/testdata/format/annotationParams.md b/core/testdata/format/annotationParams.md
index 8cdd6e96..132078ce 100644
--- a/core/testdata/format/annotationParams.md
+++ b/core/testdata/format/annotationParams.md
@@ -1,8 +1,5 @@
[test](test/index) / [f](test/f)
-
# f
-`@JvmName("FFF") fun f(): Unit`
-
-
+`@JvmName("FFF") fun f(): Unit` \ No newline at end of file
diff --git a/core/testdata/format/annotations.md b/core/testdata/format/annotations.md
index b898d55c..cc27d5af 100644
--- a/core/testdata/format/annotations.md
+++ b/core/testdata/format/annotations.md
@@ -1,26 +1,18 @@
[test](test/index) / [Foo](test/-foo/index)
-
# Foo
`data class Foo`
-
-
### Constructors
-
| [&lt;init&gt;](test/-foo/-init-) | `Foo()` |
-
### Properties
-
| [x](test/-foo/x) | `val x: Int` |
-
### Functions
-
-| [bar](test/-foo/bar) | `fun bar(notInlined:&nbsp;()&nbsp;-&gt;&nbsp;Unit): Unit` |
+| [bar](test/-foo/bar) | `fun bar(notInlined: () -> Unit): Unit` |
diff --git a/core/testdata/format/arrayAverage.md b/core/testdata/format/arrayAverage.md
index 9ffa3650..7cc31c47 100644
--- a/core/testdata/format/arrayAverage.md
+++ b/core/testdata/format/arrayAverage.md
@@ -1,25 +1,14 @@
[test](test/index) / [XArray](test/-x-array/index)
-
# XArray
-`class XArray&lt;T&gt;`
-
-
+`class XArray<T>`
### Constructors
-
| [&lt;init&gt;](test/-x-array/-init-) | `XArray()` |
-
### Extension Functions
-
-| [average](test/average) | `fun [XArray](test/-x-array/index)&lt;out&nbsp;Byte&gt;.average(): Double`
-`fun [XArray](test/-x-array/index)&lt;out&nbsp;Double&gt;.average(): Double`
-`fun [XArray](test/-x-array/index)&lt;out&nbsp;Float&gt;.average(): Double`
-`fun [XArray](test/-x-array/index)&lt;out&nbsp;Int&gt;.average(): Double`
-`fun [XArray](test/-x-array/index)&lt;out&nbsp;Long&gt;.average(): Double`
-`fun [XArray](test/-x-array/index)&lt;out&nbsp;Short&gt;.average(): Double` |
+| [average](test/average) | `fun `[`XArray`](test/-x-array/index)`<out Byte>.average(): Double`<br>`fun `[`XArray`](test/-x-array/index)`<out Double>.average(): Double`<br>`fun `[`XArray`](test/-x-array/index)`<out Float>.average(): Double`<br>`fun `[`XArray`](test/-x-array/index)`<out Int>.average(): Double`<br>`fun `[`XArray`](test/-x-array/index)`<out Long>.average(): Double`<br>`fun `[`XArray`](test/-x-array/index)`<out Short>.average(): Double` |
diff --git a/core/testdata/format/bracket.html b/core/testdata/format/bracket.html
index f96c6459..8f4310c3 100644
--- a/core/testdata/format/bracket.html
+++ b/core/testdata/format/bracket.html
@@ -7,9 +7,7 @@
<br/>
<h1>foo</h1>
<a name="$foo()"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>bar[]</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/brokenLink.html b/core/testdata/format/brokenLink.html
index 860ffc26..8803781a 100644
--- a/core/testdata/format/brokenLink.html
+++ b/core/testdata/format/brokenLink.html
@@ -7,9 +7,7 @@
<br/>
<h1>f</h1>
<a name="$f()"></a>
-<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>This references <a href="#">noSuchIdentifier</a>.</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/classWithCompanionObject.html b/core/testdata/format/classWithCompanionObject.html
index 679420bd..376bae9b 100644
--- a/core/testdata/format/classWithCompanionObject.html
+++ b/core/testdata/format/classWithCompanionObject.html
@@ -6,9 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-klass/index">Klass</a><br/>
<br/>
<h1>Klass</h1>
-<code><span class="keyword">class </span><span class="identifier">Klass</span></code><br/>
-<br/>
-<br/>
+<code><span class="keyword">class </span><span class="identifier">Klass</span></code>
<h3>Constructors</h3>
<table>
<tbody>
diff --git a/core/testdata/format/classWithCompanionObject.md b/core/testdata/format/classWithCompanionObject.md
index 9398c3d3..45684c0e 100644
--- a/core/testdata/format/classWithCompanionObject.md
+++ b/core/testdata/format/classWithCompanionObject.md
@@ -1,26 +1,18 @@
[test](test/index) / [Klass](test/-klass/index)
-
# Klass
`class Klass`
-
-
### Constructors
-
| [&lt;init&gt;](test/-klass/-init-) | `Klass()` |
-
### Companion Object Properties
-
| [x](test/-klass/x) | `val x: Int` |
-
### Companion Object Functions
-
| [foo](test/-klass/foo) | `fun foo(): Unit` |
diff --git a/core/testdata/format/codeBlock.md b/core/testdata/format/codeBlock.md
index 08710390..016ea9e8 100644
--- a/core/testdata/format/codeBlock.md
+++ b/core/testdata/format/codeBlock.md
@@ -1,31 +1,19 @@
[test](test/index) / [Throws](test/-throws/index)
-
# Throws
`class Throws`
This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
-
Example:
-
```
Throws(IOException::class)
fun readFile(name: String): String {...}
```
-
-
-
-
-
### Constructors
-
-| [&lt;init&gt;](test/-throws/-init-) | `Throws()`
-This annotation indicates what exceptions should be declared by a function when compiled to a JVM method.
-
- |
+| [&lt;init&gt;](test/-throws/-init-) | `Throws()`<br>This annotation indicates what exceptions should be declared by a function when compiled to a JVM method. |
diff --git a/core/testdata/format/codeSpan.html b/core/testdata/format/codeSpan.html
index 216a15e9..f28e6957 100644
--- a/core/testdata/format/codeSpan.html
+++ b/core/testdata/format/codeSpan.html
@@ -7,9 +7,7 @@
<br/>
<h1>foo</h1>
<a name="$foo()"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>This is a <code>code span</code>.</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/companionObjectExtension.md b/core/testdata/format/companionObjectExtension.md
index 271da5b0..e019c184 100644
--- a/core/testdata/format/companionObjectExtension.md
+++ b/core/testdata/format/companionObjectExtension.md
@@ -1,23 +1,14 @@
[test](test/index) / [Foo](test/-foo/index)
-
# Foo
`class Foo`
-
-
### Constructors
-
| [&lt;init&gt;](test/-foo/-init-) | `Foo()` |
-
### Companion Object Extension Properties
-
-| [x](test/x) | `val Foo.Default.x: Int`
-The default object property.
-
- |
+| [x](test/x) | `val Foo.Default.x: Int`<br>The default object property. |
diff --git a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html
index 295366b3..ca0725a0 100644
--- a/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html
+++ b/core/testdata/format/crossLanguage/kotlinExtendsJava/Bar.html
@@ -6,10 +6,8 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/test/index">test</a>&nbsp;/&nbsp;<a href="test/test/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/test/-foo/index"><span class="identifier">Foo</span></a></code><br/>
+<code><span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/test/-foo/index"><span class="identifier">Foo</span></a></code>
<p>See <a href="test/test/-foo/xyzzy">xyzzy</a></p>
-<br/>
-<br/>
<h3>Constructors</h3>
<table>
<tbody>
@@ -17,7 +15,8 @@
<td>
<a href="test/test/-bar/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code><p>See <a href="test/test/-foo/xyzzy">xyzzy</a></p>
+<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code>
+<p>See <a href="test/test/-foo/xyzzy">xyzzy</a></p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/deprecated.class.html b/core/testdata/format/deprecated.class.html
index 71470c63..4d998c69 100644
--- a/core/testdata/format/deprecated.class.html
+++ b/core/testdata/format/deprecated.class.html
@@ -8,8 +8,6 @@
<code><span class="keyword">class </span><s><span class="identifier">C</span></s></code><br/>
<strong>Deprecated:</strong> This class sucks<br/>
<br/>
-<br/>
-<br/>
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/f">f</a><br/>
<br/>
<h1>f</h1>
@@ -17,8 +15,6 @@
<code><span class="keyword">fun </span><s><span class="identifier">f</span></s><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<strong>Deprecated:</strong> This function sucks<br/>
<br/>
-<br/>
-<br/>
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/p">p</a><br/>
<br/>
<h1>p</h1>
@@ -26,7 +22,5 @@
<code><span class="keyword">val </span><s><span class="identifier">p</span></s><span class="symbol">: </span><span class="identifier">Int</span></code><br/>
<strong>Deprecated:</strong> This property sucks<br/>
<br/>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/emptyDescription.md b/core/testdata/format/emptyDescription.md
index e82e7228..8c0fe109 100644
--- a/core/testdata/format/emptyDescription.md
+++ b/core/testdata/format/emptyDescription.md
@@ -1,11 +1,8 @@
[test](test/index) / [fn](test/fn)
-
# fn
`fun fn(): Unit`
Function fn
-
-
diff --git a/core/testdata/format/entity.html b/core/testdata/format/entity.html
index 9c778020..db6f833f 100644
--- a/core/testdata/format/entity.html
+++ b/core/testdata/format/entity.html
@@ -6,10 +6,8 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">class </span><span class="identifier">Bar</span></code><br/>
+<code><span class="keyword">class </span><span class="identifier">Bar</span></code>
<p>Copyright &copy; JetBrains 2015 &#x22;</p>
-<br/>
-<br/>
<h3>Constructors</h3>
<table>
<tbody>
@@ -17,7 +15,8 @@
<td>
<a href="test/-bar/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code><p>Copyright &copy; JetBrains 2015 &#x22;</p>
+<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code>
+<p>Copyright &copy; JetBrains 2015 &#x22;</p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/enumClass.md b/core/testdata/format/enumClass.md
index 4f390dab..d3a6f186 100644
--- a/core/testdata/format/enumClass.md
+++ b/core/testdata/format/enumClass.md
@@ -1,15 +1,11 @@
[test](test/index) / [InlineOption](test/-inline-option/index)
-
# InlineOption
`enum class InlineOption`
-
-
### Enum Values
-
| [ONLY_LOCAL_RETURN](test/-inline-option/-o-n-l-y_-l-o-c-a-l_-r-e-t-u-r-n) | |
| [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k) | |
diff --git a/core/testdata/format/enumClass.value.md b/core/testdata/format/enumClass.value.md
index bcb685d1..feed2fe5 100644
--- a/core/testdata/format/enumClass.value.md
+++ b/core/testdata/format/enumClass.value.md
@@ -1,8 +1,5 @@
[test](test/index) / [InlineOption](test/-inline-option/index) / [LOCAL_CONTINUE_AND_BREAK](test/-inline-option/-l-o-c-a-l_-c-o-n-t-i-n-u-e_-a-n-d_-b-r-e-a-k)
-
# LOCAL_CONTINUE_AND_BREAK
-`LOCAL_CONTINUE_AND_BREAK`
-
-
+`LOCAL_CONTINUE_AND_BREAK` \ No newline at end of file
diff --git a/core/testdata/format/exceptionClass.md b/core/testdata/format/exceptionClass.md
index b3464d6f..df3457d7 100644
--- a/core/testdata/format/exceptionClass.md
+++ b/core/testdata/format/exceptionClass.md
@@ -1,14 +1,10 @@
[test](test/index) / [MyException](test/-my-exception/index)
-
# MyException
-`class MyException&nbsp;:&nbsp;[Exception](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html)`
-
-
+`class MyException : `[`Exception`](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html)
### Constructors
-
| [&lt;init&gt;](test/-my-exception/-init-) | `MyException()` |
diff --git a/core/testdata/format/exceptionClass.package.md b/core/testdata/format/exceptionClass.package.md
index fa220fe7..e27dd0ab 100644
--- a/core/testdata/format/exceptionClass.package.md
+++ b/core/testdata/format/exceptionClass.package.md
@@ -1,11 +1,8 @@
[test](test/index)
-
## Package &lt;root&gt;
-
### Exceptions
-
-| [MyException](test/-my-exception/index) | `class MyException&nbsp;:&nbsp;[Exception](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html)` |
+| [MyException](test/-my-exception/index) | `class MyException : `[`Exception`](http://docs.oracle.com/javase/6/docs/api/java/lang/Exception.html) |
diff --git a/core/testdata/format/extensionFunctionParameter.md b/core/testdata/format/extensionFunctionParameter.md
index 6980912d..b459d49e 100644
--- a/core/testdata/format/extensionFunctionParameter.md
+++ b/core/testdata/format/extensionFunctionParameter.md
@@ -1,8 +1,5 @@
[test](test/index) / [apply](test/apply)
-
# apply
-`inline fun &lt;T&gt; T.apply(f:&nbsp;T.()&nbsp;-&gt;&nbsp;Unit): T`
-
-
+`inline fun <T> T.apply(f: T.() -> Unit): T` \ No newline at end of file
diff --git a/core/testdata/format/extensionWithDocumentedReceiver.md b/core/testdata/format/extensionWithDocumentedReceiver.md
index 6fd179c6..125da37e 100644
--- a/core/testdata/format/extensionWithDocumentedReceiver.md
+++ b/core/testdata/format/extensionWithDocumentedReceiver.md
@@ -1,15 +1,11 @@
[test](test/index) / [kotlin.String](test/kotlin.-string/index) / [fn](test/kotlin.-string/fn)
-
# fn
`fun String.fn(): Unit`
Function with receiver
-
**Receiver**
must be a non-empty string
-
-
diff --git a/core/testdata/format/extensions.class.md b/core/testdata/format/extensions.class.md
index c66cdb01..f75b4dc8 100644
--- a/core/testdata/format/extensions.class.md
+++ b/core/testdata/format/extensions.class.md
@@ -1,16 +1,7 @@
[test](test/index) / [foo](test/foo/index) / [kotlin.String](test/foo/kotlin.-string/index)
-
### Extensions for kotlin.String
-
-| [fn](test/foo/kotlin.-string/fn) | `fun String.fn(): Unit`
-`fun String.fn(x:&nbsp;Int): Unit`
-Function with receiver
-
- |
-| [foobar](test/foo/kotlin.-string/foobar) | `val String.foobar: Int`
-Property with receiver.
-
- |
+| [fn](test/foo/kotlin.-string/fn) | `fun String.fn(): Unit`<br>`fun String.fn(x: Int): Unit`<br>Function with receiver |
+| [foobar](test/foo/kotlin.-string/foobar) | `val String.foobar: Int`<br>Property with receiver. |
diff --git a/core/testdata/format/extensions.package.md b/core/testdata/format/extensions.package.md
index 76ff3676..4dc0cfab 100644
--- a/core/testdata/format/extensions.package.md
+++ b/core/testdata/format/extensions.package.md
@@ -1,11 +1,8 @@
[test](test/index) / [foo](test/foo/index)
-
## Package foo
-
### Extensions for External Classes
-
| [kotlin.String](test/foo/kotlin.-string/index) | |
diff --git a/core/testdata/format/functionWithDefaultParameter.md b/core/testdata/format/functionWithDefaultParameter.md
index 21e9eff7..568c106c 100644
--- a/core/testdata/format/functionWithDefaultParameter.md
+++ b/core/testdata/format/functionWithDefaultParameter.md
@@ -1,8 +1,5 @@
[test](test/index) / [f](test/f)
-
# f
-`fun f(x:&nbsp;String&nbsp;=&nbsp;""): Unit`
-
-
+`fun f(x: String = ""): Unit` \ No newline at end of file
diff --git a/core/testdata/format/genericInheritedExtensions.md b/core/testdata/format/genericInheritedExtensions.md
index e02683a9..a3091aeb 100644
--- a/core/testdata/format/genericInheritedExtensions.md
+++ b/core/testdata/format/genericInheritedExtensions.md
@@ -1,21 +1,15 @@
[test](test/index) / [Bar](test/-bar/index)
-
# Bar
-`class Bar&lt;T&gt;&nbsp;:&nbsp;[Foo](test/-foo/index)&lt;T&gt;`
-
-
+`class Bar<T> : `[`Foo`](test/-foo/index)`<T>`
### Constructors
-
| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
-
### Extension Functions
-
-| [first](test/first) | `fun &lt;T&gt; [Foo](test/-foo/index)&lt;T&gt;.first(): Unit` |
-| [second](test/second) | `fun &lt;T&gt; [Bar](test/-bar/index)&lt;T&gt;.second(): Unit` |
+| [first](test/first) | `fun <T> `[`Foo`](test/-foo/index)`<T>.first(): Unit` |
+| [second](test/second) | `fun <T> `[`Bar`](test/-bar/index)`<T>.second(): Unit` |
diff --git a/core/testdata/format/gfm/listInTableCell.kt b/core/testdata/format/gfm/listInTableCell.kt
new file mode 100644
index 00000000..2f4fdf54
--- /dev/null
+++ b/core/testdata/format/gfm/listInTableCell.kt
@@ -0,0 +1,8 @@
+class Foo {
+ /**
+ * 1. Foo
+ * 1. Bar
+ */
+ fun foo() {
+ }
+}
diff --git a/core/testdata/format/gfm/listInTableCell.md b/core/testdata/format/gfm/listInTableCell.md
new file mode 100644
index 00000000..73152ac9
--- /dev/null
+++ b/core/testdata/format/gfm/listInTableCell.md
@@ -0,0 +1,17 @@
+[test](test/index) / [Foo](test/-foo/index)
+
+# Foo
+
+`class Foo`
+
+### Constructors
+
+| Name | Summary |
+|---|---|
+| [&lt;init&gt;](test/-foo/-init-) | `Foo()` |
+
+### Functions
+
+| Name | Summary |
+|---|---|
+| [foo](test/-foo/foo) | `fun foo(): Unit`<ol><li>Foo</li><li>Bar</li></ol> |
diff --git a/core/testdata/format/gfm/sample.md b/core/testdata/format/gfm/sample.md
index 1a26e599..c2af1c1e 100644
--- a/core/testdata/format/gfm/sample.md
+++ b/core/testdata/format/gfm/sample.md
@@ -1,33 +1,20 @@
[test](test/index) / [Foo](test/-foo/index)
-
# Foo
`class Foo`
The class Foo.
-
-
-
### Constructors
| Name | Summary |
|---|---|
-| [&lt;init&gt;](test/-foo/-init-) | `Foo()`
-The class Foo.
-
- |
+| [&lt;init&gt;](test/-foo/-init-) | `Foo()`<br>The class Foo. |
### Functions
| Name | Summary |
|---|---|
-| [bar](test/-foo/bar) | `fun bar(): Unit`
-The method bar.
-
- |
-| [baz](test/-foo/baz) | `fun baz(): Unit`
-The method baz.
-
- |
+| [bar](test/-foo/bar) | `fun bar(): Unit`<br>The method bar. |
+| [baz](test/-foo/baz) | `fun baz(): Unit`<br>The method baz. |
diff --git a/core/testdata/format/htmlEscaping.html b/core/testdata/format/htmlEscaping.html
index ad8a7bed..7ddcec8e 100644
--- a/core/testdata/format/htmlEscaping.html
+++ b/core/testdata/format/htmlEscaping.html
@@ -7,9 +7,7 @@
<br/>
<h1>x</h1>
<a name="$x()"></a>
-<code><span class="keyword">fun </span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span> <span class="identifier">x</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">T</span><span class="symbol">?</span></code><br/>
+<code><span class="keyword">fun </span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span> <span class="identifier">x</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">T</span><span class="symbol">?</span></code>
<p>Special characters: &lt; is "less than", &gt; is "greater than", &amp; is "ampersand"</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/inapplicableExtensionFunctions.md b/core/testdata/format/inapplicableExtensionFunctions.md
index 8460cf2f..30246faa 100644
--- a/core/testdata/format/inapplicableExtensionFunctions.md
+++ b/core/testdata/format/inapplicableExtensionFunctions.md
@@ -1,20 +1,14 @@
[test](test/index) / [Bar](test/-bar/index)
-
# Bar
-`class Bar&nbsp;:&nbsp;[Foo](test/-foo/index)&lt;Char&gt;`
-
-
+`class Bar : `[`Foo`](test/-foo/index)`<Char>`
### Constructors
-
| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
-
### Extension Functions
-
-| [xyzzy](test/xyzzy) | `fun [Bar](test/-bar/index).xyzzy(): Unit` |
+| [xyzzy](test/xyzzy) | `fun `[`Bar`](test/-bar/index)`.xyzzy(): Unit` |
diff --git a/core/testdata/format/inheritedCompanionObjectProperties.md b/core/testdata/format/inheritedCompanionObjectProperties.md
index 9ec24edb..b3b3230e 100644
--- a/core/testdata/format/inheritedCompanionObjectProperties.md
+++ b/core/testdata/format/inheritedCompanionObjectProperties.md
@@ -1,38 +1,26 @@
[test](test/index) / [C](test/-c/index)
-
# C
-`class C&nbsp;:&nbsp;[A](test/-a/index)`
-
-
+`class C : `[`A`](test/-a/index)
### Constructors
-
| [&lt;init&gt;](test/-c/-init-) | `C()` |
-
### Functions
-
| [xyzzy](test/-c/xyzzy) | `fun xyzzy(): Unit` |
-
### Inherited Functions
-
| [foo](test/-a/foo) | `fun foo(): Unit` |
-
### Companion Object Functions
-
| [shazam](test/-c/shazam) | `fun shazam(): Unit` |
-
### Inherited Companion Object Functions
-
| [bar](test/-b/bar) | `fun bar(): Unit` |
diff --git a/core/testdata/format/inheritedExtensions.md b/core/testdata/format/inheritedExtensions.md
index 79137eac..611b4f6a 100644
--- a/core/testdata/format/inheritedExtensions.md
+++ b/core/testdata/format/inheritedExtensions.md
@@ -1,21 +1,15 @@
[test](test/index) / [Bar](test/-bar/index)
-
# Bar
-`class Bar&nbsp;:&nbsp;[Foo](test/-foo/index)`
-
-
+`class Bar : `[`Foo`](test/-foo/index)
### Constructors
-
| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
-
### Extension Functions
-
-| [first](test/first) | `fun [Foo](test/-foo/index).first(): Unit` |
-| [second](test/second) | `fun [Bar](test/-bar/index).second(): Unit` |
+| [first](test/first) | `fun `[`Foo`](test/-foo/index)`.first(): Unit` |
+| [second](test/second) | `fun `[`Bar`](test/-bar/index)`.second(): Unit` |
diff --git a/core/testdata/format/inheritedMembers.md b/core/testdata/format/inheritedMembers.md
index d58d3974..bed5bd44 100644
--- a/core/testdata/format/inheritedMembers.md
+++ b/core/testdata/format/inheritedMembers.md
@@ -1,38 +1,26 @@
[test](test/index) / [Bar](test/-bar/index)
-
# Bar
-`class Bar&nbsp;:&nbsp;[Foo](test/-foo/index)`
-
-
+`class Bar : `[`Foo`](test/-foo/index)
### Constructors
-
| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
-
### Properties
-
| [secondProp](test/-bar/second-prop) | `val secondProp: Int` |
-
### Inherited Properties
-
| [firstProp](test/-foo/first-prop) | `val firstProp: Int` |
-
### Functions
-
| [second](test/-bar/second) | `fun second(): Unit` |
-
### Inherited Functions
-
| [first](test/-foo/first) | `fun first(): Unit` |
diff --git a/core/testdata/format/javaCodeInParam.md b/core/testdata/format/javaCodeInParam.md
index 02d5d974..696abdc4 100644
--- a/core/testdata/format/javaCodeInParam.md
+++ b/core/testdata/format/javaCodeInParam.md
@@ -1,24 +1,14 @@
[test](test/index) / [C](test/-c/index)
-
# C
-`protected open class C&lt;T&nbsp;:&nbsp;Any&gt;`
-
-
-
+`protected open class C<T : Any>`
### Parameters
`T` - this is `some code` and other text
-
-
### Constructors
-
-| [&lt;init&gt;](test/-c/-init-) | `C()`
-
-
- |
+| [&lt;init&gt;](test/-c/-init-) | `C()` |
diff --git a/core/testdata/format/javaCodeLiteralTags.md b/core/testdata/format/javaCodeLiteralTags.md
index a705a01c..99dbccfd 100644
--- a/core/testdata/format/javaCodeLiteralTags.md
+++ b/core/testdata/format/javaCodeLiteralTags.md
@@ -1,32 +1,16 @@
[test](test/index) / [C](test/-c/index)
-
# C
`protected open class C`
-
-`A&lt;B&gt;C`
-
-
-A&lt;B&gt;C
-
-
-
+`A<B>C`
-### Constructors
-
-
-| [&lt;init&gt;](test/-c/-init-) | `C()`
-
-`A&lt;B&gt;C`
-
-
A&lt;B&gt;C
-
+### Constructors
- |
+| [&lt;init&gt;](test/-c/-init-) | `C()`<br>`A<B>C` <br>A&lt;B&gt;C |
diff --git a/core/testdata/format/javaDeprecated.html b/core/testdata/format/javaDeprecated.html
index 35c0b820..619a3d5a 100644
--- a/core/testdata/format/javaDeprecated.html
+++ b/core/testdata/format/javaDeprecated.html
@@ -8,8 +8,6 @@
<h1>foo</h1>
<a name="Foo$foo()"></a>
<code><span class="keyword">open</span> <span class="keyword">fun </span><s><span class="identifier">foo</span></s><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
-<strong>Deprecated:</strong> use <code><a href="test/-foo/bar">#bar</a></code> instead <p></p>
-<br/>
-<br/>
+<strong>Deprecated:</strong> use <code><a href="test/-foo/bar">#bar</a></code> instead
</BODY>
</HTML>
diff --git a/core/testdata/format/javaLinkTag.html b/core/testdata/format/javaLinkTag.html
index 997e52ab..20940cc2 100644
--- a/core/testdata/format/javaLinkTag.html
+++ b/core/testdata/format/javaLinkTag.html
@@ -6,10 +6,8 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-foo/index">Foo</a><br/>
<br/>
<h1>Foo</h1>
-<code><span class="keyword">protected</span> <span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Foo</span></code><br/>
-<p>Call <code><a href="test/-foo/bar">#bar()</a></code> to do the job. </p>
-<br/>
-<br/>
+<code><span class="keyword">protected</span> <span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Foo</span></code>
+<p>Call <code><a href="test/-foo/bar">#bar()</a></code> to do the job.</p>
<h3>Constructors</h3>
<table>
<tbody>
@@ -17,7 +15,8 @@
<td>
<a href="test/-foo/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Foo</span><span class="symbol">(</span><span class="symbol">)</span></code><p>Call <code><a href="test/-foo/bar">#bar()</a></code> to do the job. </p>
+<code><span class="identifier">Foo</span><span class="symbol">(</span><span class="symbol">)</span></code>
+<p>Call <code><a href="test/-foo/bar">#bar()</a></code> to do the job.</p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/javaLinkTagWithLabel.html b/core/testdata/format/javaLinkTagWithLabel.html
index fdddadf9..9194229a 100644
--- a/core/testdata/format/javaLinkTagWithLabel.html
+++ b/core/testdata/format/javaLinkTagWithLabel.html
@@ -6,10 +6,8 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-foo/index">Foo</a><br/>
<br/>
<h1>Foo</h1>
-<code><span class="keyword">protected</span> <span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Foo</span></code><br/>
-<p>Call <code><a href="test/-foo/bar">this wonderful method</a></code> to do the job. </p>
-<br/>
-<br/>
+<code><span class="keyword">protected</span> <span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Foo</span></code>
+<p>Call <code><a href="test/-foo/bar">this wonderful method</a></code> to do the job.</p>
<h3>Constructors</h3>
<table>
<tbody>
@@ -17,7 +15,8 @@
<td>
<a href="test/-foo/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Foo</span><span class="symbol">(</span><span class="symbol">)</span></code><p>Call <code><a href="test/-foo/bar">this wonderful method</a></code> to do the job. </p>
+<code><span class="identifier">Foo</span><span class="symbol">(</span><span class="symbol">)</span></code>
+<p>Call <code><a href="test/-foo/bar">this wonderful method</a></code> to do the job.</p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/javaSeeTag.html b/core/testdata/format/javaSeeTag.html
index e22e8452..607375fc 100644
--- a/core/testdata/format/javaSeeTag.html
+++ b/core/testdata/format/javaSeeTag.html
@@ -6,12 +6,9 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-foo/index">Foo</a><br/>
<br/>
<h1>Foo</h1>
-<code><span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Foo</span></code><br/>
-<p></p>
+<code><span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Foo</span></code>
<p><strong>See Also</strong><br/>
<a href="test/-foo/bar">#bar</a></p>
-<br/>
-<br/>
<h3>Constructors</h3>
<table>
<tbody>
@@ -19,8 +16,7 @@
<td>
<a href="test/-foo/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Foo</span><span class="symbol">(</span><span class="symbol">)</span></code><p></p>
-</td>
+<code><span class="identifier">Foo</span><span class="symbol">(</span><span class="symbol">)</span></code></td>
</tr>
</tbody>
</table>
diff --git a/core/testdata/format/javaSpaceInAuthor.md b/core/testdata/format/javaSpaceInAuthor.md
index ddaaa35d..6d738087 100644
--- a/core/testdata/format/javaSpaceInAuthor.md
+++ b/core/testdata/format/javaSpaceInAuthor.md
@@ -1,24 +1,13 @@
[test](test/index) / [C](test/-c/index)
-
# C
`protected open class C`
-
-
-
**Author**
Dmitry Jemerov
-
-
-
### Constructors
-
-| [&lt;init&gt;](test/-c/-init-) | `C()`
-
-
- |
+| [&lt;init&gt;](test/-c/-init-) | `C()` |
diff --git a/core/testdata/format/javaSupertype.html b/core/testdata/format/javaSupertype.html
index b2676459..421fe7a0 100644
--- a/core/testdata/format/javaSupertype.html
+++ b/core/testdata/format/javaSupertype.html
@@ -6,9 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-c/index">C</a>&nbsp;/&nbsp;<a href="test/-c/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/-c/-foo/index"><span class="identifier">Foo</span></a></code><br/>
-<br/>
-<br/>
+<code><span class="keyword">open</span> <span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/-c/-foo/index"><span class="identifier">Foo</span></a></code>
<h3>Constructors</h3>
<table>
<tbody>
diff --git a/core/testdata/format/javadocHtml.md b/core/testdata/format/javadocHtml.md
index 15b86bb4..8aba2059 100644
--- a/core/testdata/format/javadocHtml.md
+++ b/core/testdata/format/javadocHtml.md
@@ -1,40 +1,28 @@
[test](test/index) / [C](test/-c/index)
-
# C
`open class C`
-**Bold** **Strong** *Italic* *Emphasized*
+**Bold** **Strong** *Italic* *Emphasized*
+
Paragraph
- ~~Strikethrough~~ ~~Deleted~~ `Code`
+ ~~Strikethrough~~ ~~Deleted~~ `Code`
+
```
Block code
```
* List Item
-
-
-
-
-
### Constructors
+| [&lt;init&gt;](test/-c/-init-) | `C()`<br>**Bold** **Strong** *Italic* *Emphasized* <br>Paragraph ~~Strikethrough~~ ~~Deleted~~ `Code`
-| [&lt;init&gt;](test/-c/-init-) | `C()`
-**Bold** **Strong** *Italic* *Emphasized*
-Paragraph
-
- ~~Strikethrough~~ ~~Deleted~~ `Code`
-```
-Block code
```
-
- * List Item
-
-
-
- |
+Block code<br>```
+<br>
+* List Item
+<br> |
diff --git a/core/testdata/format/javadocOrderedList.md b/core/testdata/format/javadocOrderedList.md
index 415e3479..00aa1bc4 100644
--- a/core/testdata/format/javadocOrderedList.md
+++ b/core/testdata/format/javadocOrderedList.md
@@ -1,26 +1,17 @@
[test](test/index) / [Bar](test/-bar/index)
-
# Bar
`open class Bar`
1. Rinse
1. Repeat
-
-
-
-
### Constructors
-
-| [&lt;init&gt;](test/-bar/-init-) | `Bar()`
- 1. Rinse
+| [&lt;init&gt;](test/-bar/-init-) | `Bar()`<br>
+1. Rinse
1. Repeat
-
-
-
- |
+ <br> |
diff --git a/core/testdata/format/jdkLinks.md b/core/testdata/format/jdkLinks.md
index 4f0344b5..460d3e32 100644
--- a/core/testdata/format/jdkLinks.md
+++ b/core/testdata/format/jdkLinks.md
@@ -1,20 +1,12 @@
[test](test/index) / [C](test/-c/index)
-
# C
-`class C&nbsp;:&nbsp;[ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html)`
+`class C : `[`ClassLoader`](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html)
This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String))
-
-
-
### Constructors
-
-| [&lt;init&gt;](test/-c/-init-) | `C()`
-This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String))
-
- |
+| [&lt;init&gt;](test/-c/-init-) | `C()`<br>This is a [ClassLoader](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html) and I can get its [ClassLoader.getResource](http://docs.oracle.com/javase/6/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String)) |
diff --git a/core/testdata/format/linkWithLabel.html b/core/testdata/format/linkWithLabel.html
index 32499d6f..8c7d228c 100644
--- a/core/testdata/format/linkWithLabel.html
+++ b/core/testdata/format/linkWithLabel.html
@@ -6,10 +6,8 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">class </span><span class="identifier">Bar</span></code><br/>
+<code><span class="keyword">class </span><span class="identifier">Bar</span></code>
<p>Use <a href="test/-bar/foo">this method</a> for best results.</p>
-<br/>
-<br/>
<h3>Constructors</h3>
<table>
<tbody>
@@ -17,7 +15,8 @@
<td>
<a href="test/-bar/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code><p>Use <a href="test/-bar/foo">this method</a> for best results.</p>
+<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code>
+<p>Use <a href="test/-bar/foo">this method</a> for best results.</p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/linkWithStarProjection.html b/core/testdata/format/linkWithStarProjection.html
index 0e829e80..c810f3f4 100644
--- a/core/testdata/format/linkWithStarProjection.html
+++ b/core/testdata/format/linkWithStarProjection.html
@@ -6,9 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-k-class-loader/index">KClassLoader</a><br/>
<br/>
<h1>KClassLoader</h1>
-<code><span class="keyword">object </span><span class="identifier">KClassLoader</span></code><br/>
-<br/>
-<br/>
+<code><span class="keyword">object </span><span class="identifier">KClassLoader</span></code>
<h3>Functions</h3>
<table>
<tbody>
diff --git a/core/testdata/format/markdownInLinks.html b/core/testdata/format/markdownInLinks.html
index 38158eac..46c2944a 100644
--- a/core/testdata/format/markdownInLinks.html
+++ b/core/testdata/format/markdownInLinks.html
@@ -7,9 +7,7 @@
<br/>
<h1>foo</h1>
<a name="$foo()"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p><a href="http://www.ibm.com">a<strong>b</strong><strong>d</strong>kas</a></p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/multipleTypeParameterConstraints.md b/core/testdata/format/multipleTypeParameterConstraints.md
index 537b127a..14f048f4 100644
--- a/core/testdata/format/multipleTypeParameterConstraints.md
+++ b/core/testdata/format/multipleTypeParameterConstraints.md
@@ -1,8 +1,5 @@
[test](test/index) / [f](test/f)
-
# f
-`fun &lt;T&gt; f(): Unit where T&nbsp;:&nbsp;[Appendable](http://docs.oracle.com/javase/6/docs/api/java/lang/Appendable.html), T&nbsp;:&nbsp;CharSequence`
-
-
+`fun <T> f(): Unit where T : `[`Appendable`](http://docs.oracle.com/javase/6/docs/api/java/lang/Appendable.html)`, T : CharSequence` \ No newline at end of file
diff --git a/core/testdata/format/nullability.md b/core/testdata/format/nullability.md
index ee50a0a5..6a4c3761 100644
--- a/core/testdata/format/nullability.md
+++ b/core/testdata/format/nullability.md
@@ -1,20 +1,14 @@
[test](test/index) / [C](test/-c/index)
-
# C
-`class C&lt;T&gt;`
-
-
+`class C<T>`
### Constructors
-
| [&lt;init&gt;](test/-c/-init-) | `C()` |
-
### Functions
-
-| [foo](test/-c/foo) | `fun foo(): Comparable&lt;T&gt;?` |
+| [foo](test/-c/foo) | `fun foo(): Comparable<T>?` |
diff --git a/core/testdata/format/operatorOverloading.md b/core/testdata/format/operatorOverloading.md
index 05fe3206..8e8d36eb 100644
--- a/core/testdata/format/operatorOverloading.md
+++ b/core/testdata/format/operatorOverloading.md
@@ -1,8 +1,5 @@
[test](test/index) / [C](test/-c/index) / [plus](test/-c/plus)
-
# plus
-`fun plus(other:&nbsp;[C](test/-c/index)): [C](test/-c/index)`
-
-
+`fun plus(other: `[`C`](test/-c/index)`): `[`C`](test/-c/index) \ No newline at end of file
diff --git a/core/testdata/format/orderedList.html b/core/testdata/format/orderedList.html
index 6b5fa007..518fbf5a 100644
--- a/core/testdata/format/orderedList.html
+++ b/core/testdata/format/orderedList.html
@@ -6,14 +6,11 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">class </span><span class="identifier">Bar</span></code><br/>
+<code><span class="keyword">class </span><span class="identifier">Bar</span></code>
<p>Usage instructions:</p>
-<ol><li><p>Rinse</p>
-</li><li><p>Repeat</p>
-</li></ol><br/>
-<br/>
-<br/>
-<br/>
+<ol><li>Rinse</li>
+<li>Repeat</li>
+</ol>
<h3>Constructors</h3>
<table>
<tbody>
@@ -21,7 +18,8 @@
<td>
<a href="test/-bar/-init-">&lt;init&gt;</a></td>
<td>
-<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code><p>Usage instructions:</p>
+<code><span class="identifier">Bar</span><span class="symbol">(</span><span class="symbol">)</span></code>
+<p>Usage instructions:</p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/overloads.html b/core/testdata/format/overloads.html
index 58241e56..ae50668a 100644
--- a/core/testdata/format/overloads.html
+++ b/core/testdata/format/overloads.html
@@ -14,7 +14,8 @@
<a href="test/f">f</a></td>
<td>
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.Int)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
-<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.String)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><p>Performs an action on x.</p>
+<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.String)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
+<p>Performs an action on x.</p>
</td>
</tr>
</tbody>
diff --git a/core/testdata/format/overloadsWithDescription.html b/core/testdata/format/overloadsWithDescription.html
index 89bddaa4..aacdebfd 100644
--- a/core/testdata/format/overloadsWithDescription.html
+++ b/core/testdata/format/overloadsWithDescription.html
@@ -9,15 +9,12 @@
<a name="$f(kotlin.Int)"></a>
<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.Int)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
<a name="$f(kotlin.String)"></a>
-<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.String)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.String)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>Performs an action on <a href="test/f#$f(kotlin.Int)/x">x</a>.</p>
<p>This is a long description.</p>
-<br/>
-<br/>
<h3>Parameters</h3>
-<a name="x"></a>
-<code>x</code> - the value to perform the action on.<br/>
-<br/>
-<br/>
+
+<p><a name="x"></a>
+<code>x</code> - the value to perform the action on.
</BODY>
</HTML>
diff --git a/core/testdata/format/overloadsWithDifferentDescriptions.html b/core/testdata/format/overloadsWithDifferentDescriptions.html
index 549adbfa..83849f23 100644
--- a/core/testdata/format/overloadsWithDifferentDescriptions.html
+++ b/core/testdata/format/overloadsWithDifferentDescriptions.html
@@ -6,27 +6,22 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/f">f</a><br/>
<br/>
<h1>f</h1>
-<a name="$f(kotlin.Int)"></a>
-<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.Int)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+
+<p><a name="$f(kotlin.Int)"></a>
+<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.Int)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>Performs an action on x.</p>
<p>This is a long description.</p>
-<br/>
-<br/>
<h3>Parameters</h3>
-<a name="x"></a>
-<code>x</code> - the int value to perform the action on.<br/>
-<br/>
-<br/>
-<a name="$f(kotlin.String)"></a>
-<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.String)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+
+<p><a name="x"></a>
+<code>x</code> - the int value to perform the action on.
+<p><a name="$f(kotlin.String)"></a>
+<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="identifier" id="$f(kotlin.String)/x">x</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>Performs an action on x.</p>
<p>This is a long description.</p>
-<br/>
-<br/>
<h3>Parameters</h3>
-<a name="x"></a>
-<code>x</code> - the string value to perform the action on.<br/>
-<br/>
-<br/>
+
+<p><a name="x"></a>
+<code>x</code> - the string value to perform the action on.
</BODY>
</HTML>
diff --git a/core/testdata/format/overridingFunction.md b/core/testdata/format/overridingFunction.md
index 2c898b9c..dcc1c426 100644
--- a/core/testdata/format/overridingFunction.md
+++ b/core/testdata/format/overridingFunction.md
@@ -1,9 +1,8 @@
[test](test/index) / [D](test/-d/index) / [f](test/-d/f)
-
# f
`fun f(): Unit`
-Overrides [C.f](test/-c/f)
+Overrides [C.f](test/-c/f)
diff --git a/core/testdata/format/paramTag.md b/core/testdata/format/paramTag.md
index 20d8faac..dec4ad9c 100644
--- a/core/testdata/format/paramTag.md
+++ b/core/testdata/format/paramTag.md
@@ -1,15 +1,12 @@
[test](test/index) / [f](test/f)
-
# f
-`fun f(x:&nbsp;String, y:&nbsp;Int): Unit`
+`fun f(x: String, y: Int): Unit`
### Parameters
`x` - A string
`y` - A number with a really long description that spans multiple lines and goes
-on and on and is very interesting to read
-
-
+on and on and is very interesting to read \ No newline at end of file
diff --git a/core/testdata/format/parameterAnchor.html b/core/testdata/format/parameterAnchor.html
index ff9c9317..5a51e171 100644
--- a/core/testdata/format/parameterAnchor.html
+++ b/core/testdata/format/parameterAnchor.html
@@ -7,12 +7,11 @@
<br/>
<h1>processFiles</h1>
<a name="$processFiles(kotlin.Function0((processFiles.T)))"></a>
-<code><span class="keyword">fun </span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span> <span class="identifier">processFiles</span><span class="symbol">(</span><span class="identifier" id="$processFiles(kotlin.Function0((processFiles.T)))/processor">processor</span><span class="symbol">:</span>&nbsp;<span class="symbol">(</span><span class="symbol">)</span>&nbsp;<span class="symbol">-&gt;</span>&nbsp;<span class="identifier">T</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">List</span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span></code><br/>
+<code><span class="keyword">fun </span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span> <span class="identifier">processFiles</span><span class="symbol">(</span><span class="identifier" id="$processFiles(kotlin.Function0((processFiles.T)))/processor">processor</span><span class="symbol">:</span>&nbsp;<span class="symbol">(</span><span class="symbol">)</span>&nbsp;<span class="symbol">-&gt;</span>&nbsp;<span class="identifier">T</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">List</span><span class="symbol">&lt;</span><span class="identifier">T</span><span class="symbol">&gt;</span></code>
<p>Runs <a href="test/process-files#$processFiles(kotlin.Function0((processFiles.T)))/processor">processor</a> for each file and collects its results into single list</p>
<h3>Parameters</h3>
-<a name="processor"></a>
-<code>processor</code> - function to receive context for symbol resolution and file for processing<br/>
-<br/>
-<br/>
+
+<p><a name="processor"></a>
+<code>processor</code> - function to receive context for symbol resolution and file for processing
</BODY>
</HTML>
diff --git a/core/testdata/format/parenthesis.html b/core/testdata/format/parenthesis.html
index 3ae75ccb..65272af2 100644
--- a/core/testdata/format/parenthesis.html
+++ b/core/testdata/format/parenthesis.html
@@ -7,9 +7,7 @@
<br/>
<h1>foo</h1>
<a name="$foo()"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>foo (bar)</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/propertyVar.md b/core/testdata/format/propertyVar.md
index f2110992..8232dff4 100644
--- a/core/testdata/format/propertyVar.md
+++ b/core/testdata/format/propertyVar.md
@@ -1,8 +1,5 @@
[test](test/index) / [x](test/x)
-
# x
-`var x: Int`
-
-
+`var x: Int` \ No newline at end of file
diff --git a/core/testdata/format/receiverParameterTypeBound.md b/core/testdata/format/receiverParameterTypeBound.md
index 872158ac..8a8c4220 100644
--- a/core/testdata/format/receiverParameterTypeBound.md
+++ b/core/testdata/format/receiverParameterTypeBound.md
@@ -1,20 +1,14 @@
[test](test/index) / [Foo](test/-foo/index)
-
# Foo
`open class Foo`
-
-
### Constructors
-
| [&lt;init&gt;](test/-foo/-init-) | `Foo()` |
-
### Extension Functions
-
-| [xyzzy](test/xyzzy) | `fun &lt;T&nbsp;:&nbsp;[Foo](test/-foo/index)&gt; T.xyzzy(): Unit` |
+| [xyzzy](test/xyzzy) | `fun <T : `[`Foo`](test/-foo/index)`> T.xyzzy(): Unit` |
diff --git a/core/testdata/format/reifiedTypeParameter.md b/core/testdata/format/reifiedTypeParameter.md
index 2e96018e..253f2438 100644
--- a/core/testdata/format/reifiedTypeParameter.md
+++ b/core/testdata/format/reifiedTypeParameter.md
@@ -1,8 +1,5 @@
[test](test/index) / [f](test/f)
-
# f
-`inline fun &lt;reified&nbsp;T&gt; f(): Unit`
-
-
+`inline fun <reified T> f(): Unit` \ No newline at end of file
diff --git a/core/testdata/format/returnWithLink.html b/core/testdata/format/returnWithLink.html
index e5827e8e..7a52391b 100644
--- a/core/testdata/format/returnWithLink.html
+++ b/core/testdata/format/returnWithLink.html
@@ -7,10 +7,8 @@
<br/>
<h1>foo</h1>
<a name="$foo(kotlin.String)"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="identifier" id="$foo(kotlin.String)/s1">s1</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">String</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="identifier" id="$foo(kotlin.String)/s1">s1</span><span class="symbol">:</span>&nbsp;<span class="identifier">String</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">String</span></code>
<p><strong>Return</strong><br/>
Returns <a href="test/foo#$foo(kotlin.String)/s1">s1</a> and does nothing else.</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/see.html b/core/testdata/format/see.html
index e39711bb..d9d1df13 100644
--- a/core/testdata/format/see.html
+++ b/core/testdata/format/see.html
@@ -6,26 +6,19 @@
<br/>
<h1>quux</h1>
<a name="$quux()"></a>
-<code><span class="keyword">fun </span><span class="identifier">quux</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">quux</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p><strong>See Also</strong><br/>
<p><a href="test/foo">foo</a></p>
<p><a href="test/bar">bar</a></p>
</p>
-<br/>
-<br/>
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/foo">foo</a><br/>
<br/>
<h1>foo</h1>
<a name="$foo()"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
-<br/>
-<br/>
-<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/bar">bar</a><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/bar">bar</a><br/>
<br/>
<h1>bar</h1>
<a name="$bar()"></a>
-<code><span class="keyword">fun </span><span class="identifier">bar</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
-<br/>
-<br/>
+<code><span class="keyword">fun </span><span class="identifier">bar</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
</BODY>
</HTML>
diff --git a/core/testdata/format/shadowedExtensionFunctions.md b/core/testdata/format/shadowedExtensionFunctions.md
index 5218d299..3b0a9dc9 100644
--- a/core/testdata/format/shadowedExtensionFunctions.md
+++ b/core/testdata/format/shadowedExtensionFunctions.md
@@ -1,22 +1,15 @@
[test](test/index) / [Bar](test/-bar/index)
-
# Bar
-`class Bar&nbsp;:&nbsp;[Foo](test/-foo/index)`
-
-
+`class Bar : `[`Foo`](test/-foo/index)
### Constructors
-
| [&lt;init&gt;](test/-bar/-init-) | `Bar()` |
-
### Extension Functions
-
-| [shazam](test/shazam) | `fun [Bar](test/-bar/index).shazam(i:&nbsp;Int): Unit`
-`fun [Foo](test/-foo/index).shazam(): Unit` |
-| [xyzzy](test/xyzzy) | `fun [Bar](test/-bar/index).xyzzy(): Unit` |
+| [shazam](test/shazam) | `fun `[`Bar`](test/-bar/index)`.shazam(i: Int): Unit`<br>`fun `[`Foo`](test/-foo/index)`.shazam(): Unit` |
+| [xyzzy](test/xyzzy) | `fun `[`Bar`](test/-bar/index)`.xyzzy(): Unit` |
diff --git a/core/testdata/format/starProjection.md b/core/testdata/format/starProjection.md
index c73a5aa9..6f796e77 100644
--- a/core/testdata/format/starProjection.md
+++ b/core/testdata/format/starProjection.md
@@ -1,8 +1,6 @@
[test](test/index) / [kotlin.collections.Iterable](test/kotlin.collections.-iterable/index)
-
### Extensions for kotlin.collections.Iterable
-
-| [containsFoo](test/kotlin.collections.-iterable/contains-foo) | `fun Iterable&lt;*&gt;.containsFoo(element:&nbsp;Any?): Boolean` |
+| [containsFoo](test/kotlin.collections.-iterable/contains-foo) | `fun Iterable<*>.containsFoo(element: Any?): Boolean` |
diff --git a/core/testdata/format/summarizeSignatures.md b/core/testdata/format/summarizeSignatures.md
index b1707f40..d37f2301 100644
--- a/core/testdata/format/summarizeSignatures.md
+++ b/core/testdata/format/summarizeSignatures.md
@@ -1,23 +1,14 @@
[test](test/index) / [kotlin](test/kotlin/index)
-
## Package kotlin
-
### Types
-
-| [Array](test/kotlin/-array/index) | `class Array&lt;T&gt;` |
+| [Array](test/kotlin/-array/index) | `class Array<T>` |
| [CharArray](test/kotlin/-char-array/index) | `class CharArray` |
| [IntArray](test/kotlin/-int-array/index) | `class IntArray` |
-
### Functions
-
-| [foo](test/kotlin/foo) | `fun &lt;T&gt; any_array&lt;T&gt;.foo(predicate:&nbsp;(T)&nbsp;-&gt;&nbsp;Boolean): Boolean`
-
-Returns true if foo.
-
- |
+| [foo](test/kotlin/foo) | `fun <T> any_array<T>.foo(predicate: (T) -> Boolean): Boolean`<br>Returns true if foo. |
diff --git a/core/testdata/format/summarizeSignaturesProperty.md b/core/testdata/format/summarizeSignaturesProperty.md
index 9646b0f1..712aebd4 100644
--- a/core/testdata/format/summarizeSignaturesProperty.md
+++ b/core/testdata/format/summarizeSignaturesProperty.md
@@ -1,23 +1,14 @@
[test](test/index) / [kotlin](test/kotlin/index)
-
## Package kotlin
-
### Types
-
-| [Array](test/kotlin/-array/index) | `class Array&lt;T&gt;` |
+| [Array](test/kotlin/-array/index) | `class Array<T>` |
| [CharArray](test/kotlin/-char-array/index) | `class CharArray` |
| [IntArray](test/kotlin/-int-array/index) | `class IntArray` |
-
### Properties
-
-| [foo](test/kotlin/foo) | `val &lt;T&gt; any_array&lt;T&gt;.foo: Int`
-
-Returns true if foo.
-
- |
+| [foo](test/kotlin/foo) | `val <T> any_array<T>.foo: Int`<br>Returns true if foo. |
diff --git a/core/testdata/format/throwsTag.md b/core/testdata/format/throwsTag.md
index 21225297..a476fa1b 100644
--- a/core/testdata/format/throwsTag.md
+++ b/core/testdata/format/throwsTag.md
@@ -1,6 +1,5 @@
[test](test/index) / [f](test/f)
-
# f
`fun f(): Unit`
@@ -9,6 +8,4 @@
`IllegalArgumentException` - on Mondays
-`NullPointerException` - on Tuesdays
-
-
+`NullPointerException` - on Tuesdays \ No newline at end of file
diff --git a/core/testdata/format/tripleBackticks.html b/core/testdata/format/tripleBackticks.html
index b085c67a..5b6c9fd3 100644
--- a/core/testdata/format/tripleBackticks.html
+++ b/core/testdata/format/tripleBackticks.html
@@ -7,11 +7,8 @@
<br/>
<h1>f</h1>
<a name="$f()"></a>
-<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">f</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>Description</p>
-<pre><code>code sample</code></pre><br/>
-<br/>
-<br/>
-<br/>
+<pre><code>code sample</code></pre>
</BODY>
</HTML>
diff --git a/core/testdata/format/typeLink.html b/core/testdata/format/typeLink.html
index 23054c8d..68c7b487 100644
--- a/core/testdata/format/typeLink.html
+++ b/core/testdata/format/typeLink.html
@@ -6,9 +6,7 @@
<a href="test/index">test</a>&nbsp;/&nbsp;<a href="test/-bar/index">Bar</a><br/>
<br/>
<h1>Bar</h1>
-<code><span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/-foo/index"><span class="identifier">Foo</span></a></code><br/>
-<br/>
-<br/>
+<code><span class="keyword">class </span><span class="identifier">Bar</span>&nbsp;<span class="symbol">:</span>&nbsp;<a href="test/-foo/index"><span class="identifier">Foo</span></a></code>
<h3>Constructors</h3>
<table>
<tbody>
diff --git a/core/testdata/format/typeParameterBounds.md b/core/testdata/format/typeParameterBounds.md
index e2551580..58df82a3 100644
--- a/core/testdata/format/typeParameterBounds.md
+++ b/core/testdata/format/typeParameterBounds.md
@@ -1,15 +1,11 @@
[test](test/index) / [generic](test/generic)
-
# generic
-`fun &lt;T&nbsp;:&nbsp;R, R&gt; generic(): Unit`
+`fun <T : R, R> generic(): Unit`
generic function
-
### Parameters
-`T` - the first type parameter
-
-
+`T` - the first type parameter \ No newline at end of file
diff --git a/core/testdata/format/typeParameterVariance.md b/core/testdata/format/typeParameterVariance.md
index 241c2e87..01f5562c 100644
--- a/core/testdata/format/typeParameterVariance.md
+++ b/core/testdata/format/typeParameterVariance.md
@@ -1,18 +1,14 @@
[test](test/index) / [Foo](test/-foo/index)
-
# Foo
-`class Foo&lt;out&nbsp;T&gt;`
+`class Foo<out T>`
### Parameters
`T` - the class parameter type
-
-
### Constructors
-
| [&lt;init&gt;](test/-foo/-init-) | `Foo()` |
diff --git a/core/testdata/format/typeProjectionVariance.md b/core/testdata/format/typeProjectionVariance.md
index 7aa34593..5b8fc190 100644
--- a/core/testdata/format/typeProjectionVariance.md
+++ b/core/testdata/format/typeProjectionVariance.md
@@ -1,8 +1,6 @@
[test](test/index) / [kotlin.Array](test/kotlin.-array/index)
-
### Extensions for kotlin.Array
-
-| [foo](test/kotlin.-array/foo) | `fun &lt;T&gt; Array&lt;out&nbsp;T&gt;.foo(): Unit` |
+| [foo](test/kotlin.-array/foo) | `fun <T> Array<out T>.foo(): Unit` |
diff --git a/core/testdata/format/uninterpretedEmphasisCharacters.html b/core/testdata/format/uninterpretedEmphasisCharacters.html
index 70409577..62850fb0 100644
--- a/core/testdata/format/uninterpretedEmphasisCharacters.html
+++ b/core/testdata/format/uninterpretedEmphasisCharacters.html
@@ -7,10 +7,8 @@
<br/>
<h1>foo</h1>
<a name="$foo()"></a>
-<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code><br/>
+<code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Unit</span></code>
<p>This is <emph>emphasized text</emph> but text_with_underscores has to preserve the underscores.
Single stars embedded in a word like Embedded*Star have to be preserved as well.</p>
-<br/>
-<br/>
</BODY>
</HTML>
diff --git a/core/testdata/format/varargsFunction.md b/core/testdata/format/varargsFunction.md
index 723437aa..85ac9c92 100644
--- a/core/testdata/format/varargsFunction.md
+++ b/core/testdata/format/varargsFunction.md
@@ -1,8 +1,5 @@
[test](test/index) / [f](test/f)
-
# f
-`fun f(vararg s:&nbsp;String): Unit`
-
-
+`fun f(vararg s: String): Unit` \ No newline at end of file
diff --git a/core/testdata/format/website/returnTag.md b/core/testdata/format/website/returnTag.md
index 301635ad..418babad 100644
--- a/core/testdata/format/website/returnTag.md
+++ b/core/testdata/format/website/returnTag.md
@@ -5,15 +5,12 @@ layout: api
<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/index-of">indexOf</a></div>
-
# indexOf
-<div class="signature"><code><span class="keyword">fun </span><a href="test/-foo/index"><span class="identifier">Foo</span></a><span class="symbol">.</span><span class="identifier">indexOf</span><span class="symbol">(</span><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameterName">char</span><span class="symbol">:</span>&nbsp;<span class="identifier">Char</span><span class="symbol">, </span><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameterName">startIndex</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span>&nbsp;<span class="symbol">=</span>&nbsp;0<span class="symbol">, </span><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameterName">ignoreCase</span><span class="symbol">:</span>&nbsp;<span class="identifier">Boolean</span>&nbsp;<span class="symbol">=</span>&nbsp;false<br/><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code><br/>
-</div>
+<div class="signature"><code><span class="keyword">fun </span><a href="test/-foo/index"><span class="identifier">Foo</span></a><span class="symbol">.</span><span class="identifier">indexOf</span><span class="symbol">(</span><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameterName" id="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/char">char</span><span class="symbol">:</span>&nbsp;<span class="identifier">Char</span><span class="symbol">, </span><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameterName" id="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/startIndex">startIndex</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span>&nbsp;<span class="symbol">=</span>&nbsp;0<span class="symbol">, </span><br/>&nbsp;&nbsp;&nbsp;&nbsp;<span class="parameterName" id="$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/ignoreCase">ignoreCase</span><span class="symbol">:</span>&nbsp;<span class="identifier">Boolean</span>&nbsp;<span class="symbol">=</span>&nbsp;false<br/><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div>
Returns the index within this string of the first occurrence of the specified character, starting from the specified <a href="test/index-of#$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/startIndex">startIndex</a>.
-
### Parameters
<code>ignoreCase</code> - <code>true</code> to ignore character case when matching a character. By default <code>false</code>.
@@ -21,5 +18,3 @@ Returns the index within this string of the first occurrence of the specified ch
**Returns**
An index of the first occurrence of <a href="test/index-of#$indexOf(Foo, kotlin.Char, kotlin.Int, kotlin.Boolean)/char">char</a> or -1 if none is found.
-
-
diff --git a/core/testdata/format/website/sample.md b/core/testdata/format/website/sample.md
index e416a039..3a52379b 100644
--- a/core/testdata/format/website/sample.md
+++ b/core/testdata/format/website/sample.md
@@ -5,28 +5,20 @@ layout: api
<div class='api-docs-breadcrumbs'><a href="test/index">test</a> / <a href="test/foo">foo</a></div>
-
# foo
-<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code><br/>
-</div>
+<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div>
Groups elements of the original sequence by the key returned by the given <a href="#">keySelector</a> function
applied to each element and returns a map where each group key is associated with a list of corresponding elements.
-
``` kotlin
if (true) {
println(property)
}
```
+<div class="overload-group"></div>
-
-
-
-<div class="overload-group"></div><div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="parameterName">i</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code><br/>
-</div>
-
-
+<div class="signature"><code><span class="keyword">fun </span><span class="identifier">foo</span><span class="symbol">(</span><span class="parameterName" id="$foo(kotlin.Int)/i">i</span><span class="symbol">:</span>&nbsp;<span class="identifier">Int</span><span class="symbol">)</span><span class="symbol">: </span><span class="identifier">Int</span></code></div>
<div class="overload-group"></div> \ No newline at end of file