API returning html
@Jacob Kofoed
I remember there was a long conversation about this on Discord at some point , but I cannot find it 🤷 I think it concluded with "it depends " (surprise 😮 ) . If you trust your source of HTML and cannot make assumptions about what it looks like , then rendering like you do is probably the best you can do . However , it is really dangerous if you cannot trust the source as people would be able to inject scripts on your site . If you know a bit more about the data , you could try to write your own parser (however this is much easier for JSON than XML ) , where you map expected data to elements in toddle . This would need to be a recursive component . We are doing something similar with our blog & docs where we get the data from contentful (they support both HTML and JSON ) . We loop over each item and render an element based on the type , then render the children recursively with the same component . This gives more control and allows you to set up events etc . on elements . It is not trivial , so perhaps we could create a video on this . I made a video a while ago where I do basically the same you 're doing https://www.youtube.com/watch?v=6pVjgsyCe54
.jpeg/public)