Skip to content

Commit

Permalink
Merge pull request #596 from DimensionDev/bugfix/misskey_text
Browse files Browse the repository at this point in the history
fix misskey text rendering
  • Loading branch information
Tlaster authored Dec 12, 2024
2 parents ee99b96 + 768684f commit 9aed8cb
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,9 @@ private fun moe.tlaster.mfm.parser.tree.Node.toHtml(accountKey: MicroBlogKey): E
Element("a").apply {
// attributes["href"] = url
attributes().put("href", url)
appendChild(TextNode(content))
content.forEach {
appendChild(it.toHtml(accountKey))
}
}
}

Expand Down Expand Up @@ -801,7 +803,12 @@ private fun moe.tlaster.mfm.parser.tree.Node.toHtml(accountKey: MicroBlogKey): E

is moe.tlaster.mfm.parser.tree.TextNode -> {
Element("span").apply {
appendChild(TextNode(content))
content.split("\n").forEachIndexed { index, line ->
if (index != 0) {
appendChild(Element("br"))
}
appendChild(TextNode(line))
}
}
}

Expand Down

0 comments on commit 9aed8cb

Please sign in to comment.