com.github.woojiahao.MarkdownDocument.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kMD2PDF Show documentation
Show all versions of kMD2PDF Show documentation
Simple and highly customizable markdown to PDF conversion library
package com.github.woojiahao
import com.github.woojiahao.utility.extensions.isFileType
import java.io.File
import org.commonmark.node.Document as CommonMarkDocument
class MarkdownDocument(val file: File) {
constructor(filePath: String) : this(File(filePath))
init {
with(file) {
require(exists()) { "File path ($path) must exist" }
require(isFile) { "File path ($path) must point to a file" }
require(isFileType("md")) { "File ($name) must be a markdown document" }
}
}
}