Skip to content

Commit

Permalink
refactor: html article 테그 추가 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
belljun3395 committed Jul 3, 2024
1 parent 91e05cc commit 9940907
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.few.storage.document.service

import org.commonmark.parser.Parser
import org.commonmark.renderer.html.HtmlRenderer
import org.jsoup.Jsoup
import org.springframework.stereotype.Service

@Service
Expand All @@ -10,10 +11,13 @@ class ConvertDocumentService {
companion object {
val parser = Parser.builder().build()
val htmlRenderer = HtmlRenderer.builder().build()
val ARTICLE = "<article class='flex flex-col gap-1 body2-regular'> </article>"
}

fun mdToHtml(md: String): String {
val html = Jsoup.parse(ARTICLE)
val article = htmlRenderer.render(parser.parse(md))
return article.toString()
html.body().append(article)
return html.toString()
}
}

0 comments on commit 9940907

Please sign in to comment.