-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
Support XML Elements #132
Comments
Hi @tgrosinger . Hmm, yeah, the library is really geared towards HTML5 use, but I've hit the use case before. I have an SVG package in the repo which would potentially hit the same issue. Maybe I could consider making an XML package that renders slightly differently, I'll think about that. I would think it would have more or less the same API, without the HTML-specific parts, and probably no helpers, so it would be pretty easy to implement. |
I'm playing with an implementation here: https://github.com/maragudk/gomponents-xml/pull/1 Not sure how I'm going to keep code duplication down, but maybe it doesn't matter. Or maybe I should just incorporate it in this repo… (I'm thinking out loud.) |
It's not very clean at all, but this change did fix the issue for me: https://github.com/tgrosinger/gomponents/commit/b8a83564c297b77523b7944ad5c97fbb1329ca13 I think if |
Alternatively, this might also relate to #124 and possibly moving where the void element checking occurs and moving it out closer to the specific element type. That might be harder to do without changing the API though. |
@tgrosinger Both good points. For me, it's important that the focus of the library is HTML, and having something like XML support is nice, but not central to it. I don't want to pollute the public API with XML-specific stuff that would confuse other users, but maybe I can pull the rendering logic into an internal package and thus have it available both from the That actually seems like a feasible solution. I'll play around with it when I get some time, hopefully next week. |
Sounds great. Thank you very much for looking at this! |
@tgrosinger I played around with this a bit, but quickly ran into problems with import cycles when pulling out the rendering logic. I'm not currently sure about a path forward without breaking the API (not an option), exposing rendering logic in the API (not a huge fan of that, since the focus is definitely HTML and would be totally irrelevant to those consumers), or duplicating a lot of code (also not a huge fan of that). I'll think about it some more, and suggestions are also welcome. 😊 |
Hello, thank you for this excellent library.
I'm trying to use gomponents to build an RSS XML along side my web site. The XML requires a
<link></link>
element, however gomponents is not rendering this correctly because it's considered avoidElement
in HTML.So far the best option I've thought of for fixing this is duplicating the
El
function to createXMLEl
which does not use theisVoidElement
check. But I would love to hear if you have another suggestion.Thanks!
The text was updated successfully, but these errors were encountered: