-
-
Notifications
You must be signed in to change notification settings - Fork 875
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
Added support for rendering as RichText Widgets #37
Conversation
Thank you for the extensive pull request! I'll review this as soon as I am have some time (because this is somewhat of a major change it may take some time). |
To be clear on the changes:
|
I now also noticed the problem when having links inside the HTML #40 , that they are getting rendered on a new line with the old parser. However I would need to still have the ability to use custom renderings. I would be willing to look into how to implement this feature. @Sub6Resources can you review this and merge? I will start using this as a base now and see how far I can get implementing the ability to use the custom renderer again. Thank you so much for solving this issue @jeffmikels |
with some data and useRichText: true
|
My latest commit fixes this. |
I have tweaked the code to treat plain text nodes inside blockquote, ol, and ul elements as if they had been block elements. This will properly indent them. However, there is a limitation to how this rendering is done, and you might not be pleased with the results as they are different from what you expect. My renderer creates a series of "BlockText" widgets in a column. BlockText Widgets cannot contain other BlockText widgets, so the way the renderer works is that when blockquote, ol, or ul elements are encountered, a flag is set telling the renderer that subsequent block widgets should be indented and might need a left side border. As a result, this renderer is only capable of handling a small subset of html correctly. For example, block elements inside other block elements will not behave as expected. To more effectively handle nested block elements, I will need to modify my BlockText widgets to handle multiple children. That has not been done yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your patience and for your work on this pull request. I feel good about merging this. Once this is merged and I've updated the CHANGELOG and README, I'll release version 0.9.0.
These changes have been published as version 0.9.0. Thank you @jeffmikels for your work on this. |
@Sub6Resources @jeffmikels thank you very much! |
@jeffmikels how can we use |
I didn't understand the implementation of customRender, so I didn't implement it. The new parser has a RichText customRenderer built in. |
I want to add different style to some of html elements, I achieved it with |
@mesuutt it's not implemented yet. We need some custom rendering as well so I already played around but what I currently have is not really a good solution. I can look into it in the next days and open a PR when I have something. If you need it right now you could also just fork it and add your rendering in the new code for now until there is an extension mechanism |
The original HTML Parser rendered widgets awkwardly. I have implemented a parser that converts the HTML into a list of Rich Text Widgets with appropriate TextSpans.