-
Notifications
You must be signed in to change notification settings - Fork 270
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
[Bug] lineLimit
truncation does not work as expected when markdown content ends with a link
#115
Comments
Hi @maciesielka, This is an interesting issue. MarkdownUI renders the markdown into an
The markdown example that you're providing has two paragraphs, and I suspect that the text container is applying truncation mode and line limit per paragraph, which can be the expected behaviour. If you squash the link together with the text in the same paragraph you should see what you expect. SwiftUI Let me know if this clarifies the behaviour you're seeing. Thanks! |
Ahh okay. Not ideal, but that makes sense at a high level. Maybe I'll use a workaround to remove the interior spacing in the text while I'm attempting truncation. Appreciate the response! |
Hi, I also tried to use the However, I argue this is a wrong behavior based on the I wonder if there is any plan to correct the behavior. |
Hi @totoroyyb, As I mentioned in #188 (a related issue), it is very challenging to implement the truncation behavior that the Here is a list of workarounds:
I could implement a |
Build Information
Markdown UI Version: Latest (1.1.1 at time of writing)
Xcode Version: 13.4.1
iOS Simulator: iPhone 13 Pro, iOS 15.5 (reproduces on a physical iPhone 11 Pro Max -- iOS 15.5 as well)
Issue Description
There seems to be an issue with how the
lineLimit
modifier affectsMarkdown
when the content ends in a link.In the example below, the intention is to truncate the full body of the markdown at 4 lines.
This renders as below, with the non-truncated version that just removes the
lineLimit
modifier shown at right:You can see that the link that is last in the markdown text is shown in both versions, despite being the last line of content overall and not the last line you'd expect to see of truncated content.
The strangeness worsens applying line-spacing, which doesn't seem to impact the spacing preceding the link:
Screenshot here:
![Screen Shot 2022-07-27 at 12 30 42 PM](https://user-images.githubusercontent.com/4276827/181300668-5ba3b720-34e3-4d5a-b1b0-3c5238cc78cb.png)
The last thing to mention is that this behavior doesn't seem to happen when using the built-in
SwiftUI.Text
markdown support, i.e.Text(.init(text))
in the example above.The text was updated successfully, but these errors were encountered: