in smithy-swift-codegen/src/main/kotlin/software/amazon/smithy/swift/codegen/DocumentationConverter.kt [60:82]
override fun head(node: Node, depth: Int) {
val name = node.nodeName()
if (isTopLevelCodeBlock(node, depth)) {
writer.indent()
}
if (node is TextNode) {
writeText(node as TextNode)
} else if (TEXT_BLOCK_NODES.contains(name) || isTopLevelCodeBlock(node, depth)) {
writeNewline()
writeIndent()
} else if (LIST_BLOCK_NODES.contains(name)) {
writeNewline()
} else if (name == "li") {
// We don't actually write out the list prefix here in case the list element
// starts with one or more text blocks. By deferring writing those out until
// the first bit of actual text, we can ensure that no intermediary newlines
// are kept. It also has the added benefit of eliminating empty list elements.
needsListPrefix = true
} else if (name == "a") {
needsBracketsForLink = true
}
}