Parma icon indicating copy to clipboard operation
Parma copied to clipboard

Add ability to render custom view for links

Open MoveUpwardsDev opened this issue 3 years ago • 2 comments

I based the custom view implementation on the ImageElementComposer logic so we can now provide AnyView to render a link instead of plain text.

MoveUpwardsDev avatar Dec 24 '21 11:12 MoveUpwardsDev

Hi @MoveUpwardsDev ,

Thank you for your PR. I see the need to provide customization to the hyperlinks, like using AttributedString to make the link actually a link.

As I saw in the code changes, the InlineElementComposer became BlockElementComposer, which will result in the link element cannot concatenate with plain texts and any other text elements. Because BlockElement's rendering logic is to stack each other one by one.

I'm wondering why to modify it, and if there are any possibilities to make it an InlineElement.

Thanks anyway.

dasautoooo avatar Jan 04 '22 02:01 dasautoooo

If I'm not mistaken links in markdown are in the form of [text](url) so no need for concatenation, right? I could not manage to use InlineElementComposer to render AnyView. This way you can return any type of view such as Button which was the purpose of doing this PR. But I might have missed some regression in your library. None that I've seen by the way with my markdown documents.

MoveUpwardsDev avatar Jan 12 '22 15:01 MoveUpwardsDev