johnxnguyen / Down

Blazing fast Markdown / CommonMark rendering in Swift, built upon cmark.
Other
2.24k stars 319 forks source link

height is incorrect #297

Closed BrannYang closed 1 year ago

BrannYang commented 1 year ago

I didn't find the answer in the issue,please help me ,thank you.

After using sizetofit, the resulting rect takes up one more line than the text

xcode:14.3

example image: https://imgur.com/a/zrTcKsz

code: let down = Down(markdownString: "test content") let attributedString = try? down.toAttributedString() let label = UILabel(frame: CGRect(origin: CGPoint(x: 0, y: 100), size: CGSize(width: self.view.frame.size.width, height: 0))) label.numberOfLines = 0 label.isUserInteractionEnabled = true label.attributedText = attributedString; label.sizeToFit() label.backgroundColor = UIColor.green self.view.addSubview(label)

BrannYang commented 1 year ago

I solved this problem, I found that he will automatically add a newline at the end