You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried converting some code that's currently using maud to instead use hypertext and ran into a few issues. I thought I'd provide them as feedback here to help improve the library.
I did really like the “checked” aspect which is something I really wanted to get with maud, and which is not currently possible there.
The main (blocking) issue for me with hypertext was that it's not possible to return an error during formatting, which is easy to do with maud. Yes, it's possible to do all error-checking up front and only then do the rendering, but the maud syntax makes it very easy to interleave this and that’s one of its strengths.
The other thing is that it is difficult to have a Renderable and share it across multiple renders. I do this with static blocks of content in maud.
I think probably Renderable should not consume its contents (which would also make it dyn-compatible [object-safe]), so you can have some shared Box<dyn Renderable> or &dyn Renderable). As far as I can see there’s no performance to be lost here since any Renderable needs to copy into the target String in any case.
Other minor issues are:
lack of support for aria-* attributes (easy enough to add yourself, but should really be included by default), add aria support #6
also lack of support for RDFa-Lite attributes (maybe included as an optional extra?)
these are the five (global) attributes vocab, typeof, property, resource, prefix
they are much easier to add in the library (because of the existing macro invocations) rather than as an end-user since they're global and need to be on everything
The text was updated successfully, but these errors were encountered:
The error handling issue is one I considered early, but I just kind of enforced that a user would handle any errors and have all the data cleaned before beginning the rendering process. I do think a try_maud! macro might fix it, but I would have to think about it longer to figure out implementation.
I actually have no idea why I chose to make it consume self, but that is definitely a breaking change I would consider for the next version, as well as some helper type alias for boxed renderable.
The other attributes are something I never got around to doing due to university and stuff, but are something to do at some point.
As for the RDFa-Lite attributes, the global attributes are actually pretty easy to add to everything from the user end through an extension trait:
I tried converting some code that's currently using
maud
to instead usehypertext
and ran into a few issues. I thought I'd provide them as feedback here to help improve the library.I did really like the “checked” aspect which is something I really wanted to get with
maud
, and which is not currently possible there.The main (blocking) issue for me with
hypertext
was that it's not possible to return an error during formatting, which is easy to do withmaud
. Yes, it's possible to do all error-checking up front and only then do the rendering, but themaud
syntax makes it very easy to interleave this and that’s one of its strengths.The other thing is that it is difficult to have a
Renderable
and share it across multiple renders. I do this with static blocks of content inmaud
.Renderable
should not consume its contents (which would also make itdyn
-compatible [object-safe]), so you can have some sharedBox<dyn Renderable>
or&dyn Renderable
). As far as I can see there’s no performance to be lost here since anyRenderable
needs to copy into the targetString
in any case.Other minor issues are:
aria-*
attributes (easy enough to add yourself, but should really be included by default), add aria support #6vocab
,typeof
,property
,resource
,prefix
The text was updated successfully, but these errors were encountered: