Skip to content

针对单个 <p> 标签处理的问题 #16

Closed
@caocanx

Description

@caocanx

最近在学习 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&#x27;t see why his opinion could be relevant on the topic...",
  "time": 1677306778,
  "type": "comment"
}

调用 parser.render(text) 后,会产生空行,如图所示:

CleanShot 2023-03-14 at 15 07 47@2x

我的预期是通过控制 paragraphSpacing 来调整段间距,从而让段落之间有一定的空间。上图中 paragraphSpacing 的值 是 8,但由于中间有空行,让段落间的空隙显得很大。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions