-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
针对单个 <p> 标签处理的问题 #16
Comments
Hi,
回到問題,原文在 ZMarkupParser Render 後會解讀成:
Render 過後應該要是:
圖上結果多了一個
->
但在單獨的情況會多一個
會儘速修正,感謝回報。 另外,行距空間可透過設置 root style 控制: let parser = ZHTMLParserBuilder.initWithDefault().set(rootStyle: MarkupStyle(paragraphStyle: .init(lineSpacing: 8))).build() 要注意的是,預設是 0,設置 8 是加大的意思。 by the way, 目前 ZMarkupParser 並不能很好是配 SwiftUI 的 AttributedString,實際上 ZMarkupParser 應該多實現直接 Convert HTML To AttributedString,而不是轉換成 NSAttributedString 放到 AttributedString 中再給 SwiftUI 使用。 ref: #12 |
感谢回复,关于你回复中提到的这一段:
我其实是在用 |
了解,感謝補充;我對 SwiftUI 不熟😅 |
最近在学习 SwiftUI,尝试开发一个 Hacker News Reader,通过官方 API 返回的 HTML String 里面的
<p>
标签都是独立的,举例:调用
parser.render(text)
后,会产生空行,如图所示:我的预期是通过控制
paragraphSpacing
来调整段间距,从而让段落之间有一定的空间。上图中paragraphSpacing
的值 是8
,但由于中间有空行,让段落间的空隙显得很大。The text was updated successfully, but these errors were encountered: