Closed
Description
最近在学习 SwiftUI,尝试开发一个 Hacker News Reader,通过官方 API 返回的 HTML String 里面的 <p>
标签都是独立的,举例:
{
"by": "joak",
"id": 34934428,
"kids": [
34934473
],
"parent": 34934270,
"text": "Henry Kissinger will be 100 years old in few weeks. And he is still around giving advice. Amazing.<p>But I don't see why his opinion could be relevant on the topic...",
"time": 1677306778,
"type": "comment"
}
调用 parser.render(text)
后,会产生空行,如图所示:
我的预期是通过控制 paragraphSpacing
来调整段间距,从而让段落之间有一定的空间。上图中 paragraphSpacing
的值 是 8
,但由于中间有空行,让段落间的空隙显得很大。