Skip to content

Comments

Add ability to render custom view for links#22

Open
MoveUpwardsDev wants to merge 1 commit intodasautoooo:mainfrom
MoveUpwardsDev:feature/link-custom-view
Open

Add ability to render custom view for links#22
MoveUpwardsDev wants to merge 1 commit intodasautoooo:mainfrom
MoveUpwardsDev:feature/link-custom-view

Conversation

@MoveUpwardsDev
Copy link

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 MoveUpwardsDev mentioned this pull request Dec 24, 2021
@dasautoooo
Copy link
Owner

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.

@MoveUpwardsDev
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants