yoshuawuyts / html

Type-safe HTML support for Rust
Apache License 2.0
244 stars 7 forks source link

question: embedding raw html #75

Open fliepeltje opened 9 months ago

fliepeltje commented 9 months ago

Hey, I want to use this as the main driver for generating my html, but I also have some markdown-based content that needs to be rendered. I can render it fine to valid html, but I cannot really find how I would embed this within an existing element.

So I'd like something like:

use html::text_content::OrderedList;
let tree = OrderedList::builder()
    .raw_html(&my_content)
    .build();

Just wondering if this is not implemented or if it is and I just can't find it :)

calebeby commented 5 months ago

The .text() function allows you to put text into an element, which is not currently escaped. See https://github.com/yoshuawuyts/html/issues/12 for a discussion of whether it should be escaped.