summaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/blog/md/CodeBlock.kt
blob: 2882b7725e1ad3ae42f7a1ad6fdf74a68f152e67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package moe.nea.blog.md

import moe.nea.blog.util.indent
import java.io.PrintStream

data class CodeBlock(val language: String, val lines: List<String>) : MarkdownBlock {
    override fun debugFormat(indent: Int, printStream: PrintStream) {
        printStream.indent(indent)
        printStream.println("<code lang=$language>")
        lines.forEach {
            printStream.indent(indent)
            printStream.println(it)
        }
        printStream.indent(indent)
        printStream.println("</code>")
    }
}