dasautoooo / Parma

A SwiftUI view for displaying Markdown with customizable appearances.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hyperlinks?

antonjazz opened this issue · comments

You list hyperlinks under "Unsupported" rather than "Possibly Support in Future Versions", but I see the stub for the function
func link(textView: Text, destination: String?) -> Text.
Is there anything that can be done with it at this point? I can see how to use it to style the textView, but since the result is a Text view there's no way to add an .onTapGesture() modifier in the function, is there?

Thank you for this terrific package!

Hi @antonjazz ,

The unsupported hyperlink is really annoying, however, by far there's no easy way to put a hyperlinked text inline with other styled-text, the only way to concatenate text is using Text. Once you add some modifier to the Text, it will convert to View, thus it is really difficult to combine those. I really hope Apple will support NSAttributedString in the next version of SwiftUI.

The reason Parma provides func link(textView: Text, destination: String?) -> Text method is because hyperlinks are super important. Parma gives a window for developers to gather destinations in order to use in other places.

Anyway, thanks for your feedback. And if you have any ideas of how to solve this problem, please let me know!

Thank you for the response, @dasautoooo! I wish I had a suggestion. Fingers crossed for a way in upcoming version of SwiftUI. best wishes!

Hey @dasautoooo, I really like your library and its customizability! I’ve also tried MDText, but it has not the customizability that you have, however it has the linking working. Can I suggest you in the very nicest way possible to have a look at that project, maybe it’ll help you in implementing it in your library.

Thank you so much for your work already!

@Dennissimeau MDText can't generate a link inline, MarkdownUI do it perfectly.

I get the necessity of returning Texts because these can be concatenated. But why don't links also have a linkBlock that returns any view, like headingBlock and paragraphBlock? This way, if we need to implement onTapGesture (or whatever other user interaction), we can add it to the link block instead of the link text itself.

#22 let you customize the link.